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

CREATE TABLE command, and translate dBase's 'M' field type to 'text'.
This commit is contained in:
Tom Lane 2005-10-06 23:05:22 +00:00
parent e6b92542a3
commit dd0fa0f958
1 changed files with 5 additions and 1 deletions

View File

@ -301,6 +301,9 @@ do_create(PGconn *conn, char *table, dbhead * dbh)
case 'L':
strcat(query, " char");
break;
case 'M':
strcat(query, " text");
break;
}
}
@ -312,7 +315,8 @@ do_create(PGconn *conn, char *table, dbhead * dbh)
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, "Detailed report: %s\n", PQerrorMessage(conn));