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
Bug in tzconnection.executedirect
Moderators: gto, cipto_kh, EgonHugeist
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
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
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
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