Creating a dialect 1 database with TIBCScript

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Creating a dialect 1 database with TIBCScript

Post by upscene » Thu 26 Nov 2009 14:49

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.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 27 Nov 2009 08:18

You can set the SQLDialect property of TIBCConnection or add

SET SQL DIALECT 1;

before the CREATE DATABASE statement.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Fri 27 Nov 2009 08:29

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!

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 30 Nov 2009 08:52

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.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Mon 30 Nov 2009 09:17

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.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Mon 07 Dec 2009 10:47

Any news on this? Can you reproduce it?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 08 Dec 2009 08:46

We have fixed this problem. The fix will be included in the next build of IBDAC.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Tue 08 Dec 2009 08:51

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 ;)

Post Reply