[ Index ] |
|
Code source de Symfony 1.0.0 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 377 lignes (15 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
Creole:: (6 méthodes):
registerDriver()
deregisterDriver()
getDriver()
getConnection()
parseDSN()
import()
registerDriver($phptype, $dotpath) X-Ref |
Register your own RDBMS driver class. You can use this to specify your own class that replaces a default driver or adds support for a new driver. Register your own class by specifying the 'phptype' (e.g. mysql) and a dot-path notation to where your Connection class is relative to any location on the include path. You can also specify '*' as the phptype if you want to register a driver that will handle any native type (e.g. if creating a set of decorator classes that log SQL before calling native driver methods). YOU CAN ONLY REGISTER ONE CATCHALL ('*') DRIVER. <p> Note: the class you need to register is your Connection class because this is the class that's responsible for instantiating the other classes that are part of your driver. It is possible to mix & match drivers -- i.e. to write a custom driver where the Connection object just instantiates stock classes for ResultSet and PreparedStatement. Note that if you wanted to "override" only the ResultSet class you would also have to override the Connection and PreparedStatement classes so that they would return the correct ResultSet class. In the future we may implement a more "packaged" approach to drivers; for now we want to keep it simple. param: string $phptype The phptype (mysql, mssql, etc.). This is first part of DSN URL (e.g. mysql://localhost/...). param: string $dotpath A dot-path locating your class. For example 'creole.drivers.mssql.MSSQLConnection' return: void |
deregisterDriver($phptype) X-Ref |
Removes the driver for a PHP type. Note that this will remove user-registered drivers _and_ the default drivers. param: string $phptype The PHP type for driver to de-register. |
getDriver($phptype) X-Ref |
Returns the class path to the driver registered for specified type. param: string $phptype The phptype handled by driver (e.g. 'mysql', 'mssql', '*'). return: string The driver class in dot-path notation (e.g. creole.drivers.mssql.MSSQLConnection) |
getConnection($dsn, $flags = 0) X-Ref |
Create a new DB connection object and connect to the specified database param: mixed $dsn "data source name", see the self::parseDSN param: int $flags Connection flags (e.g. PERSISTENT). return: Connection Newly created DB connection object |
parseDSN($dsn) X-Ref |
Parse a data source name. This isn't quite as powerful as DB::parseDSN(); it's also a lot simpler, a lot faster, and many fewer lines of code. A array with the following keys will be returned: phptype: Database backend used in PHP (mysql, odbc etc.) protocol: Communication protocol to use (tcp, unix etc.) hostspec: Host specification (hostname[:port]) database: Database to use on the DBMS server username: User name for login password: Password for login The format of the supplied DSN is in its fullest form: phptype://username:password@protocol+hostspec/database Most variations are allowed: phptype://username:password@protocol+hostspec:110//usr/db_file.db phptype://username:password@hostspec/database_name phptype://username:password@hostspec phptype://username@hostspec phptype://hostspec/database phptype://hostspec phptype param: string $dsn Data Source Name to be parsed return: array An associative array |
import($class) X-Ref |
Include once a file specified in DOT notation. Package notation is expected to be relative to a location on the PHP include_path. param: string $class return: string unqualified classname |
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |