Commit dd0fa0f9 authored by Tom Lane's avatar Tom Lane

Minor dbf2pg fixes from Martin Pitt: check for failure when issuing

CREATE TABLE command, and translate dBase's 'M' field type to 'text'.
parent e6b92542
...@@ -301,6 +301,9 @@ do_create(PGconn *conn, char *table, dbhead * dbh) ...@@ -301,6 +301,9 @@ do_create(PGconn *conn, char *table, dbhead * dbh)
case 'L': case 'L':
strcat(query, " char"); strcat(query, " char");
break; break;
case 'M':
strcat(query, " text");
break;
} }
} }
...@@ -312,7 +315,8 @@ do_create(PGconn *conn, char *table, dbhead * dbh) ...@@ -312,7 +315,8 @@ do_create(PGconn *conn, char *table, dbhead * dbh)
printf("%s\n", query); printf("%s\n", query);
} }
if ((res = PQexec(conn, query)) == NULL) if ((res = PQexec(conn, query)) == NULL ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
fprintf(stderr, "Error creating table!\n"); fprintf(stderr, "Error creating table!\n");
fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn)); fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment