Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
This class generate SQL code to be used against Oracle It extends XMLDBgenerator so everything can be overridden as needed to generate correct SQL. More...
Public Member Functions | |
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 undelying 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). | |
getCreateTriggerSQL ($xmldb_table, $xmldb_field, $sequence_name) | |
Returns the code needed to create one trigger for the xmldb_table and xmldb_field passed. | |
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. | |
getDropSequenceSQL ($xmldb_table, $xmldb_field, $include_trigger=false) | |
Returns the code needed to drop one sequence for the xmldb_table and xmldb_field passed Can, optionally, specify if the underlying trigger will be also dropped. | |
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 Experimental! Shouldn't be used at all! | |
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) | |
Given one xmldb_table returns one string with the sequence of the table in the table (fetched from DB) The sequence name for oracle is calculated by looking the corresponding trigger and retrieving the sequence name from it (because sequences are independent elements) | |
getTableName (xmldb_table $xmldb_table, $quoted=true) | |
Given one xmldb_table, returns it's correct name, depending of all the parametrization Overridden to allow change of names in temp tables. | |
getTriggerFromDB ($xmldb_table) | |
Given one xmldb_table returns one string with the trigger in the table (fetched from DB) | |
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 MODIFY (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 = false |
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 |
To specify if the generator must use some DEFAULT clause to drop defaults. | |
string | $drop_foreign_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME' |
Template to drop FKs. | |
string | $drop_index_sql = 'DROP INDEX INDEXNAME' |
SQL sentence to drop one index where 'TABLENAME', 'INDEXNAME' keywords are dynamically replaced. | |
string | $drop_primary_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME' |
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 CONSTRAINT 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 = 'NUMBER' |
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 = 'ALTER INDEX OLDINDEXNAME RENAME TO NEWINDEXNAME' |
SQL sentence to rename one index where 'TABLENAME', 'OLDINDEXNAME' and 'NEWINDEXNAME' are dynamically replaced. | |
string | $rename_key_sql = 'ALTER TABLE TABLENAME CONSTRAINT OLDKEYNAME RENAME TO NEWKEYNAME' |
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). | |
int | $sequence_cache_size = 20 |
var ugly Oracle hack - size of the sequences values cache (20 = Default) | |
bool | $sequence_extra_code = true |
True if the generator needs to add extra code to generate the sequence fields. | |
string | $sequence_name = '' |
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 = false |
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 = "\n/" |
To be automatically added at the end of each statement. | |
bool | $unique_keys = false |
True if the generator builds unique keys. | |
Protected Attributes | |
Control | $temptables |
existing temptables. | |
This class generate SQL code to be used against Oracle It extends XMLDBgenerator so everything can be overridden as needed to generate correct SQL.
oracle_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. |
|
inherited |
Given one xmldb_table and one xmldb_key, return the SQL statements needed to add the key to the table note that undelying indexes will be added as parametrised by $xxxx_keys and $xxxx_index parameters.
xmldb_table | $xmldb_table | The table related to $xmldb_key. |
xmldb_key | $xmldb_key | The xmldb_key to add. |
array | SQL statement to add the xmldb_key. |
Reimplemented in sqlite_sql_generator.
|
staticinherited |
Returns all reserved words in supported databases.
Reserved words should be lowercase.
array | ('word'=>array(databases)) |
oracle_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.
Oracle has some severe limits:
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.
oracle_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() |
oracle_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.
oracle_sql_generator::getCreateIndexSQL | ( | $xmldb_table, | |
$xmldb_index ) |
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 from sql_generator.
oracle_sql_generator::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.
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 from 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.
oracle_sql_generator::getCreateTempTableSQL | ( | $xmldb_table | ) |
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 from sql_generator.
oracle_sql_generator::getCreateTriggerSQL | ( | $xmldb_table, | |
$xmldb_field, | |||
$sequence_name ) |
Returns the code needed to create one trigger for the xmldb_table and xmldb_field passed.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
string | $sequence_name |
array | Array of SQL statements to create the sequence. |
|
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. |
oracle_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.
|
inherited |
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 in mssql_sql_generator, and sqlite_sql_generator.
|
inherited |
Given one xmldb_table and one xmldb_index, return the SQL statements needed to drop the index from the table.
xmldb_table | $xmldb_table | The xmldb_table instance to drop the index on. |
xmldb_index | $xmldb_index | The xmldb_index to drop. |
array | An array of SQL statements to drop the index. |
Reimplemented in sqlite_sql_generator.
|
inherited |
Given one xmldb_table and one xmldb_index, return the SQL statements needed to drop the index from the table.
xmldb_table | $xmldb_table | The table related to $xmldb_key. |
xmldb_key | $xmldb_key | The xmldb_key to drop. |
array | SQL statement to drop the xmldb_key. |
Reimplemented in sqlite_sql_generator.
oracle_sql_generator::getDropSequenceSQL | ( | $xmldb_table, | |
$xmldb_field, | |||
$include_trigger = false ) |
Returns the code needed to drop one sequence for the xmldb_table and xmldb_field passed Can, optionally, specify if the underlying trigger will be also dropped.
xmldb_table | $xmldb_table | The xmldb_table object instance. |
xmldb_field | $xmldb_field | The xmldb_field object instance. |
bool | $include_trigger |
array | Array of SQL statements to create the sequence. |
oracle_sql_generator::getDropTableExtraSQL | ( | $xmldb_table | ) |
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 from sql_generator.
oracle_sql_generator::getDropTableSQL | ( | $xmldb_table | ) |
Given one correct xmldb_table, returns the SQL statements to drop it (inside one array).
xmldb_table | $xmldb_table | The table to drop. |
array | SQL statement(s) for dropping the specified table. |
Reimplemented from 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. |
|
inherited |
Given one correct xmldb_key, returns its specs.
xmldb_table | $xmldb_table | The table related to $xmldb_key. |
xmldb_key | $xmldb_key | The xmldb_key's specifications requested. |
string | SQL statement about the xmldb_key. |
Reimplemented in sqlite_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. |
|
inherited |
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 in mssql_sql_generator, mysql_sql_generator, and sqlite_sql_generator.
|
inherited |
Given one xmldb_table and one xmldb_index, return the SQL statements needed to rename the index in the table Experimental! Shouldn't be used at all!
xmldb_table | $xmldb_table | The xmldb_table instance to rename the index on. |
xmldb_index | $xmldb_index | The xmldb_index to rename. |
string | $newname | The xmldb_index's new name. |
array | An array of SQL statements to rename the index. |
Reimplemented in sqlite_sql_generator.
|
inherited |
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!
xmldb_table | $xmldb_table | The table related to $xmldb_key. |
xmldb_key | $xmldb_key | The xmldb_key to rename. |
string | $newname | The xmldb_key's new name. |
array | SQL statement to rename the xmldb_key. |
Reimplemented in sqlite_sql_generator.
oracle_sql_generator::getRenameTableExtraSQL | ( | $xmldb_table, | |
$newname ) |
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 from 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.
oracle_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.
oracle_sql_generator::getSequenceFromDB | ( | $xmldb_table | ) |
Given one xmldb_table returns one string with the sequence of the table in the table (fetched from DB) The sequence name for oracle is calculated by looking the corresponding trigger and retrieving the sequence name from it (because sequences are independent elements)
xmldb_table | $xmldb_table | The xmldb_table object instance. |
string|bool | If no sequence is found, returns false |
Reimplemented from sql_generator.
oracle_sql_generator::getTableName | ( | xmldb_table | $xmldb_table, |
$quoted = true ) |
Given one xmldb_table, returns it's correct name, depending of all the parametrization Overridden to allow change of names in temp tables.
xmldb_table | table whose name we want |
boolean | to specify if the name must be quoted (if reserved word, only!) |
string | the correct name of the table |
Reimplemented from sql_generator.
oracle_sql_generator::getTriggerFromDB | ( | $xmldb_table | ) |
Given one xmldb_table returns one string with the trigger in the table (fetched from DB)
xmldb_table | $xmldb_table | The xmldb_table object instance. |
string|bool | If no trigger is found, returns false |
oracle_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.
oracle_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.
string oracle_sql_generator::$default_for_char = ' ' |
To define the default to set for NOT NULLs CHARs without default (null=do nothing).
note: Using this whitespace here because Oracle doesn't distinguish empty and null! :-(
|
inherited |
Template to drop FKs.
'TABLENAME' and 'KEYNAME' will be replaced from this template.
|
inherited |
Template to drop PKs.
'TABLENAME' and 'KEYNAME' will be replaced from this template.
|
inherited |
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 avoid outputting the rest of the field specs, leaving only the name and the sequence_name returned.
|
inherited |
To force the generator if NULL clauses must be specified.
It shouldn't be necessary.
string oracle_sql_generator::$statement_end = "\n/" |
To be automatically added at the end of each statement.
note: Using "/" because the standard ";" isn't good for stored procedures (triggers)