mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
Extending getCheckConstraintsFromDB() to support a new parameter
used to filter what field in the table we want to know its check constraints
This commit is contained in:
parent
4cc68ea184
commit
4215e41ecb
@ -1193,6 +1193,15 @@ class XMLDBgenerator {
|
||||
return array('Code to drop one default goes to getDropDefaultSQL()');
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable and one optional XMLDBField, return one array with all the check
|
||||
* constrainst found for that table (or field). Must exist for each DB supported.
|
||||
* (usually invoked from find_check_constraint_name)
|
||||
*/
|
||||
function getCheckConstraintsFromDB($xmldb_table, $xmldb_field=null) {
|
||||
return array('Code to fetch check constraints goes to getCheckConstraintsFromDB()');
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable and one XMLDBField, return the SQL statements needded to add its default
|
||||
* (usually invoked from getModifyDefaultSQL()
|
||||
|
@ -444,12 +444,14 @@ class XMLDBmssql extends XMLDBgenerator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* 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
|
||||
*/
|
||||
function getCheckConstraintsFromDB($xmldb_table) {
|
||||
function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) {
|
||||
|
||||
$results = array();
|
||||
|
||||
|
@ -247,14 +247,16 @@ class XMLDBmysql extends XMLDBGenerator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* 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
|
||||
* MySQL doesn't have check constraints in this implementation, but
|
||||
* we return them based on the enum fields in the table
|
||||
*/
|
||||
function getCheckConstraintsFromDB($xmldb_table) {
|
||||
function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) {
|
||||
|
||||
global $db;
|
||||
|
||||
|
@ -477,12 +477,14 @@ class XMLDBoci8po extends XMLDBgenerator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* 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
|
||||
*/
|
||||
function getCheckConstraintsFromDB($xmldb_table) {
|
||||
function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) {
|
||||
|
||||
$results = array();
|
||||
|
||||
|
@ -305,6 +305,15 @@ class XMLDBpostgres7 extends XMLDBgenerator {
|
||||
$notnullchanged = false;
|
||||
}
|
||||
|
||||
/// TODO: Some combinations like
|
||||
/// TODO: integer->integer
|
||||
/// TODO: integer->text
|
||||
/// TODO: number->text
|
||||
/// TODO: text->text
|
||||
/// TODO: do not require the use of temp columns, because PG 8.0 supports them automatically
|
||||
/// TODO: with a simple "alter table zzz alter column yyy type new specs"
|
||||
/// TODO: Must be implemented that way. Eloy 09/2007
|
||||
|
||||
/// If the type or the precision or the decimals have changed, then we need to:
|
||||
/// - create one temp column with the new specs
|
||||
/// - fill the new column with the values from the old one (casting if needed)
|
||||
@ -422,12 +431,14 @@ class XMLDBpostgres7 extends XMLDBgenerator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* Given one XMLDBTable returns one array with all the check constrainsts
|
||||
* 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
|
||||
*/
|
||||
function getCheckConstraintsFromDB($xmldb_table) {
|
||||
function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) {
|
||||
|
||||
$results = array();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user