On Wed, 30 Oct 2013, Graeme Geldenhuys wrote:
Hi,
I created a very simple little application that takes 2 parameters, then
creates a empty FDB (firebird) database, then runs 4
script files to populate the database with default tables and data.
This little console application works perfectly under Linux and FreeBSD, but
fails under Windows. Currently testing with
Win2000 (32-bit).
Here is the code that causes the AV.
-----------------------
procedure TMyApplication.CreateEmptyDatabase;
var
LHost: string;
LDBName: string;
n: integer;
begin
n := Pos(':', FDBLocation);
LHost := Copy(FDBLocation, 1, n-1);
LDBName := Copy(FDBLocation, n+1, Length(FDBLocation)-n);
conn := TIBConnection.Create(self);
conn.Dialect := 3;
conn.HostName := LHost;
conn.DatabaseName := LDBName;
conn.UserName := 'sysdba';
conn.Password := 'masterkey';
writeln('Creating database... ', conn.HostName + ':' + conn.DatabaseName);
conn.CreateDB;
conn.Connected := True; // <<------- This causes the AV under Windows
end;
-----------------------
Here is the console output of when I run the program.
-----------------------
c:\programming\m2_system\Scripts>makedb -d
'127.0.0.1:c:\programming\data\m2_dl_3019.fdb'
Creating database... '127.0.0.1:c:\programming\data\m2_dl_3019.fdb'
exception at 00431BD8:
: CreateDB :
-I/O error during "open" operation for file ""
-database or file exists.
-----------------------
That is an interbase error. It clearly states what the problem is :)
However, it is strange that the CreateDB() does not catch this error.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal