In one of my modules I try to connect to one SQlite DB to copy from it the info into my MySQL DB, however after creating the db info and trying to add them into the Drupal context, I get the error Notice: Undefined index: driver in Database::openConnection()
here is my function:
function query_247($table, $conditions = array()){
$module_path = drupal_get_path('module', 'cw_ticketing' );
$databases['247cinema']['db1'] = array (
'driver' => 'sqlite',
'database' => $module_path.'/247cinema_part1.sqlite',
);
$databases['247cinema']['db2'] = array (
'driver' => 'sqlite',
'database' => $module_path.'/247cinema_part2.sqlite',
);
// die(var_dump($databases));
Database::addConnectionInfo('247cinema', 'db1', $databases);
Database::addConnectionInfo('247cinema', 'db2', $databases);
try {
db_set_active('247cinema');
if (count($conditions)) {
//some logic
}else{
$where_s = false;
}
//some logic
db_set_active();
return$records;
} catch (Exception $e) {
$msg = $e->getMessage();
watchdog('error', $msg);
db_set_active();
}
}
Anyone has any idea ?