09 Oct 2008
I'm having a bit of trouble configuring the database access in Zoop to use an ODBC database connection via PDO. I understand that PDO is now the default DB access method, so it seems this should work. I just have no idea how to configure the settings in app_dir/config/db.php Any hints?
odbc
Zoop doesn't give direct access to PDO when using the sql_* functions. Maybe we should in the future?
For now, you can work around this problem by doing:
misc.php:
function &getDb() { if(isset($GLOBALS['myDB'])) return $GLOBALS['myDB']; $dsn = database::makeDSN(my_rdbms, my_host, my_port, my_username, my_password, my_database); $GLOBALS['myDB'] = &new database($dsn); return $GLOBALS['myDB']; }zone_default.php:
function pageSomePage($p, $z) { $db = &getDb(); $rows = $db->fetch_rows("select * from sometable"); }config/db.php:
define('my_rdbms', 'odbc'); //other defines required to make a connection...