Solved

How can I insert a large field into Infomix database using TQuery.

Posted on 1997-05-28
1
198 Views
Last Modified: 2010-04-06
How can I insert/update a large field (more than 255 bytes, such as BLOB) into SQL database (informix5) using TQuery in Delphi 2.0 ?
0
Comment
Question by:serg
1 Comment
 

Accepted Solution

by:
batsoft earned 200 total points
ID: 1336626
You can not do so with Insert or Update SQL statements.
1. Be shure that your query result set have RequestLive property = TRUE.
1. Locate  record you need to update.
Source Follows;
procedure UpdateField(FieldName:String;Q:TQuery;Src:TStream);
const
 BufSize = 4096; {we will trasnfer all with 4k buffer}
var
 B:TBlobStream
 Buf:Pointer;
 BytesRead:Integer;
begin
 {Src TStream object (TFileStream,TBlobSTream etc. wich contains data to be updated}
 GetMem(Buf,BufSize);
 B := TBlobStream((Q.FindField(FieldName) as TBlobField), bmOpenWrite);

 try
  repeat
    {Read source data}
   BytesRead := Src.Read(Buf^,BufSize);
  {Write data to field}
   B.Write(Buf^,BytesRead);
 until  BytesRead <> BufSize;
 finally
 {Close streams}
  B.Free;
 FreeMem(Buf,BufSize);
end;
{You can call this method whenever you need update blob field contents., before open stream to source data and put record in edit or insert state, after call Post or CheckBrowseMode}

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now