Moodle  2.2.1
http://www.collinsharper.com
sqlite_sql_generator Class Reference
Inheritance diagram for sqlite_sql_generator:
Collaboration diagram for sqlite_sql_generator:

Public Member Functions

 __construct ($mdb)
 getResetSequenceSQL ($table)
 getKeySQL ($xmldb_table, $xmldb_key)
 getTypeSQL ($xmldb_type, $xmldb_length=null, $xmldb_decimals=null)
 getAlterFieldSQL ($xmldb_table, $xmldb_field, $skip_type_clause=NULL, $skip_default_clause=NULL, $skip_notnull_clause=NULL)
 getAddKeySQL ($xmldb_table, $xmldb_key)
 getCreateEnumSQL ($xmldb_table, $xmldb_field)
 getDropEnumSQL ($xmldb_table, $xmldb_field)
 getCreateDefaultSQL ($xmldb_table, $xmldb_field)
 getRenameFieldSQL ($xmldb_table, $xmldb_field, $newname)
 getRenameIndexSQL ($xmldb_table, $xmldb_index, $newname)
 getRenameKeySQL ($xmldb_table, $xmldb_key, $newname)
 getDropFieldSQL ($xmldb_table, $xmldb_field)
 getDropIndexSQL ($xmldb_table, $xmldb_index)
 getDropKeySQL ($xmldb_table, $xmldb_key)
 getDropDefaultSQL ($xmldb_table, $xmldb_field)
 getCommentSQL ($xmldb_table)
 getCheckConstraintsFromDB ($xmldb_table, $xmldb_field=null)
 isNameInUse ($object_name, $type, $table_name)
 addslashes ($s)

Static Public Member Functions

static getReservedWords ()

Data Fields

 $drop_default_value_required = true
 Only set values that are different from the defaults present in XMLDBgenerator.
 $drop_default_value = NULL
 $drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY'
 $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME'
 $drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME'
 $default_for_char = ''
 $sequence_only = true
 $sequence_extra_code = false
 $sequence_name = 'INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL'
 $unsigned_allowed = false
 $enum_inline_code = true
 $enum_extra_code = false
 $drop_index_sql = 'ALTER TABLE TABLENAME DROP INDEX INDEXNAME'
 TABLENAME, OLDFIELDNAME and NEWFIELDNAME are dyanmically replaced.
 $rename_index_sql = null
 $rename_key_sql = null

Protected Member Functions

 getAlterTableSchema ($xmldb_table, $xmldb_add_field=NULL, $xmldb_delete_field=NULL)

Detailed Description

This class generate SQL code to be used against SQLite It extends XMLDBgenerator so everything can be overridden as needed to generate correct SQL.

Definition at line 36 of file sqlite_sql_generator.php.


Constructor & Destructor Documentation

__construct ( mdb)

Creates one new XMLDBmysql

Definition at line 73 of file sqlite_sql_generator.php.


Member Function Documentation

addslashes ( s)

Reimplemented from sql_generator.

Definition at line 453 of file sqlite_sql_generator.php.

getAddKeySQL ( xmldb_table,
xmldb_key 
)

Given one xmldb_table and one xmldb_key, return the SQL statements needed to add the key to the table note that underlying indexes will be added as parametrised by $xxxx_keys and $xxxx_index parameters

Reimplemented from sql_generator.

Definition at line 280 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getAlterFieldSQL ( xmldb_table,
xmldb_field,
skip_type_clause = NULL,
skip_default_clause = NULL,
skip_notnull_clause = NULL 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to alter the field in the table

Reimplemented from sql_generator.

Definition at line 272 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getAlterTableSchema ( xmldb_table,
xmldb_add_field = NULL,
xmldb_delete_field = NULL 
) [protected]

Function to emulate full ALTER TABLE which SQLite does not support. The function can be used to drop a column ($xmldb_delete_field != null and $xmldb_add_field == null), add a column ($xmldb_delete_field == null and $xmldb_add_field != null), change/rename a column ($xmldb_delete_field == null and $xmldb_add_field == null).

Parameters:
xmldb_table$xmldb_tabletable to change
xmldb_field$xmldb_add_fieldcolumn to create/modify (full specification is required)
xmldb_field$xmldb_delete_fieldcolumn to delete/modify (only name field is required)
Returns:
array of strings (SQL statements to alter the table structure)

Get the quoted name of the table and field

Definition at line 194 of file sqlite_sql_generator.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getCheckConstraintsFromDB ( xmldb_table,
xmldb_field = null 
)

Given one xmldb_table returns one array with all the check constraints in the table (fetched from DB) Optionally the function allows one xmldb_field to be specified in order to return only the check constraints belonging to one field. Each element contains the name of the constraint and its description If no check constraints are found, returns an empty array.

TODO: Moodle 2.1 - drop in Moodle 2.1

Reimplemented from sql_generator.

Definition at line 391 of file sqlite_sql_generator.php.

getCommentSQL ( xmldb_table)

Returns the code (in array) needed to add one comment to the table

Reimplemented from sql_generator.

Definition at line 377 of file sqlite_sql_generator.php.

getCreateDefaultSQL ( xmldb_table,
xmldb_field 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default (usually invoked from getModifyDefaultSQL()

Reimplemented from sql_generator.

Definition at line 305 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getCreateEnumSQL ( xmldb_table,
xmldb_field 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its enum (usually invoked from getModifyEnumSQL()

Definition at line 289 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getDropDefaultSQL ( xmldb_table,
xmldb_field 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default (usually invoked from getModifyDefaultSQL()

Reimplemented from sql_generator.

Definition at line 370 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getDropEnumSQL ( xmldb_table,
xmldb_field 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its enum (usually invoked from getModifyEnumSQL()

Reimplemented from sql_generator.

Definition at line 297 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getDropFieldSQL ( xmldb_table,
xmldb_field 
)

Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop the field from the table

Reimplemented from sql_generator.

Definition at line 346 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getDropIndexSQL ( xmldb_table,
xmldb_index 
)

Given one xmldb_table and one xmldb_index, return the SQL statements needed to drop the index from the table

Reimplemented from sql_generator.

Definition at line 353 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getDropKeySQL ( xmldb_table,
xmldb_key 
)

Given one xmldb_table and one xmldb_index, return the SQL statements needed to drop the index from the table

Reimplemented from sql_generator.

Definition at line 361 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getKeySQL ( xmldb_table,
xmldb_key 
)

Given one correct xmldb_key, returns its specs

Reimplemented from sql_generator.

Definition at line 96 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getRenameFieldSQL ( xmldb_table,
xmldb_field,
newname 
)

Given one correct xmldb_field and the new name, returns the SQL statements to rename it (inside one array) SQLite is pretty different from the standard to justify this overloading

Reimplemented from sql_generator.

Definition at line 314 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getRenameIndexSQL ( xmldb_table,
xmldb_index,
newname 
)

Given one xmldb_table and one xmldb_index, return the SQL statements needed to rename the index in the table

Get the real index name

Reimplemented from sql_generator.

Definition at line 323 of file sqlite_sql_generator.php.

Here is the call graph for this function:

getRenameKeySQL ( xmldb_table,
xmldb_key,
newname 
)

Given one xmldb_table and one xmldb_key, return the SQL statements needed to rename the key in the table Experimental! Shouldn't be used at all!

Reimplemented from sql_generator.

Definition at line 336 of file sqlite_sql_generator.php.

Here is the call graph for this function:

static getReservedWords ( ) [static]

Returns an array of reserved words (lowercase) for this DB

From http://www.sqlite.org/lang_keywords.html

Reimplemented from sql_generator.

Definition at line 426 of file sqlite_sql_generator.php.

getResetSequenceSQL ( table)

Reset a sequence to the id field of a table.

Parameters:
string$tablename of table or xmldb_object
Returns:
bool success

Reimplemented from sql_generator.

Definition at line 82 of file sqlite_sql_generator.php.

getTypeSQL ( xmldb_type,
xmldb_length = null,
xmldb_decimals = null 
)

Given one XMLDB Type, length and decimals, returns the DB proper SQL type

Reimplemented from sql_generator.

Definition at line 134 of file sqlite_sql_generator.php.

isNameInUse ( object_name,
type,
table_name 
)

Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg) return if such name is currently in use (true) or no (false) (invoked from getNameForObject()

Reimplemented from sql_generator.

Definition at line 417 of file sqlite_sql_generator.php.


Field Documentation

$default_for_char = ''

Reimplemented from sql_generator.

Definition at line 51 of file sqlite_sql_generator.php.

$drop_default_value = NULL

Reimplemented from sql_generator.

Definition at line 41 of file sqlite_sql_generator.php.

$drop_default_value_required = true

Only set values that are different from the defaults present in XMLDBgenerator.

Reimplemented from sql_generator.

Definition at line 40 of file sqlite_sql_generator.php.

$drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME'

Reimplemented from sql_generator.

Definition at line 49 of file sqlite_sql_generator.php.

$drop_index_sql = 'ALTER TABLE TABLENAME DROP INDEX INDEXNAME'

TABLENAME, OLDFIELDNAME and NEWFIELDNAME are dyanmically replaced.

Reimplemented from sql_generator.

Definition at line 61 of file sqlite_sql_generator.php.

$drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY'

Reimplemented from sql_generator.

Definition at line 43 of file sqlite_sql_generator.php.

$drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME'

Reimplemented from sql_generator.

Definition at line 46 of file sqlite_sql_generator.php.

$enum_extra_code = false

Definition at line 59 of file sqlite_sql_generator.php.

$enum_inline_code = true

Definition at line 58 of file sqlite_sql_generator.php.

$rename_index_sql = null

Reimplemented from sql_generator.

Definition at line 64 of file sqlite_sql_generator.php.

$rename_key_sql = null

Reimplemented from sql_generator.

Definition at line 67 of file sqlite_sql_generator.php.

$sequence_extra_code = false

Reimplemented from sql_generator.

Definition at line 54 of file sqlite_sql_generator.php.

$sequence_name = 'INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL'

Reimplemented from sql_generator.

Definition at line 55 of file sqlite_sql_generator.php.

$sequence_only = true

Reimplemented from sql_generator.

Definition at line 53 of file sqlite_sql_generator.php.

$unsigned_allowed = false

Reimplemented from sql_generator.

Definition at line 56 of file sqlite_sql_generator.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations