Bug in tzconnection.executedirect

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Bug in tzconnection.executedirect

Post by wahono »

Hi All,

I use FreePascal with IDE MSEgui. I wrote this syntax to create table in MySQL 4.1 :

TZConnection1.executedirect('CREATE TABLE rentproduct (code varchar(50) NOT NULL default '', name varchar(100) default '', description varchar(100) default '', imageid longblob, PRIMARY KEY (code))');

the result table rentproduct is created but column 'name' and 'description' not created. I doubt that 'name' can't be used to be field name (but in MySQL Administrator is OK) than I change 'name' to 'name1'

TZConnection1.executedirect('CREATE TABLE rentproduct (code varchar(50) NOT NULL default '', name1 varchar(100) default '', description varchar(100) default '', imageid longblob, PRIMARY KEY (code))');

But with this way the result is 'name1 varchar(100) default ' is to be default value for field 'code'.

Is this way result same error with other compiler (Delphi, etc).

regards
wahono
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Post by wahono »

Hi Mdaems, I try with same SQL syntax in Delphi, and result error too. This bug is causes by parsing SQL syntax. If found '' (double quote), Zeoslib translate to ' (single quote).

Original syntax :
'CREATE TABLE rentproduct (code varchar(50) NOT NULL default '', name1 varchar(100) default '', description varchar(100) default '', imageid longblob, PRIMARY KEY (code))')'

is parsed to :

'CREATE TABLE rentproduct (code varchar(50) NOT NULL default ', name1 varchar(100) default ', description varchar(100) default ', imageid longblob, PRIMARY KEY (code))')'

And surely result in database is : just 'code', 'imageid' fields is created and 'name1' and 'description' field isn't created.

wahono
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Post by wahono »

When I posted, than I remember that I make wrong with write SQL syntax. Sorry. I should write default '' with '' for every '.

The right syntax is :

TZConnection1.executedirect('CREATE TABLE rentproduct (code varchar(50) NOT NULL default '''', name1 varchar(100) default '''', description varchar(100) default '', imageid longblob, PRIMARY KEY (code))');

Stupid me.

wahono
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

So this whole thread can be ignored? No ExecuteDirect bug?
Image
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Post by wahono »

Yes, I don't see carefully. sorry.
Post Reply