cvs: pear /MDB/MDB mssql.php

From: Date: Mon, 15 Sep 2003 14:21:51 +0000
Subject: cvs: pear /MDB/MDB mssql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-12753@lists.php.net to get a copy of this message
lsmith Mon Sep 15 10:21:51 2003 EDT Modified files: /pear/MDB/MDB mssql.php Log: - ported another fix to tableinfo from mssql PEAR::DB driver (untested) - this time i even removed the DB specific method calls :-) Index: pear/MDB/MDB/mssql.php diff -u pear/MDB/MDB/mssql.php:1.37 pear/MDB/MDB/mssql.php:1.38 --- pear/MDB/MDB/mssql.php:1.37 Mon Sep 15 08:44:47 2003 +++ pear/MDB/MDB/mssql.php Mon Sep 15 10:21:51 2003 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.37 2003/09/15 12:44:47 lsmith Exp $ +// $Id: mssql.php,v 1.38 2003/09/15 14:21:51 lsmith Exp $ // require_once 'MDB/Common.php'; @@ -844,28 +844,32 @@ */ function _mssql_field_flags($table, $column) { - static $flags = false; + static $current_table = null; + static $flags; // At the first call we discover the flags for all fields - if ($flags === false) { + if ($table != $current_table) { $flags = array(); // find nullable fields $q_nulls = "SELECT syscolumns.name, syscolumns.isnullable FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.name ='$table' AND syscolumns.isnullable = 1"; - $res = $this->getAll($q_nulls, DB_FETCHMODE_ASSOC); + $res = $this->query($q_nulls, null, false); + $res = $this->fetchAll($res, MDB_FETCHMODE_ASSOC); foreach ($res as $data) { if ($data['isnullable'] == 1) { $flags[$data['name']][] = 'isnullable'; } } // find primary keys - $res2 = $this->getAll("EXEC SP_PKEYS[$table]", DB_FETCHMODE_ASSOC); + $res2 = $this->query("EXEC SP_PKEYS[$table]", null, false); + $res2 = $this->fetchAll($res, MDB_FETCHMODE_ASSOC); foreach ($res2 as $data) { if (!empty($data['COLUMN_NAME'])) { $flags[$data['COLUMN_NAME']][] = 'primary_key'; } } + $current_table = $table; } if (isset($flags[$column])) { return implode(',', $flags[$column]);

« previous php.pear.cvs (#12753) next »