Unified DB Query function

From: Date: Mon, 01 Jul 2002 09:46:02 +0000
Subject: Unified DB Query function
Groups: php.db 
Request: Send a blank email to php-db+get-20231@lists.php.net to get a copy of this message
I'm trying to write a unified database query function for an application I have which currently accesses data from both DB2 and Microsoft SQL from a Linux server. I'm using ODBC functions for DB2, and Sybase functions for Microsoft SQL. Here's what I've got for DB2, and a blank area for MSSQL: function db_query ($db_type, $db_conn, $db_query) { // Uncomment to debug //echo $db_query.'<br>'; if ($db_type == 'odbc') { $result = odbc_exec($db_conn, $db_query); while(odbc_fetch_into($result, &$row)) { $data[0][]=$row; } $data[0] = get_data ($result); $data[1] = odbc_num_rows ($result); odbc_free_result ($result); } else if ($db_type == 'sybase') { // What do I put here? } return $data; } If anyone could tell me what I could put in the sybase if statement to return data in an identical format as that returned by the odbc if statement, I would greatly appreciate it! I'm somewhat at a loss as the sybase commands are quite different from the odbc commands. Thanks in advance, -- Casey Allen Shobe / Network Security Analyst & PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 cshobe@secureworks.net / http://www.secureworks.net Content is my own and does not necessarily represent my company.

« previous php.db (#20231) next »