Error with temporary table
Posted: Thu 13 Dec 2012 17:16
---SPANISH---
Hola,
He cambiado de la version 5 a la version 6 con Delphi XE3 y tengo problemas con la conexión a la BD.
El problema consiste en que el nuevo driver me da un "connection_id" diferente para cada query.
Esto me provoca que todas las tablas temporales que uso con MySQL dejen de funcionar.
Esto no pasaba con el driver anterior.
---ENGLISH---
Hi,
I changed from version 5 to version 6 with Delphi XE3 and I have trouble connecting to the database.
The problem is that the new driver gives me a "connection_id" different for each query.
This causes malfunction in the temporary tables.
This problem was not produced with the previous driver.
Example:
// MysqlServer 5.5.15 Windows Server 2008 64 bits
SQLConnection.DriverName := 'DevartMySQLDirect';
SQLConnection.LibraryName := 'dbexpmda40.dll';
SQLConnection.VendorLib := 'not used';
SQLConnection.GetDriverFunc := 'getSQLDriverMySQLDirect';
SQLConnection.Params.Clear;
SQLConnection.Params.Add('User_Name=root');
SQLConnection.Params.Add('Password=mypass');
SQLConnection.Params.Add('HostName=localhost');
SQLConnection.Params.Add('Database=mysql');
SQLConnection.Open;
query.Close;
query.SQL.Text := ' select connection_id() as id';
query.Open;
showmessage('Conection 1 --> ' + query.FieldByName('id').AsString);
query.Close;
query.SQL.Text := ' select connection_id() as id';
query.Open;
showmessage('Conection 2 --> ' + query.FieldByName('id').AsString);
query.Close;
query.SQL.Text := ' CREATE TEMPORARY TABLE tmp (field1 int not null default 0)';
query.ExecSQL;
query.Close;
query.SQL.Text := ' Select * from tmp';
query.Open; // Error, tmp table doesn't exist
Hola,
He cambiado de la version 5 a la version 6 con Delphi XE3 y tengo problemas con la conexión a la BD.
El problema consiste en que el nuevo driver me da un "connection_id" diferente para cada query.
Esto me provoca que todas las tablas temporales que uso con MySQL dejen de funcionar.
Esto no pasaba con el driver anterior.
---ENGLISH---
Hi,
I changed from version 5 to version 6 with Delphi XE3 and I have trouble connecting to the database.
The problem is that the new driver gives me a "connection_id" different for each query.
This causes malfunction in the temporary tables.
This problem was not produced with the previous driver.
Example:
// MysqlServer 5.5.15 Windows Server 2008 64 bits
SQLConnection.DriverName := 'DevartMySQLDirect';
SQLConnection.LibraryName := 'dbexpmda40.dll';
SQLConnection.VendorLib := 'not used';
SQLConnection.GetDriverFunc := 'getSQLDriverMySQLDirect';
SQLConnection.Params.Clear;
SQLConnection.Params.Add('User_Name=root');
SQLConnection.Params.Add('Password=mypass');
SQLConnection.Params.Add('HostName=localhost');
SQLConnection.Params.Add('Database=mysql');
SQLConnection.Open;
query.Close;
query.SQL.Text := ' select connection_id() as id';
query.Open;
showmessage('Conection 1 --> ' + query.FieldByName('id').AsString);
query.Close;
query.SQL.Text := ' select connection_id() as id';
query.Open;
showmessage('Conection 2 --> ' + query.FieldByName('id').AsString);
query.Close;
query.SQL.Text := ' CREATE TEMPORARY TABLE tmp (field1 int not null default 0)';
query.ExecSQL;
query.Close;
query.SQL.Text := ' Select * from tmp';
query.Open; // Error, tmp table doesn't exist