Subject | Firebird 1.0 - Error creating multiple tables |
---|---|
Author | Tom Hahn |
Post date | 2002-08-10T06:00:04Z |
I am new to Firebird and am attempting to create a database and several
tables using SQL from within the program (Delphi 6). On the data module, I
have TIBDatabase, a TIBTransaction, and a TIBSQL. An excerpt of the code is:
const
MyTimeStrg =
'USER "SYSDBA" ' +
'PASSWORD "masterkey" ' +
'PAGE_SIZE 4096 ';
ClientTableCreateStrg =
'CREATE TABLE CLIENTS ' +
'(CLICODE CHAR(3) NOT NULL,' +
'CLINAME VARCHAR(25) NOT NULL,' +
'ADDRESS VARCHAR(25),' +
'ADDRESS1 VARCHAR(25),' +
'CITY VARCHAR(20),' +
'ST CHAR(2),' +
'ZIPCODE CHAR(10),' +
'CONTACT VARCHAR(20),' +
'PHONE CHAR(10),' +
'EMAIL VARCHAR(20), ' +
'PRIMARY KEY (CLICODE));';
ProjectTableCreateStrg =
'CREATE TABLE PROJECT ' +
'(PRJCODE CHAR(3) NOT NULL,' +
'CLICODE CHAR(3) NOT NULL,' +
'PRJNAME VARCHAR(50) NOT NULL,' +
'PRJDESC VARCHAR(250),' +
'PRJSTATUS CHAR(1),' +
'PRJSTART DATE,' +
'PRJSTOP DATE,' +
'PRJRATE DECIMAL(4,3),' +
'PRIMARY KEY (PRJCODE));';
DM.IBDatabase1.Params.Add(MyTimeStrg);
DM.IBDatabase1.CreateDatabase;
DM.IBSQL1.SQL.Clear;
DM.IBSQL1.SQL.Add(ClientTableCreateStrg);
DM.IBTransaction1.Active := true;
DM.IBSQL1.ExecQuery;
DM.IBSQL1.SQL.Clear;
DM.IBSQL1.SQL.Add(ProjectTableCreateStrg);
DM.IBTransaction1.Active := true;
DM.IBSQL1.ExecQuery;
The database and the first table are created properly. When the code for
creating the second table is executed, I get an error:
Dynamic SQL Error
SQL Error Code = -817
Unknown ISC Error 335544793
(While I can find information on error "-817", the ISC error code is
different than that shown.)
Closing the program and creating the second table alone works fine so
creating two tables one after the other is causing the problem. Subsequent
tables have the same error and workaround. Am I misusing IBTransaction?
Tom
tables using SQL from within the program (Delphi 6). On the data module, I
have TIBDatabase, a TIBTransaction, and a TIBSQL. An excerpt of the code is:
const
MyTimeStrg =
'USER "SYSDBA" ' +
'PASSWORD "masterkey" ' +
'PAGE_SIZE 4096 ';
ClientTableCreateStrg =
'CREATE TABLE CLIENTS ' +
'(CLICODE CHAR(3) NOT NULL,' +
'CLINAME VARCHAR(25) NOT NULL,' +
'ADDRESS VARCHAR(25),' +
'ADDRESS1 VARCHAR(25),' +
'CITY VARCHAR(20),' +
'ST CHAR(2),' +
'ZIPCODE CHAR(10),' +
'CONTACT VARCHAR(20),' +
'PHONE CHAR(10),' +
'EMAIL VARCHAR(20), ' +
'PRIMARY KEY (CLICODE));';
ProjectTableCreateStrg =
'CREATE TABLE PROJECT ' +
'(PRJCODE CHAR(3) NOT NULL,' +
'CLICODE CHAR(3) NOT NULL,' +
'PRJNAME VARCHAR(50) NOT NULL,' +
'PRJDESC VARCHAR(250),' +
'PRJSTATUS CHAR(1),' +
'PRJSTART DATE,' +
'PRJSTOP DATE,' +
'PRJRATE DECIMAL(4,3),' +
'PRIMARY KEY (PRJCODE));';
DM.IBDatabase1.Params.Add(MyTimeStrg);
DM.IBDatabase1.CreateDatabase;
DM.IBSQL1.SQL.Clear;
DM.IBSQL1.SQL.Add(ClientTableCreateStrg);
DM.IBTransaction1.Active := true;
DM.IBSQL1.ExecQuery;
DM.IBSQL1.SQL.Clear;
DM.IBSQL1.SQL.Add(ProjectTableCreateStrg);
DM.IBTransaction1.Active := true;
DM.IBSQL1.ExecQuery;
The database and the first table are created properly. When the code for
creating the second table is executed, I get an error:
Dynamic SQL Error
SQL Error Code = -817
Unknown ISC Error 335544793
(While I can find information on error "-817", the ISC error code is
different than that shown.)
Closing the program and creating the second table alone works fine so
creating two tables one after the other is causing the problem. Subsequent
tables have the same error and workaround. Am I misusing IBTransaction?
Tom