PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pgui_copy_write()

static int pgui_copy_write ( const char *  line)
static

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

References pg_connection, and pgui_logf().

Referenced by pgui_action_import().

372 {
373  char line_trunc[256];
374 
375  /* We need a connection to do anything. */
376  if ( ! pg_connection ) return 0;
377  if ( ! line ) return 0;
378 
379  /* Did something unexpected happen? */
380  if ( PQputCopyData(pg_connection, line, strlen(line)) < 0 )
381  {
382  /* Log errors and return failure. */
383  snprintf(line_trunc, 255, "%s", line);
384  pgui_logf("Failed row begins: \"%s\"", line_trunc);
385  pgui_logf("Failed in pgui_copy_write(): %s", PQerrorMessage(pg_connection));
386  return 0;
387  }
388 
389  /* Send linefeed to signify end of line */
390  PQputCopyData(pg_connection, "\n", 1);
391 
392  return 1;
393 }
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: