]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
add SQLite bindings
authorJuerg Billeter <j@bitron.ch>
Tue, 7 Aug 2007 19:15:00 +0000 (19:15 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 7 Aug 2007 19:15:00 +0000 (19:15 +0000)
2007-08-07  Juerg Billeter  <j@bitron.ch>

* vapi/sqlite3.vala: add SQLite bindings

svn path=/trunk/; revision=433

ChangeLog
vapi/sqlite3.vala [new file with mode: 0644]

index a163b861c294951a9d4540a54a59f419e7f32f5f..a00988b10421e5b78d22f86d72c1a89d9002531e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-07  Jürg Billeter  <j@bitron.ch>
+
+       * vapi/sqlite3.vala: add SQLite bindings
+
 2007-08-07  Jürg Billeter  <j@bitron.ch>
 
        * vapi/glib-2.0.vala: add stdin
diff --git a/vapi/sqlite3.vala b/vapi/sqlite3.vala
new file mode 100644 (file)
index 0000000..edb327b
--- /dev/null
@@ -0,0 +1,64 @@
+/* sqlite3.vala
+ *
+ * Copyright (C) 2007 Jürg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ *     Jürg Billeter <j@bitron.ch>
+ */
+
+[CCode (lower_case_cprefix = "sqlite3_", cheader_filename = "sqlite3.h")]
+namespace Sqlite {
+       [ReferenceType (free_function = "sqlite3_close")]
+       [CCode (cname = "sqlite3", cprefix = "sqlite3_")]
+       public struct Database {
+               public int exec (string! sql, Callback sqlite3_callback = null, pointer data = null, out string errmsg = null);
+               public int64 last_insert_rowid ();
+               public int changes ();
+               public int total_changes ();
+               public void interrupt ();
+               public int complete (string! sql);
+               public int get_table (string! sql, out string[] resultp, ref int nrow, ref int ncolumn, out string errmsg);
+               public static int open (string! filename, out Database db);
+               public int errcode ();
+               public weak string errmsg ();
+               public int prepare (string! sql, int n_bytes, out Statement stmt, out string tail = null);
+       }
+
+       [CCode (cname = "sqlite3_callback")]
+       public static delegate int Callback (pointer data, int n_columns, string[] values, string[] column_names);
+
+       [ReferenceType (free_function = "sqlite3_finalize")]
+       [CCode (cname = "sqlite3_stmt", cprefix = "sqlite3_")]
+       public struct Statement {
+               [NoArrayLength]
+               public int bind_blob (int index, uchar[] value, int n, GLib.DestroyNotify destroy_notify);
+               public int bind_double (int index, double value);
+               public int bind_int (int index, int value);
+               public int bind_int64 (int index, int64 value);
+               public int bind_null (int index);
+               public int bind_text (int index, string! value, int n, GLib.DestroyNotify destroy_notify);
+               public int bind_parameter_count ();
+               public string bind_parameter_name (int index);
+               public int bind_parameter_index (string! name);
+               public int clear_bindings ();
+               public int column_count ();
+               public string! column_name (int index);
+               public int step ();
+               public int column_int (int i_col);
+       }
+}
+