return res;
}
+/*
+ * Execute an SQL query and verify that we got exactly one row back.
+ */
+PGresult *
+ExecuteSqlQueryForSingleRow(Archive *fout, char *query)
+{
+ PGresult *res;
+ int ntups;
+
+ res = ExecuteSqlQuery(fout, query, PGRES_TUPLES_OK);
+
+ /* Expecting a single result only */
+ ntups = PQntuples(res);
+ if (ntups != 1)
+ exit_horribly(NULL,
+ ngettext("query returned %d row instead of one: %s\n",
+ "query returned %d rows instead of one: %s\n",
+ ntups),
+ ntups, query);
+
+ return res;
+}
+
/*
* Convenience function to send a query.
* Monitors result to detect COPY statements
extern void ExecuteSqlStatement(Archive *AHX, const char *query);
extern PGresult *ExecuteSqlQuery(Archive *AHX, const char *query,
ExecStatusType status);
+extern PGresult *ExecuteSqlQueryForSingleRow(Archive *fout, char *query);
extern void EndDBCopyMode(ArchiveHandle *AH, struct _tocEntry * te);
static void fmtReloptionsArray(Archive *fout, PQExpBuffer buffer,
const char *reloptions, const char *prefix);
static char *get_synchronized_snapshot(Archive *fout);
-static PGresult *ExecuteSqlQueryForSingleRow(Archive *fout, char *query);
static void setupDumpWorker(Archive *AHX, RestoreOptions *ropt);
if (options)
free(options);
}
-
-/*
- * Execute an SQL query and verify that we got exactly one row back.
- */
-static PGresult *
-ExecuteSqlQueryForSingleRow(Archive *fout, char *query)
-{
- PGresult *res;
- int ntups;
-
- res = ExecuteSqlQuery(fout, query, PGRES_TUPLES_OK);
-
- /* Expecting a single result only */
- ntups = PQntuples(res);
- if (ntups != 1)
- exit_horribly(NULL,
- ngettext("query returned %d row instead of one: %s\n",
- "query returned %d rows instead of one: %s\n",
- ntups),
- ntups, query);
-
- return res;
-}