Re[2]: [PEAR] MSSQL & Data Object
| From: | Joern Barthel | Date: | Sun, 14 Sep 2003 13:12:17 +0000 |
| Subject: | Re[2]: [PEAR] MSSQL & Data Object | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7796@lists.php.net to get a copy of this message | ||
Hi Markus,
no need to quote yourself - I wasn't accusing you of anything. It was
merely my intention to doublecheck if there was an error on my side.
The usefulness of the hack is fairly limited (to table-name based
tableInfo() calls and primary keys) but it works for me.
In mssql.php:
500c500
< $res[$i]['flags'] = '';
---
> $res[$i]['flags'] = $this->_mssql_field_flags((is_string($result))
> ? $result : null, @mssql_field_name($id, $i));
511c511
< $res[$i]['flags'] = '';
---
> $res[$i]['flags'] = $this->_mssql_field_flags((is_string($result))
> ? $result : null, @mssql_field_name($id, $i));
525a526,549
> }
>
> function _mssql_field_flags ($table, $field) {
>
> static $tableName;
> static $pkeys = array();
>
> if (!is_null($table) && $table != $tableName) {
>
> $tableName = $table;
> $pkeys = array();
>
> $result = mssql_query("EXEC SP_PKEYS[$table]");
>
> while ($row = mssql_fetch_array($result))
> array_push($pkeys, $row['COLUMN_NAME']);
>
> }
>
> if (in_array($field, $pkeys))
> return("primary_key");
>
> return("");
>
Kind regards,
rgs/joern
--