Commit d0d20679 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 6b1c6196
...@@ -685,11 +685,39 @@ class Doctrine_Export extends Doctrine_Connection_Module ...@@ -685,11 +685,39 @@ class Doctrine_Export extends Doctrine_Connection_Module
} }
return $default; return $default;
} }
/**
* Obtain DBMS specific SQL code portion needed to set a CHECK constraint
* declaration to be used in statements like CREATE TABLE.
*
* @param array $definition check definition
* @return string DBMS specific SQL code portion needed to set a CHECK constraint
*/
public function getCheckDeclaration(array $definition)
{
$query .= 'CHECK ';
$constraints = array();
foreach ($definition as $field => $def) {
if (isset($def['min'])) {
$constraints[] = 'CHECK (' . $field . ' > ' . $def['min'] . ')';
}
if (isset($def['max'])) {
$constraints[] = 'CHECK (' . $field . ' < ' . $def['max'] . ')';
}
if (is_string($def)) {
$constraints[] = 'CHECK (' . $def . ')';
}
}
$query .= implode(', ', $constraints);
}
/** /**
* Obtain DBMS specific SQL code portion needed to set an index * Obtain DBMS specific SQL code portion needed to set an index
* declaration to be used in statements like CREATE TABLE. * declaration to be used in statements like CREATE TABLE.
* *
* @param string $charset name of the index * @param string $name name of the index
* @param array $definition index definition * @param array $definition index definition
* @return string DBMS specific SQL code portion needed to set an index * @return string DBMS specific SQL code portion needed to set an index
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment