src/evsql/evsql.h
branchnew-evsql
changeset 44 9e76ee9729b6
parent 40 03017f5f0087
child 45 424ce5ab82fd
--- a/src/evsql/evsql.h	Wed Nov 19 19:06:10 2008 +0200
+++ b/src/evsql/evsql.h	Thu Nov 20 01:16:24 2008 +0200
@@ -106,7 +106,7 @@
     char *command;
     
     // possible query params
-    struct evsql_query_param_info {
+    struct evsql_query_params_pq {
         int count;
 
         Oid *types;
@@ -123,13 +123,22 @@
 
     // our position in the query list
     TAILQ_ENTRY(evsql_query) entry;
+};
 
-    // the result
+// the result
+struct evsql_result {
+    int error;
+
     union {
-        PGresult *evpq;
+        PGresult *pq;
     } result;
+
+    // result_* state
+    struct evsql_result_info *info;
+    size_t row_offset;
 };
 
+
 // maximum length for a 'BEGIN TRANSACTION ...' query
 #define EVSQL_QUERY_BEGIN_BUF 512
 
@@ -137,4 +146,30 @@
 // 16 = bool in 8.3
 #define EVSQL_PQ_ARBITRARY_TYPE_OID 16
 
+/*
+ * Core query-submission interface.
+ *
+ * This performs some error-checking on the trans, allocates the evsql_query and does some basic initialization.
+ *
+ * This does not actually enqueue the query anywhere, no reference is stored anywhere.
+ *
+ * Returns the new evsql_query on success, NULL on failure.
+ */
+static struct evsql_query *_evsql_query_new (struct evsql *evsql, struct evsql_trans *trans, evsql_query_cb query_fn, void *cb_arg);
+
+/*
+ * Begin processing the given query, which should now be fully filled out.
+ *
+ * If trans is given, it MUST be idle, and the query will be executed. Otherwise, it will either be executed directly
+ * or enqueued for future execution.
+ *
+ * Returns zero on success, nonzero on failure.
+ */
+static int _evsql_query_enqueue (struct evsql *evsql, struct evsql_trans *trans, struct evsql_query *query, const char *command);
+
+/*
+ * Validate and allocate the basic stuff for a new query.
+ */
+
+
 #endif /* EVSQL_INTERNAL_H */