aboutsummaryrefslogtreecommitdiff
path: root/src/pgsql.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pgsql.c')
-rw-r--r--src/pgsql.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/src/pgsql.c b/src/pgsql.c
index 44b1fa6..011a4b7 100644
--- a/src/pgsql.c
+++ b/src/pgsql.c
@@ -2,8 +2,8 @@
Copyright (C) 2002 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 Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ 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
+ Free Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
This program is distributed in the hope that it will be useful,
@@ -12,7 +12,6 @@
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+ You should have received a copy of the GNU General Public License along
+ with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
@@ -23,5 +22,5 @@
#include <libpq-fe.h>
-SCM
+static SCM
s_pgsql_mark(struct sql_connect *conn)
{
@@ -29,5 +28,5 @@ s_pgsql_mark(struct sql_connect *conn)
}
-scm_sizet
+static scm_sizet
s_pgsql_free(struct sql_connect *conn)
{
@@ -39,7 +38,8 @@ s_pgsql_free(struct sql_connect *conn)
}
-SCM
-s_pgsql_connect (char *hostname, int port,
- char *dbname, char *user, char *pass, const char *why)
+static SCM
+s_pgsql_connect (const char *hostname, int port,
+ const char *dbname, const char *user, const char *pass,
+ const char *why)
{
PGconn *pgconn;
@@ -63,5 +63,5 @@ s_pgsql_connect (char *hostname, int port,
}
-SCM
+static SCM
result_to_list(PGresult *res)
{
@@ -76,8 +76,6 @@ result_to_list(PGresult *res)
for (j = 0; j < nfields; j++) {
- SCM new_elt;
char *val = PQgetvalue(res, i, j);
- SCM_NEWCELL(new_elt);
- SCM_SETCAR(new_elt, scm_makfrom0str(val));
+ SCM new_elt = scm_cons(scm_makfrom0str(val), SCM_EOL);
if (head == SCM_EOL)
head = new_elt;
@@ -87,9 +85,5 @@ result_to_list(PGresult *res)
}
- if (head != SCM_EOL)
- SCM_SETCDR(tail, SCM_EOL);
-
- SCM_NEWCELL(new_row);
- SCM_SETCAR(new_row, head);
+ new_row = scm_cons(head, SCM_EOL);
if (row_head == SCM_EOL)
@@ -99,11 +93,9 @@ result_to_list(PGresult *res)
row_tail = new_row;
}
- if (row_head != SCM_EOL)
- SCM_SETCDR(row_tail, SCM_EOL);
return row_head;
}
-SCM
-s_pgsql_query(struct sql_connect *conn, char *query)
+static SCM
+s_pgsql_query(struct sql_connect *conn, const char *query)
{
PGconn *pgconn = (PGconn*) conn->data;
@@ -138,5 +130,5 @@ s_pgsql_query(struct sql_connect *conn, char *query)
}
-void
+static void
s_pgsql_close(struct sql_connect *conn)
{

Return to:

Send suggestions and report system problems to the System administrator.