Sannis / node-mysql-libmysqlclient

Asynchronous MySQL binding for Node.js
http://sannis.github.com/node-mysql-libmysqlclient
Other
229 stars 47 forks source link

LOAD DATA LOCAL INFILE implemetation #158

Closed anton-kotenko closed 12 years ago

anton-kotenko commented 12 years ago
  1. Make queries like "load data local infile" to work in their normal way (data is taken from file on client's machine and sent to mysql server)
  2. Make possible to use instance of nodejs's Buffer class instead of file, as source of rows. (feature similar to postgresql's COPY FROM STDIN). Sometimes it's more convenient that using temporary file or pipe.

This feature requires update in query and querySync interface (without breaking compatibility) Examples:

var buf = new Buffer('1,2,3\n4,5,6');
conn.querySync('LOAD DATA LOCAL INFILE \'some_meaningless_name\' INTO TABLE test_table FIELDS TERMINATED BY \',\'  LINES TERMINATED BY \'\n''', buf);
Sannis commented 12 years ago

Thanks! I will merge this after fix failed tests in master.

And I prefer to cherry-pick commits manually to avoid duplications from your fork. You can help me with this if you have some time.

anton-kotenko commented 12 years ago

As I understand, you are busy with some bugs with Travis, but if there will be any problems with this pull request, please, write. I would like to help, as this feature is critical for me (it makes massive inserts into database 3-5 times faster that simple inserts)

Sannis commented 12 years ago

As I understand, you are busy with some bugs with Travis

Done!

but if there will be any problems with this pull request, please, write.

Can you rebase your branch onto upstream master? I'm not commit-counter hunter, but it will be great to keep history more linear for such simple project. I hope to have some time for this next evening.

Sannis commented 12 years ago

Good work, Anton!

anton-kotenko commented 12 years ago

Thanks, don't forget to update code, because I've just fixed bug (my, incorrect rebase) with locks (double lock in EIO_Query);

Sannis commented 12 years ago

Good to merge — The Travis build passed

Now passes :)