(self, db, sql, commonCol, parameters)
| 208 | |
| 209 | |
| 210 | def doBatchRowRequest(self, db, sql, commonCol, parameters): |
| 211 | ok, requestRow = self.getRequestBuilder(db, sql) |
| 212 | if not ok: |
| 213 | return ok, "get request builder fail" |
| 214 | schema = requestRow.GetSchema() |
| 215 | commonCols = sql_router_sdk.ColumnIndicesSet(schema) |
| 216 | count = schema.GetColumnCnt() |
| 217 | commnColAddCount = 0 |
| 218 | for i in range(count): |
| 219 | colName = schema.GetColumnName(i) |
| 220 | if colName in commonCol: |
| 221 | commonCols.AddCommonColumnIdx(i) |
| 222 | commonColAddCount+=1 |
| 223 | if commnColAddCount != len(commonCol): |
| 224 | return False, "some common col is not in table schema" |
| 225 | requestRowBatch = sql_router_sdk.SQLRequestRowBatch(schema, commonCols) |
| 226 | if requestRowBatch is None: |
| 227 | return False, "generate sql request row batch fail" |
| 228 | if isinstance(parameters, dict): |
| 229 | ok, msg = self._append_request_row(requestRow, schema, parameters) |
| 230 | if not ok: |
| 231 | return ok, msg |
| 232 | requestRowBatch.AddRow(requestRow) |
| 233 | else: |
| 234 | for d in parameters: |
| 235 | ok, msg = self._append_request_row(requestRow, schema, d) |
| 236 | if not ok: |
| 237 | return ok, msg |
| 238 | requestRowBatch.AddRow(requestRow) |
| 239 | ok, requestRow = self.getRequestBuilder(db, sql) |
| 240 | if not ok: |
| 241 | return ok, "get request builder fail" |
| 242 | status = sql_router_sdk.Status() |
| 243 | rs = self.sdk.ExecuteSQLBatchRequest(db, sql, requestRowBatch, status) |
| 244 | if status.code != 0: |
| 245 | return False, status.msg |
| 246 | return True, rs |
no test coverage detected