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

Example Proxy Server (Server API) fails on inserts. #4

Closed
chrisdew opened this issue May 28, 2013 · 2 comments
Closed

Example Proxy Server (Server API) fails on inserts. #4

chrisdew opened this issue May 28, 2013 · 2 comments

Comments

@chrisdew
Copy link
Contributor

I tried a simple insert (selects are working fine) and it fails.

(I added two lines to the example proxy server to print the values of rows and columns for debugging purposes.)

The query was:

insert into engines(name, number, arrived, type, wheels) values('James',5,'1930-05-28 09:26:00','STEAM',8);

The query worked (I am using the normal MySQL command line client):

mysql> insert into engines(name, number, arrived, type, wheels) values('James',5,'1930-05-28 09:26:00','STEAM',8);
Query OK, 0 rows affected, 28265 warnings (0.07 sec)

mysql> 

but the proxy blew up with:

proxying query:insert into engines(name, number, arrived, type, wheels) values('James',5,'1930-05-28 09:26:00','STEAM',8)
rows { domain: null,
  _events: { error: [ [Function], [Function] ] },
  _maxListeners: 10,
  next: [Function],
  query: 'insert into engines(name, number, arrived, type, wheels) values(\'James\',5,\'1930-05-28 09:26:00\',\'STEAM\',8)',
  onResult: [Function],
  fieldCount: 0,
  insertId: 5,
  fields: [],
  rows: [],
  rowParser: null,
  _receivedFieldsCount: 0,
  affectedRows: 1 }
columns []

/home/chris/node_modules/mysql2/lib/connection.js:315
  rows.forEach(function(row) {
       ^
TypeError: Object #<Query> has no method 'forEach'
    at Connection.writeTextResult (/home/chris/node_modules/mysql2/lib/connection.js:315:8)
    at Query.onResult (/home/chris/Dropbox/mysqlproxy/proxy.js:22:12)
    at Query.resultsetHeader (/home/chris/node_modules/mysql2/lib/commands/query.js:46:12)
    at Query.Command.execute (/home/chris/node_modules/mysql2/lib/commands/command.js:23:20)
    at Connection.handlePacket (/home/chris/node_modules/mysql2/lib/connection.js:226:28)
    at PacketParser.execute (/home/chris/node_modules/mysql2/lib/packet_parser.js:36:21)
    at Socket.stream.ondata (/home/chris/node_modules/mysql2/lib/connection.js:70:31)
    at TCP.onread (net.js:404:27)

@chrisdew
Copy link
Contributor Author

P.S. Updates and deletes fail in a similar way.

@chrisdew chrisdew reopened this May 28, 2013
@chrisdew
Copy link
Contributor Author

(closed by accident)

sidorares added a commit that referenced this issue May 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant