Re: DB tableInfo problem
| From: | Pablo Dall'Oglio | Date: | Mon, 21 Oct 2002 23:42:29 +0000 |
| Subject: | Re: DB tableInfo problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2529@lists.php.net to get a copy of this message | ||
I have to change mssql.php
It's cos your system is Linux...
Try this code in mssql.php. I'm not sure, it's a lil colaboration of my friend Bruno
Depero.
Perhaps, I can change this file on CVS and you can test it later for me. Because I don't have
mssql installed here.
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
{
$res[$i]['name'] = @mssql_field_name($id, $i);
$res[$i]['type'] = @mssql_field_type($id, $i);
$res[$i]['len'] = @mssql_field_length($id, $i);
}
else
{
@mssql_field_seek($id, $i);
$field=@mssql_fetch_field($id);
$res[$i]['name'] = $field->name;
$res[$i]['len'] = $field->max_length;
//data type - not so good for performance/server load...
$s1 = "select DATA_TYPE, CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS ".
//column_source returns the field name ?!? "where
TABLE_NAME='".$field->column_source."' and
COLUMN_NAME='".$field->name."'";
"where COLUMN_NAME='".$field->name."'";
$ar = @mssql_fetch_row($id1);
$res[$i]['type'] = $ar[0];
@mssql_free_result($id1);
}
On Mon, 21 Oct 2002 14:16:09 -0500
Avi Schwartz <avi@CFFtechnologies.com> wrote:
> Hi,
>
> I am running under Linux and using freetds to connect to a DB on MS
> SQL-Server. In general it works very well, except when I try to use the
> tableInfo() function to retrieve information from a result set as in:
>
> print_r($result->tableInfo());
>
> The page aborts at this call. Using the Zend debugger I traced it down into
> the mssql.php file and I found that it breaks on the following line:
>
> $res[$i]['name'] = @mssql_field_name($id, $i);
>
> The error I see in the debuger is:
>
> Call to undefined function: mssql_field_name()
>
> What may the problem be? Is my installation broken? Am I missing some file
> or library?
>
> Thanks,
> Avi
> --
> Avi Schwartz Universe-watching, like golf and aging,
> avi@CFFtechnologies.com promotes humility - William R. Everdell
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
+--------------------------------------------------+
| _ Pablo Dall'Oglio (pablo@php.net) |
| °v° Univates - IT Department +55 51 3714-7040 |
| /(_)\ Life is a jorney, not a destination... |
| ^ ^ Linux User n.223253, Lajeado, RS - Brasil |
+--------------------------------------------------+
: Programmer, pilot, wine taster and a half musician