From:             richard dot quadling at carval dot co dot uk
Operating system: Windows XP Pro SP1
PHP version:      4.3.6
PHP Bug Type:     Documentation problem
Bug description:  odbc_data_source does not return info about current connection.

Description:
------------
The documentation of odbc_data_source suggests that the information about
the current connection will be used to provide the server and the
description as part of the results.

This is NOT the case.

The function odbc_data_source returns information for all DSNs defined.

I am not sure if the bug is in the manual or the function.

The reason I say "suggest" is that you have to provide a connection.

Reproduce code:
---------------
>From the example in the user notes.

<?php
// Example usage:

// Connect to a ODBC database that exists on your system
$link = odbc_connect("HRUnityOnline", "CARVAL_USER", "pswd") or
die(odbc_errormsg() );

$result = @odbc_data_source( $link, SQL_FETCH_FIRST );
while($result)
{
   echo "DSN: " . $result['server'] . " - " . $result['description'] .
"<br>\n";
   $result = @odbc_data_source( $link, SQL_FETCH_NEXT );
}

odbc_close($link); 
?>

Expected result:
----------------
DSN: HRUnityOnline - SQL Server

To acheive the desired result (i.e. you want to see the type of server
type for the current DSN) ...

<?php
// Example usage:

$sDSN = "HRUnityOnline";
// Connect to a ODBC database that exists on your system
$link = odbc_connect($sDSN, "CARVAL_USER", "pswd") or die(odbc_errormsg()
);

$result = @odbc_data_source( $link, SQL_FETCH_FIRST );
while($result)
{
if ($result['server'] == $sDSN)
        {
        echo "DSN: " . $result['server'] . " - " . $result['description'] .
"<br>\n";
        break;
        }
$result = @odbc_data_source( $link, SQL_FETCH_NEXT );
}

odbc_close($link); 
?>

Actual result:
--------------
DSN: SageLine132 - Sage Line 100
DSN: SageLine50v10 - Sage Line 50 v10
DSN: Payroll32 - Microsoft Access Driver (*.mdb)
DSN: DBISAMTEST - DBISAM 3 ODBC Driver
DSN: HRUnityOnline - SQL Server
DSN: PCS - SQL Server
DSN: Bandvulc_PCS - SQL Server
DSN: Bandvulc CCC - Sage Line 100


-- 
Edit bug report at http://bugs.php.net/?id=28090&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28090&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28090&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28090&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28090&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28090&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28090&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28090&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28090&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28090&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28090&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28090&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28090&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28090&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28090&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28090&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28090&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28090&r=float

Reply via email to