{
PGresult *res = NULL;
ExecStatusType status;
+ char sql_trunc[256];
/* We need a connection to do anything. */
if ( ! pg_connection ) return 0;
}
/* Log errors and return failure. */
- pgui_logf("Failed SQL was: %s", sql);
+ snprintf(sql_trunc, 255, "%s", sql);
+ pgui_logf("Failed SQL begins: \"%s\"", sql_trunc);
pgui_logf("Failed in pgui_exec(): %s", PQerrorMessage(pg_connection));
return 0;
}
{
PGresult *res = NULL;
ExecStatusType status;
+ char sql_trunc[256];
/* We need a connection to do anything. */
if ( ! pg_connection ) return 0;
if ( status != PGRES_COPY_IN )
{
/* Log errors and return failure. */
- pgui_logf("Failed SQL was: %s", sql);
+ snprintf(sql_trunc, 255, "%s", sql);
+ pgui_logf("Failed SQL begins: \"%s\"", sql_trunc);
pgui_logf("Failed in pgui_copy_start(): %s", PQerrorMessage(pg_connection));
return 0;
}
static int
pgui_copy_write(const char *line)
{
+ char line_trunc[256];
+
/* We need a connection to do anything. */
if ( ! pg_connection ) return 0;
if ( ! line ) return 0;
if ( PQputCopyData(pg_connection, line, strlen(line)) < 0 )
{
/* Log errors and return failure. */
- pgui_logf("Failed row was: %s", line);
+ snprintf(line_trunc, 255, "%s", line);
+ pgui_logf("Failed row begins: \"%s\"", line_trunc);
pgui_logf("Failed in pgui_copy_write(): %s", PQerrorMessage(pg_connection));
return 0;
}