線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2333
推到 Plurk!
推到 Facebook!

[轉貼]建議使用ADODB LIB

 
klmer
一般會員


發表:11
回覆:46
積分:13
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-05-08 11:15:24 IP:140.92.xxx.xxx 未訂閱
為達到程式碼不必因為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

  • Easy for Windows programmers to adapt to because many of the conventions are similar to Microsoft's ADO.
  • Unlike other PHP database classes which focus only on select statements, we provide support code to handle inserts and updates which can be adapted to multiple databases quickly. Methods are provided for date handling, string concatenation and string quoting characters for differing databases.
  • A metatype system is built in so that we can figure out that types such as CHAR, TEXT and STRING are equivalent in different databases.
  • Easy to port because all the database dependant code are stored in stub functions. You do not need to port the core logic of the classes.
  • PHP4 session support. See adodb-session.php.

Databases Supported

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
ddy
站務副站長


發表:262
回覆:2105
積分:1169
註冊:2002-07-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-07-13 13:35:05 IP:61.59.xxx.xxx 未訂閱
我也有這種看法,我習慣用ADODB 不過我在delphi 裡使用Comobj 建立ADODB.Connection 與ADODB.Recordset 物件操作資料庫 可是卻無法與DBGrid 等相關元件整合 因為Recordset 無法轉換成TADODataSet 也看過ADODB的Code 印出來數百頁,看得眼精都花了@_@ 那位先進有這樣的經驗,可以來討論討論
系統時間:2024-04-29 4:51:03
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!