Re: [firebird-support] How do load a BLOB file using an Update query
I've got it working now! Thanks - Using Firebird 2.5
Re: [firebird-support] How do load a BLOB file using an Update query
Hi Craig, >I have been using "LoadFromFile" in my Delphi apps to load a pdf file into >my Firebird databases. However, I need to replicate this using an update >query. >The code below was my first attempt. Using IBOjects within Delphi > qryUpdateManifestBLOB.SQL.Clear; > qryUpdateManifestBLOB.SQL.Add('UPDATE'); > qryUpdateManifestBLOB.SQL.Add('w_shipments'); > qryUpdateManifestBLOB.SQL.Add('SET'); > qryUpdateManifestBLOB.SQL.Add('w_shipments.US_manifest_doc ='); > qryUpdateManifestBLOB.SQL.Add('LoadFromFile'); Well, this obviously won't work, because whatever is in the .SQL property, is executed by the Firebird database engine. And that engine cannot execute Delphi code. Use a parameter: SQL.Add('SET myblobcol = :newblob'); and of course the primary key stuff. Call: qryUpdateManifestBLOB.Prepare; qryUpdateManifestBLOB.ParamByName('newblob').LoadFromFile qryUpdateManifestBLOB.ExecSQL; >which Firebird did not like because "LoadToFile" is an unknown function. See above. With regards, Martijn Tonies Upscene Productions http://www.upscene.com Download Database Workbench for Oracle, MS SQL Server, Sybase SQL Anywhere, MySQL, InterBase, NexusDB and Firebird!
[firebird-support] How do load a BLOB file using an Update query
I have been using "LoadFromFile" in my Delphi apps to load a pdf file into my Firebird databases. However, I need to replicate this using an update query. The code below was my first attempt. Using IBOjects within Delphi qryUpdateManifestBLOB.SQL.Clear; qryUpdateManifestBLOB.SQL.Add('UPDATE'); qryUpdateManifestBLOB.SQL.Add('w_shipments'); qryUpdateManifestBLOB.SQL.Add('SET'); qryUpdateManifestBLOB.SQL.Add('w_shipments.US_manifest_doc ='); qryUpdateManifestBLOB.SQL.Add('LoadFromFile'); qryUpdateManifestBLOB.SQL.Add('('); qryUpdateManifestBLOB.SQL.Add(QuotedStr(fmWasteShipments.PathtoFile)); qryUpdateManifestBLOB.SQL.Add(')'); qryUpdateManifestBLOB.SQL.Add('WHERE'); qryUpdateManifestBLOB.SQL.Add('w_shipments.shipments_pk = '); qryUpdateManifestBLOB.SQL.Add(ShipmentPK); The code produced this sql statement UPDATE w_shipments SET w_shipments.US_manifest_doc = LoadFromFile ( 'C:\Users\ccox.COXCOLVIN\Desktop\FedEx Form.pdf' ) WHERE w_shipments.shipments_pk = '585' which Firebird did not like because "LoadToFile" is an unknown function. Any help is greatly appreciated.