putrcolumndata with pointer

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
georget
Posts: 7
Joined: Wed 02 Dec 2009 20:48

putrcolumndata with pointer

Post by georget » Wed 22 Jun 2011 13:35

We use Delphi V and assoc mydac-
We have a variable normally accessible as a pointer which is initialized with a getmem(ptr,size) line of code. We modify the pointer referenced contents and now want to store the referenced contents in a text column in on-line data base. can I use the putcolumndata method with the ptr as datasource like
putcolumndata(fieldname,1,ptr)
or if not, can I typecast pointer as Pchar and use

putcolumndata(fieldname,1,Pchar(ptr))?Thanks,

Jennifer good

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Post by kaffeburk » Wed 22 Jun 2011 18:03

Try:

1: Convert the data to a string
2: Use TMyquery to store it:

with MyQuery do begin
Append; // or Edit if its an update.
FieldByName('theField').asstring := TheNewString;
Post;
end
Last edited by kaffeburk on Wed 22 Jun 2011 18:28, edited 2 times in total.

AndreyZ

Post by AndreyZ » Thu 23 Jun 2011 11:43

You can use the following code:

Code: Select all

PutColumnData(fieldname, 1, string(PChar(ptr)));

Post Reply