| | |
| | | // | Lorenzo Alberton <l.alberton@quipo.it> |
|
| | | // +----------------------------------------------------------------------+
|
| | | //
|
| | | // $Id: mssql.php,v 1.49 2008/02/17 15:30:57 quipo Exp $
|
| | | // $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ |
| | | //
|
| | |
|
| | | require_once 'MDB2/Driver/Reverse/Common.php';
|
| | |
| | | $default = false;
|
| | | if (array_key_exists('column_default', $column)) {
|
| | | $default = $column['column_default'];
|
| | | if (is_null($default) && $notnull) {
|
| | | if ((null === $default) && $notnull) { |
| | | $default = '';
|
| | | } elseif (strlen($default) > 4
|
| | | && substr($default, 0, 1) == '('
|
| | |
| | | 'notnull' => $notnull,
|
| | | 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
|
| | | );
|
| | | if (!is_null($length)) {
|
| | | if (null !== $length) { |
| | | $definition[0]['length'] = $length;
|
| | | }
|
| | | if (!is_null($unsigned)) {
|
| | | if (null !== $unsigned) { |
| | | $definition[0]['unsigned'] = $unsigned;
|
| | | }
|
| | | if (!is_null($fixed)) {
|
| | | if (null !== $fixed) { |
| | | $definition[0]['fixed'] = $fixed;
|
| | | }
|
| | | if ($default !== false) {
|
| | | if (false !== $default) { |
| | | $definition[0]['default'] = $default;
|
| | | }
|
| | | foreach ($types as $key => $type) {
|
| | |
| | |
|
| | | $index_name_mdb2 = $db->getIndexName($index_name);
|
| | | $result = $db->queryRow(sprintf($query, $index_name_mdb2));
|
| | | if (!PEAR::isError($result) && !is_null($result)) {
|
| | | if (!PEAR::isError($result) && (null !== $result)) { |
| | | // apply 'idxname_format' only if the query succeeded, otherwise
|
| | | // fallback to the given $index_name, without transformation
|
| | | $index_name = $index_name_mdb2;
|
| | |
| | |
|
| | | $constraint_name_mdb2 = $db->getIndexName($constraint_name);
|
| | | $result = $db->queryRow(sprintf($query, $constraint_name_mdb2));
|
| | | if (!PEAR::isError($result) && !is_null($result)) {
|
| | | if (!PEAR::isError($result) && (null !== $result)) { |
| | | // apply 'idxname_format' only if the query succeeded, otherwise
|
| | | // fallback to the given $index_name, without transformation
|
| | | $constraint_name = $constraint_name_mdb2;
|