feat: auto-detect OceanBase Oracle mode and use Oracle-style schema queries (#155)
Introduce MysqlMode enum to distinguish Normal/Bare/OceanBaseOracle MySQL connections. On connect, if driver_profile contains "oceanbase", detect tenant mode via SHOW VARIABLES LIKE 'ob_compatibility_mode'. When Oracle mode is detected, schema queries use ALL_TABLES/ALL_TAB_COLUMNS/etc.
This commit is contained in:
1 parent
0e2fbc5a40
commit
dfd4d2d99d
7 files changed
+286
-20
No files matched your search
@@ -154,9 +154,9 @@ pub async fn do_execute(
|
||||
})
|
||||
.await
|
||||
}
|
||||
PoolKind::Mysql(p, bare) => {
|
||||
PoolKind::Mysql(p, mode) => {
|
||||
let p = p.clone();
|
||||
let bare = *bare;
|
||||
let bare = *mode == crate::connection::MysqlMode::Bare;
|
||||
drop(connections);
|
||||
wait_for_query(cancel_token, db::mysql::execute_query(&p, sql, bare)).await.map(truncate_result)
|
||||
}
|
||||
@@ -396,7 +396,7 @@ pub async fn execute_statements_in_transaction(
|
||||
let conns = state.connections.lock().await;
|
||||
conns.get(&pool_key).map(|p| match p {
|
||||
PoolKind::Postgres(pg) => TxPath::Pg(pg.clone()),
|
||||
PoolKind::Mysql(mp, bare) => TxPath::Mysql(mp.clone(), *bare),
|
||||
PoolKind::Mysql(mp, _mode) => TxPath::Mysql(mp.clone(), false),
|
||||
PoolKind::Sqlite(sq) => TxPath::Sqlite(sq.clone()),
|
||||
PoolKind::ClickHouse(_) | PoolKind::SqlServer(_) | PoolKind::Dameng(_) | PoolKind::Gaussdb(_) => {
|
||||
TxPath::Explicit
|
||||
|
||||
Reference in new issue
Block a user