[patch_done] How to insert TEXT data?

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

[patch_done] How to insert TEXT data?

Post 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
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post 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();
Lazarus 1.0.8 fpc 2.6.0
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

Post by hstijnen »

Thanks, that works.

In CBuilder6 / ZEOS6 parameters in ZSQLProcessor did work!
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

Post 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...
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

??? Can see my chages on SourceForge.Net!

1176? we are on 1171.

Can you delete your folder and reload all the stuff?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

Post by hstijnen »

It works!

Now I used zeoslib/branches/testing (indeed rev 1171)
Is that equally safe as /trunk? Can I use it anyway?
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
hstijnen
Junior Boarder
Junior Boarder
Posts: 32
Joined: 11.04.2012, 08:49

Post by hstijnen »

Thanks for all work. I will stay using rev 1171 and reporting bugs.

Regards,
Henk
Locked