Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lmq2582609 opened this issue Nov 6, 2024 · 2 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers plugin: sql

Comments

@lmq2582609
Copy link

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

@FabianLars FabianLars transferred this issue from tauri-apps/tauri Nov 6, 2024
@FabianLars FabianLars added bug Something isn't working good first issue Good for newcomers plugin: sql labels Nov 6, 2024
@lmq2582609 lmq2582609 reopened this Nov 7, 2024
@lmq2582609
Copy link
Author

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)

@liuhuo23
Copy link

这个插件有测试过吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers plugin: sql
Projects
None yet
Development

No branches or pull requests

3 participants