diff options
Diffstat (limited to 'src/gsql_lib.c')
-rw-r--r-- | src/gsql_lib.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/gsql_lib.c b/src/gsql_lib.c new file mode 100644 index 0000000..fa28047 --- /dev/null +++ b/src/gsql_lib.c @@ -0,0 +1,47 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <guile-sql.h> +#include <app.h> + +SCM +scm_makenum (unsigned long val) +{ + if (SCM_FIXABLE ((long) val)) + return SCM_MAKINUM (val); + +#ifdef SCM_BIGDIG + return scm_long2big (val); +#else /* SCM_BIGDIG */ + return scm_make_real ((double) val); +#endif /* SCM_BIGDIG */ +} + +/* + * Chop off trailing whitespace. Return length of the resulting string + */ +int +chop(char *str) +{ + int len; + + for (len = strlen(str); len > 0 && isspace(str[len-1]); len--) + ; + str[len] = 0; + return len; +} + + + +extern void +gsql_init() +{ + gsql_conn_init(); +#ifdef USE_SQL_MYSQL + sql_register_iface(&mysql_iface); +#endif +#ifdef USE_SQL_PGSQL + sql_register_iface(&pgsql_iface); +#endif +} + |