more Memo field UTF8 adventures
more Memo field UTF8 adventures
As everything these days are unicode
New Delphi, WEB pages, windows, Firebird (UTF8) and memo fields
It is kind of natural that you could use a database blob aka memo to store
for example a web page full of unicode...
Yet why is it such a headache that one cannot do simply with your product
the following
Database and field being UTF8
SELECT from WHERE etc
Open the query and
Q.fields[0].asstring showing the right stuff
how involved it has to be????
I have spent 2 days dicking around to try to get the stuff to work
and if I cut and paste the content of the memo to a file or to an editor it work...
Please any ideas ???
by the way it should be as simple to do on a update or insert a block of text
thanks regards
Philippe Watel
New Delphi, WEB pages, windows, Firebird (UTF8) and memo fields
It is kind of natural that you could use a database blob aka memo to store
for example a web page full of unicode...
Yet why is it such a headache that one cannot do simply with your product
the following
Database and field being UTF8
SELECT from WHERE etc
Open the query and
Q.fields[0].asstring showing the right stuff
how involved it has to be????
I have spent 2 days dicking around to try to get the stuff to work
and if I cut and paste the content of the memo to a file or to an editor it work...
Please any ideas ???
by the way it should be as simple to do on a update or insert a block of text
thanks regards
Philippe Watel
UTF8 memo fields
Thaks for your answer
It works on the select now
but how about on Update or insert
what is the correct synax
q.sql := 'update
Set memofield = :memofield';
q.ParamByName(memofield).Value := bigstring;
q.execute
or you have to add
q.ParamByName(memofield).DataType := ftblob;
q.ParamByName(memofield).AsIbBlob.IsUnicode := Self.UseUnicode;
The documentation or help is a bit non existant (or at least could not find examples)
regards
PW
It works on the select now
but how about on Update or insert
what is the correct synax
q.sql := 'update
Set memofield = :memofield';
q.ParamByName(memofield).Value := bigstring;
q.execute
or you have to add
q.ParamByName(memofield).DataType := ftblob;
q.ParamByName(memofield).AsIbBlob.IsUnicode := Self.UseUnicode;
The documentation or help is a bit non existant (or at least could not find examples)
regards
PW
You should set DataType of the parameter to ftWideMemo:
In this case IBDAC encodes parameter's value to UTF8 before it sends the value to the server.
You can also set the UnicodeMemoParameters global variable from the IBC unit to True. In this case values of ftMemo parameters will be also encoded to UTF8:
Code: Select all
q.ParamByName(memofield).DataType := ftWideMemo;
q.ParamByName(memofield).Value := bigstring;
q.Execute;
You can also set the UnicodeMemoParameters global variable from the IBC unit to True. In this case values of ftMemo parameters will be also encoded to UTF8:
Code: Select all
q.ParamByName(memofield).AsMemo := bigstring;
q.Execute;
And how to clear a parameter to NULL?
Hello.
This works fine, but on the BDE it was possible to set a parameter to NULL.
Param is TParam - the result of ParamByName().
When I do this with IBDAC, I get an AV when I execute my SQL statement.
What is the suggested way to set a parameter for Blob / Memo to NULL?
Rgds,
Michael
This works fine, but on the BDE it was possible to set a parameter to NULL.
Code: Select all
if Text = '' then begin
Param.Clear;
Param.DataType := ftMemo;
end else
Param.AsMemo := Text;
When I do this with IBDAC, I get an AV when I execute my SQL statement.
What is the suggested way to set a parameter for Blob / Memo to NULL?
Rgds,
Michael
Well, the param is the result of ParamByName() called on an TIBCQuery.
So it is a TIBCParam. It's only passed to my function as TParam like this:
As TIBCParam inherites from TParam this shoud be possible.
So, how is it possible to set a blob parameter to NULL with a TIBCParam without changing the SQL statement?
So it is a TIBCParam. It's only passed to my function as TParam like this:
Code: Select all
procedure SetMemoParam (const Param : TParam; const Text : string);
begin
if Assigned(Param) then begin
if Text = '' then begin
Param.Clear;
Param.DataType := ftMemo;
end else
Param.AsMemo := Text;
end;
end;
So, how is it possible to set a blob parameter to NULL with a TIBCParam without changing the SQL statement?