-
Fons Rademakers authored
The attached patches add the following classes: TSQLiteResult TSQLiteRow TSQLiteServer TSQLiteStatement and corresponding integration into both the ROOT-buildsystem and cmake. Naturally, also the macro for the plugin-manager is included. Patches supplied for ROOT 5.34.08 and current master (as SQL-part is rarely changing, this statement should stay valid at least for some months). Some usage notes: * The handed path is evaluated as URI by sqlite3, which means it can be a relative or absolute path and can even contain additional settings as "URI" parameters, which are described in the SQLite-documentation. * Functions "{Create,Select,Drop} DataBase(s)", "Reload", "Shutdown" are not implemented as SQLite operates on one DB per file only. The implemented stub methods return appropriate error results. * "TSQLiteServer::GetColumns()" is not implemented (i.e. returns error and value 0): This is sadly not possible via a query in SQLite by their API design. This also means the TableInfo-objects cannot be queried. * The result-row-count of a TSQLiteResult is always -1, as SQLite does not know the number of result rows before all have been retrieved (a valid optimization for a file-only DBMS). For the person reviewing this patch, please note that the indices of bind_parameters in SQLite start from 1, while those for the result-columns start from 0. As this is a rather large featureset to cover and the software of our experiment currently only uses a small subset of it (only 'reading' statements, and no prepared statements), I also wrote a very simple testing-tool which creates a new database with a table with 10 columns of very different type, inserts some example data, and rereads that data both using a simple Query() and using a prepared Statement(). This tool and a very short makefile to build it are also attached if needed for the review-process. The tool uses the commands described in the documentation of the abstract baseclass TSQLStatement to simulate real-life behaviour. Please note that tool is rather hacked-together without real error-handling, as it is not meant for long-term usage, but might be helpful in the review-process / adapted to a unit-test. Apart from the mentioned specifics, nothing is really SQLite-only, thus I did not change the documentation of the baseclass in the patch (this documentation also lists all SQL-implementations). At least this list in the documentation might be extended to make users aware of the new implementation. SQlite plugin provided by Oliver Freyermuth (o.f@cern.ch).
Fons Rademakers authoredThe attached patches add the following classes: TSQLiteResult TSQLiteRow TSQLiteServer TSQLiteStatement and corresponding integration into both the ROOT-buildsystem and cmake. Naturally, also the macro for the plugin-manager is included. Patches supplied for ROOT 5.34.08 and current master (as SQL-part is rarely changing, this statement should stay valid at least for some months). Some usage notes: * The handed path is evaluated as URI by sqlite3, which means it can be a relative or absolute path and can even contain additional settings as "URI" parameters, which are described in the SQLite-documentation. * Functions "{Create,Select,Drop} DataBase(s)", "Reload", "Shutdown" are not implemented as SQLite operates on one DB per file only. The implemented stub methods return appropriate error results. * "TSQLiteServer::GetColumns()" is not implemented (i.e. returns error and value 0): This is sadly not possible via a query in SQLite by their API design. This also means the TableInfo-objects cannot be queried. * The result-row-count of a TSQLiteResult is always -1, as SQLite does not know the number of result rows before all have been retrieved (a valid optimization for a file-only DBMS). For the person reviewing this patch, please note that the indices of bind_parameters in SQLite start from 1, while those for the result-columns start from 0. As this is a rather large featureset to cover and the software of our experiment currently only uses a small subset of it (only 'reading' statements, and no prepared statements), I also wrote a very simple testing-tool which creates a new database with a table with 10 columns of very different type, inserts some example data, and rereads that data both using a simple Query() and using a prepared Statement(). This tool and a very short makefile to build it are also attached if needed for the review-process. The tool uses the commands described in the documentation of the abstract baseclass TSQLStatement to simulate real-life behaviour. Please note that tool is rather hacked-together without real error-handling, as it is not meant for long-term usage, but might be helpful in the review-process / adapted to a unit-test. Apart from the mentioned specifics, nothing is really SQLite-only, thus I did not change the documentation of the baseclass in the patch (this documentation also lists all SQL-implementations). At least this list in the documentation might be extended to make users aware of the new implementation. SQlite plugin provided by Oliver Freyermuth (o.f@cern.ch).