Forum | | | | - Page 1 - |
| Dietmar Horn | Hello together,
today contact I time with a SQL-trouble order selected Hilfestellung on The SQL-Experten under you.
I work z.Z. with XProfan 11 in a komplexeren proposition. its already right far gediehen. The yet einzigste, but crucial Problempunkt is for me The on- or. Integration the RDBS Firebird (Freeware or. Open-Source) or. Interbase (the kostenpflichtige Gegenstück of Borland To Firebird - like the Relationship between MS Office and Open-Office).
yet had to I yet never big with SQL keep busy, except that I me always times the XProfan-Help to that SQL-Topic reingezogen and the everything as right logical felt having. still How often, lying the dog certainly only in a tiny detail bury, I not know, or in a Error, whom I made or overlooking have.
Firebird and Interbase knew I To to 4 weeks not yet time of names since, because I something like yet never needed having - but now is it so far.
ODBC-driver and Firebird are installs.
first of all goes it therefore, a link produce. under windows 2000 (in unserem Vereins-cabinet) works The Initialisierung with SQLInit meanwhile.
The Initialisierung supply under W 2000 How desired the lever back:
under Windows XP yields the however yet always 0 (means failed), and in the Contrast To W 2000 appear there before not yet time the dialog to that prompt of Username, PWD, etc.
before this Completed: the produce the link not resolved is, need I none big go on.
Literatur over Firebird have I meanwhile tonnenweise, still before I not create, on all windows-Systemen ex 2000 up a reliable link produce, nützt me the everything unfortunately not too plenty.
can me Perhaps someone help, the itself already time something hither so engage has?
The next steps, So the Neuanlegen of/ one data base, or the Edit / Reading of/ one vorhandenen DB and the Weiterverarbeiten the data in the actual Program might then solely another pure Fleiß- and Logik-work his.
the sheer z.B. on dBase isn't possible, because dBase dbzgl. not over The for this proposition erforderlichen Feautures verfügt.
who can evtl. help on?
I suspect time, if the program sometime with Firebird runs, then should the program too with Interbase functions - or?
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: [...] | 01/11/09 ▲ |
| |
| | | | | - Page 6 - |
| RGH | Dietmar horn
Dietmar hornand the BLOBs go Yes by the 64KB-boundary the Treibers versaut the can so not voices, because others Konkurrenzprodukte To my or. unserem actually proposition works with real Blobs in Interbase and Firebird (however in C Delphi program). only with XProfan shining the yet unfortunately even not yet To klappen.
These others programs communicate under Umständen (with ziemlicher safety) not by ODBC with Firebird/Interbase, separate directly. there are naturally integrally others things possible. XProfan kommuniziert only over ODBC with all Databases, a such interface afford. and here bid XProfan (at least not without API) not any Opportunities, separate only The communication over SQL by SQLEXEC (the The ODBC-API SQLExelDirect corresponds to). and for SQL-Statementsgibt it with Firebird/Interbase even The Begrenzung on 64 kB. Pascal has already viewed, How one The ODBC-API benefit can what about me having moreover supra Yes aich already The APIs erwähnt, with them it presumably possible is, BLOBs under evasion the 64k-boundary To befüllen. If I Time find, I will me the time look at.
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 | 03/01/09 ▲ |
| |
| | RGH | Uwe Pascal Niemeier
Hi people! Mutmaßung: either is the db-Unterstützungvon Delphi completely differently knitted as The of Profan
Korekt! Delphi can over defined Komponenten directly with Interbase communicate and goes thereby not over ODBC.
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 | 03/01/09 ▲ |
| |
| | Uwe ''Pascal'' Niemeier | Hi Dietmar!
the can so not voices, because others Konkurrenzprodukte To my or. unserem actually proposition works with real Blobs in Interbase and Firebird (however in C Delphi program). only with XProfan shining the yet unfortunately even not yet To klappen.
i remember again on whom suggested Workaround, with the The data in several bites in the same thing Datenfeld written go. the Result is definitiv one truer BLOB!
with anybody 32- or 64-KB-boundary irgendeines ODBC-Treibers might the nothing concern,...
Roland mentioned Yes, that this even in anybody Doku erwähnt becomes. the The people of FireBird your driver as Stiefkinder standing isn't Profans guilt
too the EMS-SQL-manager can real Blob-boxes lay out
there could one Yes time look, How it the power... but there Roland Yes anyhow already so zugange is, rewards it itself well not, because the Result already with the next Profan-Version obsolete would.
SeeYou Pascal |
| | | | |
| | RGH | and It's all right still: real Binäre BLOBs with XProfan
before I my obiges Beispielprogramm on real BLOBs umschreibe, hierzunächst The Solution by ODBC-API: CompileMarkSeparationwindow 50,50-500,500
DEF &SQL_PARAM_INPUT 1
DEF &SQL_SUCCESS 0
DEF &SQL_HANDLE_STMT 3
DEF &SQL_C_DEFAULT 99
DEF &SQL_CHAR 1
DEF &SQL_NUMERIC 2
DEF &SQL_DECIMAL 3
DEF &SQL_INTEGER 4
DEF &SQL_SMALLINT 5
DEF &SQL_FLOAT 6
DEF &SQL_REAL 7
DEF &SQL_DOUBLE 8
DEF &SQL_VARCHAR 12
DEF &SQL_DATE 9
DEF &SQL_TIME 10
DEF &SQL_TIMESTAMP 11
DEF &SQL_LONGVARCHAR -1
DEF &SQL_BINARY -2
DEF &SQL_VARBINARY -3
DEF &SQL_LONGVARBINARY -4
DEF &SQL_BIGINT -5
DEF &SQL_TINYINT -6
DEF &SQL_BIT -7
def SQLAllocHandle(3) !odbc32,SQLAllocHandle
def SQLFreeHandle(2) !odbc32,SQLFreeHandle
def SQLPrepare(3) !odbc32,SQLPrepare
def SQLBindParameter(10) !odbc32,SQLBindParameter
def SQLExecute(1) !odbc32,SQLExecute
proc SQLPutBlob
parameters Exec$, DATA#
declare stmt&, size&, ret%, error$
SQLAllocHandle(&SQL_HANDLE_STMT, &SQLDBC, addr(stmt&))
size& = SizeOf(Data#)
Ret% = SQLBindParameter(stmt&, 1, &SQL_PARAM_INPUT, &SQL_BINARY, &SQL_LONGVARBINARY,
SizeOf(Data#), 0, Data#, 0, Addr(size&))
If LoWord(Ret%) = &SQL_SUCCESS
Ret% = SQLPrepare(stmt&,addr(Exec$),len(Exec$))
If LoWord(Ret%) = &SQL_SUCCESS
Ret% = SQLExecute(stmt&)
Case LoWord(Ret%) <> &SQL_SUCCESS : Error$ = SQLExecute
Else
error$ = SQLPrepare
EndIf
Else
error$ = SQLBindParameter
EndIf
Case Len(error$) : MessageBox(error$ + fehlgeschlagen!, ODBC-Fehler, 16)
SQLFreeHandle(&SQL_HANDLE_STMT, stmt&)
endproc
Declare Bild#
CLS
Var datei$ = HELLOWEEN.JPG
Dim Bild#, FileSize(datei$)
BlockRead(datei$, Bild#, 0, FileSize(datei$))
var db& = sqlinit(DSN=KursDB;UID=SYSDBA;PWD=masterkey;DBNAME=D:\Dokumente\FireBird\KURSDB.GDB)
SQLPutBlob(INSERT INTO TCS (Feld1) VALUES (?), Bild#)
SQLDone
Print Blob geschrieben!
waitin >
end
the Result can with the SQL-manager begutachten and z.B. whom written BLOB as Save file and these then with a Bildbearbeitungsprogramm viewing. BTW: Helloween.jpg is ca. 1,5 MB big.
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 | 03/02/09 ▲ |
| |
| | | | - Page 7 - |
| | RGH | reading and write binärere BLOB-boxes with XProfan
and here the complete example with binären BLOB-Feldern. (for Blobfelder with long Texten should it something rewritten go.) in the example becomes a Image-File as BLOB stored, again read and on The Festplatte zurückgeschrieben. (naturally can here arbitrary File Types akin go.) CompileMarkSeparation
{ ========================================
KONSTANTEN UND API FUNKTIONEN DEFINIEREN
========================================
DEF &SQL_PARAM_INPUT 1
DEF &SQL_SUCCESS 0
DEF &SQL_HANDLE_STMT 3
DEF &SQL_C_DEFAULT 99
DEF &SQL_CHAR 1
DEF &SQL_NUMERIC 2
DEF &SQL_DECIMAL 3
DEF &SQL_INTEGER 4
DEF &SQL_SMALLINT 5
DEF &SQL_FLOAT 6
DEF &SQL_REAL 7
DEF &SQL_DOUBLE 8
DEF &SQL_VARCHAR 12
DEF &SQL_DATE 9
DEF &SQL_TIME 10
DEF &SQL_TIMESTAMP 11
DEF &SQL_LONGVARCHAR -1
DEF &SQL_BINARY -2
DEF &SQL_VARBINARY -3
DEF &SQL_LONGVARBINARY -4
DEF &SQL_BIGINT -5
DEF &SQL_TINYINT -6
DEF &SQL_BIT -7
def SQLAllocHandle(3) !odbc32,SQLAllocHandle
def SQLFreeHandle(2) !odbc32,SQLFreeHandle
def SQLPrepare(3) !odbc32,SQLPrepare
def SQLBindParameter(10) !odbc32,SQLBindParameter
def SQLExecute(1) !odbc32,SQLExecute
def SQLExecDirect(3) !odbc32,SQLExecDirect
def SQLGetData(6) !odbc32,SQLGetData
def SQLFetch(1) !odbc32,SQLFetch
}
================
BLOB-Funktionen:
================
proc SQLPutBlob
parameters Exec$, DATA#
declare stmt&, size&, ret%, error$
SQLAllocHandle(&SQL_HANDLE_STMT, &SQLDBC, addr(stmt&))
size& = SizeOf(Data#)
Ret% = SQLBindParameter(stmt&, 1, &SQL_PARAM_INPUT, &SQL_BINARY, &SQL_LONGVARBINARY,
SizeOf(Data#), 0, Data#, 0, Addr(size&))
If LoWord(Ret%) = &SQL_SUCCESS
Ret% = SQLPrepare(stmt&,addr(Exec$),len(Exec$))
If LoWord(Ret%) = &SQL_SUCCESS
Ret% = SQLExecute(stmt&)
Case LoWord(Ret%) <> &SQL_SUCCESS : Error$ = SQLExecute
Else
error$ = SQLPrepare
EndIf
Else
error$ = SQLBindParameter
EndIf
Case Len(error$) : MessageBox(error$ + fehlgeschlagen!, ODBC-Fehler, 16)
SQLFreeHandle(&SQL_HANDLE_STMT, stmt&)
endproc
proc SQLGetBlob
parameters Exec$
declare Data#, size&, stmt&, ret%, error$
SQLAllocHandle(&SQL_HANDLE_STMT, &SQLDBC, addr(stmt&))
SQLExecDirect(stmt&, addr(Exec$), len(Exec$))
dim Data#, 1 Dummy-DIM zur Größenermittlung
Ret% = SQLFetch(stmt&)
If LoWord(Ret%) = &SQL_SUCCESS
Ret% = SQLGetData(stmt&, 1, &SQL_BINARY, Data#, 0, addr(size&))
if Size& > 0
dim Data#, size&
SQLGetData(stmt&, 1, &SQL_BINARY, Data#, SizeOf(Data#), addr(size&))
endif
Else
error$ = SQLFetch
endif
SQLFreeHandle(&SQL_HANDLE_STMT, stmt&)
Case Len(error$) : MessageBox(error$ + fehlgeschlagen!, ODBC-Fehler, 16)
Return Data#
endproc
=============================
Das eigentliche Testprogramm:
=============================
declare db&, sql$, bild#, sbild$, datei$, startpos&, teil$, teilnr%, ergebnis$, bildnr%
cls
db& = sqlinit(DSN=KursDB;UID=SYSDBA;PWD=masterkey;DBNAME=D:\Dokumente\FireBird\KURSDB.GDB)
If db& > 0
=================
TABELLEN ERZEUGEN
=================
Tabellen löschen, wenn schon vorhanden
Set(Errorlevel,0)
SQLExec DROP TABLE bilderliste,0
SQLExec DROP TABLE bild,0
Set(Errorlevel,1)
Tabelle für die Bilder neu erzeugen
SQLExec CREATE TABLE bilderliste (name CHAR(40), fotograf CHAR(40), bildnr INTEGER, bild BLOB),1
=========================
BILD IN TABELLE SPEICHERN
=========================
Da für eine Bild zwei Schreibvorgänge nötig sind, werden wir diese in eine Transaktion
zusammmenfassen.
Zunächst also die automatische Bestätigung einzelner SQL-Befehle ausschalten. Die folgenden
SQL-Befehle werden also erst mal zwischengespeichert ohne wirklich in die Datenbank zu gehen
sqlexec #AUTOCOMMIT_OFF, 0
Tabelle Bilderliste füllen: Bild 1 hinzufügen, das Bild selbst noch weg lassen
sql$ = INSERT INTO bilderliste VALUES (Helloween Muffins,Jasmin Hülsmann,1,)
sqlexec sql$,0
Nun das Bild in Bild# einlesen
datei$ = HELLOWEEN.JPG
Dim Bild#, FileSize(datei$)
BlockRead(datei$, Bild#, 0, FileSize(datei$))
Und das Bild in die Tabelle einfügen
ACHTUNG: Das SQL-Statement darf nur ein Feld enthalten und zwar das BLOB-Feld (nur INSERT oder UPDATE)
SQLPutBlob(UPDATE bilderliste SET bild = ? WHERE bildnr = 1, Bild#)
Wenn bis hierher alles glatt gegangen ist, konnte alle Felder in den Satz geschrieben
werden. Es erfolgt also die Bestätigung, dass es nun wirklich in die Datenbank kann:
sqlexec #COMMIT, 0
Für die folgenden Befehle benötigen wir die Transaktionskontrolle nicht mehr, so dass
jede SQL-Anweisung automatisch bestätigt werden soll:
sqlexec #AUTOCOMMIT_ON, 0
=========================
BILD AUS TABELLE AUSLESEN
=========================
Ein Bild aus der Tabelle Bilderliste auswählen, dabei das BLOB-Feld bild nicht anzeigen
sql$ = SELECT name, fotograf, bildnr FROM bilderliste
clearlist
sqlexec sql$,1
Überschrift und Trennzeile entfernen
DeleteString(0,0)
DeleteString(0,0)
ergebnis$ = listbox$(Bild auswählen und mit OK bestätigen:,2)
if ergebnis$ >
Die Nummer des gewählten Bildes steht im dritten Feld
bildnr% = Int(Val(SubStr$(ergebnis$,3,|)))
Jetzt das Bild laden
Wir benötigen jetzt nur das BLOB-Feld bild
ACHTUNG: Das SQL-Statement darf nur ein Feld enthalten und zwar das BLOB-Feld (nur SELECT)
sql$ =SELECT bild FROM bilderliste WHERE bildnr = + Str$(bildnr%)
Clear Bild#
Bild# = SQLGetBlob(sql$)
Bild auf Festplatte speichern
blockwrite GelesenesBild.jpg, Bild#, 0, SizeOf(Bild#)
Bild zur Kontrolle anzeigen
DrawSizedPic GelesenesBild.jpg, 0, 0 - 400, 300, 0
EndIf
SQLDone
Else
Print Datenbank konnte nicht geöffnet werden!
Endif
waitinput
end
One technischer Info yet: too to the supra erwähnten Korrektur in XProfan becomes the reading binary Blobs with SQLEXEC not directly possible his. there went it circa long Text-Blobs. |
| | | 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 | 03/02/09 ▲ |
| |
| | RGH | Hello Dietmar,
reicht you with the whom BLOBs so far or missing yet what?
i think i'll The BLOB-edit along into The next Version Help take in and a sqlblobs.ph mitliefern, The The obigen Definition of Konstanten and external functions contains. I hope, that now explicit become is, How with something ODBC-API self large binäre BLOBs with XProfan relatively free from problems possible are.
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 | 03/05/09 ▲ |
| |
| | Dietmar Horn | Hello Roland,
thanks first times for your trouble!
because I since end last week gesundheitlich not integrally so well on it was, be I unfortunately not yet big to that testing come. I hope, that it at the latest on the weekend so klappen becomes, after I again on the aufsteigenden branch be.
After the first Überfliegen would me evtl. yet the Delete and the Updaten the contents the BLOB-boxes are missing. but How said, i'm dbzgl. yet not yet big to that experiment come ...
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: [...] | 03/05/09 ▲ |
| |
| | Dietmar Horn | Hello together,
knows someone Perhaps a Possibility, How one one the users the Einbinden the whole SQL-Treibergeschichten and the Login the *.fdb- or. *.gdb-DB save can - means either by separate Setup-Program, or rather yet, same of own Program from ...
slow find I Real fallen on the whole SQL-Zeugs! yet To to one Vierteljahr had I do not time of it To dream ventured, that the too still in my middle-aged Knusperkopp reinpassen could.
particularly Thomas Z. has one dickes, fettes praise and Thank you for its stamina with me earn - for, that it me The SQL-Grundlagen so verständlich eingeprügelt has! I find it anyway lovely so, what's it like: first learn The schoolboy jahrelang from her teacher - and later functions the andersrum ditto fine!
particularly The BLOBs are a geniale invention (even if I the for the time being over VARCHAR-boxes and the obigen Solution of Roland through Encode64-String-Verschlüsselung realisiere)! still sometime I will guaranteeing time again intensiver blobben and me stronger with the BLOBs try make friends.
If I with my actually proposition something moreover be, I will in some ruhigeren hours my small XProfan-Textbook certainly yet a part about Databases (introduction in dBase and SQL with Firebird) give liberally.
I know meanwhile even a renommierte software-Schmiede for medizinischen area, The your programs currently of kostenpflichtigen Interbase (of Borland) the free erhältliche Firebird adjust, because it with Interbase with ihren customers with its software constantly Problems with the joint Datenbankzugriff the network gives, if More as 5 Clients connected are.
These firm erspart the users anyway the Herumklickern In the Control Panel because of the Anmeldens the SQL-story already with the Setup for your programs. but so fat be I with them unfortunately too not yet befreundet, that tappt im dunkeln me these Vorgehensweise betray would.
somehow must the means weg - still How?
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: [...] | 03/19/09 ▲ |
| |
| | | The link simply self produce, Winsock-Zeugs if you so want. You could you a Include write which your Statements by TCP/IP on IP/PORT absendet in the stature, as the jeweilige Datenbankserver/service expects. in the Grunde nothing other as if You z.B. a FTP-link self aufbaust.
one could even at SQL-Server a FTP-Server zurechtfummeln as local Wrapper for SQL. (unl.Mgl...) |
| | | | |
| | Dietmar Horn | *nurbahnhofversteh* and how does that? |
| | | 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: [...] | 03/19/09 ▲ |
| |
| | | well this is the [...] here - Have so did i to (erstmalig) in a game (XNoid) for a Online-Multiplayer anzutesten.
i think but, because of the sure not unerheblichen hoisted in your drop for DB-Zeugs, should You you for Schaffung this self-sufficiency later Time take - is indeed one Topic for itself.
You wanted only know still How?! |
| | | | |
| | Uwe ''Pascal'' Niemeier | Hi Dietmar!
be I do not sure, whether I you correctly. understood have; the install the jeweiligen driver can itself well not avoid, think I. the arrange of/ one Datenquelle In the Control Panel can you you though in the doing schenken; The driver can too directly address. Wirf again NEN look in my Demos: there make I it just as. further About connections To diversen Databases find You under [...]
HTH Pascal |
| | | | |
|
AnswerTopic-Options | 18.828 Views |
Themeninformationenthis Topic has 9 subscriber: |