pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Quan Zongliang <zongliang.quan@postgresdata.com>
To: pgsql-odbc@postgresql.org
Subject: bugfix: bit/varbit type support
Date: Mon, 19 Nov 2018 19:37:16 +0800
Message-ID: <85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com> (raw)

hi, all

patch attached,please review.

support the type BIT/BIT VARYING
1. calculate column length correctly.
2. reverse type name correctly

it cause SQLColAttribute can not get
SQL_DESC_BASE_COLUMN_NAME/SQL_DESC_TYPE_NAME.

--
Quan Zongliang

Attachments:

bittype.patch (text/plain, 1.8K) download diff --git a/columninfo.c b/columninfo.c index 60bd89c..c0d67ab 100644 --- a/columninfo.c +++ b/columninfo.c @@ -95,6 +95,8 @@ CI_read_fields_from_pgres(ColumnInfoClass *self, PGresult *pgres) case PG_TYPE_TIMESTAMP_NO_TMZONE: case PG_TYPE_TIME: case PG_TYPE_TIME_WITH_TMZONE: + case PG_TYPE_BIT: + case PG_TYPE_VARBIT: break; default: new_atttypmod -= 4; diff --git a/info.c b/info.c index 052f0ae..bdaa575 100644 --- a/info.c +++ b/info.c @@ -2705,6 +2705,7 @@ MYLOG(0, " and the data=%s\n", attdef); case PG_TYPE_TIME: case PG_TYPE_TIME_WITH_TMZONE: case PG_TYPE_BIT: + case PG_TYPE_VARBIT: break; default: if (mod_length >= 4) diff --git a/pgtypes.c b/pgtypes.c index 5f49137..1bf7d8a 100644 --- a/pgtypes.c +++ b/pgtypes.c @@ -840,6 +840,10 @@ MYLOG(DETAIL_LOG_LEVEL, "pgtype_to_name int4\n"); return "cidr"; case PG_TYPE_UUID: return "uuid"; + case PG_TYPE_BIT: + return "bit"; + case PG_TYPE_VARBIT: + return "varbit"; case PG_TYPE_INTERVAL: get_interval_type(atttypmod, &tname); return tname; diff --git a/pgtypes.h b/pgtypes.h index 2b120bd..9703dee 100644 --- a/pgtypes.h +++ b/pgtypes.h @@ -58,6 +58,7 @@ #define PG_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */ #define PG_TYPE_TIMESTAMP 1296 /* deprecated since 7.0 */ #define PG_TYPE_BIT 1560 +#define PG_TYPE_VARBIT 1562 #define PG_TYPE_NUMERIC 1700 #define PG_TYPE_REFCURSOR 1790 #define PG_TYPE_RECORD 2249 diff --git a/qresult.c b/qresult.c index c89a3ea..ab899ef 100644 --- a/qresult.c +++ b/qresult.c @@ -625,6 +625,8 @@ QR_from_PGresult(QResultClass *self, StatementClass *stmt, ConnectionClass *conn case PG_TYPE_TIMESTAMP_NO_TMZONE: case PG_TYPE_TIME: case PG_TYPE_TIME_WITH_TMZONE: + case PG_TYPE_BIT: + case PG_TYPE_VARBIT: break; default: new_atttypmod -= 4;

Message-ID: <85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com>
Permalink:  ../85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com/
Also on:    postgresql.org/message-id/85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: zongliang.quan@postgresdata.com
  Subject: Re: bugfix: bit/varbit type support
  In-Reply-To: <85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com>
  References: <85c01814-e97b-7930-9499-d5d975620bea@postgresdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox