Re: MSSQL & Data Object

From: Date: Sun, 14 Sep 2003 16:32:03 +0000
Subject: Re: MSSQL & Data Object
References: 1 2 3  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-7799@lists.php.net to get a copy of this message
can you file it as a bug - http://pear.php.net/bugs/report.php?package=DB cvs diff -u is the prefered format for diffs. (but dont fret if you cant get it to work.. - the information below is OK.) Regards Alan Joern Barthel wrote:
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 --
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.general (#7799) next »