Re: PEAR - mssql.php

From: Date: Wed, 24 Jul 2002 12:49:25 +0000
Subject: Re: PEAR - mssql.php
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7935@lists.php.net to get a copy of this message
David Clark wrote: > > >>> > function tableInfo($result, $mode = null) > { > $count = 0; > $id = 0; > $res = array(); > > /* > * $result[]: > * [0]["table"] table name > * [0]["name"] field name > * [0]["type"] field type > * [0]["len"] field length > * [0]["flags"] field flags > * > */ > > // if $result is a string, then we want information about a > // table without a resultset > > if (is_string($result)) { > $id = @mssql_query("SELECT TOP 0 * FROM $result", > $this->connection); That seems to be the best option. I'll change that. > if (empty($id)) { > return $this->mssqlRaiseError(); > } > } else { // else we want information about a resultset > $id = $result; > if (empty($id)) { > return $this->mssqlRaiseError(); > } > } > > $i = 0; > while ($curField = mssql_fetch_field($id)) { > $res[$i]['table'] = (is_string($result)) ? $result : ''; > $res[$i]['name'] = $curField->name; > $res[$i]['type'] = $curField->type; > $res[$i]['len'] = $curField->max_length; > $res[$i]['flags'] = ''; > $i++; > } Do you mean that the functions mssql_field_name(), mssql_field_type(), etc does not work with FreeTSD? > // free the result only if we were called on a table > if (is_string($result)) { > @mssql_free_result($id); > } > return $res; > } Tomas V.V.Cox

« previous php.pear.dev (#7935) next »