ID:               28090
 Updated by:       [EMAIL PROTECTED]
 Reported By:      richard dot quadling at carval dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: Windows XP Pro SP1
 PHP Version:      4.3.6
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dup to bug #27249.


Previous Comments:
------------------------------------------------------------------------

[2004-04-21 14:15:18] richard dot quadling at carval dot co dot uk

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 this bug report at http://bugs.php.net/?id=28090&edit=1

Reply via email to