tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
945 stars 264 forks source link

[bug] SQL Plugins Query mysql Return unsupported datatype: BINARY #2010

Open lmq2582609 opened 1 day ago

lmq2582609 commented 1 day ago

Describe the bug

Here's my code

let db = await Database.load(`mysql://${username}:${password}@${host}:${port}/information_schema`)
let res = await db.select(`SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '${database}' AND TABLE_TYPE = 'BASE TABLE'`)
console.info('返回:', res)

error:unsupported datatype: BINARY

But when I use:SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ........ Returns correctly when * is not used

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 128.0.2739.79
    ✔ MSVC: Visual Studio Generation Tools 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.18.0
    - npm: 9.8.1

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

[-] Plugins
    - tauri-plugin-sql 🦀: 2.0.1
    - @tauri-apps/plugin-sql : 2.0.0 (outdated, latest: 2.0.1)
    - tauri-plugin-log 🦀: 2.0.1
    - @tauri-apps/plugin-log : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.1 (outdated, latest: 2.0.2)
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.1.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

lmq2582609 commented 22 hours ago

Today I changed a table with a marker bit type, and a new error occurred during the query. error:unsupported datatype: BIT database is mysql,table structure:

CREATE TABLE `m_config` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `config_id` bigint NOT NULL COMMENT '',
  `config_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '',
  `config_key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '',
  `config_value` varchar(500) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '',
  `description` varchar(512) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '',
  `status` tinyint DEFAULT '1' COMMENT '',
  `create_id` bigint DEFAULT '0' COMMENT '',
  `create_time` datetime(6) DEFAULT NULL COMMENT '',
  `update_id` bigint DEFAULT '0' COMMENT '',
  `update_time` datetime(6) DEFAULT NULL COMMENT '',
  `deleted` bit(1) DEFAULT b'1' COMMENT '0deleted  1normal',
  `version` int DEFAULT '0' COMMENT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='params config'

select statement:

SELECT * FROM m_config

my code:

let db = await Database.load(`mysql://${username}:${password}@${host}:${port}/${database}`)
let sql = `SELECT * FROM ${database}.${connName}`
console.info(‘sql', sql)
let res = await db.select(sql)