Skip to content

Commit b91191d

Browse files
committed
Merge pull request mauricio#62 from dylex/oid
Decode OIDs as Long
2 parents 9258433 + 0f556e8 commit b91191d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

postgresql-async/src/main/scala/com/github/mauricio/async/db/postgresql/column/ColumnTypes.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ object ColumnTypes {
5555
final val IntervalArray = 1187
5656
final val Boolean = 16
5757
final val BooleanArray = 1000
58+
final val OID = 26
59+
final val OIDArray = 1028
5860

5961
final val ByteA = 17
6062
final val ByteA_Array = 1001
6163

62-
final val OIDArray = 1028
6364
final val MoneyArray = 791
6465
final val NameArray = 1003
6566
final val UUIDArray = 2951

postgresql-async/src/main/scala/com/github/mauricio/async/db/postgresql/column/PostgreSQLColumnDecoderRegistry.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ class PostgreSQLColumnDecoderRegistry( charset : Charset = CharsetUtil.UTF_8 ) e
6767
case ColumnTypes.Integer => IntegerEncoderDecoder
6868
case IntegerArray => this.integerArrayDecoder
6969

70+
case OID => LongEncoderDecoder
71+
case OIDArray => this.longArrayDecoder
72+
7073
case ColumnTypes.Numeric => BigDecimalEncoderDecoder
7174
case NumericArray => this.bigDecimalArrayDecoder
7275

@@ -103,7 +106,6 @@ class PostgreSQLColumnDecoderRegistry( charset : Charset = CharsetUtil.UTF_8 ) e
103106
case Interval => PostgreSQLIntervalEncoderDecoder
104107
case IntervalArray => this.intervalArrayDecoder
105108

106-
case OIDArray => this.stringArrayDecoder
107109
case MoneyArray => this.stringArrayDecoder
108110
case NameArray => this.stringArrayDecoder
109111
case UUIDArray => this.stringArrayDecoder

postgresql-async/src/test/scala/com/github/mauricio/async/db/postgresql/PostgreSQLConnectionSpec.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class PostgreSQLConnectionSpec extends Specification with DatabaseTestHelper {
5353
time_column time,
5454
boolean_column boolean,
5555
constraint bigserial_column_pkey primary key (bigserial_column)
56-
)"""
56+
) with oids"""
5757

5858
val insert = """insert into type_test_table (
5959
smallint_column,
@@ -83,7 +83,7 @@ class PostgreSQLConnectionSpec extends Specification with DatabaseTestHelper {
8383
)
8484
"""
8585

86-
val select = "select * from type_test_table"
86+
val select = "select *, oid from type_test_table"
8787

8888
val preparedStatementCreate = """create temp table prepared_statement_test (
8989
id bigserial not null,
@@ -151,6 +151,8 @@ class PostgreSQLConnectionSpec extends Specification with DatabaseTestHelper {
151151
row(10) === DateEncoderDecoder.decode("1984-08-06")
152152
row(11) === TimeEncoderDecoder.Instance.decode("22:13:45.888888")
153153
row(12) === true
154+
row(13) must beAnInstanceOf[java.lang.Long]
155+
row(13).asInstanceOf[Long] must beGreaterThan(0L)
154156

155157

156158
}

0 commit comments

Comments
 (0)