PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int pgui_copy_start ( const char *  sql)
static

Definition at line 346 of file shp2pgsql-gui.c.

References pg_connection, pgui_logf(), and window::res.

Referenced by pgui_action_import().

347 {
348  PGresult *res = NULL;
349  ExecStatusType status;
350  char sql_trunc[256];
351 
352  /* We need a connection to do anything. */
353  if ( ! pg_connection ) return 0;
354  if ( ! sql ) return 0;
355 
356  res = PQexec(pg_connection, sql);
357  status = PQresultStatus(res);
358  PQclear(res);
359 
360  /* Did something unexpected happen? */
361  if ( status != PGRES_COPY_IN )
362  {
363  /* Log errors and return failure. */
364  snprintf(sql_trunc, 255, "%s", sql);
365  pgui_logf("Failed SQL begins: \"%s\"", sql_trunc);
366  pgui_logf("Failed in pgui_copy_start(): %s", PQerrorMessage(pg_connection));
367  return 0;
368  }
369 
370  return 1;
371 }
tuple res
Definition: window.py:80
static void pgui_logf(const char *fmt,...)
static PGconn * pg_connection

Here is the call graph for this function:

Here is the caller graph for this function: