Flush writes to server after every send.

This commit is contained in:
Phil Sorber 2012-03-12 21:34:35 -04:00
parent 6bea0390f8
commit 0b34675449

View File

@ -266,22 +266,30 @@ protected:
int Send(const char *queryText) int Send(const char *queryText)
{ {
return PQsendQuery(connection_, queryText); int rv = PQsendQuery(connection_, queryText);
StartWrite();
return rv;
} }
int SendQueryParams(const char *command, const int nParams, const char * const *paramValues) int SendQueryParams(const char *command, const int nParams, const char * const *paramValues)
{ {
return PQsendQueryParams(connection_, command, nParams, NULL, paramValues, NULL, NULL, 0); int rv = PQsendQueryParams(connection_, command, nParams, NULL, paramValues, NULL, NULL, 0);
StartWrite();
return rv;
} }
int SendPrepare(const char *name, const char *command, const int nParams) int SendPrepare(const char *name, const char *command, const int nParams)
{ {
return PQsendPrepare(connection_, name, command, nParams, NULL); int rv = PQsendPrepare(connection_, name, command, nParams, NULL);
StartWrite();
return rv;
} }
int SendPreparedQuery(const char *name, int nParams, const char * const *paramValues) int SendPreparedQuery(const char *name, int nParams, const char * const *paramValues)
{ {
return PQsendQueryPrepared(connection_, name, nParams, paramValues, NULL, NULL, 0); int rv = PQsendQueryPrepared(connection_, name, nParams, paramValues, NULL, NULL, 0);
StartWrite();
return rv;
} }
int Cancel() int Cancel()
@ -289,6 +297,7 @@ protected:
PGcancel* pgCancel = PQgetCancel(connection_); PGcancel* pgCancel = PQgetCancel(connection_);
char errbuf[256]; char errbuf[256];
int result = PQcancel(pgCancel, errbuf, 256); int result = PQcancel(pgCancel, errbuf, 256);
StartWrite();
PQfreeCancel(pgCancel); PQfreeCancel(pgCancel);
return result; return result;
} }