Page 1 of 1

support of Boolean value for TMyLoader?

Posted: Fri 10 Sep 2010 04:00
by easyblue
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.

Posted: Fri 10 Sep 2010 12:12
by AndreyZ
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.

Posted: Sun 12 Sep 2010 04:00
by easyblue
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

Posted: Mon 13 Sep 2010 10:35
by Dimon
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.

Posted: Mon 13 Sep 2010 13:26
by easyblue
current I use

Code: Select all

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

I just wonder where is the problem.

Posted: Mon 13 Sep 2010 14:31
by Dimon
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.