1154{
1155 ExecStatusType status;
1157 int ntuples;
1158 char *pg_fieldname, *pg_fieldtype;
1160
1161
1162 status = PQresultStatus(result);
1163 if (status == PGRES_TUPLES_OK)
1164 {
1165 ntuples = PQntuples(result);
1166
1167 switch (config->
opt)
1168 {
1169 case 'c':
1170
1171 if (ntuples > 0)
1172 {
1175 }
1176 break;
1177
1178 case 'p':
1179
1180 if (ntuples > 0)
1181 {
1184 }
1185 break;
1186
1187 case 'a':
1188
1189 if (ntuples == 0)
1190 {
1191 pgui_seterr(
_(
"ERROR: Destination table %s.%s could not be found for appending"), config->
schema, config->
table);
1193 }
1194 else
1195 {
1196
1200 {
1203 }
1204
1205
1207 {
1208
1209 found = 0;
1210 for (j = 0; j < ntuples; j++)
1211 {
1212 pg_fieldname = PQgetvalue(result, j, PQfnumber(result, "field"));
1213 pg_fieldtype = PQgetvalue(result, j, PQfnumber(result, "type"));
1214
1216 {
1217 found = -1;
1218
1220 if (!ret)
1221 {
1222 pgui_logf(
_(
"Warning: DBF Field '%s' is not compatible with PostgreSQL column '%s' in %s.%s"), state->
field_names[i], pg_fieldname, config->
schema, config->
table);
1224 }
1225 }
1226 }
1227
1228
1229 if (!found)
1230 {
1231 pgui_logf(
_(
"Warning: DBF Field '%s' within file %s could not be matched to a column within table %s.%s"),
1234 }
1235 }
1236
1238 }
1239
1240 break;
1241 }
1242 }
1243 else
1244 {
1245 pgui_seterr(
_(
"ERROR: unable to process validation response from remote server"));
1247 }
1248
1249 return response;
1250}
void ShpLoaderDestroy(SHPLOADERSTATE *state)
SHPLOADERSTATE * ShpLoaderCreate(SHPLOADERCONFIG *config)
int ShpLoaderOpenShape(SHPLOADERSTATE *state)
static void pgui_seterr(const char *fmt,...)
static int validate_shape_column_against_pg_column(int dbf_fieldtype, char *pg_fieldtype)
static void pgui_logf(const char *fmt,...)