return count;
}
- public bool has_plots () {
- return (count ("Plots") > 0);
+ public bool has_table (string table) {
+ string sql = "SELECT * FROM sqlite_master WHERE type=\"table\" AND name=\"%s\"".printf (table);
+ Statement stmt;
+ int rc;
+
+ rc = db.prepare_v2 (sql, -1, out stmt);
+ if (rc != Sqlite.OK) {
+ stderr.printf ("SQL error: %d, %s\n", rc, db.errmsg ());
+ db.progress_handler (0, null);
+ return false;
+ }
+
+ do {
+ rc = stmt.step ();
+ if (rc == Sqlite.ROW)
+ return true;
+ } while (rc == Sqlite.ROW);
+
+ return false;
}
public string get_plot (string title) {