Permalink
Browse files

Reformating SQLServer 'describe' query.

  • Loading branch information...
markstory committed Jun 22, 2011
1 parent 92bbf11 commit 936d068eecb225067cb7096c3d92aaef7b0b4e1d
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -194,7 +194,18 @@ public function describe($model) {
}
$fields = array();
$table = $this->fullTableName($model, false);
- $cols = $this->_execute("SELECT COLUMN_NAME as Field, DATA_TYPE as Type, COL_LENGTH('" . $table . "', COLUMN_NAME) as Length, IS_NULLABLE As [Null], COLUMN_DEFAULT as [Default], COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key], NUMERIC_SCALE as Size FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" . $table . "'");
+ $cols = $this->_execute(
+ "SELECT
+ COLUMN_NAME as Field,
+ DATA_TYPE as Type,
+ COL_LENGTH('" . $table . "', COLUMN_NAME) as Length,
+ IS_NULLABLE As [Null],
+ COLUMN_DEFAULT as [Default],
+ COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key],
+ NUMERIC_SCALE as Size
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE TABLE_NAME = '" . $table . "'"
+ );
if (!$cols) {
throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $model->name));
}

0 comments on commit 936d068

Please sign in to comment.