From 317095181674a01651602ddf6817e888d0ad5280 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 17 Feb 2009 18:36:54 +0200 Subject: Begin rewriting method system * src/builtin.c, src/builtin.h: New files. * src/Makefile.am (wydawca_SOURCES): Add builtin.c and builtin.h * src/config.c: New keyword access-method.query * src/update-2.0.awk: Update. * src/meta.c: Remove quote_string (replaced by method_quote_string). (meta_escape): Add `handle' argument. * src/method.c (struct method_descr): New methods: open, close, quote. Updated methods: free, run, get. All callers updated. (method_quote_string): New function. * src/process.c (scan_directory_pair): Init all access methods at once. * src/sql.c: Take name of the SQL connection from method->parmv[0]. Adapt to changes to the method subsystem. * src/sql.h: Likewise. * src/wydawca.h (struct access_method): New members id, parmc, parmv, storage. Remove union v. (meta_escape): Take 3 arguments. (method_new): Take 2 arguments. (method_open, method_close, method_quote_string): New proto. (method_run, method_result): Change signature. * src/mail.c, src/triplet.c, src/verify.c * etc/wydawca.rc: Update. --- src/sql.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/sql.h') diff --git a/src/sql.h b/src/sql.h index 4529ce9..d581e57 100644 --- a/src/sql.h +++ b/src/sql.h @@ -1,5 +1,5 @@ /* wydawca - automatic release submission daemon - Copyright (C) 2007 Sergey Poznyakoff + Copyright (C) 2009 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -36,6 +36,11 @@ struct sqlconn *sql_find_connection (const char *ident); int sql_init_method (struct access_method *method); int sql_done_method (struct access_method *method); -int sql_run_method (struct access_method *method, const char *cmd); -int sql_get_method (struct access_method *method, unsigned nrow, unsigned ncol); -int sql_free_result (struct access_method *method); +void *sql_open (struct access_method *method); + +int sql_run_method (struct access_method *method, void *handle, + const char *cmd); +int sql_get_method (struct access_method *method, void *handle, + unsigned nrow, unsigned ncol); +int sql_free_result (struct access_method *method, void *handle); +int sql_quote (struct access_method *, void *, const char *, char **, size_t *); -- cgit v1.2.1