Re: [HACKERS] enum types and binary queries

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: [HACKERS] enum types and binary queries
Дата
Msg-id b42b73150708311132k563c3e94le52989667b8b186f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] enum types and binary queries  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] enum types and binary queries  ("Merlin Moncure" <mmoncure@gmail.com>)
Re: [HACKERS] enum types and binary queries  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches
On 8/31/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
> > Here's a patch (minus catalog bump) which I think does that.
>
> Looks sane in a very quick once-over, but I didn't test it.

works fine (here was my test). thanks for quick resolution to this
issue. strings returned in binary format is IMO ok.

enum.c:
include "libpq-fe.h"
#include "string.h"
#include <stdlib.h>


int main(int argc, char **argv)
{
  PGconn *c = PQconnectdb("user=postgres");
  PGresult *r;
  r = PQexecParams(c, "select 'foo'::foo", 0, NULL, NULL, NULL, NULL, 1);

  ExecStatusType t = PQresultStatus(r);

  if(t != PGRES_COMMAND_OK & t != PGRES_TUPLES_OK)
  {
    printf("%s", PQresultErrorMessage(r));
    exit(1);
  }

  char* f = PQgetvalue(r,0,0);
  int len = 3;
  int format = 1;
  PQclear(r);

  r = PQexecParams(c, "select $1::foo", 1, NULL, (const char* const
*)&f, &len, &format, 1);

  if(t != PGRES_COMMAND_OK & t != PGRES_TUPLES_OK)
  {
    printf("%s", PQresultErrorMessage(r));
    exit(1);
  }

  PQfinish(c);
}

В списке pgsql-patches по дате отправления:

Предыдущее
От: Decibel!
Дата:
Сообщение: Re: HOT patch - version 14
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: [HACKERS] enum types and binary queries