1
/* Copyright 2009-2011 Yorba Foundation
3
* This software is licensed under the GNU LGPL (version 2.1 or later).
4
* See the COPYING file in this distribution.
7
public errordomain DatabaseError {
16
public abstract class DatabaseTable {
18
protected static Sqlite.Database db;
20
public string table_name = null;
22
protected void set_table_name(string table_name) {
23
this.table_name = table_name;
26
// This method will throw an error on an SQLite return code unless it's OK, DONE, or ROW, which
27
// are considered normal results.
28
protected static void throw_error(string method, int res) throws DatabaseError {
29
string msg = "(%s) [%d] - %s".printf(method, res, db.errmsg());
47
throw new DatabaseError.BACKING(msg);
50
throw new DatabaseError.MEMORY(msg);
54
case Sqlite.INTERRUPT:
55
throw new DatabaseError.ABORT(msg);
60
case Sqlite.CONSTRAINT:
62
throw new DatabaseError.LIMITS(msg);
66
throw new DatabaseError.TYPESPEC(msg);
72
throw new DatabaseError.ERROR(msg);