@@ -51,48 +51,54 @@ const (
51
51
//SB1 TNSType = 3
52
52
//SB2 TNSType = 3
53
53
//SB4 TNSType = 3
54
- FLOAT TNSType = 4
55
- NullStr TNSType = 5
56
- VarNum TNSType = 6
57
- LONG TNSType = 8
58
- VARCHAR TNSType = 9
59
- ROWID TNSType = 11
60
- DATE TNSType = 12
61
- VarRaw TNSType = 15
62
- BFloat TNSType = 21
63
- BDouble TNSType = 22
64
- RAW TNSType = 23
65
- LongRaw TNSType = 24
66
- UINT TNSType = 68
67
- LongVarChar TNSType = 94
68
- LongVarRaw TNSType = 95
69
- CHAR TNSType = 96
70
- CHARZ TNSType = 97
71
- IBFloat TNSType = 100
72
- IBDouble TNSType = 101
73
- REFCURSOR TNSType = 102
74
- OCIXMLType TNSType = 108
75
- XMLType TNSType = 109
76
- OCIRef TNSType = 110
77
- OCIClobLocator TNSType = 112
78
- OCIBlobLocator TNSType = 113
79
- OCIFileLocator TNSType = 114
80
- ResultSet TNSType = 116
81
- OCIString TNSType = 155
82
- OCIDate TNSType = 156
83
- TimeStampDTY TNSType = 180
84
- TimeStampTZ_DTY TNSType = 181
85
- IntervalYM_DTY TNSType = 182
86
- IntervalDS_DTY TNSType = 183
87
- TimeTZ TNSType = 186
88
- TIMESTAMP TNSType = 187
89
- TIMESTAMPTZ TNSType = 188
90
- IntervalYM TNSType = 189
91
- IntervalDS TNSType = 190
92
- UROWID TNSType = 208
93
- TimeStampLTZ_DTY TNSType = 231
94
- TimeStampeLTZ TNSType = 232
95
- Boolean TNSType = 0xFC
54
+ FLOAT TNSType = 4
55
+ NullStr TNSType = 5
56
+ VarNum TNSType = 6
57
+ PDN TNSType = 7
58
+ LONG TNSType = 8
59
+ VARCHAR TNSType = 9
60
+ ROWID TNSType = 11
61
+ DATE TNSType = 12
62
+ VarRaw TNSType = 15
63
+ BFloat TNSType = 21
64
+ BDouble TNSType = 22
65
+ RAW TNSType = 23
66
+ LongRaw TNSType = 24
67
+ TNS_JSON_TYPE_DATE TNSType = 60
68
+ TNS_JSON_TYPE_INTERVAL_YM TNSType = 61
69
+ TNS_JSON_TYPE_INTERVAL_DS TNSType = 62
70
+ UINT TNSType = 68
71
+ LongVarChar TNSType = 94
72
+ LongVarRaw TNSType = 95
73
+ CHAR TNSType = 96
74
+ CHARZ TNSType = 97
75
+ IBFloat TNSType = 100
76
+ IBDouble TNSType = 101
77
+ REFCURSOR TNSType = 102
78
+ OCIXMLType TNSType = 108
79
+ XMLType TNSType = 109
80
+ OCIRef TNSType = 110
81
+ OCIClobLocator TNSType = 112
82
+ OCIBlobLocator TNSType = 113
83
+ OCIFileLocator TNSType = 114
84
+ ResultSet TNSType = 116
85
+ JSON TNSType = 119
86
+ TNS_DATA_TYPE_OAC122 TNSType = 120
87
+ OCIString TNSType = 155
88
+ OCIDate TNSType = 156
89
+ TimeStampDTY TNSType = 180
90
+ TimeStampTZ_DTY TNSType = 181
91
+ IntervalYM_DTY TNSType = 182
92
+ IntervalDS_DTY TNSType = 183
93
+ TimeTZ TNSType = 186
94
+ TIMESTAMP TNSType = 187
95
+ TIMESTAMPTZ TNSType = 188
96
+ IntervalYM TNSType = 189
97
+ IntervalDS TNSType = 190
98
+ UROWID TNSType = 208
99
+ TimeStampLTZ_DTY TNSType = 231
100
+ TimeStampeLTZ TNSType = 232
101
+ Boolean TNSType = 0xFC
96
102
)
97
103
98
104
type ParameterType int
@@ -105,9 +111,13 @@ const (
105
111
type ParameterInfo struct {
106
112
Name string
107
113
TypeName string
114
+ SchemaName string
115
+ DomainSchema string
116
+ DomainName string
108
117
Direction ParameterDirection
109
118
IsNull bool
110
119
AllowNull bool
120
+ IsJson bool
111
121
ColAlias string
112
122
DataType TNSType
113
123
IsXmlType bool
@@ -130,6 +140,7 @@ type ParameterInfo struct {
130
140
getDataFromServer bool
131
141
oaccollid int
132
142
cusType * customType
143
+ Annotations map [string ]string
133
144
}
134
145
135
146
// load get parameter information form network session
@@ -251,7 +262,7 @@ func (par *ParameterInfo) load(conn *Connection) error {
251
262
return err
252
263
}
253
264
par .AllowNull = num1 > 0
254
- _ , err = session .GetByte () // session.GetInt(1, false, false)
265
+ _ , err = session .GetByte () // v7 length of name
255
266
if err != nil {
256
267
return err
257
268
}
@@ -260,7 +271,11 @@ func (par *ParameterInfo) load(conn *Connection) error {
260
271
return err
261
272
}
262
273
par .Name = session .StrConv .Decode (bName )
263
- _ , err = session .GetDlc ()
274
+ bName , err = session .GetDlc () // schema name
275
+ if err != nil {
276
+ return err
277
+ }
278
+ par .SchemaName = strings .ToUpper (session .StrConv .Decode (bName ))
264
279
bName , err = session .GetDlc ()
265
280
if err != nil {
266
281
return err
@@ -285,7 +300,57 @@ func (par *ParameterInfo) load(conn *Connection) error {
285
300
if session .TTCVersion < 6 {
286
301
return nil
287
302
}
288
- _ , err = session .GetInt (4 , true , true )
303
+ var uds_flags int
304
+ uds_flags , err = session .GetInt (4 , true , true )
305
+ par .IsJson = (uds_flags & 0x100 ) > 0
306
+ if session .TTCVersion < 17 {
307
+ return nil
308
+ }
309
+ bName , err = session .GetDlc ()
310
+ if err != nil {
311
+ return err
312
+ }
313
+ par .DomainSchema = strings .ToUpper (session .StrConv .Decode (bName ))
314
+ bName , err = session .GetDlc ()
315
+ if err != nil {
316
+ return err
317
+ }
318
+ par .DomainName = strings .ToUpper (session .StrConv .Decode (bName ))
319
+ if session .TTCVersion < 20 {
320
+ return nil
321
+ }
322
+ numAnnotations , err := session .GetInt (4 , true , true )
323
+ if err != nil {
324
+ return err
325
+ }
326
+ if numAnnotations > 0 {
327
+ par .Annotations = make (map [string ]string )
328
+ _ , err = session .GetByte ()
329
+ if err != nil {
330
+ return err
331
+ }
332
+ numAnnotations , err = session .GetInt (4 , true , true )
333
+ if err != nil {
334
+ return err
335
+ }
336
+ _ , err = session .GetByte ()
337
+ if err != nil {
338
+ return err
339
+ }
340
+ for i := 0 ; i < numAnnotations ; i ++ {
341
+ bKey , bValue , _ , err := session .GetKeyVal ()
342
+ if err != nil {
343
+ return err
344
+ }
345
+ key := session .StrConv .Decode (bKey )
346
+ value := session .StrConv .Decode (bValue )
347
+ par .Annotations [key ] = value
348
+ }
349
+ _ , err = session .GetInt (4 , true , true )
350
+ if err != nil {
351
+ return err
352
+ }
353
+ }
289
354
return nil
290
355
}
291
356
0 commit comments