Page 1 of 1

[patch_done] How to insert TEXT data?

Posted: 16.04.2012, 11:04
by hstijnen
Hi,
I've a problem with inserting text data (MySQL; ZEOS7; CBuilder XE).
I create a table:
CREATE table test(id int not null, txt TEXT null) Engine=InnoDB;

Next I want to insert data:
ZSQLProcessor1->Script->Text = "insert into test (id, txt) values(:id,:txt)";
ZSQLProcessor1->ParamByName("id")->AsInteger = 2;
ZSQLProcessor1->ParamByName("txt")->AsString = "test2";
ZSQLProcessor1->Execute();

Then I get error:
Project Project1.exe raised exception class EZSQLException with message 'Input parameter count is less then expected'.

What can be wrong? The cause must be in the text var, for when I omit that, all works OK.

Thanks for help
Henk

Posted: 16.04.2012, 12:33
by ism
You can use the ZSQLProcessor1 is not designed working with parameters

ZQuery1->SQL->Text = "insert into test (id, txt) values(:id,:txt)";
ZQuery1->ParamByName("id")->AsInteger = 2;
ZQuery1->ParamByName("txt")->AsString = "test2";
ZQuery1->Execute();

Posted: 16.04.2012, 16:32
by hstijnen
Thanks, that works.

In CBuilder6 / ZEOS6 parameters in ZSQLProcessor did work!

Posted: 16.04.2012, 20:29
by EgonHugeist
hstijnen,

i must admit don't know anything about features of Z6. So it would be a dream to keep the old functionality or not? So can you help here? Can you tell me the differences of Z6 and Z7 in code lines concerning that unsupported feature? Are you able to do that?

Michael

Posted: 17.04.2012, 08:10
by hstijnen
Egon,
I don't know anything about the code. The functionality is there, for it does work for e.g. integer, float, datetime parameters. Only when I use text there is an error.
The assignment succeeds:
ZSQLProcessor1->ParamByName("message")->AsString = rvMsg;
for when I check it:
UnicodeString rvm1=ZSQLProcessor1->ParamByName("message")->AsString;
then rvm1 gives the correct value.
Only ZSQLProcessor1->Execute() causes an error. It seems to me it must have to do with the transgression from AnsiString (Z6) to UnicodeString/WideString (Z7) and the sending of UnicodeString data to the server. That data seems not to arrive, for server says that parameter is missing.

Kind regards,
Henk

Posted: 18.04.2012, 23:54
by EgonHugeist
hstijnen,

you're right. Here was a missing field-type for ftWideString.
Patch done r1168

It would be fine if your confirm this.

Michael

Posted: 19.04.2012, 11:02
by hstijnen
I'm not very skillfull with SVN. When I call Updat SVN in my ZEOS rootmap, I get message "completed at revision 1176", but I don't see anyting transferred or changed...

Posted: 19.04.2012, 11:12
by EgonHugeist
??? Can see my chages on SourceForge.Net!

1176? we are on 1171.

Can you delete your folder and reload all the stuff?

Posted: 19.04.2012, 14:01
by hstijnen
It works!

Now I used zeoslib/branches/testing (indeed rev 1171)
Is that equally safe as /trunk? Can I use it anyway?

Posted: 20.04.2012, 09:27
by EgonHugeist
hstijnen,

you're XE user. So it would be fine if you also try my branch zeoslib/branches/testing-egonhugeist. But it's up to you to decide what you want.

Concerning the trunk. If you report us bugs then the fixes are first available in the testing branches. The Project-manager MDeams merges all fixes to the trunk from time to time IF the last fixes do not make trouble again. Just like your Parameter bug. This i've fixed on both testing branches. The rules of periodes concerning updating the trunk have dependencies on time periodes of the last fixed bugs. The best sign would be -> no fixes done since long times -> update the trunk -> beta! But we must actually admit that the last one isn't so easy because it was MARK and ME who fixed a lot (New Compilers, 64Bit support and so on). We've a hight rate actually over 100 patches since the last 4 mounth. The most are related to my new branch and the new compiler supports.

If you want to be up to data then my advice for you is: use the testing branches and help us to fullfill the beta state. Use TortoiseSVN to stay up to date. And help us to kill the last bugs.

Michael

Posted: 20.04.2012, 10:05
by hstijnen
Thanks for all work. I will stay using rev 1171 and reporting bugs.

Regards,
Henk