An error occurred while connecting to sybase in adodb5.
Source: Internet
Author: User
An error occurred when adodb5 was connected to sybase-Linux Enterprise Application-Linux server application information. For details, refer to the following section. This error is rather embarrassing, so let's talk about it. Environment: php 5.2.3, adodb 5.04, ubuntu 7.10 Gutsy.
Two days ago, to use adodb and sqlite3, we upgraded adodb to adodb5 (5.0.4) that only supports php5. Two days later, we found that another program using sybase was abnormal, exit without running, without any error information. Add die ('Hi'); to locate the error in $ db = & ADONewConnection ('sybase '); this line.
Adodb's support for sybase has not been strong, but it has not yet reached the point where it is not working, but there is no prompt for this error. It is really hard to find it. Instead, use ZendStudio to trace it, with the simplest small program, of course, it ends directly without a job error:
Compile Error:/home/fwolf/dev/include/adodb5/drivers/adodb-sybase.inc.php line 271-Cannot make static method ADOConnection: UnixDate () non static in class ADODB_sybase
I checked with the error message online and it turned out to be in the adodb-sybase.inc.php file, where the beginning of line 180 defined two functions UnixDate () and UnixTimeStamp () (the error is prompted in line 271, the second row is the end position of the definition of the class ADODB_sybase, so this error is generated during code compilation rather than runtime), and the two functions are in the adodb. inc. php is defined as a static function (rows 2481 and 2505). php5 does, so the compilation error occurs and the program is aborted. In the 4089 line of adodb. inc. php, the @ symbol is added when the adodb-sybase.inc.php is included:
@ Include_once ($ file );
Therefore, the error message is blocked and not displayed. Due to Debug, ZendStudio may catch all errors and ignore @. After @ is removed, an error can be reported if you run the command directly.
I have figured out how to change it. I think there are two ways:
Modify adodb. inc. php without defining the UnixDate () function as static.
Modify the adodb-sybase.inc.php to cancel duplicate definitions for both functions.
In contrast, the first method is better, and the second method may cause other errors. Therefore, four static statements are removed:
Line 2481: ADOConnection: UnixDate ()
Line 2505: ADOConnection: UnixTimeStamp ()
Line 3204: ADORecordSet: UnixDate ()
Line 3215: ADORecordSet: UnixTimeStamp ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service