[轉貼]建議使用ADODB LIB |
|
klmer
一般會員 發表:11 回覆:46 積分:13 註冊:2002-03-13 發送簡訊給我 |
為達到程式碼不必因為DB更換而需要大幅修改,建議可以考慮使用像ADODB一類的library,聽說未來有將這種一致性存取library整合進PHP core kernel的計畫。 介紹: PHP's database access functions are not standardised. This creates a need for a database class library to hide the differences between the different databases (encapsulate the differences) so we can easily switch databases. We currently support MySQL, Interbase, Oracle, Microsoft SQL Server, Sybase, PostgreSQL, FrontBase, Foxpro, Access, ADO and ODBC. PHP4 supports session variables. You can store your session information using ADODB for true portability and scalability. See adodb-session.php for more information. Unique Features of ADODB
|
Name | Database | RecordCount() usable | Prerequisites | Operating Systems |
access | Microsoft Access. You need to create an ODBC DSN. | N | ODBC | Windows only |
ado | Generic ADO, not tuned for specific databases. Slower than ODBC, but allows DSN-less connections. | ? depends on database | ADO and OLEDB provider | Windows only |
ado_access | Microsoft Access using ADO. Slower than ODBC, but allows DSN-less connections. | N | ADO and OLEDB provider for Access | Windows only |
vfp | Microsoft Visual FoxPro. You need to create an ODBC DSN. | N | ODBC | Windows only |
ibase | Interbase 6 or earlier. Some users report you might need to use this $db->PConnect('localhost:c:\ibase\employee.gdb', "sysdba", "masterkey") to connect. | N | Interbase client | Unix and Windows |
firebird | Firebird version of interbase. | N | Interbase client | Unix and Windows |
borland_ibase | Borland version of Interbase 6.5 or later. Very sad that the forks differ. | N | Interbase client | Unix and Windows |
informix | Informix. Still very much a beta experimental version - use at your own risk. | Y - but this is an unreliable estimate, so probably should return -1 in future versions | Informix client | Unix and Windows |
mssql | Microsoft SQL Server 7. Works with Microsoft SQL Server 2000 also. Note that date formating is problematic with this driver. For example, the PHP mssql extension does not return the seconds for datetime! | Y | Mssql client | Unix and Windows. Unix install howto. |
mysql | MySQL without transaction support (3.22) | Y | MySQL client | Unix and Windows |
mysqlt or maxsql | MySQL with transaction support (3.23) | Y | MySQL client | Unix and Windows |
oci8 | Oracle 8/9. Has more functionality than oracle driver (eg. Affected_Rows). You might have to putenv('ORACLE_HOME=...') before Connect/PConnect. There are 2 ways of connecting - with server IP and service name: PConnect('serverip:1521','scott','tiger','service') or using an entry in the tnsnames.ora: PConnect('', 'scott', 'tiger', 'tnsname'). | N | Oracle client | Unix and Windows |
oci8po | Oracle 8/9 portable driver. This is nearly identical with the oci8 driver except (a) bind variables in Prepare() use the ? convention, instead of :bindvar, (b) field names use the more common PHP convention of lowercase names. Use this driver if porting from other databases is important. Otherwise the oci8 driver offers better performance. | N | Oracle client | Unix and Windows |
odbc | Generic ODBC, not tuned for specific databases. To connect, use PConnect('DSN','user','pwd'). | ? depends on database | ODBC | Unix and Windows. Unix hints. |
oracle | Oracle 7 or 8 support. Obsolete. | N | Oracle client | Unix and Windows |
postgres | PostgreSQL which does not support LIMIT internally. | Y | PostgreSQL client | Unix and Windows. |
postgres7 | PostgreSQL which supports LIMIT and other version 7 functionality. | Y | PostgreSQL client | Unix and Windows. |
sybase | Sybase. | Y | Sybase client | Unix and Windows. Unix hints. |
db2 | DB2. Warning: this is experimental. Please email me if there are problems. | Y | DB2 CLI/ODBC interface | Unix and Windows. Unix install hints. |
fbsql | FrontBase. Warning: this is experimental. Please email me if there are problems. | Y | ? | Unix and Windows |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |