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 @@ -11,43 +11,24 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Gamma. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <guile-sql.h> #include <app.h> -SCM -scm_makenum (unsigned long val) -#ifndef HAVE_SCM_LONG2NUM -{ - if (SCM_FIXABLE ((long) val)) - return scm_from_int (val); - -#ifdef SCM_BIGDIG - return scm_i_long2big (val); -#else /* SCM_BIGDIG */ - return scm_make_real ((double) val); -#endif /* SCM_BIGDIG */ -} -#else -{ - return scm_long2num (val); -} -#endif - static struct gamma_parmdcl * find_parmdcl(struct gamma_parmdcl *dcl, const char *name) { for (; dcl->name; dcl++) if (strcmp(dcl->name, name) == 0) return dcl; return 0; } void gamma_parmlist_parse(SCM parmlist, struct gamma_parmdcl *dcltab, int flags, const char *func_name) 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 @@ -48,19 +48,18 @@ struct sql_iface { extern SCM gsql_error; struct gamma_parmdcl { const char *name; void *valptr; void (*cvt) (SCM inval, void *outval, const char *func_name); }; #define GAMMA_PARMLIST_IGNORE_UNKNOWN 0x0001 #define GAMMA_PARMLIST_WARN_UNKNOWN 0x0002 SCM sql_connect_create(char *name); -SCM scm_makenum(unsigned long val); void gamma_parmlist_parse(SCM parmlist, struct gamma_parmdcl *dcltab, int flags, 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); diff --git a/src/mysql.c b/src/mysql.c index f4e178f..2499154 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -163,25 +163,25 @@ s_mysql_query(struct sql_connect *conn, const char *query) new_row = scm_cons(head, SCM_EOL); if (row_head == SCM_EOL) row_head = new_row; else SCM_SETCDR(row_tail, new_row); row_tail = new_row; } cell = row_head; mysql_free_result(result); } else { /* should it have returned something? */ if (mysql_field_count(mysql) == 0) { - cell = scm_makenum(mysql_affected_rows(mysql)); + cell = scm_to_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"), scm_makfrom0str(mysql_error(mysql)))); } } return cell; } static void s_mysql_close(struct sql_connect *conn) { diff --git a/src/pgsql.c b/src/pgsql.c index 2a7fe23..c1a8e41 100644 --- a/src/pgsql.c +++ b/src/pgsql.c @@ -128,25 +128,25 @@ s_pgsql_query(struct sql_connect *conn, const char *query) res = PQexec(pgconn, query); if (!res) scm_throw(gsql_error, scm_list_2(scm_makfrom0str("Error executing PostgreSQL query"), scm_makfrom0str(PQerrorMessage(pgconn)))); stat = PQresultStatus(res); switch (stat) { case PGRES_COMMAND_OK: /* Successful completion of a command returning no data */ - cell = scm_makenum(strtoul(PQcmdTuples(res), NULL, 0)); + cell = scm_to_ulong(strtoul(PQcmdTuples(res), NULL, 0)); break; case PGRES_TUPLES_OK: /* The query successfully executed */ cell = result_to_list(res); PQclear(res); break; default: scm_throw(gsql_error, scm_list_2(scm_makfrom0str("PostgreSQL error"), scm_makfrom0str(PQresStatus(stat)))); } return cell; |