Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
On 06/11/2014 14:09, Maurizio Tomasi wrote: I was not able to find the documentation for TSQLite in the Free Pascal manuals. Am I missing something, or is it this the way the class is intended to be used? FYI: http://wiki.lazarus.freepascal.org/SQLite covers dataset-based sqlite support. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
On Fri Nov 7 09:58, Reinier Olislagers wrote: FYI: http://wiki.lazarus.freepascal.org/SQLite covers dataset-based sqlite support. Hi Reiner, Thanks for the link, I hadn't found that page (I only Googled for free pascal TSQLite). However, I am even more puzzled than before! First, from that page, now I learn that there are *four* ways to connect to a SQLite3 database: 1. Using the sqlite3 unit, which is a low-level set of bindings to the C library; 2. Using the TSQLite class, for which I have not been able to find documentation yet (and whose Query method forces me to parse its comma-separated results); 3. Using the TSQLite3Dataset, which however seems to be restricted to Lazarus (at least, this is what I deduce from the tutorial: http://sqlite4fpc.yolasite.com/dataset-tutorial-1.php). 4. Using TSQLite3Connection, which is part of the SQLDB framework. This too seems to require Lazarus. The point is that Lazarus is a no-option for me: all the programs I have developed in the last months are designed to be run on superclusters (using my own hand-made bindings to MPI). My workflow is: connect to the cluster front-end using SSH+GNU Screen, edit using Vi, compile, submit the job. I find hard to use Lazarus in such a context. I am thinking of stopping using TSQLite and switching to the low-level sqlite3 unit: at least, there is plenty of documentation around for the SQLite3 C API. Thanks a lot, Maurizio. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
On 07/11/2014 11:16, Maurizio Tomasi wrote: 3. Using the TSQLite3Dataset, which however seems to be restricted to Lazarus (at least, this is what I deduce from the tutorial: http://sqlite4fpc.yolasite.com/dataset-tutorial-1.php). I suppose it doesn't. The tutorial just uses Lazarus. However, I have no experience with TSQLite3Dataset. 4. Using TSQLite3Connection, which is part of the SQLDB framework. This too seems to require Lazarus. No it doesn't - what makes you think that? (So I can if needed update the relevant wiki page/sentence) You can e.g. adapt the minimal FPC demo code from here: http://wiki.lazarus.freepascal.org/Database_bug_reporting#FreePascal The advantage of this approach is that switching to another db engine such as PostgreSQL or Firebird is fairly simple (you'd still need to rewrite db dependent SQL of course). I am thinking of stopping using TSQLite and switching to the low-level sqlite3 unit: at least, there is plenty of documentation around for the SQLite3 C API. Could be an option. The sqldb code is documented as well in the FPC docs. Reinier (not Reiner ;) ) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
On 11/07/2014 11:16 AM, Maurizio Tomasi wrote: On Fri Nov 7 09:58, Reinier Olislagers wrote: FYI: http://wiki.lazarus.freepascal.org/SQLite covers dataset-based sqlite support. The point is that Lazarus is a no-option for me: all the programs I have developed in the last months are designed to be run on superclusters (using my own hand-made bindings to MPI). My workflow is: connect to the cluster front-end using SSH+GNU Screen, edit using Vi, compile, submit the job. I find hard to use Lazarus in such a context. Well, even in that case using Lazarus is possible. But what I do when I only have console-access is using the 'old-style'-Freepascal IDE. (fp) That's somewhat easier then vi when you are working on Pascal-files. But you don't need Lazarus for SQLDB or the TSQLite3Dataset. The tutorials are mainly for new users who most often do use Lazarus, though. In your case I would use the TSQLite3Dataset. SQLDB is overkill for most Sqlite-usage. And you can have a look at the fpc-sources for an example. You can find a nice example in packages/fcl-db/src/sqlite/testds.pas. (http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/sqlite/testds.pas?view=markup) Joost ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
Hi Joost and Reinier (sorry for the typo), Well, even in that case using Lazarus is possible. But what I do when I only have console-access is using the 'old-style'-Freepascal IDE. (fp) That's somewhat easier then vi when you are working on Pascal-files. Sure, I didn't say it is impossible, only that it is not the best option in my case. I tried to use the FPIDE (I have used Turbo Pascal for years, from 3.0 through 7.0, and the FPIDE environment is thus very familiar to me), but I find Vim more productive, despite the fact that its Delphi mode is quite limited. In your case I would use the TSQLite3Dataset. SQLDB is overkill for most Sqlite-usage. And you can have a look at the fpc-sources for an example. You can find a nice example in packages/fcl-db/src/sqlite/testds.pas. (http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/sqlite/testds.pas?view=markup) I think I'll follow your advice. And thanks for the link, it seems exactly what I need! At this point I wonder what is the intended usage of the sqlite3db unit: is anybody using it, apart from me? No it doesn't - what makes you think that? (So I can if needed update the relevant wiki page/sentence) Sorry, I just *assumed* that. In the wiki page you linked (http://wiki.freepascal.org/SQLite) the example program under section Using the SQLdb components with SQLite / Creating a database and noticed that it used a variable SQLite3Connection1 and a variable SQLTransaction1 with no apparent connection between them (judging from the code fragment), so I assumed that such connection between the two objects was meant to be done using the Lazarus GUI. But reading carefully, I found the sentence TSQLite3Connection can be found in the sqlite3conn unit, if you want to declare it yourself or are working in FreePascal, which settles the matter. You can e.g. adapt the minimal FPC demo code from here: http://wiki.lazarus.freepascal.org/Database_bug_reporting#FreePascal The advantage of this approach is that switching to another db engine such as PostgreSQL or Firebird is fairly simple (you'd still need to rewrite db dependent SQL of course). Thanks a lot for the link, but I think I'll follow Joost' advice and use TSQLite3Dataset: I do not foresee to use any other database than SQLite3 for the kind of app I'm developing. Maurizio. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
On 07.11.2014 11:16, Maurizio Tomasi wrote: The point is that Lazarus is a no-option for me: all the programs I have developed in the last months are designed to be run on superclusters (using my own hand-made bindings to MPI). My workflow is: connect to the cluster front-end using SSH+GNU Screen, edit using Vi, compile, submit the job. I find hard to use Lazarus in such a context. Out of curiosity: couldn't you use SSHFS to mount the remote location as a filesystem? (I've never done it myself, so I can't comment on how useable that would be) Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Use of TSQLite.Query method (sqlite3db unit)
Hi to everybody, I am developing a small application that retrieves data from a SQLite3 file. Currently I am using the TSQLite class found in the unit sqlite3db. The Query method fills one of its arguments (Table) with the result of the query. Each string in the Table variable is a comma-separated string containing the values of each column. I find this a bit inconvenient, as I have to parse the string in order to get back the values of the columns. (The C/C++ SQLite3 library allows to retrieve the value of each column separatedly, using the sqlite3_column_*** functions.) I was not able to find the documentation for TSQLite in the Free Pascal manuals. Am I missing something, or is it this the way the class is intended to be used? Cheers, Maurizio. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal