|
| 1 | +// #include "lse/Entry.h" |
1 | 2 | // #include "legacyapi/db/impl/mysql/Stmt.h" |
2 | 3 |
|
3 | 4 | // #include "legacyapi/db/impl/mysql/Session.h" |
|
171 | 172 | // if (len) { |
172 | 173 | // auto buffer = std::shared_ptr<char[]>(new char[len]); |
173 | 174 | // #if defined(LLDB_DEBUG_MODE) |
174 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("AllocateBuffer: Allocated! Buffer size: |
| 175 | +// lse::getSelfPluginInstance().getLogger().debug("AllocateBuffer: Allocated! Buffer size: |
175 | 176 | // {}", len); |
176 | 177 | // #endif |
177 | 178 | // return std::make_pair(buffer, len); |
|
235 | 236 | // // case MYSQL_TYPE_GEOMETRY: |
236 | 237 | // case MYSQL_TYPE_JSON: |
237 | 238 | // #if defined(LLDB_DEBUG_MODE) |
238 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("ReceiverToAny: string: length: {}, buffer |
| 239 | +// lse::getSelfPluginInstance().getLogger().debug("ReceiverToAny: string: length: {}, buffer |
239 | 240 | // {}", rec.length, rec.buffer.get()); |
240 | 241 | // #endif |
241 | 242 | // return Any(std::string(rec.buffer.get())); |
|
244 | 245 | // case MYSQL_TYPE_MEDIUM_BLOB: |
245 | 246 | // case MYSQL_TYPE_LONG_BLOB: |
246 | 247 | // #if defined(LLDB_DEBUG_MODE) |
247 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("ReceiverToAny: blob: length: {}, buffer |
| 248 | +// lse::getSelfPluginInstance().getLogger().debug("ReceiverToAny: blob: length: {}, buffer |
248 | 249 | // {}", rec.length, rec.buffer.get()); |
249 | 250 | // #endif |
250 | 251 | // // Unknown bug: rec.length is 0 |
251 | 252 | // return Any(ByteArray(rec.buffer.get(), rec.buffer.get() + rec.length)); |
252 | 253 | // case MYSQL_TYPE_DECIMAL: |
253 | 254 | // case MYSQL_TYPE_NEWDECIMAL: |
254 | 255 | // // TODO: Decimal |
255 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQL_Decimal: {}", |
| 256 | +// lse::getSelfPluginInstance().getLogger().debug("MySQL_Decimal: {}", |
256 | 257 | // std::string(rec.buffer.get(), rec.length)); return Any(); |
257 | 258 | // default: |
258 | 259 | // throw std::runtime_error("ReceiverToAny: Unsupported MySQL data type: " + std::to_string(rec.field.type)); |
|
278 | 279 | // result++; |
279 | 280 | // } |
280 | 281 | // } |
281 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::getNextParamIndex: The |
| 282 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::getNextParamIndex: The |
282 | 283 | // next param index is {}", result + 1); return result + 1; |
283 | 284 | // } |
284 | 285 |
|
|
290 | 291 | // ); |
291 | 292 | // } |
292 | 293 | // if (!metadata) { |
293 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::bindResult: No result |
| 294 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::bindResult: No result |
294 | 295 | // metadata"); return; |
295 | 296 | // } |
296 | 297 | // // Set the attribute UPDATE_MAX_LENGTH to true |
|
301 | 302 | // // later |
302 | 303 | // mysql_stmt_store_result(stmt); |
303 | 304 | // auto cnt = mysql_num_fields(metadata); |
304 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::bindResult: |
| 305 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::bindResult: |
305 | 306 | // mysql_num_fields: {}", cnt); auto fields = mysql_fetch_fields(metadata); result.reset(new MYSQL_BIND[cnt]); |
306 | 307 | // // Allocate result bindings resultHeader.reset(new RowHeader); // Allocate result header for (auto i = 0U; i < |
307 | 308 | // cnt; i++) { |
|
398 | 399 | // params[index].buffer_length = sz; |
399 | 400 | // params[index].is_null = 0; |
400 | 401 | // params[index].length = (unsigned long*)¶m.length; |
401 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::bind: Bound string |
| 402 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::bind: Bound string |
402 | 403 | // param at {}: {}", index, param.buffer.get()); break; |
403 | 404 | // } |
404 | 405 | // case Any::Type::Date: |
|
490 | 491 | // if (fetched) { |
491 | 492 | // throw std::runtime_error("MySQLStmt::_Fetch: No more rows"); |
492 | 493 | // } |
493 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::_Fetch: Fetching |
| 494 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::_Fetch: Fetching |
494 | 495 | // row..."); Row row(resultHeader); IF_ENDBG |
495 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::_Fetch: RowHeader size |
| 496 | +// lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::_Fetch: RowHeader size |
496 | 497 | // {}", row.header->size()); int i = 0; for (auto& col : resultValues) { |
497 | 498 | // // Because of the inexplicable problems of MySQL C API, |
498 | 499 | // // we must set the length of the field manually. |
499 | 500 | // auto length = *(stmt->bind + i)->length; |
500 | 501 | // col.length = length; |
501 | 502 | // auto v = ReceiverToAny(col); |
502 | 503 | // row.push_back(v); |
503 | | -// IF_ENDBG ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug( |
| 504 | +// IF_ENDBG lse::getSelfPluginInstance().getLogger().debug( |
504 | 505 | // "MySQLStmt::_Fetch: Fetched column `{}`, type {}, value {}", |
505 | 506 | // col.field.name, |
506 | 507 | // Any::type2str(v.type), |
|
590 | 591 | // auto query = sql; |
591 | 592 | // auto params = ParseStmtParams(query); |
592 | 593 | // if (raw->debugOutput && !params.empty()) { |
593 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::create: Parsed named |
| 594 | +// lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::create: Parsed named |
594 | 595 | // parameters in query: "); |
595 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::create: - SQL without named |
| 596 | +// lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::create: - SQL without named |
596 | 597 | // parameters: {}", query); for (auto& [k, v] : params) { |
597 | | -// ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::create: - {}: {}", k, v); |
| 598 | +// lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::create: - {}: {}", k, v); |
598 | 599 | // } |
599 | 600 | // } |
600 | 601 | // auto res = mysql_stmt_prepare(stmt, query.c_str(), query.size()); |
|
605 | 606 | // result->query = sql; |
606 | 607 | // result->paramIndexes = params; |
607 | 608 | // result->setDebugOutput(raw->debugOutput); |
608 | | -// if (raw->debugOutput) ll::io::LoggerRegistry::getInstance().getOrCreate("LLSEDB")->debug("MySQLStmt::create: |
| 609 | +// if (raw->debugOutput) lse::getSelfPluginInstance().getLogger().debug("MySQLStmt::create: |
609 | 610 | // Prepared > " + query); auto shared = SharedPointer<Stmt>(result); result->self = shared; return shared; |
610 | 611 | // } |
611 | 612 |
|
|
0 commit comments