Moodle

SQLite support

Details

  • Type: Task Task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: DEV backlog
  • Component/s: Database SQL/XMLDB
  • Labels:
    None

Description

This project is part of the 2008 edition of Google Summer of Code (GSoC). Mentor: Penny Leach. Student: Andrei Bautu.

  1. 200806221743-sqlite_acceslib.patch
    22/Jun/08 11:21 PM
    1 kB
    Andrei Bautu
  2. 200806221743-sqlite_dml_ddl.patch
    22/Jun/08 11:25 PM
    52 kB
    Andrei Bautu
  3. 200806221743-sqlite_install.patch
    22/Jun/08 11:22 PM
    5 kB
    Andrei Bautu
  4. 200806301845-lib.patch
    30/Jun/08 11:47 PM
    5 kB
    Andrei Bautu
  5. 200807081047-xmldb.patch
    08/Jul/08 4:04 PM
    2 kB
    Andrei Bautu
  6. 200807081058-moodle.patch
    08/Jul/08 4:13 PM
    31 kB
    Andrei Bautu
  7. 200807090136-sql_generator.php.patch
    09/Jul/08 6:41 AM
    2 kB
    Andrei Bautu
  8. 20080713_db_move_patch_merged3.patch
    13/Jul/08 7:43 PM
    26 kB
    Petr Škoda (skodak)
  9. 200807311303-MDL-15071.patch
    31/Jul/08 5:05 PM
    16 kB
    Andrei Bautu

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

please do not use tab characters

Show
Petr Škoda (skodak) added a comment - please do not use tab characters
Hide
Andrei Bautu added a comment -

SQL update rewrite

Show
Andrei Bautu added a comment - SQL update rewrite
Hide
Andrei Bautu added a comment -

SQLite language strings and install options

