Files
dbx/src-tauri/src/db/mod.rs
T
kingcanfish d1075c0042 fix: resolve PostgreSQL/MySQL/SQL Server NUMERIC/DECIMAL display issues
- Add rust_decimal feature to sqlx and tiberius for proper Decimal type handling
- Fix try_get_unchecked<String> causing NULL or garbled output for numeric types
- Add numeric_precision and numeric_scale to ColumnInfo for all database drivers
- Update frontend to display precision (e.g., numeric(20,6)) in column headers
- Fix typeColorClass to handle type names with precision suffix

Root cause: PostgreSQL binary protocol sends NUMERIC as PgNumeric binary format,
not UTF-8 text. try_get_unchecked<String> attempted to decode binary bytes as UTF-8,
causing decode failures (NULL) or garbage characters (乱码).
2026-05-02 10:14:01 +08:00

70 lines
1.6 KiB
Rust

pub mod clickhouse_driver;
pub mod elasticsearch_driver;
pub mod mongo_driver;
pub mod mysql;
pub mod oracle_driver;
pub mod postgres;
pub mod redis_driver;
pub mod sqlite;
pub mod sqlserver;
pub mod ssh_tunnel;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DatabaseInfo {
pub name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TableInfo {
pub name: String,
pub table_type: String, // "TABLE" or "VIEW"
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ColumnInfo {
pub name: String,
pub data_type: String,
pub is_nullable: bool,
pub column_default: Option<String>,
pub is_primary_key: bool,
pub extra: Option<String>,
pub comment: Option<String>,
pub numeric_precision: Option<i32>,
pub numeric_scale: Option<i32>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueryResult {
pub columns: Vec<String>,
pub rows: Vec<Vec<serde_json::Value>>,
pub affected_rows: u64,
pub execution_time_ms: u128,
#[serde(default)]
pub truncated: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IndexInfo {
pub name: String,
pub columns: Vec<String>,
pub is_unique: bool,
pub is_primary: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ForeignKeyInfo {
pub name: String,
pub column: String,
pub ref_table: String,
pub ref_column: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TriggerInfo {
pub name: String,
pub event: String,
pub timing: String,
}