@@ -54,6 +54,30 @@ def __init__(self, connection: Connection, transaction_id: Optional[str] = None)
54
54
self .autocommit : bool = True
55
55
super ().__init__ (connection , transaction_id )
56
56
57
+ def create_column_metadata_set (
58
+ self , cursor : jaydebeapi .Cursor
59
+ ) -> List [ColumnMetadata ]:
60
+ meta = getattr (cursor , '_meta' )
61
+ return [
62
+ ColumnMetadata (
63
+ arrayBaseColumnType = 0 ,
64
+ isAutoIncrement = meta .isAutoIncrement (i ),
65
+ isCaseSensitive = meta .isCaseSensitive (i ),
66
+ isCurrency = meta .isCurrency (i ),
67
+ isSigned = meta .isSigned (i ),
68
+ label = meta .getColumnLabel (i ),
69
+ name = meta .getColumnName (i ),
70
+ nullable = meta .isNullable (i ),
71
+ precision = meta .getPrecision (i ),
72
+ scale = meta .getScale (i ),
73
+ schema = meta .getSchemaName (i ),
74
+ tableName = meta .getTableName (i ),
75
+ type = meta .getColumnType (i ),
76
+ typeName = meta .getColumnTypeName (i ),
77
+ )
78
+ for i in range (1 , meta .getColumnCount () + 1 )
79
+ ]
80
+
57
81
def autocommit_off (self , cursor : jaydebeapi .Cursor ) -> None :
58
82
self .connection .jconn .setAutoCommit (False )
59
83
self .autocommit = False
@@ -96,8 +120,9 @@ def execute(
96
120
],
97
121
)
98
122
if include_result_metadata :
99
- meta = getattr (cursor , '_meta' )
100
- response .columnMetadata = create_column_metadata_set (meta )
123
+ response .columnMetadata = self .create_column_metadata_set (
124
+ cursor
125
+ )
101
126
return response
102
127
else :
103
128
rowcount : int = cursor .rowcount
@@ -144,25 +169,3 @@ def create_connection_maker(
144
169
{"user" : user_name , "password" : password },
145
170
engine_kwargs ['JAR_PATH' ],
146
171
)
147
-
148
-
149
- def create_column_metadata_set (meta : Any ) -> List [ColumnMetadata ]:
150
- return [
151
- ColumnMetadata (
152
- arrayBaseColumnType = 0 ,
153
- isAutoIncrement = meta .isAutoIncrement (i ),
154
- isCaseSensitive = meta .isCaseSensitive (i ),
155
- isCurrency = meta .isCurrency (i ),
156
- isSigned = meta .isSigned (i ),
157
- label = meta .getColumnLabel (i ),
158
- name = meta .getColumnName (i ),
159
- nullable = meta .isNullable (i ),
160
- precision = meta .getPrecision (i ),
161
- scale = meta .getScale (i ),
162
- schema = meta .getSchemaName (i ),
163
- tableName = meta .getTableName (i ),
164
- type = meta .getColumnType (i ),
165
- typeName = meta .getColumnTypeName (i ),
166
- )
167
- for i in range (1 , meta .getColumnCount () + 1 )
168
- ]
0 commit comments