Forum | | | | Dietmar Horn | Hello together,
with my XProfan-Firebird-SQL-proposition works it so far integrally well.
now there but a problem, which I possible To the day before yesterday with XProfan solve should, if with the XProfan currently at all possible is.
in the first official Beta for ausgesuchte Tester should the program now absolutely as Embedded-Variante walk, and not as not-Embedded.
with not-Embedded over ODBC-interface through the normalen FB-SQL-command works yet everything weitestgehend tadellos.
still how can I The Embedded-Variante initialisieren, circa thereafter with the same SQL-routines in the program How dwelt weiterarbeiten to? Later to the users then between both mutants yourself The selection meet.
for the SQL-Experten under you have I already time everything into ZIP-archive gepackt - means Firbird embedded (no installation necessary) and some additional Help Files (except The, which in the Unterordner doc anyhow already present are). The beigelegte Patienten.fdb could to that testing serve.
yourself have I The couple loudly Helpfile(en) required Files the Projektverzeichnis copies and The fbembed.dll in fbclient.dll umbenannt. loudly Helpfile(en) ought to the suffice. How I the yet understand, need one still whom remainder from the Firebird-Ordner from the ZIP still none absolutely, or?
still with CompileMarkSeparation I get simply no link there!
If I the into next Meet (if need be even first time by Workarount) not somehow with XProfan hinbekomme, then can I The work of several Monaten in the principle into Tonne kloppen ...
Roland, have You Perhaps as data base-Profi a Solution for this trouble, or who from the others DB-Profis knows itself yet so from?
Greeting and thanks beforehand!
Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 04/17/09 ▲ |
| |
| | E.T. |
...The Datenbankdatei must itself with the Benutzung the embedded Server next to this ditto in the Applikationsverzeichnis find. ...
is me at reading the guide over ands over again noticed. mostly lying The DB Yes in another directory...
[offtopic]...only so as thought... [/offtopic] |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 04/17/09 ▲ |
| |
| | Dietmar Horn | No, Mario,
The couple DLLs can in the same directory lying, as DB, anderenfalls go tappt im dunkeln from the (umbenannten) fbclient.dll in the windows-, windows-system- or windows-system32-directory sought. the having we everything for hours in vain durchprobiert (like then The thing with the BLOBs). with ImportDLL(fbclient.dll,*) can itself very standing, where The fbclient.dll The others couple DLLs with the restlichen functions seek. if need be can Yes with ChDir into Ordner change, in the itself these couple Files bustling.
and loudly the many FB-Help Files position in the Embedded-Version The fbclient.dll for the DBMS whom actual Server dar, the any FB-Funktionalitäten pub available position - but in the Contrast to Nichtembedded-Version must the users there not first each yet so small DB-Program In the Control Panel whom ODBC-driver konfigurieren.
of my opinion to missing there (or. me) yet only yet the allererste Baustein, circa this Server (means The Embedded-FBClient.dll) To initialisieren.
I suspect or. befürchte soon, that the yet with XProfans SQLInit not so without further possible his becomes. I wealth time, here becomes probably only Roland yourself zeitnah help on can - like with the BLOB-story - or of/ one from the others API-Specialists, which now already accurate with the FB-APIs know, without itself yourself first with difficulty herantasten To must ... if need be even over a new, yet with C++ or Delphi To erstellende FB-Embedded-DLL for XProfan. my next Befürchtung goes to there, that SQL-Exec ditto whom installierten ODBC-driver voraussetzt and to the whole SQL-Zeugs with SQLEXEC then ditto api-mäßig yourself nachbasteln should. hopefully have I with my Berfürchtungen not right, because then would without Rolands rapid Help my News already right far fortgeschrittenes proposition only from this Found to that failure doomed and monatelange Programmierarbeit for Katz been.
i'd me however gigant above forward, if I in this Points fallacy begehe what about me time again only whom woods not sheer trees see. still How in the Ausgangsposting already said: The Time depends me because of this story meanwhile integrally beautiful in the neck.
Greeting Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 04/18/09 ▲ |
| |
| | RGH | Hi,
even if I today no Time have, one first Info: without ODBC-driver becomes it naturally not weg: without ODBC-driver can The ODBC-interface of XProfan naturally not functions. gives it a ODBC-driver for Firebird-Emedded? or can itself the previous driver for Embedded konfigurieren?
Direkter appeal over The API the DLL could naturally weg. is these somewhere documents? Presumably there there a Documentation for Delphi or C++ ... or in the worst drop only finished Komponenten without Source, The over your Zugriffe nothing Price give. (though wären The recent Überlegungen then objectively quite trashy, there it then Yes circa something integrally other goes. the had one of beginning on allude must. OK, The surface can naturally stay ...)
Greeting Roland |
| | | Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 04/19/09 ▲ |
| |
| | | Perhaps time whom Florian Heuberger ask whether it with Visual-Zeugs on something like grabbed has. |
| | | | |
| | Dietmar Horn | Hi,
No, this is Yes the sense of FB-Embedded, that one there none ODBC-driver needed. several others Programs from this Branche make the just as. The users can optional switch, whom mode it benefit would like: Embedded (local, without gleichzeitigen Mehrfachzugriff), or not-Embedded (Mehrfachzugriff on DB over networking possible).
on Documentations have I the, what with FB anyhow thereby is, the I along into the above-mentioned ZIP gepackt have and another API-Guide for Interbase (IB and FB should well compatible his) - see Appendix. for me one book with seven Siegeln!
though wären The recent Überlegungen then objectively quite trashy, there it then Yes circa something integrally other goes.
trashy not, because I need coercive both Modi. only stupid, that the Projektleiter The Beta-Version selected Testern now for the time being as Embedded give would like (because these To 99% not in the site are, the ODBC-story yourself einzurichten).
whom normalen mode have I ready, there functions dbzgl. with XProfan yet everything fine.
Greeting Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 04/19/09 ▲ |
| |
| | RGH | Hi,
How said, for in XProfan integrierten ODBC-functions is a ODBC-driver zwingende Prerequisite. this switch on Embedded without ODBC functions means only for Applications, The generisch, means directly by Firebird- or. Interbase-API, with the data base communicate. for Delphi or C++ go presumably suitable Komponenten included. with this Applications becomes means at the outset not the detour over ODBC gone. The Access to The data base is So one integrally another and there are The recent Überlegungen to that Save and Reading BLOBs over ODBC objectively hardly useable.
Möglicherweise need one but no extra To schreibende DLL, separate can The API directly use.
Greeting Roland |
| | | Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 04/19/09 ▲ |
| |
| | RGH | Hi, I have time a short look on the API-Guide thrown. there shining Yes everything drin To stand, what need: isc_attach_database() to that Open the data base, isc_dsql_exec_immediate() to that Perform one SQL-Statements, etc. declared reminds a little bit on The ODBC-API. I look time, I The next days Time find, so a little bit To experiment. (but it I hindere too niemanden, it self To try. The Beschreibungen shine me right in detail To his.)
Greeting Roland |
| | | Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 04/19/09 ▲ |
| |
| | Dietmar Horn | Hello Roland,
thanks beforehand for your trouble!
If this Embedded-mode somehow works, then be I fix and ready and will be certainly ripe for Klappse his! the would then Perhaps but neither badly, because there had I presumably sufficient Time, my XProfan-Textbook circa two further more chapter To complement:
XProfan and The relationalen Datenbanksysteme Firebird and Interbase
1. my poor nerves and Firebird 2. introduction in Firebird with XProfan
because Firebird Yes free to have is, would the then a clevere not-ODBC-alternative to the z.T. still right eingeschränkten and The years gekommenen dBase.
Greeting Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 04/20/09 ▲ |
| |
| | RGH | Hi,
here first part to usage of direktem Access to Firebird through XProfan. the example ought to sowohl for Client-Version (there is The DLL though differently: fbclient.dll, with Interbase naturally too) as well as as here for Embedded-Version functions.
ACHTUNG: the example functions! If one with Yes answer becomes The data base objectively deleted and at attempt, The not any more available data base To close, there The entsprechene Firebird-Error Message. ALso before Please a Sicherheitskopie the Datenbankdatei (in the example Patienten.fdb) create.
what happens in the program? - with ImportDLL go The API-functions the DLL imortiert - with isc_expand_dpb() becomes the Verbindungsstring created. In unserem drop need we only Username and password. The suitable Konstanten come from the ibase.h - with isc_attach_database() becomes The link to data base manufactured. If the first entry the status-Arrays a 1 is, is the second entry in the entrapment mismatched 0 The Interbase-Fehlernummer. In this case is with isc_interprete() the Text the suitable Error Message determined. - with isc_drop_database() can we now The data base delete. the works naturally only with korrektem Usernamen and password. otherwise there a Error Message. (the Delete the data base have I as virtually Test for erfolgreiche link chosen, because one SELECT a little bit komplexer would ... ;) ) with something Fleiß and experience can naturally with the übrigen API-functions too SQL-Statements put down, BLOBs write and reading, etc. declared reminds a little bit on The ODBC-API ... unfortunately only a little bit. - with isc_detach_database() becomes The link to data base exits ... vorrausgesetzt tappt im dunkeln watts in the vorigen step not deleted.
the example proving, what but eh clear was: If with others Programmiersprachen the direct Access to Firebird goes, goes it too with XProfan: CompileMarkSeparationFireBird Embedded Demo
----------------------
©2009 Roland G. Hülsmann
Definitionen aus ibase.h
def &isc_dpb_user_name 28
def &isc_dpb_password 29
declare msg#
declare status_vector&[20]
declare pdpb&, pstatus&
var hdll& = ImportDLL(fbembed.dll, fb_)
dim msg#, 512
var dpb_length& = 0 Länge des Verbindungsstrings
var db1& = 0 Databasehandle
var user$ = SYSDBA
var pass$ = masterkey
var name$ = Patienten.fdb
cls
Verbindungsstring erstellen
fb_isc_expand_dpb(addr(pdpb&), addr(dpb_length&),
&isc_dpb_user_name, addr(user$),
&isc_dpb_password, addr(pass$),
0)
whileloop 0, dpb_length& - 1
print hex$(byte(pdpb&,&loop));,;
endwhile
Verbindung zur Datenbank herstellen und auf Fehler prüfen
fb_isc_attach_database(addr(status_vector&[0]), len(name$), addr(name$), addr(db1&), dpb_length&, pdpb&)
if ((status_vector&[0] = 1) and status_vector&[1])
pstatus& = addr(status_vector&[0])
fb_isc_interprete(msg#, addr(pstatus&))
messagebox(string$(msg#, 0), Firebird-Fehler, 16)
end 1
endif
Hier könnte nun der Zugriff auf die Datenbank stattfinden ...
Im Beispiel wird die Datenbank gelöscht! (Vor dem Ausprobieren bitte Sicherheitskopie anlegen!)
if messageBox(Wollen Sie die Datenbank wirklich löschen?, Frage:, 36) = 6
fb_isc_drop_database(addr(status_vector&[0]), addr(db1&))
if ((status_vector&[0] = 1) and status_vector&[1])
pstatus& = addr(status_vector&[0])
fb_isc_interprete(msg#, addr(pstatus&))
messagebox(string$(msg#, 0), Firebird-Fehler, 16)
end 2
endif
endif
Verbindung mit der Datenbank lösen und auf Fehler prüfen
fb_isc_detach_database(addr(status_vector&[0]), addr(db1&))
if ((status_vector&[0] = 1) and status_vector&[1])
pstatus& = addr(status_vector&[0])
fb_isc_interprete(msg#, addr(pstatus&))
messagebox(string$(msg#, 0), Firebird-Fehler, 16)
end 3
endif class=s4 href='./../../Function-References/XProfan/end/'>end
Greeting Roland |
| | | Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 04/20/09 ▲ |
| |
| | Dietmar Horn | Thank you!
the SQLInit and SQLDone hätten we then already time.
If I still somehow the Äquivalent To SQLEXEC by API with the integrally normalen SQL-Übergabestrings (SELECT, INTO, UPDATE, etc.) had, then would The cow Yes first time almost of ice-cream.
Greeting Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 04/20/09 ▲ |
| |
| | RGH | Dietmar horn, Beitrag=51895, Zeitpunkt=20.04.2009
Thank you!
the SQLInit and SQLDone hätten we then already time.
If I still somehow the Äquivalent To SQLEXEC by API with the integrally normalen SQL-Übergabestrings (SELECT, INTO, UPDATE, etc.) had, then would The cow Yes first time almost of ice-cream.
Greeting Dietmar
now because! the meiste goes already. from Found, The me not yet famous are, can itself no area with NUMERIC(10,2) define. NUMERIC(8,2) against functions. and boxes, The with NUMERIC(10,2) definiert are, How z.B. SALARY in EMPLOYEES produce at grabbed solely a Error Message. and BLOBs there too not yet, dürften but no large trouble his. CompileMarkSeparationFireBird Embedded Demo
----------------------
©2009 Roland G. Hülsmann
Definitionen aus ibase.h
def &isc_dpb_user_name 28
def &isc_dpb_password 29
def &SQLDA_VERSION1 1
def &DSQL_close 1
def &DSQL_drop 2
def &SQL_TEXT 452
def &SQL_VARYING 448
def &SQL_SHORT 500
def &SQL_LONG 496
def &SQL_FLOAT 482
def &SQL_DOUBLE 480
def &SQL_D_FLOAT 530
def &SQL_TIMESTAMP 510
def &SQL_BLOB 520
def &SQL_ARRAY 540
def &SQL_QUAD 550
def &SQL_TYPE_TIME 560
def &SQL_TYPE_DATE 570
def &SQL_INT64 580
Weitere Definitionen
def &varchar $1C0 448 SQL_VARYING NOT NULL
def &varchar2 $1C1 449 NULL ALLOWED
def &char $1C4 452 SQL_TEXT NOT NULL
def &char2 $1C5 453 NULL ALLOWED
def &float $1E2 482 SQL_FLOAT NOT NULL
def &float2 $1E3 NULL ALLOWED
def &long $1F0 496 SQL_LONG NOT NULL
def &long2 $1F1 497 NULL ALLOWED
def &short $1F4 500 SQL_SHORT NOT NULL
def &short2 $1F5 501 NULL ALLOWED
def &date $1FE 510 SQL_TIMESTAMP N NULL
def &date2 $1FF 511 NULL ALLOWED
def &blob $208 520 SQL_BLOB NOT NULL
def &blob2 $209 521 NULL ALLOWED
Strukturen aus ibase.h
struct XSQLVAR =
sqltype%, 00:datatype of field
sqlscale%, 02:scale factor
sqlsubtype%, 04:datatype subtype - BLOBs & Text types only
sqllen%, 06:length of data area
sqldata&, 08:address of data
sqlind&, 12:address of indicator variable (short)
sqlname_length%, 16:length of sqlname field
sqlname$(31), 18:name of field, name length + space for NULL
relname_length%, 50:length of relation name
relname$(31), 52:fields relation name + space for NULL
ownname_length%, 84:length of owner name
ownname$(31), 86:relations owner name + space for NULL
aliasname_length%, 118:length of alias name
aliasname$(31) 120:relations alias name + space for NULL -> 151 = 152 Bytes
struct XSQLDA =
version%, 00:version of this XSQLDA
sqldaid#(14), 02:for future use
sqln%, 16:number of fields allocated
sqld% 18:actual number of fields
Weitere Strukturen
struct TIMEDATE =
sek&, 0 .. 59
min&, 0 .. 59
std&, 0 .. 23
tag&, 1 .. 31
mon&, 0 .. 11 !
jahr&, Jahr - 1900 (109 = 2009)
wtag&, Wochentag 0 .. 6, 0 = Sonntag
jtag&, Tag im Jahr 0 .. 365
isdst& Ungleich null bei US-Sommerzeitkonvertierung
Funktionen aus DLL importieren
var hdll& = ImportDLL(fbembed.dll, fb_)
proc fbError
parameters sv&[]
declare msg#
dim msg#, 512
var pstatus& = addr(sv&[0])
var sqlcode& = fb_isc_sqlcode(addr(sv&[0]))
if sqlcode& < 0 SQL-Fehlergefunden
fb_isc_sql_interprete(sqlcode&, msg#, 512)
else
fb_isc_interprete(msg#, addr(pstatus&))
endif
if get(errorlevel) > 0
messagebox(string$(msg#, 0), Firebird Fehler:, 16)
end 1
elseif get(errorlevel) = 0
messagebox(string$(msg#, 0), Firebird Warnung:, 16)
endif
endproc
proc fbInit
parameters user$, pass$, name$
declare status_vector&[20]
var dpb_length& = 0 Länge des Verbindungsstrings
var db1& = 0 Databasehandle
var pdpb& = 0 Zeiger auf Verbindungsstring
Verbindungsstring erstellen
fb_isc_expand_dpb(addr(pdpb&), addr(dpb_length&),
&isc_dpb_user_name, addr(user$),
&isc_dpb_password, addr(pass$),
0)
Verbindung zur Datenbank herstellen und auf Fehler prüfen
fb_isc_attach_database(addr(status_vector&[0]), len(name$), addr(name$), addr(db1&), dpb_length&, pdpb&)
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
return db1&
endproc
proc fbDone
parameters db1&
declare status_vector&[20]
Verbindung mit der Datenbank lösen und auf Fehler prüfen
fb_isc_detach_database(addr(status_vector&[0]), addr(db1&))
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
endproc
proc fbDrop
parameters db1&
declare status_vector&[20]
fb_isc_drop_database(addr(status_vector&[0]), addr(db1&))
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
endproc
proc pad
parameters s$, l&
return left$(s$ + space$(l&), l&)
endproc
proc fbSQLExec
parameters db1&, sql$, mode%
declare status_vector&[20], trans&, stmt&
declare osqlda#, osqlvar#, osql#, tm_date#
var sqlcount& = 0
dim osqlda#, XSQLDA
dim osqlvar#, XSQLVAR
dim tm_date#, TIMEDATE
Transaktion starten
fb_isc_start_transaction(addr(status_vector&[0]), addr(trans&), 1, addr(db1&), 0, 0)
if trans& > 0
Statementhandle holen
if left$(upper$(trim$(sql$)),7) <> SELECT
fb_isc_dsql_execute_immediate(addr(status_vector&[0]), addr(db1&), addr(trans&), len(sql$), addr(sql$), 1, 0)
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
else
fb_isc_dsql_allocate_statement(addr(status_vector&[0]), addr(db1&), addr(stmt&))
if stmt& > 0
Datenbereich zunächst für das Lesen der ersten 2 Felder vorbereiten
dim osql#, sizeof(osqlda#) + 2 * sizeof(osqlvar#)
clear osql#
osqlda# = addr(osql#)
osqlda#.version% = &SQLDA_VERSION1
osqlda#.sqln% = 2
Informationen über erste 2 Felder holen (Datentyp, Länge, etc.)
fb_isc_dsql_prepare(addr(status_vector&[0]), addr(trans&), addr(stmt&), len(sql$), addr(sql$), 1, osql#)
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
var d% = osqlda#.sqld%
if d% > 2
Wenn mehr als zwei Felder, dann Datenbereich für erittelte Feldanzahl neu dimensionieren
clear osql#
dim osql#, sizeof(osqlda#) + d% * sizeof(osqlvar#)
osqlda# = addr(osql#)
osqlda#.version% = &SQLDA_VERSION1
osqlda#.sqln% = d%
Informationen über alle Felder holen (Datentyp, Länge, etc.)
fb_isc_dsql_prepare(addr(status_vector&[0]), addr(trans&), addr(stmt&), len(sql$), addr(sql$), 1, osql#)
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
endif
Feldbeschreibungen füllen und Titelzeile erzteugen
declare fname$[d%-1], ftyp%[d%-1], fstyp%[d%-1], flen%[d%-1], fscale%[d%-1], fdata$[d%-1]
var zeile$ =
var maxlen& = 0
whileloop 0, d%-1
osqlvar# = addr(osql#) + sizeof(osqlda#) + &loop * sizeof(osqlvar#)
fname$[&loop] = osqlvar#.sqlname$
flen%[&loop] = osqlvar#.sqllen%
case len(fname$[&loop]) > flen%[&loop] : flen%[&loop] = len(fname$[&loop])
ftyp%[&loop] = osqlvar#.sqltype%
fstyp%[&loop] = osqlvar#.sqlsubtype%
case ftyp%[&loop] = &date : flen%[&loop] = 10
case ftyp%[&loop] = &date2 : flen%[&loop] = 10
fscale%[&loop] = osqlvar#.sqlscale%
print osqlvar#.sqltype%, hex$(ftyp%[&loop]),fstyp%[&loop],fname$[&loop],flen%[&loop]
zeile$ = zeile$ + pad(fname$[&loop],flen%[&loop]) + |
case flen%[&loop] > maxlen& : maxlen& = flen%[&loop]
endwhile
Titelzeile ausgeben
select mode%
caseof 0 : print zeile$
caseof 1 : addstring zeile$
endselect
Trennlinie erzeugen und ausgeben
zeile$ =
whileloop 0, d%-1
zeile$ = zeile$ + mkstr$(-,flen%[&loop]) + |
endwhile
select mode%
caseof 0 : print zeile$
caseof 1 : addstring zeile$
endselect
Statement ausführen
fb_isc_dsql_execute(addr(status_vector&[0]), addr(trans&), addr(stmt&), 1, 0)
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
Datenbereich für Empfang eines Satzes vorbereiten
osqlda#.sqln% = d% * 256
declare data#[d%-1]
declare ind&[d%-1]
dim data#[], maxlen& + 1
whileloop 0, d% - 1
long osql#, sizeof(osqlda#) + &loop * sizeof(osqlvar#) + 8 = addr(data#[&loop])
long osql#, sizeof(osqlda#) + &loop * sizeof(osqlvar#) + 12 = addr(ind&[&loop])
endwhile
Daten satzweise holen und auswerten
var retcode& = 0
retcode& = fb_isc_dsql_fetch(addr(status_vector&[0]), addr(stmt&), 1, osql#)
while retcode& <> 100 100: keine weiteren Sätze
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
zeile$ =
whileloop 0, d%-1
select ftyp%[&loop]
caseof &varchar, &varchar2
fdata$[&loop] = string$(data#[&loop],2)
caseof &date, &date2
fb_isc_decode_sql_date(data#[&loop],tm_date#)
fdata$[&loop] = dtoc$(format$(%.4d, tm_date#.jahr& + 1900)
+ format$(%.2u, tm_date#.mon& + 1)
+ format$(%.2u, tm_date#.tag&))
caseof &char, &char2
fdata$[&loop] = string$(data#[&loop],0)
caseof &long, &long2, &short, &short2
fdata$[&loop] = str$(long(data#[&loop],0))
caseof &float, &float2
fdata$[&loop] = str$(double(long(data#[&loop],0)))
caseof &blob, &blob2
fdata$[&loop] = BLOB- + str$(fstyp%[&loop])
endselect
zeile$ = zeile$ + pad(fdata$[&loop],flen%[&loop]) + |
endwhile
inc sqlcount&
Datenzeile ausgeben
select mode%
caseof 0 : print zeile$
caseof 1 : addstring zeile$
endselect
retcode& = fb_isc_dsql_fetch(addr(status_vector&[0]), addr(stmt&), 1, osql#)
endwhile
endif
Statementhandle freigeben
fb_isc_dsql_free_statement(addr(status_vector&[0]), addr(stmt&), &DSQL_drop)
endif SELECT-Ende
Transaktion abschließen
fb_isc_commit_transaction(addr(status_vector&[0]), addr(trans&))
endif
if ((status_vector&[0] = 1) and status_vector&[1])
fbError(status_vector&[])
endif
return sqlcount&
endproc
=============
HAUPTPROGRAMM
=============
window 1000, 800
cls
var db1& = fbInit(SYSDBA, masterkey, Employee.fdb)
set(errorlevel, -1)
fbSQLExec(db1&, drop table BUECHER, 1)
set(errorlevel, 1)
fbSQLExec(db1&, create table BUECHER (titel CHAR(40), autor CHAR(40), preis NUMERIC(8,2), datum TIMESTAMP), 1)
fbSQLExec(db1&, INSERT INTO buecher (titel,autor,preis) VALUES (XProfan für Dummies,RGH-Soft,19.94), 1)
clearlist
fbSQLExec(db1&, select * from BUECHER, 1)
listbox$(BUECHER:,2)
clearlist
print fbSQLExec(db1&, select EMP_NO, FIRST_NAME, LAST_NAME, JOB_CODE, JOB_GRADE, JOB_COUNTRY, FULL_NAME, PHONE_EXT, HIRE_DATE from EMPLOYEE, 1)
listbox$(EMPLOYEE:,2)
clearlist
print fbSQLExec(db1&, select * from PROJECT, 1)
listbox$(PROJECT:,2)
clearlist
print fbSQLExec(db1&, select * from CUSTOMER, 1)
listbox$2>(CUSTOMER:,2)
waitinput
fbDone(db1&)
end
|
| | | Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 04/22/09 ▲ |
| |
|
AnswerThemeninformationenthis Topic has 5 subscriber: |