Keep the namespace clean.
Showing
5 changed files
with
85 additions
and
79 deletions
... | @@ -441,7 +441,7 @@ refile (struct mh_whatnow_env *wh, int argc, char **argv, int *status) | ... | @@ -441,7 +441,7 @@ refile (struct mh_whatnow_env *wh, int argc, char **argv, int *status) |
441 | 441 | ||
442 | /* Send action */ | 442 | /* Send action */ |
443 | static int | 443 | static int |
444 | send (struct mh_whatnow_env *wh, int argc, char **argv, int *status) | 444 | call_send (struct mh_whatnow_env *wh, int argc, char **argv, int *status) |
445 | { | 445 | { |
446 | if (invoke ("sendproc", MHBINDIR "/send", argc, argv, wh->file, NULL) == 0) | 446 | if (invoke ("sendproc", MHBINDIR "/send", argc, argv, wh->file, NULL) == 0) |
447 | annotate (wh); | 447 | annotate (wh); |
... | @@ -541,7 +541,7 @@ static struct action_tab whatnow_tab[] = { | ... | @@ -541,7 +541,7 @@ static struct action_tab whatnow_tab[] = { |
541 | { "push", push }, | 541 | { "push", push }, |
542 | { "quit", quit }, | 542 | { "quit", quit }, |
543 | { "refile", refile }, | 543 | { "refile", refile }, |
544 | { "send", send }, | 544 | { "send", call_send }, |
545 | { "whom", whom }, | 545 | { "whom", whom }, |
546 | { NULL } | 546 | { NULL } |
547 | }; | 547 | }; | ... | ... |
... | @@ -696,7 +696,7 @@ _action_send (void *item, void *data) | ... | @@ -696,7 +696,7 @@ _action_send (void *item, void *data) |
696 | } | 696 | } |
697 | 697 | ||
698 | static int | 698 | static int |
699 | send (int argc, char **argv) | 699 | do_send (int argc, char **argv) |
700 | { | 700 | { |
701 | int i, rc; | 701 | int i, rc; |
702 | char *p; | 702 | char *p; |
... | @@ -762,5 +762,5 @@ main (int argc, char **argv) | ... | @@ -762,5 +762,5 @@ main (int argc, char **argv) |
762 | argc = 1; | 762 | argc = 1; |
763 | } | 763 | } |
764 | 764 | ||
765 | return send (argc, argv); | 765 | return do_send (argc, argv); |
766 | } | 766 | } | ... | ... |
... | @@ -61,7 +61,7 @@ do_mysql_query (mu_sql_connection_t conn, char *query) | ... | @@ -61,7 +61,7 @@ do_mysql_query (mu_sql_connection_t conn, char *query) |
61 | /* Interface routines */ | 61 | /* Interface routines */ |
62 | 62 | ||
63 | static int | 63 | static int |
64 | init (mu_sql_connection_t conn) | 64 | mu_mysql_init (mu_sql_connection_t conn) |
65 | { | 65 | { |
66 | struct mu_mysql_data *mp = calloc (1, sizeof (*mp)); | 66 | struct mu_mysql_data *mp = calloc (1, sizeof (*mp)); |
67 | if (!mp) | 67 | if (!mp) |
... | @@ -71,7 +71,7 @@ init (mu_sql_connection_t conn) | ... | @@ -71,7 +71,7 @@ init (mu_sql_connection_t conn) |
71 | } | 71 | } |
72 | 72 | ||
73 | static int | 73 | static int |
74 | destroy (mu_sql_connection_t conn) | 74 | mu_mysql_destroy (mu_sql_connection_t conn) |
75 | { | 75 | { |
76 | struct mu_mysql_data *mp = conn->data; | 76 | struct mu_mysql_data *mp = conn->data; |
77 | free (mp->mysql); | 77 | free (mp->mysql); |
... | @@ -82,7 +82,7 @@ destroy (mu_sql_connection_t conn) | ... | @@ -82,7 +82,7 @@ destroy (mu_sql_connection_t conn) |
82 | 82 | ||
83 | 83 | ||
84 | static int | 84 | static int |
85 | connect (mu_sql_connection_t conn) | 85 | mu_mysql_connect (mu_sql_connection_t conn) |
86 | { | 86 | { |
87 | struct mu_mysql_data *mp = conn->data; | 87 | struct mu_mysql_data *mp = conn->data; |
88 | char *host, *socket_name = NULL; | 88 | char *host, *socket_name = NULL; |
... | @@ -115,7 +115,7 @@ connect (mu_sql_connection_t conn) | ... | @@ -115,7 +115,7 @@ connect (mu_sql_connection_t conn) |
115 | } | 115 | } |
116 | 116 | ||
117 | static int | 117 | static int |
118 | disconnect (mu_sql_connection_t conn) | 118 | mu_mysql_disconnect (mu_sql_connection_t conn) |
119 | { | 119 | { |
120 | struct mu_mysql_data *mp = conn->data; | 120 | struct mu_mysql_data *mp = conn->data; |
121 | 121 | ||
... | @@ -126,7 +126,7 @@ disconnect (mu_sql_connection_t conn) | ... | @@ -126,7 +126,7 @@ disconnect (mu_sql_connection_t conn) |
126 | } | 126 | } |
127 | 127 | ||
128 | static int | 128 | static int |
129 | query (mu_sql_connection_t conn, char *query) | 129 | mu_mysql_query (mu_sql_connection_t conn, char *query) |
130 | { | 130 | { |
131 | if (do_mysql_query (conn, query)) | 131 | if (do_mysql_query (conn, query)) |
132 | return MU_ERR_SQL; | 132 | return MU_ERR_SQL; |
... | @@ -135,7 +135,7 @@ query (mu_sql_connection_t conn, char *query) | ... | @@ -135,7 +135,7 @@ query (mu_sql_connection_t conn, char *query) |
135 | 135 | ||
136 | 136 | ||
137 | static int | 137 | static int |
138 | store_result (mu_sql_connection_t conn) | 138 | mu_mysql_store_result (mu_sql_connection_t conn) |
139 | { | 139 | { |
140 | struct mu_mysql_data *mp = conn->data; | 140 | struct mu_mysql_data *mp = conn->data; |
141 | if (!(mp->result = mysql_store_result (mp->mysql))) | 141 | if (!(mp->result = mysql_store_result (mp->mysql))) |
... | @@ -148,7 +148,7 @@ store_result (mu_sql_connection_t conn) | ... | @@ -148,7 +148,7 @@ store_result (mu_sql_connection_t conn) |
148 | } | 148 | } |
149 | 149 | ||
150 | static int | 150 | static int |
151 | release_result (mu_sql_connection_t conn) | 151 | mu_mysql_release_result (mu_sql_connection_t conn) |
152 | { | 152 | { |
153 | struct mu_mysql_data *mp = conn->data; | 153 | struct mu_mysql_data *mp = conn->data; |
154 | mysql_free_result (mp->result); | 154 | mysql_free_result (mp->result); |
... | @@ -157,7 +157,7 @@ release_result (mu_sql_connection_t conn) | ... | @@ -157,7 +157,7 @@ release_result (mu_sql_connection_t conn) |
157 | } | 157 | } |
158 | 158 | ||
159 | static int | 159 | static int |
160 | num_columns (mu_sql_connection_t conn, size_t *np) | 160 | mu_mysql_num_columns (mu_sql_connection_t conn, size_t *np) |
161 | { | 161 | { |
162 | struct mu_mysql_data *mp = conn->data; | 162 | struct mu_mysql_data *mp = conn->data; |
163 | *np = mysql_num_fields (mp->result); | 163 | *np = mysql_num_fields (mp->result); |
... | @@ -165,7 +165,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) | ... | @@ -165,7 +165,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) |
165 | } | 165 | } |
166 | 166 | ||
167 | static int | 167 | static int |
168 | num_tuples (mu_sql_connection_t conn, size_t *np) | 168 | mu_mysql_num_tuples (mu_sql_connection_t conn, size_t *np) |
169 | { | 169 | { |
170 | struct mu_mysql_data *mp = conn->data; | 170 | struct mu_mysql_data *mp = conn->data; |
171 | *np = mysql_num_rows (mp->result); | 171 | *np = mysql_num_rows (mp->result); |
... | @@ -173,7 +173,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) | ... | @@ -173,7 +173,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) |
173 | } | 173 | } |
174 | 174 | ||
175 | static int | 175 | static int |
176 | get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | 176 | mu_mysql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, |
177 | char **pdata) | ||
177 | { | 178 | { |
178 | struct mu_mysql_data *mp = conn->data; | 179 | struct mu_mysql_data *mp = conn->data; |
179 | MYSQL_ROW row; | 180 | MYSQL_ROW row; |
... | @@ -191,7 +192,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | ... | @@ -191,7 +192,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) |
191 | } | 192 | } |
192 | 193 | ||
193 | static int | 194 | static int |
194 | get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | 195 | mu_mysql_get_field_number (mu_sql_connection_t conn, const char *fname, |
196 | size_t *fno) | ||
195 | { | 197 | { |
196 | struct mu_mysql_data *mp = conn->data; | 198 | struct mu_mysql_data *mp = conn->data; |
197 | MYSQL_FIELD *fields; | 199 | MYSQL_FIELD *fields; |
... | @@ -212,7 +214,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | ... | @@ -212,7 +214,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) |
212 | } | 214 | } |
213 | 215 | ||
214 | static const char * | 216 | static const char * |
215 | errstr (mu_sql_connection_t conn) | 217 | mu_mysql_errstr (mu_sql_connection_t conn) |
216 | { | 218 | { |
217 | struct mu_mysql_data *mp = conn->data; | 219 | struct mu_mysql_data *mp = conn->data; |
218 | return mysql_error (mp->mysql); | 220 | return mysql_error (mp->mysql); |
... | @@ -355,17 +357,17 @@ mu_check_mysql_scrambled_password (const char *scrambled, const char *message) | ... | @@ -355,17 +357,17 @@ mu_check_mysql_scrambled_password (const char *scrambled, const char *message) |
355 | MU_DECL_SQL_DISPATCH_T(mysql) = { | 357 | MU_DECL_SQL_DISPATCH_T(mysql) = { |
356 | "mysql", | 358 | "mysql", |
357 | 3306, | 359 | 3306, |
358 | init, | 360 | mu_mysql_init, |
359 | destroy, | 361 | mu_mysql_destroy, |
360 | connect, | 362 | mu_mysql_connect, |
361 | disconnect, | 363 | mu_mysql_disconnect, |
362 | query, | 364 | mu_mysql_query, |
363 | store_result, | 365 | mu_mysql_store_result, |
364 | release_result, | 366 | mu_mysql_release_result, |
365 | num_tuples, | 367 | mu_mysql_num_tuples, |
366 | num_columns, | 368 | mu_mysql_num_columns, |
367 | get_column, | 369 | mu_mysql_get_column, |
368 | get_field_number, | 370 | mu_mysql_get_field_number, |
369 | errstr, | 371 | mu_mysql_errstr, |
370 | }; | 372 | }; |
371 | 373 | ... | ... |
... | @@ -60,7 +60,7 @@ mu_odbc_diag(struct mu_odbc_data *dp, | ... | @@ -60,7 +60,7 @@ mu_odbc_diag(struct mu_odbc_data *dp, |
60 | /* Interface routines */ | 60 | /* Interface routines */ |
61 | 61 | ||
62 | static int | 62 | static int |
63 | init (mu_sql_connection_t conn) | 63 | odbc_init (mu_sql_connection_t conn) |
64 | { | 64 | { |
65 | struct mu_odbc_data *dp = calloc (1, sizeof (*dp)); | 65 | struct mu_odbc_data *dp = calloc (1, sizeof (*dp)); |
66 | if (!dp) | 66 | if (!dp) |
... | @@ -70,7 +70,7 @@ init (mu_sql_connection_t conn) | ... | @@ -70,7 +70,7 @@ init (mu_sql_connection_t conn) |
70 | } | 70 | } |
71 | 71 | ||
72 | static int | 72 | static int |
73 | destroy (mu_sql_connection_t conn) | 73 | odbc_destroy (mu_sql_connection_t conn) |
74 | { | 74 | { |
75 | struct mu_odbc_data *dp = conn->data; | 75 | struct mu_odbc_data *dp = conn->data; |
76 | free (dp->err.msg); | 76 | free (dp->err.msg); |
... | @@ -83,7 +83,7 @@ destroy (mu_sql_connection_t conn) | ... | @@ -83,7 +83,7 @@ destroy (mu_sql_connection_t conn) |
83 | } | 83 | } |
84 | 84 | ||
85 | static int | 85 | static int |
86 | connect (mu_sql_connection_t conn) | 86 | odbc_connect (mu_sql_connection_t conn) |
87 | { | 87 | { |
88 | struct mu_odbc_data *dp = conn->data; | 88 | struct mu_odbc_data *dp = conn->data; |
89 | long rc; | 89 | long rc; |
... | @@ -124,7 +124,7 @@ connect (mu_sql_connection_t conn) | ... | @@ -124,7 +124,7 @@ connect (mu_sql_connection_t conn) |
124 | } | 124 | } |
125 | 125 | ||
126 | static int | 126 | static int |
127 | disconnect (mu_sql_connection_t conn) | 127 | odbc_disconnect (mu_sql_connection_t conn) |
128 | { | 128 | { |
129 | struct mu_odbc_data *dp = conn->data; | 129 | struct mu_odbc_data *dp = conn->data; |
130 | SQLDisconnect (dp->dbc); | 130 | SQLDisconnect (dp->dbc); |
... | @@ -133,7 +133,7 @@ disconnect (mu_sql_connection_t conn) | ... | @@ -133,7 +133,7 @@ disconnect (mu_sql_connection_t conn) |
133 | } | 133 | } |
134 | 134 | ||
135 | static int | 135 | static int |
136 | query (mu_sql_connection_t conn, char *query) | 136 | odbc_query (mu_sql_connection_t conn, char *query) |
137 | { | 137 | { |
138 | struct mu_odbc_data *dp = conn->data; | 138 | struct mu_odbc_data *dp = conn->data; |
139 | long rc; | 139 | long rc; |
... | @@ -171,7 +171,7 @@ query (mu_sql_connection_t conn, char *query) | ... | @@ -171,7 +171,7 @@ query (mu_sql_connection_t conn, char *query) |
171 | } | 171 | } |
172 | 172 | ||
173 | static int | 173 | static int |
174 | store_result (mu_sql_connection_t conn) | 174 | odbc_store_result (mu_sql_connection_t conn) |
175 | { | 175 | { |
176 | struct mu_odbc_data *dp = conn->data; | 176 | struct mu_odbc_data *dp = conn->data; |
177 | mu_list_create (&dp->result); | 177 | mu_list_create (&dp->result); |
... | @@ -179,17 +179,17 @@ store_result (mu_sql_connection_t conn) | ... | @@ -179,17 +179,17 @@ store_result (mu_sql_connection_t conn) |
179 | } | 179 | } |
180 | 180 | ||
181 | static int | 181 | static int |
182 | free_char_data (void *item, void *data MU_ARG_UNUSED) | 182 | odbc_free_char_data (void *item, void *data MU_ARG_UNUSED) |
183 | { | 183 | { |
184 | free (item); | 184 | free (item); |
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int | 188 | static int |
189 | release_result (mu_sql_connection_t conn) | 189 | odbc_release_result (mu_sql_connection_t conn) |
190 | { | 190 | { |
191 | struct mu_odbc_data *dp = conn->data; | 191 | struct mu_odbc_data *dp = conn->data; |
192 | mu_list_do (dp->result, free_char_data, NULL); | 192 | mu_list_do (dp->result, odbc_free_char_data, NULL); |
193 | mu_list_destroy (&dp->result); | 193 | mu_list_destroy (&dp->result); |
194 | mu_argcv_free (dp->fcount, dp->fnames); | 194 | mu_argcv_free (dp->fcount, dp->fnames); |
195 | dp->fcount = 0; | 195 | dp->fcount = 0; |
... | @@ -198,7 +198,7 @@ release_result (mu_sql_connection_t conn) | ... | @@ -198,7 +198,7 @@ release_result (mu_sql_connection_t conn) |
198 | } | 198 | } |
199 | 199 | ||
200 | static int | 200 | static int |
201 | num_columns (mu_sql_connection_t conn, size_t *np) | 201 | odbc_num_columns (mu_sql_connection_t conn, size_t *np) |
202 | { | 202 | { |
203 | struct mu_odbc_data *dp = conn->data; | 203 | struct mu_odbc_data *dp = conn->data; |
204 | SQLSMALLINT count; | 204 | SQLSMALLINT count; |
... | @@ -217,7 +217,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) | ... | @@ -217,7 +217,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) |
217 | } | 217 | } |
218 | 218 | ||
219 | static int | 219 | static int |
220 | num_tuples (mu_sql_connection_t conn, size_t *np) | 220 | odbc_num_tuples (mu_sql_connection_t conn, size_t *np) |
221 | { | 221 | { |
222 | struct mu_odbc_data *dp = conn->data; | 222 | struct mu_odbc_data *dp = conn->data; |
223 | SQLINTEGER count; | 223 | SQLINTEGER count; |
... | @@ -232,7 +232,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) | ... | @@ -232,7 +232,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) |
232 | } | 232 | } |
233 | 233 | ||
234 | static int | 234 | static int |
235 | get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | 235 | odbc_get_column (mu_sql_connection_t conn, |
236 | size_t nrow, size_t ncol, char **pdata) | ||
236 | { | 237 | { |
237 | struct mu_odbc_data *dp = conn->data; | 238 | struct mu_odbc_data *dp = conn->data; |
238 | char buffer[1024]; | 239 | char buffer[1024]; |
... | @@ -258,7 +259,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | ... | @@ -258,7 +259,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) |
258 | 259 | ||
259 | /* FIXME: untested */ | 260 | /* FIXME: untested */ |
260 | static int | 261 | static int |
261 | get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | 262 | odbc_get_field_number (mu_sql_connection_t conn, const char *fname, |
263 | size_t *fno) | ||
262 | { | 264 | { |
263 | size_t count; | 265 | size_t count; |
264 | struct mu_odbc_data *dp = conn->data; | 266 | struct mu_odbc_data *dp = conn->data; |
... | @@ -268,7 +270,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | ... | @@ -268,7 +270,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) |
268 | { | 270 | { |
269 | int rc; | 271 | int rc; |
270 | 272 | ||
271 | rc = num_columns (conn, &count); | 273 | rc = odbc_num_columns (conn, &count); |
272 | if (rc) | 274 | if (rc) |
273 | return rc; | 275 | return rc; |
274 | dp->fnames = calloc(count + 1, sizeof dp->fnames[0]); | 276 | dp->fnames = calloc(count + 1, sizeof dp->fnames[0]); |
... | @@ -335,7 +337,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | ... | @@ -335,7 +337,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) |
335 | #define DEFAULT_ERROR_BUFFER_SIZE 1024 | 337 | #define DEFAULT_ERROR_BUFFER_SIZE 1024 |
336 | 338 | ||
337 | static const char * | 339 | static const char * |
338 | errstr (mu_sql_connection_t conn) | 340 | odbc_errstr (mu_sql_connection_t conn) |
339 | { | 341 | { |
340 | struct mu_odbc_data *dp = conn->data; | 342 | struct mu_odbc_data *dp = conn->data; |
341 | char state[16]; | 343 | char state[16]; |
... | @@ -380,16 +382,16 @@ errstr (mu_sql_connection_t conn) | ... | @@ -380,16 +382,16 @@ errstr (mu_sql_connection_t conn) |
380 | MU_DECL_SQL_DISPATCH_T(odbc) = { | 382 | MU_DECL_SQL_DISPATCH_T(odbc) = { |
381 | "odbc", | 383 | "odbc", |
382 | 0, | 384 | 0, |
383 | init, | 385 | odbc_init, |
384 | destroy, | 386 | odbc_destroy, |
385 | connect, | 387 | odbc_connect, |
386 | disconnect, | 388 | odbc_disconnect, |
387 | query, | 389 | odbc_query, |
388 | store_result, | 390 | odbc_store_result, |
389 | release_result, | 391 | odbc_release_result, |
390 | num_tuples, | 392 | odbc_num_tuples, |
391 | num_columns, | 393 | odbc_num_columns, |
392 | get_column, | 394 | odbc_get_column, |
393 | get_field_number, | 395 | odbc_get_field_number, |
394 | errstr, | 396 | odbc_errstr, |
395 | }; | 397 | }; | ... | ... |
... | @@ -46,7 +46,7 @@ struct mu_pgsql_data | ... | @@ -46,7 +46,7 @@ struct mu_pgsql_data |
46 | 46 | ||
47 | 47 | ||
48 | static int | 48 | static int |
49 | init (mu_sql_connection_t conn) | 49 | postgres_init (mu_sql_connection_t conn) |
50 | { | 50 | { |
51 | struct mu_pgsql_data *dp = calloc (1, sizeof (*dp)); | 51 | struct mu_pgsql_data *dp = calloc (1, sizeof (*dp)); |
52 | if (!dp) | 52 | if (!dp) |
... | @@ -56,7 +56,7 @@ init (mu_sql_connection_t conn) | ... | @@ -56,7 +56,7 @@ init (mu_sql_connection_t conn) |
56 | } | 56 | } |
57 | 57 | ||
58 | static int | 58 | static int |
59 | destroy (mu_sql_connection_t conn) | 59 | postgres_destroy (mu_sql_connection_t conn) |
60 | { | 60 | { |
61 | struct mu_pgsql_data *dp = conn->data; | 61 | struct mu_pgsql_data *dp = conn->data; |
62 | free (dp); | 62 | free (dp); |
... | @@ -65,7 +65,7 @@ destroy (mu_sql_connection_t conn) | ... | @@ -65,7 +65,7 @@ destroy (mu_sql_connection_t conn) |
65 | } | 65 | } |
66 | 66 | ||
67 | static int | 67 | static int |
68 | connect (mu_sql_connection_t conn) | 68 | postgres_connect (mu_sql_connection_t conn) |
69 | { | 69 | { |
70 | struct mu_pgsql_data *dp = conn->data; | 70 | struct mu_pgsql_data *dp = conn->data; |
71 | char portbuf[16]; | 71 | char portbuf[16]; |
... | @@ -88,7 +88,7 @@ connect (mu_sql_connection_t conn) | ... | @@ -88,7 +88,7 @@ connect (mu_sql_connection_t conn) |
88 | } | 88 | } |
89 | 89 | ||
90 | static int | 90 | static int |
91 | disconnect (mu_sql_connection_t conn) | 91 | postgres_disconnect (mu_sql_connection_t conn) |
92 | { | 92 | { |
93 | struct mu_pgsql_data *dp = conn->data; | 93 | struct mu_pgsql_data *dp = conn->data; |
94 | PQfinish (dp->pgconn); | 94 | PQfinish (dp->pgconn); |
... | @@ -96,7 +96,7 @@ disconnect (mu_sql_connection_t conn) | ... | @@ -96,7 +96,7 @@ disconnect (mu_sql_connection_t conn) |
96 | } | 96 | } |
97 | 97 | ||
98 | static int | 98 | static int |
99 | query (mu_sql_connection_t conn, char *query) | 99 | postgres_query (mu_sql_connection_t conn, char *query) |
100 | { | 100 | { |
101 | struct mu_pgsql_data *dp = conn->data; | 101 | struct mu_pgsql_data *dp = conn->data; |
102 | ExecStatusType stat; | 102 | ExecStatusType stat; |
... | @@ -114,13 +114,13 @@ query (mu_sql_connection_t conn, char *query) | ... | @@ -114,13 +114,13 @@ query (mu_sql_connection_t conn, char *query) |
114 | } | 114 | } |
115 | 115 | ||
116 | static int | 116 | static int |
117 | store_result (mu_sql_connection_t conn) | 117 | postgres_store_result (mu_sql_connection_t conn) |
118 | { | 118 | { |
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
121 | 121 | ||
122 | static int | 122 | static int |
123 | release_result (mu_sql_connection_t conn) | 123 | postgres_release_result (mu_sql_connection_t conn) |
124 | { | 124 | { |
125 | struct mu_pgsql_data *dp = conn->data; | 125 | struct mu_pgsql_data *dp = conn->data; |
126 | PQclear (dp->res); | 126 | PQclear (dp->res); |
... | @@ -129,7 +129,7 @@ release_result (mu_sql_connection_t conn) | ... | @@ -129,7 +129,7 @@ release_result (mu_sql_connection_t conn) |
129 | } | 129 | } |
130 | 130 | ||
131 | static int | 131 | static int |
132 | num_columns (mu_sql_connection_t conn, size_t *np) | 132 | postgres_num_columns (mu_sql_connection_t conn, size_t *np) |
133 | { | 133 | { |
134 | struct mu_pgsql_data *dp = conn->data; | 134 | struct mu_pgsql_data *dp = conn->data; |
135 | if (!dp->res) | 135 | if (!dp->res) |
... | @@ -139,7 +139,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) | ... | @@ -139,7 +139,7 @@ num_columns (mu_sql_connection_t conn, size_t *np) |
139 | } | 139 | } |
140 | 140 | ||
141 | static int | 141 | static int |
142 | num_tuples (mu_sql_connection_t conn, size_t *np) | 142 | postgres_num_tuples (mu_sql_connection_t conn, size_t *np) |
143 | { | 143 | { |
144 | struct mu_pgsql_data *dp = conn->data; | 144 | struct mu_pgsql_data *dp = conn->data; |
145 | if (!dp->res) | 145 | if (!dp->res) |
... | @@ -149,7 +149,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) | ... | @@ -149,7 +149,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np) |
149 | } | 149 | } |
150 | 150 | ||
151 | static int | 151 | static int |
152 | get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | 152 | postgres_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, |
153 | char **pdata) | ||
153 | { | 154 | { |
154 | struct mu_pgsql_data *dp = conn->data; | 155 | struct mu_pgsql_data *dp = conn->data; |
155 | if (!dp->res) | 156 | if (!dp->res) |
... | @@ -159,7 +160,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) | ... | @@ -159,7 +160,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata) |
159 | } | 160 | } |
160 | 161 | ||
161 | static int | 162 | static int |
162 | get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | 163 | postgres_get_field_number (mu_sql_connection_t conn, const char *fname, |
164 | size_t *fno) | ||
163 | { | 165 | { |
164 | struct mu_pgsql_data *dp = conn->data; | 166 | struct mu_pgsql_data *dp = conn->data; |
165 | if (!dp->res) | 167 | if (!dp->res) |
... | @@ -170,7 +172,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) | ... | @@ -170,7 +172,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno) |
170 | } | 172 | } |
171 | 173 | ||
172 | static const char * | 174 | static const char * |
173 | errstr (mu_sql_connection_t conn) | 175 | postgres_errstr (mu_sql_connection_t conn) |
174 | { | 176 | { |
175 | struct mu_pgsql_data *dp = conn->data; | 177 | struct mu_pgsql_data *dp = conn->data; |
176 | return PQerrorMessage (dp->pgconn); | 178 | return PQerrorMessage (dp->pgconn); |
... | @@ -180,18 +182,18 @@ errstr (mu_sql_connection_t conn) | ... | @@ -180,18 +182,18 @@ errstr (mu_sql_connection_t conn) |
180 | MU_DECL_SQL_DISPATCH_T(postgres) = { | 182 | MU_DECL_SQL_DISPATCH_T(postgres) = { |
181 | "postgres", | 183 | "postgres", |
182 | 5432, | 184 | 5432, |
183 | init, | 185 | postgres_init, |
184 | destroy, | 186 | postgres_destroy, |
185 | connect, | 187 | postgres_connect, |
186 | disconnect, | 188 | postgres_disconnect, |
187 | query, | 189 | postgres_query, |
188 | store_result, | 190 | postgres_store_result, |
189 | release_result, | 191 | postgres_release_result, |
190 | num_tuples, | 192 | postgres_num_tuples, |
191 | num_columns, | 193 | postgres_num_columns, |
192 | get_column, | 194 | postgres_get_column, |
193 | get_field_number, | 195 | postgres_get_field_number, |
194 | errstr, | 196 | postgres_errstr, |
195 | }; | 197 | }; |
196 | 198 | ||
197 | #endif | 199 | #endif | ... | ... |
-
Please register or sign in to post a comment