Skip to content

[mariadb/mysql] does not support named placeholders like :col1 - use ? instead #52

Description

@spidgorny

[mariadb/mysql] does not support named placeholders like :col1 - use ? instead

const jsonSql = require("json-sql")({
  namedValues: false,
  valuesPrefix: "$$",
});
jsonSql.setDialect("mysql");
    const sql = jsonSql.build({
      type: "update",
      table: "table1",
      condition: {
        guid: id,
      },
      modifier: updateFields,
    });
/// CONVERT placeholders
const query1 = sql.query.replace(/\$\$\d+/g, "?");

Maybe this can be built into the mysql dialect?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions