ID: 8126
Updated by: vlad
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Sybase (dblib) related
PHP Version: 4.0.3pl1
Assigned To: joey
Comments:

Patch for the problem below. Please, review.

Apparently, dbopen() might or might not exist, depending on how you install FreeTDS. 
Sometimes FreeTDS provides you with tdsdbopen() instead.

The patch checks, if tdsdbopen() is available (a config.m4 modification), and, if yes, 
uses it. If not, it falls back to using dbopen().

Does anyone have objections to the way I implemented it (it's kinda crude, with 
#define, but I think this is the cleanest I can get). If someone has objections, 
please speak now.

If nobody has objections, someone with enough karma, please apply the patch (or give 
me karma and I'll apply it myself).



diff -urN php-4.0.5-tdsbroken/ext/sybase/config.m4 php-4.0.5/ext/sybase/config.m4
--- php-4.0.5-tdsbroken/ext/sybase/config.m4    Mon May  1 21:27:02 2000
+++ php-4.0.5/ext/sybase/config.m4      Tue May  1 16:28:14 2001
@@ -21,4 +21,8 @@
         AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
      ])
   AC_DEFINE(HAVE_SYBASE,1,[ ])
+  AC_CHECK_LIB(sybdb, tdsdbopen, 
+     [ AC_DEFINE(PHP_SYBASE_DBOPEN,tdsdbopen,[ ])
+       AC_DEFINE(DBMFIX,1,[ ]) ],
+     [ AC_DEFINE(PHP_SYBASE_DBOPEN,dbopen,[ ]) ])
 fi
diff -urN php-4.0.5-tdsbroken/ext/sybase/php_sybase_db.c 
php-4.0.5/ext/sybase/php_sybase_db.c
--- php-4.0.5-tdsbroken/ext/sybase/php_sybase_db.c      Sun Feb 25 22:07:24 2001
+++ php-4.0.5/ext/sybase/php_sybase_db.c        Tue May  1 15:42:54 2001
@@ -379,7 +379,7 @@
                                RETURN_FALSE;
                        }
                        /* create the link */
-                       if ((sybase.link=dbopen(sybase.login,host))==FAIL) {
+                       if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==FAIL) 
+{
                                /*php_error(E_WARNING,"Sybase:  Unable to connect to 
server:  %s",sybase_error(sybase));*/
                                efree(hashed_details);
                                dbloginfree(sybase.login);
@@ -415,7 +415,7 @@
                        sybase_ptr = (sybase_link *) le->ptr;
                        /* test that the link hasn't died */
                        if (DBDEAD(sybase_ptr->link)==TRUE) {
-                               if 
((sybase_ptr->link=dbopen(sybase_ptr->login,host))==FAIL) {
+                               if 
+((sybase_ptr->link=PHP_SYBASE_DBOPEN(sybase_ptr->login,host))==FAIL) {
                                        /*php_error(E_WARNING,"Sybase:  Link to server 
lost, unable to reconnect");*/
                                        zend_hash_del(&EG(persistent_list), 
hashed_details, hashed_details_length+1);
                                        efree(hashed_details);
@@ -462,7 +462,7 @@
                        RETURN_FALSE;
                }
                
-               if ((sybase.link=dbopen(sybase.login,host))==NULL) {
+               if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==NULL) {
                        /*php_error(E_WARNING,"Sybase:  Unable to connect to server:  
%s",sybase_error(sybase));*/
                        efree(hashed_details);
                        RETURN_FALSE;



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

[2000-12-11 14:11:56] [EMAIL PROTECTED]
Reclassify. --with-sybase is dblib, not ctlib.

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

[2000-12-11 14:11:44] [EMAIL PROTECTED]
Reclassify. --with-sybase is dblib, not ctlib.

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

[2000-12-05 14:13:34] [EMAIL PROTECTED]
when i load apache, i get : 
cannot load libphp4.so into server: undefiend symbol: dbopen
httpd could not be started.

I have apache 1.3.14 and php 4.0.3pl1.

apache configure..
./configure --prefix=/www --enable-module=so

php configure..
./configure --with-apxs=/www/bin/apxs --with-sybase=/usr/local/freetds

I have freetds 0.51.

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



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=8126&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to