adamlofts / mysql1_dart

MySQL driver for Dart
Other
134 stars 45 forks source link

CAST() is not working #119

Open dukefirehawk opened 2 years ago

dukefirehawk commented 2 years ago

For the following table:

CREATE TABLE feet (
    id serial PRIMARY KEY,
    n_toes int NOT NULL,
    created_at timestamp,
    updated_at timestamp
);

Running the following query on MariaDB 10.6.5 CLI works fine.

SELECT id, CAST (n_toes AS CHAR) as toes from feet

However, it is not working when executed programmatically through mysql1

  var result2 = await connection
      .query('SELECT id, CAST (n_toes AS CHAR) as toes from feet');

The following error is thrown:

MySqlConnection: completing with MySqlException: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHAR) as toes from feet' at line 1