my problem it's quite simple.
I'm trying to make a script for dump information from one table in firebird to another in SQLite.
I'm able to do all the process but what I'm not able to do is to create a persistent sqlite database. I launch this script on my computer (Ubuntu 13.04) in "/var/www/PabloLab/experiments" and I don't know where creates the file or if it's created.
The full script:
/*
* Preparing SQLite db
*/
$dbname = 'langs.sqlite';
$my_table = 'LANG';
$db = new SQLite3($dbname, 0666);
$query = "CREATE TABLE $my_table (ID INTEGER NOT NULL,
TXT VARCHAR,
LANG_ID NUMERIC NOT NULL)";
$success = $db->exec($query);
$stmt = "SELECT r.ID, r.TXT, r.LANG_ID
FROM VLANG r
WHERE r.ID in (1,3)";
$sql = EF_sql_connection($stmt, MY_FIREBIRD_DB); //It works perfect, no problem here.
while ($lang_info = ibase_fetch_assoc($sql)) {
$lang = utf8_encode($lang_info["TXT"]);
$id = utf8_encode($lang_info["ID"]);
$lang_id = utf8_encode($lang_info["LANG_ID"]);
$stmt_sqlite = "INSERT INTO $my_table VALUES ($id, '$lang', $lang_id)";
$success = $db->exec($stmt_sqlite);
}
$result = $db->query("SELECT * FROM $my_table");
while($row = $result->fetchArray()){
$id = $row["ID"];
$txt = $row["TXT"];
$lang_id = $row["LANG_ID"];
echo "$id - $txt - $lang_id<br>";
}
Thanks for your help and your time.
Regards.