3 /***********************************************************************
4 * This code is part of GLPK (GNU Linear Programming Kit).
6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
7 * 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
9 * E-mail: <mao@gnu.org>.
11 * GLPK is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 * License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
23 ***********************************************************************/
30 /**********************************************************************/
32 #define CSV_FIELD_MAX 50
33 /* maximal number of fields in record */
35 #define CSV_FDLEN_MAX 100
36 /* maximal field length */
39 { /* comma-separated values file */
41 /* 'R' = reading; 'W' = writing */
43 /* name of csv file */
45 /* stream assigned to csv file */
47 /* address for non-local go to in case of error */
50 /*--------------------------------------------------------------*/
51 /* used only for input csv file */
53 /* current character or EOF */
56 #define CSV_EOF 0 /* end-of-file */
57 #define CSV_EOR 1 /* end-of-record */
58 #define CSV_NUM 2 /* floating-point number */
59 #define CSV_STR 3 /* character string */
60 char field[CSV_FDLEN_MAX+1];
61 /* current field just read */
63 /* number of fields in the csv file */
64 int ref[1+CSV_FIELD_MAX];
65 /* ref[k] = k', if k-th field of the csv file corresponds to
66 k'-th field in the table statement; if ref[k] = 0, k-th field
67 of the csv file is ignored */
68 #if 1 /* 01/VI-2010 */
70 /* number of comment records preceding the header record */
76 static void read_char(struct csv *csv)
77 { /* read character from csv data file */
79 xassert(csv->c != EOF);
80 if (csv->c == '\n') csv->count++;
81 loop: c = fgetc(csv->fp);
83 { xprintf("%s:%d: read error - %s\n", csv->fname, csv->count,
85 longjmp(csv->jump, 0);
93 { xprintf("%s:%d: warning: missing final end-of-line\n",
94 csv->fname, csv->count);
103 { xprintf("%s:%d: invalid control character 0x%02X\n",
104 csv->fname, csv->count, c);
105 longjmp(csv->jump, 0);
111 static void read_field(struct csv *csv)
112 { /* read field from csv data file */
113 /* check for end of file */
115 { csv->what = CSV_EOF;
116 strcpy(csv->field, "EOF");
119 /* check for end of record */
121 { csv->what = CSV_EOR;
122 strcpy(csv->field, "EOR");
125 err1: { xprintf("%s:%d: empty field not allowed\n", csv->fname,
127 longjmp(csv->jump, 0);
130 { xprintf("%s:%d: empty record not allowed\n", csv->fname,
132 longjmp(csv->jump, 0);
134 #if 1 /* 01/VI-2010 */
135 /* skip comment records; may appear only before the very first
136 record containing field names */
137 if (csv->c == '#' && csv->count == 1)
138 { while (csv->c == '#')
139 { while (csv->c != '\n')
148 /* skip comma before next field */
152 if (csv->c == '\'' || csv->c == '"')
153 { /* read a field enclosed in quotes */
154 int quote = csv->c, len = 0;
156 /* skip opening quote */
158 /* read field characters within quotes */
160 { /* check for closing quote and read it */
165 else if (csv->c == ',' || csv->c == '\n')
168 { xprintf("%s:%d: invalid field\n", csv->fname,
170 longjmp(csv->jump, 0);
173 /* check the current field length */
174 if (len == CSV_FDLEN_MAX)
175 err2: { xprintf("%s:%d: field too long\n", csv->fname,
177 longjmp(csv->jump, 0);
179 /* add the current character to the field */
180 csv->field[len++] = (char)csv->c;
181 /* read the next character */
184 /* the field has been read */
185 if (len == 0) goto err1;
186 csv->field[len] = '\0';
189 { /* read a field not enclosed in quotes */
193 while (!(csv->c == ',' || csv->c == '\n'))
194 { /* quotes within the field are not allowed */
195 if (csv->c == '\'' || csv->c == '"')
196 { xprintf("%s:%d: invalid use of single or double quote wi"
197 "thin field\n", csv->fname, csv->count);
198 longjmp(csv->jump, 0);
200 /* check the current field length */
201 if (len == CSV_FDLEN_MAX) goto err2;
202 /* add the current character to the field */
203 csv->field[len++] = (char)csv->c;
204 /* read the next character */
207 /* the field has been read */
208 if (len == 0) goto err1;
209 csv->field[len] = '\0';
210 /* check the field type */
211 if (str2num(csv->field, &temp)) csv->what = CSV_STR;
216 static struct csv *csv_open_file(TABDCA *dca, int mode)
217 { /* open csv data file */
219 /* create control structure */
220 csv = xmalloc(sizeof(struct csv));
224 if (setjmp(csv->jump)) goto fail;
228 csv->field[0] = '\0';
230 /* try to open the csv data file */
231 if (mpl_tab_num_args(dca) < 2)
232 { xprintf("csv_driver: file name not specified\n");
233 longjmp(csv->jump, 0);
235 csv->fname = xmalloc(strlen(mpl_tab_get_arg(dca, 2))+1);
236 strcpy(csv->fname, mpl_tab_get_arg(dca, 2));
238 { /* open the file for reading */
240 csv->fp = fopen(csv->fname, "r");
242 { xprintf("csv_driver: unable to open %s - %s\n",
243 csv->fname, strerror(errno));
244 longjmp(csv->jump, 0);
246 #if 1 /* 01/VI-2010 */
249 /* skip fake new-line */
251 xassert(csv->what == CSV_EOR);
252 /* read field names */
253 xassert(csv->nf == 0);
256 if (csv->what == CSV_EOR)
258 if (csv->what != CSV_STR)
259 { xprintf("%s:%d: invalid field name\n", csv->fname,
261 longjmp(csv->jump, 0);
263 if (csv->nf == CSV_FIELD_MAX)
264 { xprintf("%s:%d: too many fields\n", csv->fname,
266 longjmp(csv->jump, 0);
269 /* find corresponding field in the table statement */
270 for (k = mpl_tab_num_flds(dca); k >= 1; k--)
271 { if (strcmp(mpl_tab_get_name(dca, k), csv->field) == 0)
274 csv->ref[csv->nf] = k;
276 /* find dummy RECNO field in the table statement */
277 for (k = mpl_tab_num_flds(dca); k >= 1; k--)
278 if (strcmp(mpl_tab_get_name(dca, k), "RECNO") == 0) break;
281 else if (mode == 'W')
282 { /* open the file for writing */
284 csv->fp = fopen(csv->fname, "w");
286 { xprintf("csv_driver: unable to create %s - %s\n",
287 csv->fname, strerror(errno));
288 longjmp(csv->jump, 0);
290 /* write field names */
291 nf = mpl_tab_num_flds(dca);
292 for (k = 1; k <= nf; k++)
293 fprintf(csv->fp, "%s%c", mpl_tab_get_name(dca, k),
294 k < nf ? ',' : '\n');
298 xassert(mode != mode);
299 /* the file has been open */
301 fail: /* the file cannot be open */
302 if (csv->fname != NULL) xfree(csv->fname);
303 if (csv->fp != NULL) fclose(csv->fp);
308 static int csv_read_record(TABDCA *dca, struct csv *csv)
309 { /* read next record from csv data file */
311 xassert(csv->mode == 'R');
312 if (setjmp(csv->jump))
316 /* read dummy RECNO field */
318 #if 0 /* 01/VI-2010 */
319 mpl_tab_set_num(dca, csv->ref[0], csv->count-1);
321 mpl_tab_set_num(dca, csv->ref[0], csv->count-csv->nskip-1);
324 for (k = 1; k <= csv->nf; k++)
326 if (csv->what == CSV_EOF)
327 { /* end-of-file reached */
332 else if (csv->what == CSV_EOR)
333 { /* end-of-record reached */
334 int lack = csv->nf - k + 1;
336 xprintf("%s:%d: one field missing\n", csv->fname,
339 xprintf("%s:%d: %d fields missing\n", csv->fname,
341 longjmp(csv->jump, 0);
343 else if (csv->what == CSV_NUM)
344 { /* floating-point number */
347 xassert(str2num(csv->field, &num) == 0);
348 mpl_tab_set_num(dca, csv->ref[k], num);
351 else if (csv->what == CSV_STR)
352 { /* character string */
354 mpl_tab_set_str(dca, csv->ref[k], csv->field);
359 /* now there must be NL */
361 xassert(csv->what != CSV_EOF);
362 if (csv->what != CSV_EOR)
363 { xprintf("%s:%d: too many fields\n", csv->fname, csv->count);
364 longjmp(csv->jump, 0);
369 static int csv_write_record(TABDCA *dca, struct csv *csv)
370 { /* write next record to csv data file */
373 xassert(csv->mode == 'W');
374 nf = mpl_tab_num_flds(dca);
375 for (k = 1; k <= nf; k++)
376 { switch (mpl_tab_get_type(dca, k))
378 fprintf(csv->fp, "%.*g", DBL_DIG,
379 mpl_tab_get_num(dca, k));
383 for (c = mpl_tab_get_str(dca, k); *c != '\0'; c++)
385 fputc('"', csv->fp), fputc('"', csv->fp);
394 fputc(k < nf ? ',' : '\n', csv->fp);
398 { xprintf("%s:%d: write error - %s\n", csv->fname, csv->count,
405 static int csv_close_file(TABDCA *dca, struct csv *csv)
406 { /* close csv data file */
409 if (csv->mode == 'W')
412 { xprintf("%s:%d: write error - %s\n", csv->fname,
413 csv->count, strerror(errno));
423 /**********************************************************************/
425 #define DBF_FIELD_MAX 50
426 /* maximal number of fields in record */
428 #define DBF_FDLEN_MAX 100
429 /* maximal field length */
432 { /* xBASE data file */
434 /* 'R' = reading; 'W' = writing */
436 /* name of xBASE file */
438 /* stream assigned to xBASE file */
440 /* address for non-local go to in case of error */
442 /* offset of a byte to be read next */
446 /* number of fields */
447 int ref[1+DBF_FIELD_MAX];
448 /* ref[k] = k', if k-th field of the csv file corresponds to
449 k'-th field in the table statement; if ref[k] = 0, k-th field
450 of the csv file is ignored */
451 int type[1+DBF_FIELD_MAX];
452 /* type[k] is type of k-th field */
453 int len[1+DBF_FIELD_MAX];
454 /* len[k] is length of k-th field */
455 int prec[1+DBF_FIELD_MAX];
456 /* prec[k] is precision of k-th field */
459 static int read_byte(struct dbf *dbf)
460 { /* read byte from xBASE data file */
464 { xprintf("%s:0x%X: read error - %s\n", dbf->fname,
465 dbf->offset, strerror(errno));
466 longjmp(dbf->jump, 0);
469 { xprintf("%s:0x%X: unexpected end of file\n", dbf->fname,
471 longjmp(dbf->jump, 0);
473 xassert(0x00 <= b && b <= 0xFF);
478 static void read_header(TABDCA *dca, struct dbf *dbf)
479 { /* read xBASE data file header */
483 for (j = 1; j <= 10; j++)
485 /* length of each record, in bytes */
486 recl = read_byte(dbf);
487 recl += read_byte(dbf) << 8;
489 for (j = 1; j <= 20; j++)
491 /* field descriptor array */
492 xassert(dbf->nf == 0);
494 { /* check for end of array */
496 if (b == 0x0D) break;
497 if (dbf->nf == DBF_FIELD_MAX)
498 { xprintf("%s:0x%X: too many fields\n", dbf->fname,
500 longjmp(dbf->jump, 0);
505 for (j = 1; j < 10; j++)
506 { b = read_byte(dbf);
512 { xprintf("%s:0x%X: invalid field name\n", dbf->fname,
514 longjmp(dbf->jump, 0);
516 /* find corresponding field in the table statement */
517 for (k = mpl_tab_num_flds(dca); k >= 1; k--)
518 if (strcmp(mpl_tab_get_name(dca, k), name) == 0) break;
519 dbf->ref[dbf->nf] = k;
522 if (!(b == 'C' || b == 'N'))
523 { xprintf("%s:0x%X: invalid field type\n", dbf->fname,
525 longjmp(dbf->jump, 0);
527 dbf->type[dbf->nf] = b;
529 for (j = 1; j <= 4; j++)
534 { xprintf("%s:0x%X: invalid field length\n", dbf->fname,
536 longjmp(dbf->jump, 0);
538 if (b > DBF_FDLEN_MAX)
539 { xprintf("%s:0x%X: field too long\n", dbf->fname,
541 longjmp(dbf->jump, 0);
543 dbf->len[dbf->nf] = b;
546 for (j = 1; j <= 15; j++)
550 { xprintf("%s:0x%X: invalid file header\n", dbf->fname,
552 longjmp(dbf->jump, 0);
554 /* find dummy RECNO field in the table statement */
555 for (k = mpl_tab_num_flds(dca); k >= 1; k--)
556 if (strcmp(mpl_tab_get_name(dca, k), "RECNO") == 0) break;
561 static void parse_third_arg(TABDCA *dca, struct dbf *dbf)
562 { /* parse xBASE file format (third argument) */
565 dbf->nf = mpl_tab_num_flds(dca);
566 arg = mpl_tab_get_arg(dca, 3), j = 0;
567 for (k = 1; k <= dbf->nf; k++)
568 { /* parse specification of k-th field */
570 { xprintf("xBASE driver: field %s: specification missing\n",
571 mpl_tab_get_name(dca, k));
572 longjmp(dbf->jump, 0);
574 /* parse field type */
575 if (arg[j] == 'C' || arg[j] == 'N')
576 dbf->type[k] = arg[j], j++;
578 { xprintf("xBASE driver: field %s: invalid field type\n",
579 mpl_tab_get_name(dca, k));
580 longjmp(dbf->jump, 0);
582 /* check for left parenthesis */
586 err: { xprintf("xBASE driver: field %s: invalid field format\n",
587 mpl_tab_get_name(dca, k));
588 longjmp(dbf->jump, 0);
590 /* parse field length */
592 while (isdigit(arg[j]))
593 { if (temp > DBF_FDLEN_MAX) break;
594 temp = 10 * temp + (arg[j] - '0'), j++;
596 if (!(1 <= temp && temp <= DBF_FDLEN_MAX))
597 { xprintf("xBASE driver: field %s: invalid field length\n",
598 mpl_tab_get_name(dca, k));
599 longjmp(dbf->jump, 0);
602 /* parse optional field precision */
603 if (dbf->type[k] == 'N' && arg[j] == ',')
606 while (isdigit(arg[j]))
607 { if (temp > dbf->len[k]) break;
608 temp = 10 * temp + (arg[j] - '0'), j++;
610 if (temp > dbf->len[k])
611 { xprintf("xBASE driver: field %s: invalid field precision"
612 "\n", mpl_tab_get_name(dca, k));
613 longjmp(dbf->jump, 0);
619 /* check for right parenthesis */
625 /* ignore other specifications */
629 static void write_byte(struct dbf *dbf, int b)
630 { /* write byte to xBASE data file */
636 static void write_header(TABDCA *dca, struct dbf *dbf)
637 { /* write xBASE data file header */
641 write_byte(dbf, 0x03 /* file without DBT */);
642 /* date of last update (YYMMDD) */
643 write_byte(dbf, 70 /* 1970 */);
644 write_byte(dbf, 1 /* January */);
645 write_byte(dbf, 1 /* 1st */);
646 /* number of records (unknown so far) */
647 for (j = 1; j <= 4; j++)
648 write_byte(dbf, 0xFF);
649 /* length of the header, in bytes */
650 temp = 32 + dbf->nf * 32 + 1;
651 write_byte(dbf, temp);
652 write_byte(dbf, temp >> 8);
653 /* length of each record, in bytes */
655 for (k = 1; k <= dbf->nf; k++)
657 write_byte(dbf, temp);
658 write_byte(dbf, temp >> 8);
660 for (j = 1; j <= 20; j++)
661 write_byte(dbf, 0x00);
662 /* field descriptor array */
663 for (k = 1; k <= dbf->nf; k++)
664 { /* field name (terminated by 0x00) */
665 name = mpl_tab_get_name(dca, k);
666 for (j = 0; j < 10 && name[j] != '\0'; j++)
667 write_byte(dbf, name[j]);
668 for (j = j; j < 11; j++)
669 write_byte(dbf, 0x00);
671 write_byte(dbf, dbf->type[k]);
673 for (j = 1; j <= 4; j++)
674 write_byte(dbf, 0x00);
676 write_byte(dbf, dbf->len[k]);
677 /* field precision */
678 write_byte(dbf, dbf->prec[k]);
680 for (j = 1; j <= 14; j++)
681 write_byte(dbf, 0x00);
684 write_byte(dbf, 0x0D);
688 static struct dbf *dbf_open_file(TABDCA *dca, int mode)
689 { /* open xBASE data file */
691 /* create control structure */
692 dbf = xmalloc(sizeof(struct dbf));
696 if (setjmp(dbf->jump)) goto fail;
700 /* try to open the xBASE data file */
701 if (mpl_tab_num_args(dca) < 2)
702 { xprintf("xBASE driver: file name not specified\n");
703 longjmp(dbf->jump, 0);
705 dbf->fname = xmalloc(strlen(mpl_tab_get_arg(dca, 2))+1);
706 strcpy(dbf->fname, mpl_tab_get_arg(dca, 2));
708 { /* open the file for reading */
709 dbf->fp = fopen(dbf->fname, "rb");
711 { xprintf("xBASE driver: unable to open %s - %s\n",
712 dbf->fname, strerror(errno));
713 longjmp(dbf->jump, 0);
715 read_header(dca, dbf);
717 else if (mode == 'W')
718 { /* open the file for writing */
719 if (mpl_tab_num_args(dca) < 3)
720 { xprintf("xBASE driver: file format not specified\n");
721 longjmp(dbf->jump, 0);
723 parse_third_arg(dca, dbf);
724 dbf->fp = fopen(dbf->fname, "wb");
726 { xprintf("xBASE driver: unable to create %s - %s\n",
727 dbf->fname, strerror(errno));
728 longjmp(dbf->jump, 0);
730 write_header(dca, dbf);
733 xassert(mode != mode);
734 /* the file has been open */
736 fail: /* the file cannot be open */
737 if (dbf->fname != NULL) xfree(dbf->fname);
738 if (dbf->fp != NULL) fclose(dbf->fp);
743 static int dbf_read_record(TABDCA *dca, struct dbf *dbf)
744 { /* read next record from xBASE data file */
745 int b, j, k, ret = 0;
746 char buf[DBF_FDLEN_MAX+1];
747 xassert(dbf->mode == 'R');
748 if (setjmp(dbf->jump))
752 /* check record flag */
760 { xprintf("%s:0x%X: invalid record flag\n", dbf->fname,
762 longjmp(dbf->jump, 0);
764 /* read dummy RECNO field */
766 mpl_tab_set_num(dca, dbf->ref[0], dbf->count+1);
768 for (k = 1; k <= dbf->nf; k++)
769 { /* read k-th field */
770 for (j = 0; j < dbf->len[k]; j++)
771 buf[j] = (char)read_byte(dbf);
772 buf[dbf->len[k]] = '\0';
773 /* set field value */
774 if (dbf->type[k] == 'C')
775 { /* character field */
777 mpl_tab_set_str(dca, dbf->ref[k], strtrim(buf));
779 else if (dbf->type[k] == 'N')
780 { /* numeric field */
784 xassert(str2num(buf, &num) == 0);
785 mpl_tab_set_num(dca, dbf->ref[k], num);
791 /* increase record count */
796 static int dbf_write_record(TABDCA *dca, struct dbf *dbf)
797 { /* write next record to xBASE data file */
800 xassert(dbf->mode == 'W');
801 if (setjmp(dbf->jump))
806 write_byte(dbf, 0x20);
807 xassert(dbf->nf == mpl_tab_num_flds(dca));
808 for (k = 1; k <= dbf->nf; k++)
809 { if (dbf->type[k] == 'C')
810 { /* character field */
812 if (mpl_tab_get_type(dca, k) == 'N')
813 { sprintf(buf, "%.*g", DBL_DIG, mpl_tab_get_num(dca, k));
816 else if (mpl_tab_get_type(dca, k) == 'S')
817 str = mpl_tab_get_str(dca, k);
820 if ((int)strlen(str) > dbf->len[k])
821 { xprintf("xBASE driver: field %s: cannot convert %.15s..."
822 " to field format\n", mpl_tab_get_name(dca, k), str);
823 longjmp(dbf->jump, 0);
825 for (j = 0; j < dbf->len[k] && str[j] != '\0'; j++)
826 write_byte(dbf, str[j]);
827 for (j = j; j < dbf->len[k]; j++)
828 write_byte(dbf, ' ');
830 else if (dbf->type[k] == 'N')
831 { /* numeric field */
832 double num = mpl_tab_get_num(dca, k);
833 if (fabs(num) > 1e20)
834 err: { xprintf("xBASE driver: field %s: cannot convert %g to fi"
835 "eld format\n", mpl_tab_get_name(dca, k), num);
836 longjmp(dbf->jump, 0);
838 sprintf(buf, "%*.*f", dbf->len[k], dbf->prec[k], num);
839 xassert(strlen(buf) < sizeof(buf));
840 if ((int)strlen(buf) != dbf->len[k]) goto err;
841 for (j = 0; j < dbf->len[k]; j++)
842 write_byte(dbf, buf[j]);
847 /* increase record count */
852 static int dbf_close_file(TABDCA *dca, struct dbf *dbf)
853 { /* close xBASE data file */
856 if (dbf->mode == 'W')
857 { if (setjmp(dbf->jump))
861 /* end-of-file flag */
862 write_byte(dbf, 0x1A);
863 /* number of records */
865 if (fseek(dbf->fp, dbf->offset, SEEK_SET))
866 { xprintf("%s:0x%X: seek error - %s\n", dbf->fname,
867 dbf->offset, strerror(errno));
868 longjmp(dbf->jump, 0);
870 write_byte(dbf, dbf->count);
871 write_byte(dbf, dbf->count >> 8);
872 write_byte(dbf, dbf->count >> 16);
873 write_byte(dbf, dbf->count >> 24);
876 { xprintf("%s:0x%X: write error - %s\n", dbf->fname,
877 dbf->offset, strerror(errno));
878 longjmp(dbf->jump, 0);
888 /**********************************************************************/
895 void mpl_tab_drv_open(MPL *mpl, int mode)
896 { TABDCA *dca = mpl->dca;
897 xassert(dca->id == 0);
898 xassert(dca->link == NULL);
899 xassert(dca->na >= 1);
900 if (strcmp(dca->arg[1], "CSV") == 0)
902 dca->link = csv_open_file(dca, mode);
904 else if (strcmp(dca->arg[1], "xBASE") == 0)
905 { dca->id = TAB_XBASE;
906 dca->link = dbf_open_file(dca, mode);
908 else if (strcmp(dca->arg[1], "ODBC") == 0 ||
909 strcmp(dca->arg[1], "iODBC") == 0)
910 { dca->id = TAB_ODBC;
911 dca->link = db_iodbc_open(dca, mode);
913 else if (strcmp(dca->arg[1], "MySQL") == 0)
914 { dca->id = TAB_MYSQL;
915 dca->link = db_mysql_open(dca, mode);
918 xprintf("Invalid table driver `%s'\n", dca->arg[1]);
919 if (dca->link == NULL)
920 error(mpl, "error on opening table %s",
921 mpl->stmt->u.tab->name);
925 int mpl_tab_drv_read(MPL *mpl)
926 { TABDCA *dca = mpl->dca;
930 ret = csv_read_record(dca, dca->link);
933 ret = dbf_read_record(dca, dca->link);
936 ret = db_iodbc_read(dca, dca->link);
939 ret = db_mysql_read(dca, dca->link);
945 error(mpl, "error on reading data from table %s",
946 mpl->stmt->u.tab->name);
950 void mpl_tab_drv_write(MPL *mpl)
951 { TABDCA *dca = mpl->dca;
955 ret = csv_write_record(dca, dca->link);
958 ret = dbf_write_record(dca, dca->link);
961 ret = db_iodbc_write(dca, dca->link);
964 ret = db_mysql_write(dca, dca->link);
970 error(mpl, "error on writing data to table %s",
971 mpl->stmt->u.tab->name);
975 void mpl_tab_drv_close(MPL *mpl)
976 { TABDCA *dca = mpl->dca;
980 ret = csv_close_file(dca, dca->link);
983 ret = dbf_close_file(dca, dca->link);
986 ret = db_iodbc_close(dca, dca->link);
989 ret = db_mysql_close(dca, dca->link);
997 error(mpl, "error on closing table %s",
998 mpl->stmt->u.tab->name);