[ Index ] |
|
Code source de Symfony 1.0.0 |
1 2 3 Creole ODBC Bridge Driver 4 ========================= 5 6 7 I. Overview 8 ----------- 9 10 In the text below, the word "driver" can get somewhat muddled since there are 11 two libraries concerned here (Creole & ODBC). So, we'll use the term "bridge 12 driver" to refer to Creole's ODBC bridge driver, and "ODBC driver" to refer to 13 an ODBC database driver. 14 15 The Creole ODBC Bridge driver provides a solution for databases which 16 currently have no PHP-native interface. It is currently in an experimental 17 stage of development. It has been tested with two ODBC drivers (Sequiter's 18 CodeBase ODBC driver and the MySQL ODBC driver (as a baseline test)). To 19 use any other ODBC drivers you may need to write your own ODBCAdapter-derived 20 class (see below). 21 22 23 II. ODBCAdapter 24 --------------- 25 26 Because ODBC itself is a database abstraction library, the bridge driver needed 27 a way of hiding ODBC driver-specific behavior. The solution to this was to 28 create an adapter layer (akin to how the Propel runtime engine works). Think of 29 it as a sub-driver for the bridge driver. Any ODBC driver-specific behavior is 30 handled by an ODBCAdapter-derived class. To use a specific adapter class, you 31 specify its name via a parameter in the connection string: 32 33 odbc://localhost/DSN=CodeBase;?adapter=CodeBase 34 35 The string above will load the following file as the adapter to use with the 36 bridge driver: creole/drivers/odbc/adapters/CodeBaseAdapter.php 37 38 Some ODBC drivers are limited in support for various Creole features. The 39 ODBCAdapter also provides a method for emulation of some of these missing 40 features: 41 42 -The emulatePrepareStmt() method provides a switch for enabling prepared 43 statement emulation for drivers that do not support (or have trouble with) 44 prepared statements. This emulation is disabled by default. 45 46 -The hasLimitOffset() method provides a switch for enabling LIMIT/OFFSET 47 emulation for drivers that do not support this. This emulation is enabled 48 by default. The LIMIT/OFFSET emulation was borrowed from the MSSQL Creole 49 driver. 50 51 -The createResultSet() method provides a switch for enabling cached 52 result sets. To enable this feature, return an instance of 53 ODBCCachedResultSet in the createResultSet() method of your ODBCAdapter- 54 derived class. This can be useful as a workaround for ODBC drivers which 55 lack support for record count retrieval, reverse/absolute cursor 56 scrolling, etc. In most cases, result rows are cached on-demand. So if 57 you only read the first couple rows of a result, then only those rows will 58 be cached. 59 60 -The getIdGenerator() method provides a switch for enabling sequence 61 emulation. This feature is enabled by default in ODBCAdapter and is 62 implemented in the ODBCIdGenerator class. The emulation code was inspired 63 by the PEAR::DB nextID() method. If your database supports sequences or 64 autoincrement natively, you can return your own IdGenerator-derived class 65 instead. Check out some of the other Creole drivers for IdGenerator 66 examples. 67 68 69 III. Incomplete Features 70 ------------------------ 71 72 -The database metadata classes are not fully tested/complete. Specifically, 73 the ODBCDatabaseInfo class does not currently set the database name. There 74 may be other problems as well. 75 76 -The Creole CallableStatement class (stored procedures) is not currently 77 implemented. No immediate plans to do this in the future, but it looks 78 feasible. 79 80 81 IV. Known Issues 82 ---------------- 83 84 This driver was developed using the PHP v5.0 final build. During the course 85 of testing I uncovered several bugs in the php_odbc module. I submitted 86 patches for these bugs, but have not yet received word that they were 87 committed (they were just submitted this morning). If you want more details 88 on the problems I encountered or would like a copy of the patches, please 89 e-mail me (dlawson@masterytech.com). 90
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |