Creating a dialect 1 database with TIBCScript
Creating a dialect 1 database with TIBCScript
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.
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.
As I said in my original message, I did add SET SQL DIALECT to the script.Plash wrote:You can set the SQLDialect property of TIBCConnection or add
SET SQL DIALECT 1;
before the CREATE DATABASE statement.
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'
Yet, it creates a Dialect 3 database!
Are you serious with this answer? Don't you think I've double checked?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.
Here's what's executed:
After connecting, it's your component set that returns "dialect 3" as the database dialect and my application returns a warning for that.SET SQL DIALECT 1;
create database 'IDUNA-VM/ib2009:c:\temp\dia13.ibn' user 'SYSDBA' password 'masterkey' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE
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;