prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
311 stars 113 forks source link

how to parse intn ? #324

Closed amokio closed 7 months ago

amokio commented 7 months ago

i have created a function to parse row into HashMap<String, serde_json::Value>

but seems Intn is a dynamic length integer. How to deal with this issue?

example SQL:

SELECT * FROM information_schema.columns ORDER BY table_name, ordinal_position
pub(crate) fn to_json(col: &Column, col_index: usize, row: &Row) -> Result<JsonValue, Error> {
    let col_type = col.column_type();
    Ok(match col_type {
       ...
       tiberius::ColumnType::NVarchar => get_basic(row, col, col_index, |a: &str| {
            Ok(JsonValue::String(a.to_string()))
        })?,
       tiberius::ColumnType::Intn => ?????
     })