github.com/xiyichan/dm8@v0.0.0-20211213021639-be727be3e136/za.go (about) 1 /* 2 * Copyright (c) 2000-2018, 达梦数据库有限公司. 3 * All rights reserved. 4 */ 5 6 package dm 7 8 const ( 9 IGNORE_TARGET_LENGTH int32 = -1 10 11 IGNORE_TARGET_SCALE int32 = -1 12 13 IGNORE_TARGET_TYPE = INT32_MIN 14 15 TYPE_FLAG_UNKNOWN byte = 0 // 未知类型 16 17 TYPE_FLAG_EXACT byte = 1 // 精确类型 18 19 TYPE_FLAG_RECOMMEND byte = 2 // 推荐类型 20 21 IO_TYPE_IN byte = 0 22 23 IO_TYPE_OUT byte = 1 24 25 IO_TYPE_INOUT byte = 2 26 ) 27 28 type execInfo struct { 29 // param 30 outParamDatas [][]byte 31 32 // rs 33 hasResultSet bool 34 35 rsDatas [][][]byte 36 37 rsSizeof int // 结果集数据占用多少空间,(消息中结果集起始位置到 rsCacheOffset 38 // 的空间大小,这和实际的rsDatas占用空间大小有一定出入,这里粗略估算,用于结果集缓存时的空间管理) 39 40 rsCacheOffset int32 // 缓存信息,在响应消息体中的偏移,0表示不存在,仅结果集缓存中可以用 41 42 rsBdta bool 43 44 rsUpdatable bool 45 46 rsRowIds []int64 47 48 // rs cache 49 tbIds []int32 50 51 tbTss []int64 52 53 // print 54 printLen int32 55 56 printMsg string 57 58 // explain 59 explain string 60 61 // 影响行数 62 updateCount int64 // Insert/Update/Delet影响行数, select结果集的总行数 63 64 updateCounts []int64 // 批量影响行数 65 66 // 键 67 rowid int64 68 69 lastInsertId int64 70 71 // other 72 retSqlType int16 // 执行返回的语句类型 73 74 execId int32 75 } 76 77 type column struct { 78 typeName string 79 80 colType int32 81 82 prec int32 83 84 scale int32 85 86 name string 87 88 tableName string 89 90 schemaName string 91 92 nullable bool 93 94 identity bool 95 96 readonly bool // 是否只读 97 98 baseName string 99 100 // lob info 101 lob bool 102 103 lobTabId int32 104 105 lobColId int16 106 107 // 用于描述ARRAY、STRUCT类型的特有描述信息 108 typeDescriptor *TypeDescriptor 109 110 isBdta bool 111 } 112 113 type parameter struct { 114 column 115 116 typeFlag byte 117 118 ioType byte 119 120 outJType int32 121 122 outScale int32 123 124 outObjectName string 125 126 cursorStmt *DmStatement 127 } 128 129 func (column *column) InitColumn() *column { 130 column.typeName = "" 131 132 column.colType = 0 133 134 column.prec = 0 135 136 column.scale = 0 137 138 column.name = "" 139 140 column.tableName = "" 141 142 column.schemaName = "" 143 144 column.nullable = false 145 146 column.identity = false 147 148 column.readonly = false 149 150 column.baseName = "" 151 152 // lob info 153 column.lob = false 154 155 column.lobTabId = 0 156 157 column.lobColId = 0 158 159 // 用于描述ARRAY、STRUCT类型的特有描述信息 160 column.typeDescriptor = nil 161 162 column.isBdta = false 163 164 return column 165 } 166 167 func (parameter *parameter) InitParameter() *parameter { 168 parameter.InitColumn() 169 170 parameter.typeFlag = TYPE_FLAG_UNKNOWN 171 172 parameter.ioType = IO_TYPE_IN 173 174 parameter.outJType = IGNORE_TARGET_TYPE 175 176 parameter.outScale = IGNORE_TARGET_SCALE 177 178 parameter.outObjectName = "" 179 180 parameter.cursorStmt = nil 181 182 return parameter 183 } 184 185 func NewExceInfo() *execInfo { 186 187 execInfo := execInfo{} 188 189 execInfo.outParamDatas = nil 190 191 execInfo.hasResultSet = false 192 193 execInfo.rsDatas = nil 194 195 execInfo.rsSizeof = 0 196 197 execInfo.rsCacheOffset = 0 198 199 execInfo.rsBdta = false 200 201 execInfo.rsUpdatable = false 202 203 execInfo.rsRowIds = nil 204 205 execInfo.tbIds = nil 206 207 execInfo.tbTss = nil 208 209 execInfo.printLen = 0 210 211 execInfo.printMsg = "" 212 213 execInfo.explain = "" 214 215 execInfo.updateCount = 0 216 217 execInfo.updateCounts = nil 218 219 execInfo.rowid = -1 220 221 execInfo.lastInsertId = 0 222 // other 223 execInfo.retSqlType = -1 // 执行返回的语句类型 224 225 execInfo.execId = 0 226 227 return &execInfo 228 }