Skip to content

Commit 5380cb3

Browse files
committed
Code refactoring, all content except Cpython
1 parent 7a007ba commit 5380cb3

File tree

8 files changed

+15
-119
lines changed

8 files changed

+15
-119
lines changed

.github/workflows/install-krb5.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/install-postgres.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

async_gaussdb/protocol/codecs/array.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ cdef textarray_decode(ConnectionSettings settings, FRBuffer *buf,
419419

420420
# Make a copy of array data since we will be mutating it for
421421
# the purposes of element decoding.
422-
s = gaussdbproto.text_decode(settings, buf)
422+
s = pgproto.text_decode(settings, buf)
423423
array_text = cpythonx.PyUnicode_AsUCS4Copy(s)
424424

425425
try:
@@ -648,7 +648,7 @@ cdef _textarray_decode(ConnectionSettings settings,
648648

649649
# Prepare the element buffer and call the text decoder
650650
# for the element type.
651-
gaussdbproto.as_pg_string_and_size(
651+
pgproto.as_pg_string_and_size(
652652
settings, item_text, &pg_item_str, &pg_item_len)
653653
frb_init(&item_buf, pg_item_str, pg_item_len)
654654
item = decoder(settings, &item_buf, decoder_arg)
@@ -822,12 +822,12 @@ cdef _infer_array_dims(const Py_UCS4 *array_text,
822822

823823
cdef uint4_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,
824824
const void *arg):
825-
return gaussdbproto.uint4_encode(settings, buf, obj)
825+
return pgproto.uint4_encode(settings, buf, obj)
826826

827827

828828
cdef uint4_decode_ex(ConnectionSettings settings, FRBuffer *buf,
829829
const void *arg):
830-
return gaussdbproto.uint4_decode(settings, buf)
830+
return pgproto.uint4_decode(settings, buf)
831831

832832

833833
cdef arrayoid_encode(ConnectionSettings settings, WriteBuffer buf, items):
@@ -841,12 +841,12 @@ cdef arrayoid_decode(ConnectionSettings settings, FRBuffer *buf):
841841

842842
cdef text_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,
843843
const void *arg):
844-
return gaussdbproto.text_encode(settings, buf, obj)
844+
return pgproto.text_encode(settings, buf, obj)
845845

846846

847847
cdef text_decode_ex(ConnectionSettings settings, FRBuffer *buf,
848848
const void *arg):
849-
return gaussdbproto.text_decode(settings, buf)
849+
return pgproto.text_decode(settings, buf)
850850

851851

852852
cdef arraytext_encode(ConnectionSettings settings, WriteBuffer buf, items):

async_gaussdb/protocol/codecs/pgproto.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ cdef init_txid_codecs():
385385
<decode_func>pgproto.text_decode,
386386
PG_FORMAT_TEXT)
387387

388-
register_core_codec(PG_SNAPSHOTOID,
388+
register_core_codec(pg_snapshotOID,
389389
<encode_func>pgproto.pg_snapshot_encode,
390390
<decode_func>pgproto.pg_snapshot_decode,
391391
PG_FORMAT_BINARY)

async_gaussdb/protocol/coreproto.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ cdef class CoreProtocol:
513513
object row
514514
bytes mem
515515

516-
if PG_DEBUG:
516+
if GAUSSDB_DEBUG:
517517
if buf.get_message_type() != b'D':
518518
raise apg_exc.InternalClientError(
519519
'_parse_data_msgs: first message is not "D"')
@@ -523,7 +523,7 @@ cdef class CoreProtocol:
523523
buf.discard_message()
524524
return
525525

526-
if PG_DEBUG:
526+
if GAUSSDB_DEBUG:
527527
if type(self.result) is not list:
528528
raise apg_exc.InternalClientError(
529529
'_parse_data_msgs: result is not a list, but {!r}'.

async_gaussdb/protocol/pgtypes.pxi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ DEF ANYCOMPATIBLEMULTIRANGEOID = 4538
106106
DEF PG_BRIN_BLOOM_SUMMARYOID = 4600
107107
DEF PG_BRIN_MINMAX_MULTI_SUMMARYOID = 4601
108108
DEF PG_MCV_LISTOID = 5017
109-
DEF PG_SNAPSHOTOID = 5038
109+
DEF pg_snapshotOID = 5038
110110
DEF XID8OID = 5069
111111
DEF ANYCOMPATIBLEOID = 5077
112112
DEF ANYCOMPATIBLEARRAYOID = 5078
@@ -175,7 +175,7 @@ BUILTIN_TYPE_OID_MAP = {
175175
PG_MCV_LISTOID: 'pg_mcv_list',
176176
PG_NDISTINCTOID: 'pg_ndistinct',
177177
PG_NODE_TREEOID: 'pg_node_tree',
178-
PG_SNAPSHOTOID: 'pg_snapshot',
178+
pg_snapshotOID: 'pg_snapshot',
179179
POINTOID: 'point',
180180
POLYGONOID: 'polygon',
181181
RECORDOID: 'record',

async_gaussdb/protocol/protocol.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from libc.stdint cimport int16_t, int32_t, uint16_t, \
99
uint32_t, int64_t, uint64_t
1010

11-
from async_gaussdb.pgproto.debug cimport PG_DEBUG
11+
from async_gaussdb.pgproto.debug cimport GAUSSDB_DEBUG
1212

1313
from async_gaussdb.pgproto.pgproto cimport (
1414
WriteBuffer,

async_gaussdb/protocol/protocol.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ cdef class BaseProtocol(CoreProtocol):
804804
waiter.set_result(True)
805805

806806
cdef _on_result__prepare(self, object waiter):
807-
if PG_DEBUG:
807+
if GAUSSDB_DEBUG:
808808
if self.statement is None:
809809
raise apg_exc.InternalClientError(
810810
'_on_result__prepare: statement is None')
@@ -851,7 +851,7 @@ cdef class BaseProtocol(CoreProtocol):
851851
waiter.set_result(status_msg)
852852

853853
cdef _decode_row(self, const char* buf, ssize_t buf_len):
854-
if PG_DEBUG:
854+
if GAUSSDB_DEBUG:
855855
if self.statement is None:
856856
raise apg_exc.InternalClientError(
857857
'_decode_row: statement is None')
@@ -863,7 +863,7 @@ cdef class BaseProtocol(CoreProtocol):
863863
self.waiter = None
864864

865865
if waiter is None:
866-
if PG_DEBUG:
866+
if GAUSSDB_DEBUG:
867867
raise apg_exc.InternalClientError('_on_result: waiter is None')
868868

869869
if self.state == PROTOCOL_COPY_OUT_DATA or \

0 commit comments

Comments
 (0)