[Vala] [PATCH 1/1] sqlite3: Add Context and Database.create_function() bindings.
- From: Julian Andres Klode <jak jak-linux org>
- To: vala-list gnome org
- Subject: [Vala] [PATCH 1/1] sqlite3: Add Context and Database.create_function() bindings.
- Date: Fri, 11 Dec 2009 17:52:49 +0100
These bindings make it possible to create custom functions for use
in SQL code.
---
vapi/sqlite3.vapi | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/vapi/sqlite3.vapi b/vapi/sqlite3.vapi
index c9d3e26..90992a6 100644
--- a/vapi/sqlite3.vapi
+++ b/vapi/sqlite3.vapi
@@ -18,6 +18,7 @@
*
* Author:
* Jürg Billeter <j bitron ch>
+ * Julian Andres Klode <jak jak-linux org>
*/
[CCode (lower_case_cprefix = "sqlite3_", cheader_filename = "sqlite3.h")]
@@ -49,8 +50,17 @@ namespace Sqlite {
public void progress_handler (int n_opcodes, Sqlite.ProgressCallback? progress_handler);
public void commit_hook (CommitCallback? commit_hook);
public void rollback_hook (RollbackCallback? rollback_hook);
+
+ public int create_function (string name, int nargs, int encoding, void* client_data,
CustomFunc? func, CustomFunc? step=null, CustomFinal? final=null);
}
+ // No target, since the value of client_data is retrieved by calling
+ // user_data() on the Context object of the callbacks.
+ [CCode (has_target = false)]
+ public delegate void CustomFunc(Context context, [CCode(array_length_pos=1.9)] Value[] args);
+ [CCode (has_target = false)]
+ public delegate void CustomFinal(Context context);
+
[CCode (instance_pos = 0)]
public delegate void TraceCallback (string message);
[CCode (instance_pos = 0)]
@@ -163,6 +173,19 @@ namespace Sqlite {
[CCode (cname = "SQLITE_MUTEX_RECURSIVE")]
public const int MUTEX_RECURSIVE;
+ [CCode (cname = "SQLITE_UTF8")]
+ public const int UTF8;
+ [CCode (cname = "SQLITE_UTF16LE")]
+ public const int UTF16LE;
+ [CCode (cname = "SQLITE_UTF16BE")]
+ public const int UTF16BE;
+ [CCode (cname = "SQLITE_UTF16")]
+ public const int UTF16;
+ [CCode (cname = "SQLITE_ANY")]
+ public const int ANY;
+ [CCode (cname = "SQLITE_UTF16_ALIGNED")]
+ public const int UTF16_ALIGNED;
+
/* SQL Statement Object */
[Compact]
[CCode (free_function = "sqlite3_finalize", cname = "sqlite3_stmt", cprefix = "sqlite3_")]
@@ -205,5 +228,26 @@ namespace Sqlite {
public int @try ();
public void leave ();
}
+
+ [Compact]
+ [CCode (cname = "sqlite3_context", cprefix="sqlite3_")]
+ public class Context {
+ public void result_blob (void* blob, int size, GLib.DestroyNotify destroy_notify);
+ public void result_double (double result);
+ public void result_error (string message, int length=-1);
+ public void result_error_toobig ();
+ public void result_error_nomem ();
+ public void result_error_code (int error_code);
+ public void result_int (int result);
+ public void result_int64 (int64 result);
+ public void result_null ();
+ public void result_text (string text, int length=-1, GLib.DestroyNotify destroy_notify =
GLib.g_free);
+ public void result_value (Value value);
+ public void result_zeroblob (int count);
+ public void* aggregate_context (int nbytes);
+ public void* user_data ();
+ public void* get_auxdata (int argument);
+ public void set_auxdata (int argument, void* data, GLib.DestroyNotify destroy_notify);
+ }
}
--
1.6.5.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]