diff options
-rw-r--r-- | src/gsql_conn.c | 2 | ||||
-rw-r--r-- | src/gsql_lib.c | 1 | ||||
-rw-r--r-- | src/guile-sql.h | 3 | ||||
-rw-r--r-- | src/mysql.c | 8 | ||||
-rw-r--r-- | src/pgsql.c | 8 |
5 files changed, 13 insertions, 9 deletions
diff --git a/src/gsql_conn.c b/src/gsql_conn.c index 5b2d1d6..a2fc93c 100644 --- a/src/gsql_conn.c +++ b/src/gsql_conn.c @@ -147,7 +147,6 @@ SCM_DEFINE (sql_open_connection, "sql-open-connection", 1, 0, 0, }; SCM smob; - struct sql_connect *conn; SCM_ASSERT(scm_is_pair(PARAM), PARAM, SCM_ARG1, FUNC_NAME); gamma_parmlist_parse (PARAM, dcltab, @@ -178,7 +177,6 @@ SCM_DEFINE (sql_query, "sql-query", 2, 0, 0, #define FUNC_NAME s_sql_query { struct sql_connect *conn; - void *ptr; char *query; SCM ret; diff --git a/src/gsql_lib.c b/src/gsql_lib.c index be2e15f..72ce17a 100644 --- a/src/gsql_lib.c +++ b/src/gsql_lib.c @@ -19,6 +19,7 @@ #endif #include <guile-sql.h> #include <app.h> +#include <string.h> static struct gamma_parmdcl * find_parmdcl(struct gamma_parmdcl *dcl, const char *name) diff --git a/src/guile-sql.h b/src/guile-sql.h index e66ffcb..f6c775a 100644 --- a/src/guile-sql.h +++ b/src/guile-sql.h @@ -63,3 +63,6 @@ void gamma_parmlist_parse(SCM parmlist, const char *func_name); void gamma_cvt_string(SCM inval, void *outval, const char *func_name); void gamma_cvt_int(SCM inval, void *outval, const char *func_name); + +void gsql_conn_init(void); +int sql_register_iface(struct sql_iface *ifp); diff --git a/src/mysql.c b/src/mysql.c index 2499154..dc8d463 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -130,7 +130,7 @@ s_mysql_query(struct sql_connect *conn, const char *query) { MYSQL *mysql = conn->data; MYSQL_RES *result; - SCM cell; + SCM cell = SCM_EOL; if (mysql_query(mysql, query)) scm_throw(gsql_error, scm_list_2(scm_makfrom0str("Error executing MySQL query"), @@ -142,11 +142,11 @@ s_mysql_query(struct sql_connect *conn, const char *query) int nfields = mysql_num_fields(result); int nrows = mysql_num_rows(result); int i, j; - SCM row_head = SCM_EOL, row_tail; + SCM row_head = SCM_EOL, row_tail = SCM_EOL; for (i = 0; i < nrows; i++) { SCM new_row; - SCM head = SCM_EOL, tail; + SCM head = SCM_EOL, tail = SCM_EOL; MYSQL_ROW row = mysql_fetch_row(result); if (!row) @@ -172,7 +172,7 @@ s_mysql_query(struct sql_connect *conn, const char *query) mysql_free_result(result); } else { /* should it have returned something? */ if (mysql_field_count(mysql) == 0) { - cell = scm_to_ulong(mysql_affected_rows(mysql)); + cell = scm_from_ulong(mysql_affected_rows(mysql)); } else { /* mysql_store_result() should have returned data */ scm_throw(gsql_error, scm_list_2(scm_makfrom0str("Query should have returned data"), diff --git a/src/pgsql.c b/src/pgsql.c index c1a8e41..609fedb 100644 --- a/src/pgsql.c +++ b/src/pgsql.c @@ -59,6 +59,8 @@ s_pgsql_connect (SCM parmlist, const char *func_name) SCM smob; struct sql_connect *conn; + gamma_parmlist_parse (parmlist, dcltab, 0, func_name); + pgconn = PQsetdbLogin(hostname, port, NULL, NULL, dbname, user, pass); if (PQstatus(pgconn) == CONNECTION_BAD) { @@ -91,7 +93,7 @@ result_to_list(PGresult *res) int i, j; int ntuples = PQntuples(res); int nfields = PQnfields(res); - SCM row_head = SCM_EOL, row_tail; + SCM row_head = SCM_EOL, row_tail = SCM_EOL; for (i = 0; i < ntuples; i++) { SCM new_row; @@ -123,7 +125,7 @@ s_pgsql_query(struct sql_connect *conn, const char *query) { PGconn *pgconn = (PGconn*) conn->data; PGresult *res; - SCM cell; + SCM cell = SCM_EOL; ExecStatusType stat; res = PQexec(pgconn, query); @@ -137,7 +139,7 @@ s_pgsql_query(struct sql_connect *conn, const char *query) switch (stat) { case PGRES_COMMAND_OK: /* Successful completion of a command returning no data */ - cell = scm_to_ulong(strtoul(PQcmdTuples(res), NULL, 0)); + cell = scm_from_ulong(strtoul(PQcmdTuples(res), NULL, 0)); break; case PGRES_TUPLES_OK: /* The query successfully executed */ |