Commit 1b0e2e50 authored by Juozas Kaziukenas's avatar Juozas Kaziukenas

Fixed fetch() and default column values retrieval

Signed-off-by: 's avatarJuozas Kaziukenas <juozas@juokaz.com>
parent 347d8d13
...@@ -211,7 +211,13 @@ class SqlsrvStatement implements \Doctrine\DBAL\Driver\Statement ...@@ -211,7 +211,13 @@ class SqlsrvStatement implements \Doctrine\DBAL\Driver\Statement
throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle); throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle);
} }
return sqlsrv_fetch_array($this->_sth, self::$fetchStyleMap[$fetchStyle]); $result = sqlsrv_fetch_array($this->_sth, self::$fetchStyleMap[$fetchStyle]);
if (!$result) {
return false;
} else {
return $result;
}
} }
/** /**
......
...@@ -151,16 +151,23 @@ class MsSqlSchemaManager extends AbstractSchemaManager ...@@ -151,16 +151,23 @@ class MsSqlSchemaManager extends AbstractSchemaManager
'fixed' => (bool) $fixed 'fixed' => (bool) $fixed
); );
// @todo
$default = $tableColumn['COLUMN_DEF'];
while($default != ($default2 = preg_replace("/^\((.*)\)$/", '$1', $default))) {
$default = $default2;
}
$options = array( $options = array(
'length' => ((int) $tableColumn['LENGTH'] == 0) ? null : (int) $tableColumn['LENGTH'], 'length' => ((int) $tableColumn['LENGTH'] == 0) ? null : (int) $tableColumn['LENGTH'],
'unsigned' => (bool)$unsigned, 'unsigned' => (bool)$unsigned,
'fixed' => (bool)$fixed, 'fixed' => (bool)$fixed,
'default' => $tableColumn['COLUMN_DEF'] !== '(NULL)' ? $tableColumn['COLUMN_DEF'] : null, 'default' => $default !== 'NULL' ? $default : null,
'notnull' => (bool) ($tableColumn['IS_NULLABLE'] != 'YES'), 'notnull' => (bool) ($tableColumn['IS_NULLABLE'] != 'YES'),
'scale' => $tableColumn['SCALE'], 'scale' => $tableColumn['SCALE'],
'precision' => $tableColumn['PRECISION'], 'precision' => $tableColumn['PRECISION'],
'platformOptions' => array( 'platformOptions' => array(
// @todo
'primary' => false, 'primary' => false,
'unique' => false, 'unique' => false,
'autoincrement' => false, 'autoincrement' => false,
......
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