Show
Andrei Bautu added a comment - SQLite language strings and install options
Hide
Andrei Bautu added a comment -
  • rewrite of connect in moodle_database (and use it in subclasses) - (some part of it was submitted in http://tracker.moodle.org/secure/attachment/14293/200806202038-dml.patch so it deprecates that patch)
  • generic implementation of pdo_moodle_database and pdo_moodle_recordset
  • implementation of sqlite_sql_generator
  • implementation of sqlite3_pdo_moodle_database
Show
Andrei Bautu added a comment -
  • rewrite of connect in moodle_database (and use it in subclasses) - (some part of it was submitted in http://tracker.moodle.org/secure/attachment/14293/200806202038-dml.patch so it deprecates that patch)
  • generic implementation of pdo_moodle_database and pdo_moodle_recordset
  • implementation of sqlite_sql_generator
  • implementation of sqlite3_pdo_moodle_database
Hide
Petr Škoda (skodak) added a comment -

patches in cvs:

  • the connect cahnges were not committed - going to rewrite this part
  • install/lang/ can not be edited directly
  • I had some problems with the ddl_dml patch, the relative paths there totally confused my eclipse

thanks for the patches!

Now I am going to:
1/ rewrite the connect() and export_dbconfig() methods
2/ remove addsingleslashes() from installer

Show
Petr Škoda (skodak) added a comment - patches in cvs:
  • the connect cahnges were not committed - going to rewrite this part
  • install/lang/ can not be edited directly
  • I had some problems with the ddl_dml patch, the relative paths there totally confused my eclipse
thanks for the patches! Now I am going to: 1/ rewrite the connect() and export_dbconfig() methods 2/ remove addsingleslashes() from installer
Hide
Petr Škoda (skodak) added a comment -

my changes are in cvs, please cvs update

Show
Petr Škoda (skodak) added a comment - my changes are in cvs, please cvs update
Hide
Eloy Lafuente (stronk7) added a comment -

Have seen one commit related to this bug:

+ } else {
+ // sqlite and others
+ $updatesql = "UPDATE {context}
+ SET path = (SELECT path FROM {context_temp} WHERE id = {context}.id),
+ depth = (SELECT depth FROM {context_temp} WHERE id = {context}.id)
+ WHERE id IN (SELECT id FROM mdl_context_temp)";

I'd suggest using EXISTS instead of IN. Not sure if sqllite supports it, though.

FYC, ciao, Eloy

Show
Eloy Lafuente (stronk7) added a comment - Have seen one commit related to this bug: + } else { + // sqlite and others + $updatesql = "UPDATE {context} + SET path = (SELECT path FROM {context_temp} WHERE id = {context}.id), + depth = (SELECT depth FROM {context_temp} WHERE id = {context}.id) + WHERE id IN (SELECT id FROM mdl_context_temp)"; I'd suggest using EXISTS instead of IN. Not sure if sqllite supports it, though. FYC, ciao, Eloy
Hide
Andrei Bautu added a comment -

@Eloy SQLite supports IN, but is there a particular reason for using EXISTS instead of IN?
In this case, the subquery would reference the record in the {context} table like this (SELECT id FROM {context_temp} WHERE id = {context}.id). For many RDBMS this means to rerun the subquery for each record. Using IN involves running the subquery only once and then check the result for each record.

Show
Andrei Bautu added a comment - @Eloy SQLite supports IN, but is there a particular reason for using EXISTS instead of IN? In this case, the subquery would reference the record in the {context} table like this (SELECT id FROM {context_temp} WHERE id = {context}.id). For many RDBMS this means to rerun the subquery for each record. Using IN involves running the subquery only once and then check the result for each record.
Hide
Andrei Bautu added a comment -

Fixes a regular expression in xmldb_object which breaks sentences with empty strings.

Show
Andrei Bautu added a comment - Fixes a regular expression in xmldb_object which breaks sentences with empty strings.
Hide
Andrei Bautu added a comment -
  • list all supported drivers (from install.php) is returned by static method moodle_database::get_supported_drivers
  • static method moodle_database::get_driver() loads the class and returns a specific driver
  • static method moodle_database::get_all_drivers() loads the classes and returns objects for each supported driver
  • method moodle_database::export_dbconfig now exports cached settings (which can be set with store_settings or connect)
  • method database_manager::get_generator returns the generator
  • method database_manager::install_from_xmldb_structure installs a database from a xmldb_structure
  • method database_manager::install_from_xmldb_file load the file and calls install_from_xmldb_structure
  • fixes of the SQLite layer
  • new Database mover tool which can switch, transfer, import and export Moodle databases and update config.php file
Show
Andrei Bautu added a comment -
  • list all supported drivers (from install.php) is returned by static method moodle_database::get_supported_drivers
  • static method moodle_database::get_driver() loads the class and returns a specific driver
  • static method moodle_database::get_all_drivers() loads the classes and returns objects for each supported driver
  • method moodle_database::export_dbconfig now exports cached settings (which can be set with store_settings or connect)
  • method database_manager::get_generator returns the generator
  • method database_manager::install_from_xmldb_structure installs a database from a xmldb_structure
  • method database_manager::install_from_xmldb_file load the file and calls install_from_xmldb_structure
  • fixes of the SQLite layer
  • new Database mover tool which can switch, transfer, import and export Moodle databases and update config.php file
Hide
Petr Škoda (skodak) added a comment -

thanks!! going to start merging this at the end of this week, we have to release 1.9.2 and friends now.

Show
Petr Škoda (skodak) added a comment - thanks!! going to start merging this at the end of this week, we have to release 1.9.2 and friends now.
Hide
Andrei Bautu added a comment -

rewrite of getAllReservedWords and added support for SQLite's reserved words

Show
Andrei Bautu added a comment - rewrite of getAllReservedWords and added support for SQLite's reserved words
Hide
Petr Škoda (skodak) added a comment -

sending db move patch updated to apply to current HEAD (not tested)

Show
Petr Škoda (skodak) added a comment - sending db move patch updated to apply to current HEAD (not tested)
Hide
Petr Škoda (skodak) added a comment -

oops, forgot to include some parts, moment please

Show
Petr Škoda (skodak) added a comment - oops, forgot to include some parts, moment please
Hide
Petr Škoda (skodak) added a comment -

going to commit parts that are not related to db migration today and post smaller patch dre - see MDL-15635 for more info

Show
Petr Škoda (skodak) added a comment - going to commit parts that are not related to db migration today and post smaller patch dre - see MDL-15635 for more info
Hide
Petr Škoda (skodak) added a comment -

1/ It seems that we do not need the changes in settings export - not committed
2/ the static methods proposed for moodle_database do not have optimal names imho - get_supported_drivers() returns all core drivers, event those experiment (== not supported), get_all_drivers() does not return "all" drivers, only the core drivers; =& is not needed in PHP5; php docs should be enclosed by /** */ - not committed for now
3/ the database mover changes not committed - see MDL-15635

thanks for the patches!

Show
Petr Škoda (skodak) added a comment - 1/ It seems that we do not need the changes in settings export - not committed 2/ the static methods proposed for moodle_database do not have optimal names imho - get_supported_drivers() returns all core drivers, event those experiment (== not supported), get_all_drivers() does not return "all" drivers, only the core drivers; =& is not needed in PHP5; php docs should be enclosed by /** */ - not committed for now 3/ the database mover changes not committed - see MDL-15635 thanks for the patches!
Hide
Andrei Bautu added a comment -

1/ It would be usefull for the db mover if I could get information from a driver (through export) about it's current settings.
2/ I'll fix these comments and =&.
Is get_driver_names better? Or another suggestion, please.
I took the list of drivers from install.php and these are all existing drivers at the moment. What do you mean by "all"?

Show
Andrei Bautu added a comment - 1/ It would be usefull for the db mover if I could get information from a driver (through export) about it's current settings. 2/ I'll fix these comments and =&. Is get_driver_names better? Or another suggestion, please. I took the list of drivers from install.php and these are all existing drivers at the moment. What do you mean by "all"?
Hide
Andrei Bautu added a comment -

Full ALTER TABLE support + bug fixes

Show
Andrei Bautu added a comment - Full ALTER TABLE support + bug fixes

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated: