aboutsummaryrefslogtreecommitdiff
path: root/src/sql.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql.c')
-rw-r--r--src/sql.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sql.c b/src/sql.c
index a4b311e..80eb344 100644
--- a/src/sql.c
+++ b/src/sql.c
@@ -21,25 +21,25 @@
21struct sql_list 21struct sql_list
22{ 22{
23 struct sql_list *next; 23 struct sql_list *next;
24 struct sqlconn conn; 24 struct sqlconn conn;
25}; 25};
26 26
27static struct sql_list *sql_list; 27static struct sql_list *sql_list;
28 28
29/* Append CONN to the end of sql_list */ 29/* Append CONN to the end of sql_list */
30void 30void
31sql_register_conn (struct sqlconn *conn) 31sql_register_conn (struct sqlconn *conn)
32{ 32{
33 struct sql_list *ent = xmalloc (sizeof *ent); 33 struct sql_list *ent = grecs_malloc (sizeof *ent);
34 ent->conn = *conn; 34 ent->conn = *conn;
35 ent->next = sql_list; 35 ent->next = sql_list;
36 sql_list = ent; 36 sql_list = ent;
37} 37}
38 38
39/* Find a configured connection that has the given IDENT */ 39/* Find a configured connection that has the given IDENT */
40struct sqlconn * 40struct sqlconn *
41sql_find_connection (const char *ident) 41sql_find_connection (const char *ident)
42{ 42{
43 struct sql_list *p; 43 struct sql_list *p;
44 for (p = sql_list; p; p = p->next) 44 for (p = sql_list; p; p = p->next)
45 if (strcmp (p->conn.ident, ident) == 0) 45 if (strcmp (p->conn.ident, ident) == 0)
@@ -189,19 +189,19 @@ sql_get_dictionary (struct dictionary *dict, void *handle,
189} 189}
190 190
191int 191int
192sql_quote (struct dictionary *dict, void *handle, const char *input, 192sql_quote (struct dictionary *dict, void *handle, const char *input,
193 char **poutput, size_t *psize) 193 char **poutput, size_t *psize)
194{ 194{
195 struct sqlconn *conn = handle; 195 struct sqlconn *conn = handle;
196 size_t len, size; 196 size_t len, size;
197 char *output; 197 char *output;
198 198
199 len = strlen (input); 199 len = strlen (input);
200 size = 2 * len + 1; 200 size = 2 * len + 1;
201 output = xmalloc (size); 201 output = grecs_malloc (size);
202 mysql_real_escape_string (&conn->mysql, output, input, len); 202 mysql_real_escape_string (&conn->mysql, output, input, len);
203 *poutput = output; 203 *poutput = output;
204 if (psize) 204 if (psize)
205 *psize = strlen (output); 205 *psize = strlen (output);
206 return 0; 206 return 0;
207} 207}

Return to:

Send suggestions and report system problems to the System administrator.