[fpc-pascal] Re: Embedded firebird test program was: Firebird stored procedure exceptions generate access violation
Jim
hakkie42 at gmail.com
Wed Jun 16 15:57:41 CEST 2010
> Sorry all:
>
> Solved: PEBKAC/PICNIC problem as usual.
>
> I assigned a variable that hadn't been initialised as a stringlist to
> the connection's Params property.
>
> On with the next problem...
>
> thanks,
> jb
>
Progress & help requested from the experts.
32 bit works, 64 bit doesn't:
32 bit:
The custom Firebird exception stuff as well as embedded Firebird works
well on my version of fpc 2.4.1 32 bit on Windows:
...snip output...
*** Insert number 5 again. This shold fail because of the unique index.
*** We should get a generic database error.
Debug: 16-6-2010 15:38:50: SaveNumber: going to add parameters for
insert query
Debug: 16-6-2010 15:38:50: Database error running insert query. Database
error message: : Execute :
-violation of PRIMARY or UNIQUE KEY constraint "NUMBERUNIQUE" on table
"NUMBERS
"; Database error code: 335544665
...snip output...
*** Now test our custom Firebird exception by trying to insert 13:
Debug: 16-6-2010 15:12:21: SaveNumber: going to add parameters for
insert query
Debug: 16-6-2010 15:12:21: Database error running insert query. Database
error message: : Execute :
-exception 1
-EXCNOT13
-No, not 13, I can't handle that!
-At trigger 'TRIGCHECK13' line: 7, col: 28; Database error code: 335544517
Debug: 16-6-2010 15:12:21: Parameters were:
BINGONUMBER: *13*
Debug: 16-6-2010 15:12:21: Rolling back transaction.
...snip output...
Uploaded this to bitbucket as fbembedtest16June_15.10.zip
http://bitbucket.org/jb/flocate/issue/5/cant-get-embedded-firebird-to-work
64 bit:
1. The code seems to hang somewhere. Do I have to fiddle with integers
or longints or whatever they're called?
2. The database error handling that was working in 32 bit is erroneous
here (control-c hit - see output below - instead of Database error
running insert query. )
Seems like the database layer isn't passing on error messages but
something is just dumping a generic error. (My exception handling code
distinguishes between database and other errors).
Compiled using 64 bit fpc:
Free Pascal Compiler version 2.4.1 [2010/06/06] for x86_64
Recompiled all .pp files.
Now the program seems to hang in the middle of adding parameters or when
executing the query, possibly somewhere in
FInsertQuery.Params.ParamByName('BINGONUMBER').AsInteger := BingoNumber;
try
FInsertQuery.ExecSQL;
Output:
Debug: 16-6-2010 15:32:49: Starting database setup:
Debug: 16-6-2010 15:32:49: SetUp: Connecting to database:
Debug: 16-6-2010 15:32:49: DB/Setup/Going to start transaction.
Debug: 16-6-2010 15:32:49: Getting query
===============================================================
fbembedtest: information.
Test program for firebird 2.1 embedded database and custom stored
procedures.
Please see
fbembedtest_readme.TXT
for details on setting up database etc.
Freeware but no warranties, express or implied.
For full copyright and license, please see the source code.
===============================================================
Debug: 16-6-2010 15:32:49: Application started.
*** First, clear any existing numbers out of database:
Debug: 16-6-2010 15:32:49: ClearData: going to run query DELETE FROM
NUMBERS;
*** Insert number 5. This should work:
Debug: 16-6-2010 15:32:49: SaveNumber: going to add parameters for
insert query
Debug: 16-6-2010 15:32:49: SaveNumber: insert query code done.
*** Insert number 5 again. This should fail because of the unique index.
*** We should get a generic database error.
Debug: 16-6-2010 15:32:49: SaveNumber: going to add parameters for
insert query
Debug: 16-6-2010 15:32:49: Error running insert query. Technical
details: Control-C hit
Debug: 16-6-2010 15:32:49: Parameters were:
BINGONUMBER: *5*
Debug: 16-6-2010 15:32:49: SaveNumber: insert query code done.
*** Now test our custom Firebird exception by trying to insert 13:
Debug: 16-6-2010 15:32:49: SaveNumber: going to add parameters for
insert query
Uploaded to bitbucket as well.
More information about the fpc-pascal
mailing list