ODBC Column Name Truncation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When retrieving ODBC results from Sybase SQL Anywhere 6 and 9, the
column names are being truncated to 31 characters. --

<?php
$DBN = 'thedbn';
$UID = 'theuid';
$PWD = 'thepws';

$CONN = odbc_connect( $DBN, $UID, $PWD ) or die( "Cannot connect to
$DBN."); $sql = "select * from crap"; $result = odbc_exec( $CONN,
$sql );

for( $i = 1 ; $i <= odbc_num_fields( $result ) ; $i++ ) {
   $name = odbc_field_name( $result, $i );
   ${$name} = odbc_result( $result, $name );
   print( "$i: $name - ${$name}\n" );
}
?>

Result:
1: key - 4
2: a_really_long_name_that_is_long - 5
3: longer_name - 6

I expected #2 to have the name:
a_really_long_name_that_is_longer_than_31_characters

-- This happens even if the column name is simply specified using sql
'AS' (i.e. "select column as
a_really_long_name_that_is_longer_than_31_characters from crap" would
still return "a_really_long_name_that_is_long" as the column name).

Using PHP 4.3.4 on Windows 2000 Server. Have also tried on SUSE Linux
as well as with PHP 5.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux