Jasmine Wiki |
|
|
Navigation Wiki HomeInstalling Framework Configuring jasmine.php Database Module MySQL Mysqlix ODBC MSSQL Database Objects Datagrid Datasource Repeater SQLQuery Files Module File FileSystem FTP Attachment ExcelFile Graphics Module Color Image Graph Miscellaneous Classes: NumbWordter Poll Shield XMLParser Functions: General Functions HTML Functions Validation Functions TrackThisPage
|
ODBC Database Connector ODBC ConnectorJasmine offers ODBC connector to connect to databases via ODBC. In order to use ODBC feature, the ODBC connector class should be included in jasmine.php Object initialization The class must be instantiated and proper connection variables have to be assigned before connecting. The three connection varibales are ODBC Host ($host), UserName ($user) and Password ($pass). First way: $db->new odbc($odbcHost, $userID, $password); Second way: $db=new odbc(); $db->host="odbcDSN"; $db->user="userName"; $db->pass="password"; Connecting and disconnecting Like the base class, database, connect() and disconnect() methods control the connection. $db->connect(); $db->disconnect(); Querying: Query can be executed using query(). e.g. $db->query($odbcQuery); Getting Results If rows are expected from the query, they will be available in $rows property. e.g. echo 'First customer is ' . $db->rows[0][0] ; Caching and Sourcing of results is same as described in Common Functionalities section in Database Connectors manual. Technical info: PHP functions used in the class - While connecting, the class uses odbc_connect(). While disconnecting, odbc_free_result() and odbc_close() functions are used. - Executing the query is done using odbc_exec(). - Rows are extracted using odbc_fetch_array() and columns with odbc_field_name(). odbc_num_fields() determines fields in the result set. - In case of any errors, odbc_error() is used and its value is assigned to $error property. |
(c) 2008 Jasmine Framework. A Creation by Krishna Srikanth. |
|