Skip to content

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

@spidgorny

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions