Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
This class generate SQL code to be used against SQLite It extends XMLDBgenerator so everything can be overridden as needed to generate correct SQL. More...
Public Member Functions | |
__construct ($mdb) | |
Creates one new XMLDBmysql. | |
addslashes ($s) | |
Adds slashes to string. | |
cleanup_after_drop (xmldb_table $table) | |
Performs any clean up that needs to be done after a table is dropped. | |
dispose () | |
Releases all resources. | |
get_nullable_fields_in_index ($xmldb_table, $xmldb_index) | |
Get the fields from an index definition that might be null. | |
getAddFieldSQL ($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 add the field to the table. | |
getAddIndexSQL ($xmldb_table, $xmldb_index) | |
Given one xmldb_table and one xmldb_index, return the SQL statements needed to add the index to the table. | |
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. | |
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. | |
getCommentSQL ($xmldb_table) | |
Returns the code (array of statements) needed to add one comment to the table. | |
getConcatSQL ($elements) | |
Given one array of elements, build the proper CONCAT expression, based in the $concat_character setting. | |
getCreateDefaultSQL ($xmldb_table, $xmldb_field) | |
Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default (usually invoked from getModifyDefaultSQL() | |
getCreateIndexSQL ($xmldb_table, $xmldb_index) | |
Given one correct xmldb_index, returns the SQL statements needed to create it (in array). | |
getCreateSequenceSQL ($xmldb_table, $xmldb_field) | |
Returns the code (array of statements) needed to create one sequence for the xmldb_table and xmldb_field passed in. | |
getCreateStructureSQL ($xmldb_structure) | |
This function will return the SQL code needed to create db tables and statements. | |
getCreateTableSQL ($xmldb_table) | |
Given one correct xmldb_table, returns the SQL statements to create it (inside one array). | |
getCreateTempTableSQL ($xmldb_table) | |
Given one correct xmldb_table, returns the SQL statements to create temporary table (inside one array). | |
getDefaultClause ($xmldb_field) | |
Given one xmldb_field, returns the correct "default clause" for the current configuration. | |
getDefaultValue ($xmldb_field) | |
Give one xmldb_field, returns the correct "default value" for the current configuration. | |
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() | |
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. | |
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. | |
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. | |
getDropTableExtraSQL ($xmldb_table) | |
Returns the code (array of statements) needed to execute extra statements on table drop. | |
getDropTableSQL ($xmldb_table) | |
Given one correct xmldb_table, returns the SQL statements to drop it (inside one array). | |
getEncQuoted ($input) | |
Given any string (or one array), enclose it by the proper quotes if it's a reserved word. | |
getEndedStatements ($input) | |
Given one string (or one array), ends it with $statement_end . | |
getExecuteInsertSQL ($statement) | |
Given one XMLDB Statement, build the needed SQL insert sentences to execute it. | |
getFieldSQL ($xmldb_table, $xmldb_field, $skip_type_clause=NULL, $skip_default_clause=NULL, $skip_notnull_clause=NULL, $specify_nulls_clause=NULL, $specify_field_name=true) | |
Given one correct xmldb_field, returns the complete SQL line to create it. | |
getKeySQL ($xmldb_table, $xmldb_key) | |
Given one correct xmldb_key, returns its specs. | |
getModifyDefaultSQL ($xmldb_table, $xmldb_field) | |
Given one xmldb_table and one xmldb_field, return the SQL statements needed to modify the default of the field in the table. | |
getNameForObject ($tablename, $fields, $suffix='') | |
Given three strings (table name, list of fields (comma separated) and suffix), create the proper object name quoting it if necessary. | |
getRenameFieldExtraSQL ($xmldb_table, $xmldb_field) | |
Returns the code (array of statements) needed to execute extra statements on field rename. | |
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). | |
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. | |
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! | |
getRenameTableExtraSQL ($xmldb_table, $newname) | |
Returns the code (array of statements) needed to execute extra statements on table rename. | |
getRenameTableSQL ($xmldb_table, $newname) | |
Given one correct xmldb_table and the new name, returns the SQL statements to rename it (inside one array). | |
getResetSequenceSQL ($table) | |
Reset a sequence to the id field of a table. | |
getSequenceFromDB ($xmldb_table) | |
Returns the name (string) of the sequence used in the table for the autonumeric pk Only some DB have this implemented. | |
getTableName (xmldb_table $xmldb_table, $quoted=true) | |
Given one xmldb_table, this returns it's correct name, depending of all the parameterization. | |
getTypeSQL ($xmldb_type, $xmldb_length=null, $xmldb_decimals=null) | |
Given one XMLDB Type, length and decimals, returns the DB proper SQL type. | |
isNameInUse ($object_name, $type, $table_name) | |
Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg). | |
table_exists ($table) | |
Given one xmldb_table, checks if it exists in DB (true/false). | |
Static Public Member Functions | |
static | getAllReservedWords () |
Returns all reserved words in supported databases. | |
static | getReservedWords () |
Returns an array of reserved words (lowercase) for this DB. | |
Public Attributes | |
bool | $add_after_clause = false |
True if the generator needs to add the after clause for fields. | |
bool | $add_table_comments = true |
True if the generator needs to add code for table comments. | |
bool | $alter_column_skip_default = false |
The generator will skip the default clause on alter columns. | |
bool | $alter_column_skip_notnull = false |
The generator will skip the null/notnull clause on alter columns. | |
bool | $alter_column_skip_type = false |
The generator will skip the type clause on alter columns. | |
string | $alter_column_sql = 'ALTER TABLE TABLENAME ALTER COLUMN COLUMNSPECS' |
The SQL template to alter columns where the 'TABLENAME' and 'COLUMNSPECS' keywords are dynamically replaced. | |
string | $concat_character = '||' |
Characters to be used as concatenation operator. | |
bool | $default_after_null = true |
To decide if the default clause of each field must go after the null clause. | |
string | $default_for_char = '' |
To define the default to set for NOT NULLs CHARs without default (null=do nothing). | |
string | $drop_default_value = NULL |
The DEFAULT clause required to drop defaults. | |
bool | $drop_default_value_required = true |
Only set values that are different from the defaults present in XMLDBgenerator. | |
string | $drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME' |
Template to drop FKs. | |
string | $drop_index_sql = 'ALTER TABLE TABLENAME DROP INDEX INDEXNAME' |
SQL sentence to drop one index where 'TABLENAME', 'INDEXNAME' keywords are dynamically replaced. | |
string | $drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY' |
Template to drop PKs. | |
string | $drop_table_sql = 'DROP TABLE TABLENAME' |
SQL sentence to drop one table where the 'TABLENAME' keyword is dynamically replaced. | |
string | $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME' |
Template to drop UKs. | |
bool | $float_to_number = false |
To create all the floats as NUMBER(x) (also called DECIMAL, NUMERIC...). | |
bool | $foreign_keys = false |
True if the generator builds foreign keys. | |
bool | $integer_to_number = false |
To create all the integers as NUMBER(x) (also called DECIMAL, NUMERIC...). | |
moodle_database | $mdb |
The moodle_database instance. | |
int | $names_max_length = 30 |
Maximum length for key/index/sequence/trigger/check names (keep 30 for all!). | |
string | $number_type = 'NUMERIC' |
Proper type for NUMBER(x) in this DB. | |
string | $prefix |
The prefix to be used for all the DB objects. | |
bool | $prefix_on_names = true |
True if the generator needs to prepend the prefix to all the key/index/sequence/trigger/check names. | |
string | $primary_key_name = null |
To force primary key names to one string (null=no force). | |
bool | $primary_keys = true |
True if the generator builds primary keys. | |
bool | $quote_all = false |
To decide if we want to quote all the names or only the reserved ones. | |
string | $quote_string = '"' |
Used to quote names. | |
string | $rename_column_sql = 'ALTER TABLE TABLENAME RENAME COLUMN OLDFIELDNAME TO NEWFIELDNAME' |
SQL sentence to rename one column where 'TABLENAME', 'OLDFIELDNAME' and 'NEWFIELDNAME' keywords are dynamically replaced. | |
string | $rename_index_sql = null |
SQL sentence to rename one index where 'TABLENAME', 'OLDINDEXNAME' and 'NEWINDEXNAME' are dynamically replaced. | |
string | $rename_key_sql = null |
SQL sentence to rename one key 'TABLENAME', 'OLDKEYNAME' and 'NEWKEYNAME' are dynamically replaced. | |
string | $rename_table_sql = 'ALTER TABLE OLDNAME RENAME TO NEWNAME' |
SQL sentence to rename one table, both 'OLDNAME' and 'NEWNAME' keywords are dynamically replaced. | |
array | $reserved_words |
List of reserved words (in order to quote them properly). | |
bool | $sequence_extra_code = false |
True if the generator needs to add extra code to generate the sequence fields. | |
string | $sequence_name = 'INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL' |
The particular name for inline sequences in this generator. | |
string bool | $sequence_name_small = false |
Different name for small (4byte) sequences or false if same. | |
bool | $sequence_only = true |
To avoid outputting the rest of the field specs, leaving only the name and the sequence_name returned. | |
bool | $specify_nulls = false |
To force the generator if NULL clauses must be specified. | |
string | $statement_end = ';' |
To be automatically added at the end of each statement. | |
bool | $unique_keys = false |
True if the generator builds unique keys. | |
Protected Member Functions | |
getAlterTableSchema ($xmldb_table, $xmldb_add_field=NULL, $xmldb_delete_field=NULL) | |
Function to emulate full ALTER TABLE which SQLite does not support. | |
Protected Attributes | |
Control | $temptables |
existing temptables. | |
This class generate SQL code to be used against SQLite It extends XMLDBgenerator so everything can be overridden as needed to generate correct SQL.
sqlite_sql_generator::addslashes | ( | $s | ) |
Adds slashes to string.
string | $s |
string | The escaped string. |
Reimplemented from sql_generator.
|
inherited |
Performs any clean up that needs to be done after a table is dropped.
xmldb_table | $table |
|
inherited |
Get the fields from an index definition that might be null.
xmldb_table | $xmldb_table | the table |
xmldb_index | $xmldb_index | the index |
array | list of fields in the index definition that might be null. |
|
inherited |
Given one xmldb_table and one xmldb_field, return the SQL statements needed to add the field to the table.
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to create the SQL from. |
string | $skip_type_clause | The type clause on alter columns, NULL by default. |
string | $skip_default_clause | The default clause on alter columns, NULL by default. |
string | $skip_notnull_clause | The null/notnull clause on alter columns, NULL by default. |
array | The SQL statement for adding a field to the table. |
Reimplemented in mysql_sql_generator.
|
inherited |
Given one xmldb_table and one xmldb_index, return the SQL statements needed to add the index to the table.
xmldb_table | $xmldb_table | The xmldb_table instance to add the index on. |
xmldb_index | $xmldb_index | The xmldb_index to add. |
array | An array of SQL statements to add the index. |
sqlite_sql_generator::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.
|
staticinherited |
Returns all reserved words in supported databases.
Reserved words should be lowercase.
array | ('word'=>array(databases)) |
sqlite_sql_generator::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.
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to create the SQL from. |
string | $skip_type_clause | The type clause on alter columns, NULL by default. |
string | $skip_default_clause | The default clause on alter columns, NULL by default. |
string | $skip_notnull_clause | The null/notnull clause on alter columns, NULL by default. |
string | The field altering SQL statement. |
Reimplemented from sql_generator.
|
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).
xmldb_table | $xmldb_table | table to change |
xmldb_field | $xmldb_add_field | column to create/modify (full specification is required) |
xmldb_field | $xmldb_delete_field | column to delete/modify (only name field is required) |
array | of strings (SQL statements to alter the table structure) |
sqlite_sql_generator::getCommentSQL | ( | $xmldb_table | ) |
Returns the code (array of statements) needed to add one comment to the table.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
array | Array of SQL statements to add one comment to the table. |
Reimplemented from sql_generator.
|
inherited |
Given one array of elements, build the proper CONCAT expression, based in the $concat_character setting.
If such setting is empty, then MySQL's CONCAT function will be used instead.
array | $elements | An array of elements to concatenate. |
mixed | Returns the result of moodle_database\sql_concat() or false. @uses moodle_database\sql_concat() @uses call_user_func_array() |
sqlite_sql_generator::getCreateDefaultSQL | ( | $xmldb_table, | |
$xmldb_field ) |
Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default (usually invoked from getModifyDefaultSQL()
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
array | Array of SQL statements to create a field's default. |
Reimplemented from sql_generator.
|
inherited |
Given one correct xmldb_index, returns the SQL statements needed to create it (in array).
xmldb_table | $xmldb_table | The xmldb_table instance to create the index on. |
xmldb_index | $xmldb_index | The xmldb_index to create. |
array | An array of SQL statements to create the index. |
coding_exception | Thrown if the xmldb_index does not validate with the xmldb_table. |
Reimplemented in mssql_sql_generator, oracle_sql_generator, and postgres_sql_generator.
|
inherited |
Returns the code (array of statements) needed to create one sequence for the xmldb_table and xmldb_field passed in.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
array | Array of SQL statements to create the sequence. |
Reimplemented in oracle_sql_generator.
|
inherited |
This function will return the SQL code needed to create db tables and statements.
xmldb_structure | $xmldb_structure | An xmldb_structure instance. |
array |
|
inherited |
Given one correct xmldb_table, returns the SQL statements to create it (inside one array).
xmldb_table | $xmldb_table | An xmldb_table instance. |
array | An array of SQL statements, starting with the table creation SQL followed by any of its comments, indexes and sequence creation SQL statements. |
Reimplemented in mysql_sql_generator.
|
abstractinherited |
Given one correct xmldb_table, returns the SQL statements to create temporary table (inside one array).
xmldb_table | $xmldb_table | The xmldb_table object instance. |
array | of sql statements |
Reimplemented in mssql_sql_generator, mysql_sql_generator, oracle_sql_generator, and postgres_sql_generator.
|
inherited |
Given one xmldb_field, returns the correct "default clause" for the current configuration.
xmldb_field | $xmldb_field | The xmldb_field. |
The | SQL clause for generating the default value as in $xmldb_field. |
|
inherited |
Give one xmldb_field, returns the correct "default value" for the current configuration.
xmldb_field | $xmldb_field | The field. |
The | default value of the field. |
sqlite_sql_generator::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()
Note that this method may be dropped in future.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
array | Array of SQL statements to create a field's default. |
Reimplemented from sql_generator.
sqlite_sql_generator::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.
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to create the SQL from. |
array | The SQL statement for dropping a field from the table. |
Reimplemented from sql_generator.
sqlite_sql_generator::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.
sqlite_sql_generator::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.
|
inherited |
Returns the code (array of statements) needed to execute extra statements on table drop.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
array | Array of extra SQL statements to drop a table. |
Reimplemented in oracle_sql_generator.
|
inherited |
Given one correct xmldb_table, returns the SQL statements to drop it (inside one array).
Works also for temporary tables.
xmldb_table | $xmldb_table | The table to drop. |
array | SQL statement(s) for dropping the specified table. |
Reimplemented in mysql_sql_generator, and oracle_sql_generator.
|
inherited |
Given any string (or one array), enclose it by the proper quotes if it's a reserved word.
string | array | $input | String to quote. |
string|array | Quoted string. |
|
inherited |
Given one string (or one array), ends it with $statement_end .
array | string | $input | SQL statement(s). |
array|string |
|
inherited |
Given one XMLDB Statement, build the needed SQL insert sentences to execute it.
mixed | $statement | SQL statement. |
array | Array of sentences in the SQL statement. |
|
inherited |
Given one correct xmldb_field, returns the complete SQL line to create it.
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to create the SQL from. |
string | $skip_type_clause | The type clause on alter columns, NULL by default. |
string | $skip_default_clause | The default clause on alter columns, NULL by default. |
string | $skip_notnull_clause | The null/notnull clause on alter columns, NULL by default. |
string | $specify_nulls_clause | To force a specific null clause, NULL by default. |
bool | $specify_field_name | Flag to specify fieldname in return. |
string | The field generating SQL statement. |
coding_exception | Thrown when xmldb_field doesn't validate with the xmldb_table. |
sqlite_sql_generator::getKeySQL | ( | $xmldb_table, | |
$xmldb_key ) |
Given one correct xmldb_key, returns its specs.
Reimplemented from sql_generator.
|
inherited |
Given one xmldb_table and one xmldb_field, return the SQL statements needed to modify the default of the field in the table.
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to get the modified default value from. |
array | The SQL statement for modifying the default value. |
Reimplemented in mssql_sql_generator.
|
inherited |
Given three strings (table name, list of fields (comma separated) and suffix), create the proper object name quoting it if necessary.
IMPORTANT: This function must be used to CALCULATE NAMES of objects TO BE CREATED, NEVER TO GUESS NAMES of EXISTING objects!!!
string | $tablename | The table name. |
string | $fields | A list of comma separated fields. |
string | $suffix | A suffix for the object name. |
string | Object's name. |
Reimplemented in mssql_sql_generator.
|
inherited |
Returns the code (array of statements) needed to execute extra statements on field rename.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
array | Array of extra SQL statements to run with a field being renamed. |
sqlite_sql_generator::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).
xmldb_table | $xmldb_table | The table related to $xmldb_field. |
xmldb_field | $xmldb_field | The instance of xmldb_field to get the renamed field from. |
string | $newname | The new name to rename the field to. |
array | The SQL statements for renaming the field. |
Reimplemented from sql_generator.
sqlite_sql_generator::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.
Reimplemented from sql_generator.
sqlite_sql_generator::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.
|
inherited |
Returns the code (array of statements) needed to execute extra statements on table rename.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
string | $newname | The new name for the table. |
array | Array of extra SQL statements to rename a table. |
Reimplemented in mssql_sql_generator, oracle_sql_generator, and postgres_sql_generator.
|
inherited |
Given one correct xmldb_table and the new name, returns the SQL statements to rename it (inside one array).
xmldb_table | $xmldb_table | The table to rename. |
string | $newname | The new name to rename the table to. |
array | SQL statement(s) to rename the table. |
|
static |
Returns an array of reserved words (lowercase) for this DB.
array | An array of database specific reserved words |
Reimplemented from sql_generator.
sqlite_sql_generator::getResetSequenceSQL | ( | $table | ) |
Reset a sequence to the id field of a table.
xmldb_table | string | $table | name of table or the table object. |
array | of sql statements |
Reimplemented from sql_generator.
|
inherited |
Returns the name (string) of the sequence used in the table for the autonumeric pk Only some DB have this implemented.
xmldb_table | $xmldb_table | The xmldb_table instance. |
bool | Returns the sequence from the DB or false. |
Reimplemented in oracle_sql_generator, and postgres_sql_generator.
|
inherited |
Given one xmldb_table, this returns it's correct name, depending of all the parameterization.
eg: This appends $prefix to the table name.
xmldb_table | $xmldb_table | The table whose name we want. |
boolean | $quoted | To specify if the name must be quoted (if reserved word, only!). |
string | The correct name of the table. |
Reimplemented in mssql_sql_generator, and oracle_sql_generator.
sqlite_sql_generator::getTypeSQL | ( | $xmldb_type, | |
$xmldb_length = null, | |||
$xmldb_decimals = null ) |
Given one XMLDB Type, length and decimals, returns the DB proper SQL type.
int | $xmldb_type | The xmldb_type defined constant. XMLDB_TYPE_INTEGER and other XMLDB_TYPE_* constants. |
int | $xmldb_length | The length of that data type. |
int | $xmldb_decimals | The decimal places of precision of the data type. |
string | The DB defined data type. |
Reimplemented from sql_generator.
sqlite_sql_generator::isNameInUse | ( | $object_name, | |
$type, | |||
$table_name ) |
Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg).
(MySQL requires the whole xmldb_table object to be specified, so we add it always)
This is invoked from getNameForObject(). Only some DB have this implemented.
string | $object_name | The object's name to check for. |
string | $type | The object's type (pk, uk, fk, ck, ix, uix, seq, trg). |
string | $table_name | The table's name to check in |
bool | If such name is currently in use (true) or no (false) |
Reimplemented from sql_generator.
|
inherited |
Given one xmldb_table, checks if it exists in DB (true/false).
mixed | $table | The table to be searched (string name or xmldb_table instance). |
boolean | true/false |
|
inherited |
Characters to be used as concatenation operator.
If not defined, MySQL CONCAT function will be used.
bool sqlite_sql_generator::$drop_default_value_required = true |
Only set values that are different from the defaults present in XMLDBgenerator.
To specify if the generator must use some DEFAULT clause to drop defaults.
string sqlite_sql_generator::$drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME' |
Template to drop FKs.
'TABLENAME' and 'KEYNAME' will be replaced from this template.
string sqlite_sql_generator::$drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY' |
Template to drop PKs.
'TABLENAME' and 'KEYNAME' will be replaced from this template.
string sqlite_sql_generator::$drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME' |
Template to drop UKs.
'TABLENAME' and 'KEYNAME' will be replaced from this template.
|
inherited |
True if the generator needs to prepend the prefix to all the key/index/sequence/trigger/check names.
|
inherited |
To force the generator if NULL clauses must be specified.
It shouldn't be necessary.