~chrisvaughn/gearmand/devel

« back to all changes in this revision

Viewing changes to libgearman-server/plugins/queue/postgres/queue.cc

  • Committer: root
  • Date: 2012-02-05 05:40:05 UTC
  • Revision ID: root@cvaughn.yv.local-20120205054005-m8o3vuynx6gekebx
fixes postgres bug and adds testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <libgearman-server/plugins/queue/postgres/queue.h>
18
18
#include <libgearman-server/plugins/queue/base.h>
19
19
 
20
 
#if defined(HAVE_LIBPQ_FE_H)
21
 
# include <libpq-fe.h>
22
 
# include <pg_config_manual.h>
23
 
#else
24
 
# include <postgresql/libpq-fe.h>
25
 
# include <postgresql/pg_config_manual.h>
26
 
#endif
 
20
#include <postgresql/libpq-fe.h>
 
21
#include <postgresql/pg_config_manual.h>
 
22
 
27
23
 
28
24
/**
29
25
 * @addtogroup plugins::queue::Postgresatic Static libpq Queue Storage Definitions
194
190
    result= PQexec(queue->con, queue->create().c_str());
195
191
    if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK)
196
192
    {
197
 
      gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, 
 
193
      gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM,
198
194
                         "PQexec:%s", PQerrorMessage(queue->con));
199
195
      PQclear(result);
200
196
      gearman_server_set_queue(server, NULL, NULL, NULL, NULL, NULL);
243
239
    (char *)data,
244
240
    (char *)when };
245
241
 
246
 
  int param_lengths[]= { 
 
242
  int param_lengths[]= {
247
243
    (int)strlen(buffer),
248
244
    (int)unique_size,
249
245
    (int)function_name_size,
254
250
 
255
251
  gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libpq add: %.*s", (uint32_t)unique_size, (char *)unique);
256
252
 
257
 
  PGresult *result= PQexecParams(queue->con, queue->insert().c_str(), 
 
253
  PGresult *result= PQexecParams(queue->con, queue->insert().c_str(),
258
254
                                 gearmand_array_size(param_lengths),
259
255
                                 NULL, param_values, param_lengths, param_formats, 0);
260
256
  if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK)