How to store files into SQLBase

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
Horst Jaeger

How to store files into SQLBase

Post by Horst Jaeger » 08 Mar 2008, 10:12

 Posted by:  Horst Jaeger 

Hi,
can anybody tell me how to store files like .doc, .xls or .pdf into SQLBase?
Also a hint for suitable documentatin about this problem is most welcome.
regards
Horst

Mike Buch

Re: How to store files into SQLBase

Post by Mike Buch » 08 Mar 2008, 10:51

 Posted by:  Mike Buch 

Hi,

short sample (this is from TD 1.5.1, don't know there are other ways in
newer versions):

Window Handle: hwnd_in
Long String: l_str_pic

Save to Database:
Call SalPicGetString( hwnd_in, PIC_FormatObject, l_str_pic )
....
UPDATE table SET myPic = :l_str_pic

Read From Database:
SELECT myPic from table into :l_str_picout

Call SalPicSetString( hwnd_in, PIC_FormatObject, l_str_pic )

Best Regards
Mike Buch

Horst Jaeger

Re: How to store files into SQLBase

Post by Horst Jaeger » 10 Mar 2008, 12:06

 Posted by:  Horst Jaeger 

Thanks Mike,
this seems to work only with a picture.
What I want to do
choose a file and store it to the database.
How do I connect the file (f.i. test.pdf) to the handle hwnde_in?
When looking for a file, only itmap-files are offered.
Thanks.
Horst

Jim McNamara

Re: How to store files into SQLBase

Post by Jim McNamara » 10 Mar 2008, 14:33

 Posted by:  Jim McNamara 

You're not reading a picture! Use something link:

!!CB!! 73
Call SalFileOpen( fhFile, sPath, OF_Read|OF_Binary )
Set nBytes = SalFileRead( fhFile, lsFile, 30000000 )

Jim McNamara

Re: How to store files into SQLBase

Post by Jim McNamara » 10 Mar 2008, 14:35

 Posted by:  Jim McNamara 

Left out the insert/update to SQLBase:

!!CB!! 73
Call SalFileOpen( fhFile, sPath, OF_Read|OF_Binary )
Set nBytes = SalFileRead( fhFile, lsIntallFile, 30000000 )
Call SalFileClose( fhFile )
Set nLength = SalStrLength( lsIntallFile )
Call SqlCommit( hSql )
Call SqlPrepare( hSql, 'update update_apps
set file = :lsIntallFile
where app = :cmbApplication' )
Call SqlExecute( hSql )
Call SqlCommit( hSql )

Mike Buch

Re: How to store files into SQLBase

Post by Mike Buch » 10 Mar 2008, 15:32

 Posted by:  Mike Buch 

Hi,

oh sorry, now i see it ...
Jim has post you the way to do it.

Regards,

Horst Jaeger

Re: How to store files into SQLBase

Post by Horst Jaeger » 10 Mar 2008, 15:52

 Posted by:  Horst Jaeger 

Hi Jim,
Thank you very much for your help.
regards
Horst

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests