diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gsql_lib.c | 19 | ||||
-rw-r--r-- | src/guile-sql.h | 1 | ||||
-rw-r--r-- | src/mysql.c | 2 | ||||
-rw-r--r-- | src/pgsql.c | 2 |
4 files changed, 2 insertions, 22 deletions
diff --git a/src/gsql_lib.c b/src/gsql_lib.c index 223b223..be2e15f 100644 --- a/src/gsql_lib.c +++ b/src/gsql_lib.c | |||
@@ -17,31 +17,12 @@ | |||
17 | #ifdef HAVE_CONFIG_H | 17 | #ifdef HAVE_CONFIG_H |
18 | # include <config.h> | 18 | # include <config.h> |
19 | #endif | 19 | #endif |
20 | #include <guile-sql.h> | 20 | #include <guile-sql.h> |
21 | #include <app.h> | 21 | #include <app.h> |
22 | 22 | ||
23 | SCM | ||
24 | scm_makenum (unsigned long val) | ||
25 | #ifndef HAVE_SCM_LONG2NUM | ||
26 | { | ||
27 | if (SCM_FIXABLE ((long) val)) | ||
28 | return scm_from_int (val); | ||
29 | |||
30 | #ifdef SCM_BIGDIG | ||
31 | return scm_i_long2big (val); | ||
32 | #else /* SCM_BIGDIG */ | ||
33 | return scm_make_real ((double) val); | ||
34 | #endif /* SCM_BIGDIG */ | ||
35 | } | ||
36 | #else | ||
37 | { | ||
38 | return scm_long2num (val); | ||
39 | } | ||
40 | #endif | ||
41 | |||
42 | static struct gamma_parmdcl * | 23 | static struct gamma_parmdcl * |
43 | find_parmdcl(struct gamma_parmdcl *dcl, const char *name) | 24 | find_parmdcl(struct gamma_parmdcl *dcl, const char *name) |
44 | { | 25 | { |
45 | for (; dcl->name; dcl++) | 26 | for (; dcl->name; dcl++) |
46 | if (strcmp(dcl->name, name) == 0) | 27 | if (strcmp(dcl->name, name) == 0) |
47 | return dcl; | 28 | return dcl; |
diff --git a/src/guile-sql.h b/src/guile-sql.h index 1956395..e66ffcb 100644 --- a/src/guile-sql.h +++ b/src/guile-sql.h | |||
@@ -54,13 +54,12 @@ struct gamma_parmdcl { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | #define GAMMA_PARMLIST_IGNORE_UNKNOWN 0x0001 | 56 | #define GAMMA_PARMLIST_IGNORE_UNKNOWN 0x0001 |
57 | #define GAMMA_PARMLIST_WARN_UNKNOWN 0x0002 | 57 | #define GAMMA_PARMLIST_WARN_UNKNOWN 0x0002 |
58 | 58 | ||
59 | SCM sql_connect_create(char *name); | 59 | SCM sql_connect_create(char *name); |
60 | SCM scm_makenum(unsigned long val); | ||
61 | 60 | ||
62 | void gamma_parmlist_parse(SCM parmlist, | 61 | void gamma_parmlist_parse(SCM parmlist, |
63 | struct gamma_parmdcl *dcltab, int flags, | 62 | struct gamma_parmdcl *dcltab, int flags, |
64 | const char *func_name); | 63 | const char *func_name); |
65 | void gamma_cvt_string(SCM inval, void *outval, const char *func_name); | 64 | void gamma_cvt_string(SCM inval, void *outval, const char *func_name); |
66 | void gamma_cvt_int(SCM inval, void *outval, const char *func_name); | 65 | void gamma_cvt_int(SCM inval, void *outval, const char *func_name); |
diff --git a/src/mysql.c b/src/mysql.c index f4e178f..2499154 100644 --- a/src/mysql.c +++ b/src/mysql.c | |||
@@ -169,13 +169,13 @@ s_mysql_query(struct sql_connect *conn, const char *query) | |||
169 | row_tail = new_row; | 169 | row_tail = new_row; |
170 | } | 170 | } |
171 | cell = row_head; | 171 | cell = row_head; |
172 | mysql_free_result(result); | 172 | mysql_free_result(result); |
173 | } else { /* should it have returned something? */ | 173 | } else { /* should it have returned something? */ |
174 | if (mysql_field_count(mysql) == 0) { | 174 | if (mysql_field_count(mysql) == 0) { |
175 | cell = scm_makenum(mysql_affected_rows(mysql)); | 175 | cell = scm_to_ulong(mysql_affected_rows(mysql)); |
176 | } else { /* mysql_store_result() should have returned data */ | 176 | } else { /* mysql_store_result() should have returned data */ |
177 | scm_throw(gsql_error, | 177 | scm_throw(gsql_error, |
178 | scm_list_2(scm_makfrom0str("Query should have returned data"), | 178 | scm_list_2(scm_makfrom0str("Query should have returned data"), |
179 | scm_makfrom0str(mysql_error(mysql)))); | 179 | scm_makfrom0str(mysql_error(mysql)))); |
180 | } | 180 | } |
181 | } | 181 | } |
diff --git a/src/pgsql.c b/src/pgsql.c index 2a7fe23..c1a8e41 100644 --- a/src/pgsql.c +++ b/src/pgsql.c | |||
@@ -134,13 +134,13 @@ s_pgsql_query(struct sql_connect *conn, const char *query) | |||
134 | 134 | ||
135 | stat = PQresultStatus(res); | 135 | stat = PQresultStatus(res); |
136 | 136 | ||
137 | switch (stat) { | 137 | switch (stat) { |
138 | case PGRES_COMMAND_OK: | 138 | case PGRES_COMMAND_OK: |
139 | /* Successful completion of a command returning no data */ | 139 | /* Successful completion of a command returning no data */ |
140 | cell = scm_makenum(strtoul(PQcmdTuples(res), NULL, 0)); | 140 | cell = scm_to_ulong(strtoul(PQcmdTuples(res), NULL, 0)); |
141 | break; | 141 | break; |
142 | case PGRES_TUPLES_OK: | 142 | case PGRES_TUPLES_OK: |
143 | /* The query successfully executed */ | 143 | /* The query successfully executed */ |
144 | cell = result_to_list(res); | 144 | cell = result_to_list(res); |
145 | PQclear(res); | 145 | PQclear(res); |
146 | break; | 146 | break; |