prepare($overview_sql); $incoming_overview = file($spooldir.'/'.$group.'-overview'); foreach($incoming_overview as $overviewline) { $import = explode("\t", $overviewline); $overview_stmt->execute([$group, $import[0], $import[4], strtotime($import[3]), $import[3], $import[2], $import[1], $import[5], $import[6], $import[7], $import[8]]); echo "\nImported: ".$group.":".$import[0]; } $overview_dbh = null; } function UPGRADE_overview_db_open($database, $table='overview') { try { $dbh = new PDO('sqlite:'.$database); } catch (PDOException $e) { echo 'Connection failed: '.$e->getMessage(); exit; } $dbh->exec("CREATE TABLE IF NOT EXISTS $table( id INTEGER PRIMARY KEY, newsgroup TEXT, number TEXT, msgid TEXT, date TEXT, datestring TEXT, name TEXT, subject TEXT, refs TEXT, bytes TEXT, lines TEXT, xref TEXT, unique (newsgroup, msgid))"); $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_date on '.$table.'(date)'); $stmt->execute(); $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_newsgroup on '.$table.'(newsgroup)'); $stmt->execute(); $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_msgid on '.$table.'(msgid)'); $stmt->execute(); $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_newsgroup_number on '.$table.'(newsgroup,number)'); $stmt->execute(); $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_name on '.$table.'(name)'); $stmt->execute(); return($dbh); } ?>