brianc/node-sql

Add support for CREATE TEMPORARY TABLE

Opened this issue · 1 comments

geon commented

It looks like it should be simple to implement. If someone can give me some pointers on how it should be implemented, I can give it a try myself.

You could start by modifying this function to take a isTemporary boolean variable that defaults to false

https://github.com/brianc/node-sql/blob/master/lib/table.js#L193

After that pass the 'isTemporary' through as a config to here:

https://github.com/brianc/node-sql/blob/master/lib/node/query.js#L271

Which basically just creates a new CreateNode

https://github.com/brianc/node-sql/blob/master/lib/node/create.

You'll need to track the 'isTemporary' value there is well.

The create node is passed to the query writer as a sort of bastardized AST and is handled here:

https://github.com/brianc/node-sql/blob/master/lib/dialect/postgres.js#L240

Theeeen just a few tests & you're done. :) Really it's probably ~10 lines of implementation code. and about 10 lines of test code!