Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-03

SQLdb_Tutorial3 error

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Santiago A.

Hello:

I'm trying to "SQLdb_Tutorial3" example with sqlite3 connector. When the program executes Fquery.open it raises a SIGSEGV exception.

sqlite3.dll is in the same directory that the binary. I have created the table employee, just in case. I don't know what else to check.  I can't debug anything else, the debug can't enter in "open" method.

Any hint?

Windows 7 32 bits, Lazarus 1.8.0 SVN: 56594, fpc 3.0.4

Saludos Santiago A.

Reply by email

Santiago A.
to leledumbo
leledumbo wrote
> Any hint? Code please. Zipped project directory (use Publish Project feature) is OK if single file example is not possible.

I will zip it, but sure you have it. The code is one of the examples installed with the standard lazarus 1.8.0

In windows: <lazarusdir>\examples\database\sqldbtutorial3\

Error in mainform.pas line 221, using sqlite connector

Saludos Santiago A. -------------- next part -------------- A non-text attachment was scrubbed... Name: sqdbltutorial3.zip Type: application/x-zip-compressed Size: 8953 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180309/a3160246/attachment-0001.bin>

Reply by email

Santiago A.
to Santiago A.
Santiago A. wrote 10 lines
El 08/03/2018 a las 20:42, leledumbo via Lazarus escribió: >> Any hint? > Code please. Zipped project directory (use Publish Project feature) is OK if > single file example is not possible. I will zip it, but sure you have it. The code is one of the examples installed with the standard lazarus 1.8.0 In windows: <lazarusdir>\examples\database\sqldbtutorial3\ Error in mainform.pas line 221, using sqlite connector

Any suggestion of what could be wrong? Where to look? Any hint?

Saludos Santiago A.

Reply by email

Rik van Kekem
to Santiago A.: Hello: I'm trying to "SQLdb_Tutorial3" example with sqlite3 connector. When the program…

Op 08-03-2018 16:07 schreef Santiago A. via Lazarus:

sqlite3.dll is in the same directory that the binary. I have created the table employee, just in case. I don't know what else to check.  I can't debug anything else, the debug can't enter in "open" method.

Creating the database and table employee wasn't "just in case". It was a requirement if you want to use that example with sqlite. http://wiki.lazarus.freepascal.org/SQLdb_Tutorial3#Getting_database_data_into_normal_controls

And surely you changed something (like the .ini) otherwise you end up with Firebird db connection.

So zipping your project (with the database) is still best.

Tip: You are sure sqlite3.dll has the same 'bitness' (i.e. 32 of 64 bit) as your executable?

Rik

Reply by email

Santiago A.
to Rik van Kekem
Rik van Kekem wrote 7 lines
Op 08-03-2018 16:07 schreef Santiago A. via Lazarus: > sqlite3.dll is in the same directory that the binary. I have created the > table employee, just in case. I don't know what else to check.  I can't > debug anything else, the debug can't enter in "open" method. Creating the database and table employee wasn't "just in case". It was a requirement if you want to use that example with sqlite.

I mean "Just in case" not to get the TStringGrid properly filled, but to get an exception like "Table not found", not a "SIGSEGV exception"

That is the piece of code that raises the error, in the line "Fquery.open"

And surely you changed something (like the .ini) otherwise you end up with Firebird db connection.

No, the default is still firebird, and it woks fine. Well, it doesn't work because employee doesn't exits, and I get an "Database not found exception"
I select on propose sqlite3. and I get SIGSEGV  with no more clue in the Fquery.open

Show quoted text 5 lines
So zipping your project (with the database) is still best. Tip: You are sure sqlite3.dll has the same 'bitness' (i.e. 32 of 64 bit) as your executable?

Well, it is the dll I use for some old delphi 32bits utilities.

My point is if I'm missing some package, or the dll should be in other path, or a hint how to dig and debug deeper, beacuse I can't debug into open.

Saludos Santiago A. -------------- next part -------------- A non-text attachment was scrubbed... Name: publishedproject.zip Type: application/x-zip-compressed Size: 8953 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180313/bdea00f0/attachment-0001.bin>

Reply by email

Rik van Kekem
to Santiago A.

Op 13-03-2018 10:43 schreef Santiago A. via Lazarus:

My point is if I'm missing some package, or the dll should be in other path, or a hint how to dig and debug deeper, beacuse I can't debug into open.

No, the SQLite3.dll and your DB should be sufficient.

Could you include your .ini file and your SQLite db?

Normally the firebird employee database is in
C:\Program Files\Firebird\Firebird_2_5\examples\empbuild\EMPLOYEE.FDB (which you can copy to another location so you can access it)

But for SQLite you'll need to create your own DB with the correct table and content.

Rik

Reply by email

Santiago A.
to Rik van Kekem
Rik van Kekem wrote 16 lines
Op 13-03-2018 10:43 schreef Santiago A. via Lazarus: > My point is if I'm missing some package, or the dll should be in other > path, or a hint how to dig and debug deeper, beacuse I can't debug into > open. No, the SQLite3.dll and your DB should be sufficient. Could you include your .ini file and your SQLite db? Normally the firebird employee database is in C:\Program Files\Firebird\Firebird_2_5\examples\empbuild\EMPLOYEE.FDB (which you can copy to another location so you can access it) But for SQLite you'll need to create your own DB with the correct table and content. Rik

Thanks. Finally it works. I created the table employee and set the full path of the file.

Nevertheless, it looks that sqlite3 is a little... well... sending SIGSEGV is not a valid error, "cant' find file", "table doesn't exits" etc would be much better.

I would like to dig a little and try to improve error detection. Is there any way I can debug into open?. I've tried compiling Lazarus IDE with debug, but skips over "open" call. What should I compile in debug mode to parse FQuery.open?

Saludos Santiago A.

Reply by email

Rik van Kekem
to Santiago A.

Op 13-03-2018 12:22 schreef Santiago A. via Lazarus:

Show quoted text 11 lines
Thanks. Finally it works. I created the table employee and set the full path of the file. Nevertheless, it looks that sqlite3 is a little... well... sending SIGSEGV is not a valid error, "cant' find file", "table doesn't exits" etc would be much better. I would like to dig a little and try to improve error detection. Is there any way I can debug into open?. I've tried compiling Lazarus IDE with debug, but skips over "open" call. What should I compile in debug mode to parse FQuery.open?

I take it you already activated the debugging options (which were disabled in your published project). Otherwise you wouldn't even be able to trace to the Open line.

Next problem is that the database sources are not part of the Lazarus IDE. They are from FPC. So you would need to recompile the complete FPC to be able to step through it. (Recompiling Lazarus IDE only compiles the IDE part with debugging information)

I use the trunk version from my own script but you could use fpcupdeluxe to install a development version, in which you could trace through the whole source. http://wiki.freepascal.org/fpcupdeluxe

Here, I get the correct and expected warnings/errors when using the SQLite3 driver (in both Lazarus 1.9 and 1.8.2). SQLite will automatically create an empty database if it does not exist. After that it should warn about the absence of the employee table.

Rik

Reply by email