Edit report at http://bugs.php.net/bug.php?id=48122&edit=1

 ID:                 48122
 Updated by:         ka...@php.net
 Reported by:        theodoreb at goshen dot edu
 Summary:            odbc_cursor() returns empty name
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            ODBC related
 Operating System:   Gentoo Linux
 PHP Version:        5.2.9
-Assigned To:        
+Assigned To:        kalle
 Block user comment: N
 Private report:     N

 New Comment:

Could you try the attached patch?



According to the ODBC specification available at MSDN, then its possible
for the SQLGetCursorName function to point to a NULL name where the
length and return codes still are correct, so if thats the case it would
fallback to the PHP cursor name which hopefully is the cause of this as
I'm unable to reproduce it


Previous Comments:
------------------------------------------------------------------------
[2011-01-17 16:48:41] ka...@php.net

The following patch has been added/updated:

Patch Name: odbc-bug-48122
Revision:   1295279320
URL:       
http://bugs.php.net/patch-display.php?bug=48122&patch=odbc-bug-48122&revision=1295279320

------------------------------------------------------------------------
[2009-05-06 22:13:31] theodoreb at goshen dot edu

Thanks for responding. 



I tried your code as follow:



error_reporting(E_ALL);

$conn = odbc_connect("mssql", "login", "passwd",SQL_CUR_USE_ODBC);

var_dump($conn, odbc_errormsg($conn));

$query = "SELECT * FROM tablename";

$cur = odbc_exec($conn,$query);

var_dump(odbc_errormsg($conn));

echo odbc_cursor($cur);

var_dump(odbc_errormsg($conn));



Here is the result:

resource(16) of type (odbc link) string(0) "" string(0) "" string(0) ""

------------------------------------------------------------------------
[2009-05-06 21:37:31] j...@php.net

Try this:



<?php

error_reporting(E_ALL);

$conn = odbc_connect("mssql", "login", "passwd",SQL_CUR_USE_ODBC);

var_dump($conn, odbc_errormsg($conn));

$query = "SELECT * FROM tablename";

$cur = odbc_exec($conn,$query);

var_dump(odbc_errormsg($conn));

echo odbc_cursor($cur);

var_dump(odbc_errormsg($conn));

?>



------------------------------------------------------------------------
[2009-04-30 16:08:45] theodoreb at goshen dot edu

Description:
------------
odbc_cursor() returns empty string when the connection is created using
odbc_connect() with SQL_CUR_USE_ODBC as the fourth parameter.



Using unixODBC-2.2.12 and freetds-0.82-r2 to connect to Microsoft SQL
Server 2008.

Reproduce code:
---------------
$conn = odbc_connect("mssql", "login", "passwd",SQL_CUR_USE_ODBC);

$query = "SELECT *

            FROM tablename";

$cur = odbc_exec($conn,$query);

echo odbc_cursor($cur);



Expected result:
----------------
cursor name of $cur, something like SQL_CURa70b90

Actual result:
--------------
empty string ''


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=48122&edit=1

Reply via email to