Skip to content

mysql/lib/protocol/SqlString.js:71 TypeError: undefined is not a function #1058

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

Closed
reggi opened this issue Apr 13, 2015 · 5 comments
Closed
Assignees

Comments

@reggi
Copy link

reggi commented Apr 13, 2015

/Users/thomas/Desktop/project/node_modules/mysql/lib/protocol/SqlString.js:71
  return sql.replace(/\?\??/g, function(match) {
             ^
TypeError: undefined is not a function
    at Object.SqlString.format (/Users/thomas/Desktop/wordpress-shopify-importer/node_modules/mysql/lib/protocol/SqlString.js:71:14)
    at Connection.format (/Users/thomas/Desktop/wordpress-shopify-importer/node_modules/mysql/lib/Connection.js:247:20)
    at Connection.query (/Users/thomas/Desktop/wordpress-shopify-importer/node_modules/mysql/lib/Connection.js:183:20)
    at Object.<anonymous> (/Users/thomas/Desktop/wordpress-shopify-importer/index.js:14:12)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:428:10)
    at Module.load (module.js:335:32)
    at Function.Module._load (module.js:290:12)
    at Function.Module.runMain (module.js:451:10)
    at startup (node.js:124:18)
@dougwilson
Copy link
Member

Hi! Can you provide a little simple program or some code to reproduce? It looks like it's caused by a bad call into this library.

@dougwilson
Copy link
Member

Mainly what is on line 14 in wordpress-shopify-importer/index.js ?

@reggi
Copy link
Author

reggi commented Apr 13, 2015

This is all I've got. I was trying to hide what I was working on. Whoops.

var mysql = require('mysql')
var options = {
  host: process.env.MYSQL_HOST,
  user: process.env.MYSQL_USER,
  password: process.env.MYSQL_PASSWORD,
  database: process.env.MYSQL_DATABASE,
  charset: "utf8"
}

var connection = mysql.createConnection(options)

connection.connect()

connection.query(function(err, rows, fields) {
  if (err) throw err
  console.log(rows.length)
});

connection.end()

@reggi
Copy link
Author

reggi commented Apr 13, 2015

No query, duh.

@reggi reggi closed this as completed Apr 13, 2015
@dougwilson
Copy link
Member

lol, thanks. Looks like our arguments are probably too forgiving, haha, because we should probably throw a useful error on a missing query ;)

@dougwilson dougwilson reopened this Apr 13, 2015
@dougwilson dougwilson self-assigned this Apr 14, 2015
seangarner pushed a commit to seangarner/node-mysql that referenced this issue May 11, 2015
dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
json encoded data is represented as bytes however it should be interpolated as a string

Fixes mysqljs#819
dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
…js#1059)

Following mysqljs#1058, in order for the driver.Value to get as a json.RawMessage,
the converter should accept it as a valid value, and handle it as bytes in
case where interpolation is disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants