Skip to content

Instantly share code, notes, and snippets.

@anatooly
Created July 1, 2013 21:17
Show Gist options
  • Save anatooly/5904707 to your computer and use it in GitHub Desktop.
Save anatooly/5904707 to your computer and use it in GitHub Desktop.
diff --git a/vapi/mysql.vapi b/vapi/mysql.vapi
index b0a0acb..fe217af 100644
--- a/vapi/mysql.vapi
+++ b/vapi/mysql.vapi
@@ -257,6 +257,35 @@ namespace Mysql {
public bool data_seek (ulong offset);
}
+
+ [CCode (cname = "MYSQL_BIND")]
+ public struct Bind {
+ public Mysql.FieldType buffer_type;
+ [CCode (array_length_cname = "buffer_length", array_length_type = "unsigned long")]
+ public unowned uint8[] buffer;
+ public ulong* length;
+ public bool* is_null;
+ public bool is_unsigned;
+ public bool* error;
+ }
+
+ [Compact, CCode (cname = "MYSQL_STMT", free_function = "mysql_stmt_close", lower_case_cprefix = "mysql_stmt_")]
+ public class Statement {
+ public Statement (Mysql.Database mysql);
+ public int prepare (string stmt_str, ulong length);
+ public bool bind_param ([CCode (array_length = false)] Mysql.Bind[] bind);
+ public int execute ();
+ [CCode (simple_generics = true)]
+ public bool attr_set<T> (Mysql.StatementAttrType option, T arg);
+ }
+
+ [CCode (cname = "enum enum_stmt_attr_type", cprefix = "STMT_ATTR_")]
+ public enum StatementAttrType {
+ UPDATE_MAX_LENGTH,
+ CURSOR_TYPE,
+ PREFETCH_ROWS
+ }
+
[CCode (cname = "MYSQL_FIELD")]
public struct Field {
public unowned string name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment