Page 1 of 1
Creating a dialect 1 database with TIBCScript
Posted: Thu 26 Nov 2009 14:49
by upscene
Hi,
I'm using TIBCScript to create a database, but how do I set the database dialect?
I've tried adding a SET SQL DIALECT statement, but that doesn't work.
Posted: Fri 27 Nov 2009 08:18
by Plash
You can set the SQLDialect property of TIBCConnection or add
SET SQL DIALECT 1;
before the CREATE DATABASE statement.
Posted: Fri 27 Nov 2009 08:29
by upscene
Plash wrote:You can set the SQLDialect property of TIBCConnection or add
SET SQL DIALECT 1;
before the CREATE DATABASE statement.
As I said in my original message, I did add SET SQL DIALECT to the script.
Here's what SQL.Text has, before calling Execute:
Code: Select all
'SET SQL DIALECT 1;'
'create database 'IDUNA-VM/ib2009:c:\temp\dia1.ib' user 'SYSDBA' password 'masterkey' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE'
The "1" comes from the IntToStr(Connection.SQLDialect) and the Connection component is attached to the script component, so that's also set to "1". NoPreConnect = True.
Yet, it creates a Dialect 3 database!
Posted: Mon 30 Nov 2009 08:52
by Plash
Maybe you get the SQL dialect of new database incorrectly.
Connect to the new database at design-time using TIBCConnection, go to the Info page of the connection editor, and see SQL dialect of the database.
Posted: Mon 30 Nov 2009 09:17
by upscene
Plash wrote:Maybe you get the SQL dialect of new database incorrectly.
Connect to the new database at design-time using TIBCConnection, go to the Info page of the connection editor, and see SQL dialect of the database.
Are you serious with this answer? Don't you think I've double checked?
Here's what's executed:
SET SQL DIALECT 1;
create database 'IDUNA-VM/ib2009:c:\temp\dia13.ibn' user 'SYSDBA' password 'masterkey' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE
After connecting, it's your component set that returns "dialect 3" as the database dialect and my application returns a warning for that.
My previous component set returns "dialect 3" as the database dialect.
For existing databases, your component set returns "dialect 1" for, obviously, dialect 1 databases and "dialect 3" for dialect 3 databases, so that works just fine.
Here's the code, perhaps you can spot what's wrong:
Code: Select all
sqlcreate := TIBCScript.Create(nil);
try
// Dialect is taken from the connection
sqlcreate.NoPreconnect := True;
sqlcreate.SQL.Add('SET SQL DIALECT ' + IntToStr(FNativeConnection.SQLDialect) + ';');
sqlcreate.Connection := FNativeConnection;
sqlcreate.SQL.Add(Params.Text);
showmessage(sqlcreate.SQL.Text);
sqlcreate.Execute;
finally
sqlcreate.Free;
end;
The SQL you saw above is what is shown by ShowMessage.
Posted: Mon 07 Dec 2009 10:47
by upscene
Any news on this? Can you reproduce it?
Posted: Tue 08 Dec 2009 08:46
by Plash
We have fixed this problem. The fix will be included in the next build of IBDAC.
Posted: Tue 08 Dec 2009 08:51
by upscene
Plash wrote:We have fixed this problem. The fix will be included in the next build of IBDAC.
Ok, thanks, good to know it wasn't me
