support of Boolean value for TMyLoader?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

support of Boolean value for TMyLoader?

Post by easyblue » Fri 10 Sep 2010 04:00

Hello

When I use TMyLoader to put millions of data, I found that TMyLoader may have a problem on supporting boolean value.

the boolean value was put by TMyLoader in such a way

Code: Select all

Sender.PutColumnData(i,RowNr,SrcField.AsBoolean);
and I can catch the SQL for EXECSQL is like

Code: Select all

'Insert..... Values ( ....., TRUE)
It seems that this TRUE is regarded as a field instead of a value, which will result a failure with a error message of

"TRUE is missing from fieldlist"

I guess that a something like "QuoteNames" feature may be needed.

AndreyZ

Post by AndreyZ » Fri 10 Sep 2010 12:12

Hello,

I could not reproduce the problem. Please send me a complete small sample to andreyz*devart*com to demonstrate the problem, including a script to create a table.
Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can see it in the Info sheet of TMyConnection Editor.

easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

Post by easyblue » Sun 12 Sep 2010 04:00

Hello

MyDAC v5.90.0.59
BDS2006
MySQL v4.0

Seems to be linked with boolean value convertion for Oracle ODAC

I read the source from an Oracle dataset, where use an non-zero integer (actually 1 is used) to represent "True" value.
And the destination MySQL table has directly the field as a boolean type.

So when I debug, I can see for

Code: Select all

Sender.PutColumnData(i,RowNr,SrcField.AsBoolean);
the value of SrcField.AsBoolean is shown as "true" in the debug window

but when I catch ExecSQL, such value is changed into

Code: Select all

Insert..... Values ( ....., TRUE)
According to your request, I try to make a test demo using the MyDAC demo project.
I added one field in MyDAC_Loaded as a boolean field, and directly set it

Code: Select all

Sender.PutColumnData(i,RowNr,True);
then I found EXECSQL becomes

Code: Select all

Insert..... Values ( ....., 1)
and result is successful.

I guess that
1. The Oralce source field is an integer as nature, to be cast as boolean, it will become a string of "TRUE" for EXECSQL.
2. The direct boolean True value will become "1" for EXECSQL.

So the problem should be in somewhere in ODAC, or MyDAC or coverting of data type, which should be very deep in your components. Please kindly check it

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 13 Sep 2010 10:35

To solve the problem set the ftBoolean field type for the column appropriate for the boolean field, like this:

Code: Select all

MyLoader.Columns[i].FieldType := ftBoolean;
Or use the AsInteger property instead of AsBoolean to assign data to the Boolean field.

easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

Post by easyblue » Mon 13 Sep 2010 13:26

current I use

Code: Select all

Sender.PutColumnData(i,RowNr,SrcField.AsInteger0);
to convert the boolean code.

I just wonder where is the problem.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 13 Sep 2010 14:31

The problem is that MySQL version 4.0 doesn't support the TRUE lexeme as boolean value. Therefore you should use "1" as true and "0" as false. When you use the AsBoolean property then TRUE and FALSE is used instead of 1 and 0, and it raises an error.

Post Reply