Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Student projects/SQLite.

Student projects/SQLite

From MoodleDocs

Note: This page outlines ideas for the XMLDB/SQLite project. It's a specification under construction! If you have any comments or suggestions, please add them to the page comments.

Summary

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

The objective of this project is to extend Moodle's database support and features. The main working directions established in the proposal are:

  • implement SQLite in Moodle database abstraction layer;
  • implement a tool which will allow administrators to copy a live Moodle database and switch into 'testing mode' using a SQLite copy of the live database.

SQLite support

Adding support for SQLite in Moodle requires a careful analysis of compatibility between Moodle's database requirements and SQLite's features (e.g. https://docs.moodle.org/en/Development:XMLDB_problems).

SQLite supports almost all of the features of SQL92 (see http://www.sqlite.org/omitted.html). Some areas that need special attention are:

  • proper settings for Unicode support, long field names, numeric/associative fetches, metadata support;
  • incompatible SQL commands (e.g. SQLite does not support MySQL's TRUNCATE because it is not part of standard SQL);
  • unsupported SQL commands (SQLite does not support GRANT/REVOKE);
  • unsupported SQL keywords (SQLite does not support right and full join);
  • security issues (in a misconfigured environment, the SQLite database may be downloaded).

A serious limitation of SQLite is the limited ALTER TABLE command. In this case, the general solution for the missing clauses problem consists in replacing the query with a series of queries that will create a second table to replace the original one. This will be done by the database layer.

Testing mode tool

Using this tool, the live database will be copied to a SQLite testing database. This will allow administrators to experiment in testing mode without performing a backup of the live database or worrying about breaking their live site. The tool will use Moodle's XMLDB to replicate the data from the live database to the test database.

See also