/**
* Returns an array of the fields in given table name.
*
* @param Model $model Model object to describe
* @return array Fields in table. Keys are name and type
*/
function &describe(&$model) {
$cache=parent::describe($model);
if ($cache != null) {
return $cache;
}
$fields = array();
// modifying this area to be incompliance with Progress DB's quirks
// Can't have those backtics on the table name...
$myTableName = $this->stripTics($this->fullTableName($model));
// Use Progress's SYSPROGRESS table to get the column attributes of the table
$sql = ' SELECT "SYSCOLUMNS"."COL",
"SYSCOLUMNS"."WIDTH",
"SYSCOLUMNS"."COLTYPE"
FROM "SYSPROGRESS"."SYSCOLUMNS" "SYSCOLUMNS"
WHERE "SYSCOLUMNS"."TBL"=\''.$myTableName.'\'';
$result = odbc_exec($this->connection, $sql);
while (odbc_fetch_row($result)) {
$column = odbc_result($result, 1);
$type = odbc_result($result, 3);
$fields[$column] = array('type' => $type);
}
$this->__cacheDescription($model->tablePrefix . $model->table, $fields);
return $fields;
}
/**
* Returns the table name stripped of the tic marks.
*
* @param string $tableName String to be stripped of tics for Progress DB use
* @return string "naked" table name, just the characters, ma'am
* @todo Clean up this whole thing for production
*/
function stripTics($tableName) {
$myTableNameLength = strlen($tableName);
$myTableName = substr($tableName, 1, $myTableNameLength - 2);
return $myTableName;
}