Skip to content

Commit

Permalink
Merge branch 'rblalock-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlacot committed Nov 15, 2013
2 parents 5d7a066 + 924aaac commit c2d202c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions joli.js
Expand Up @@ -453,6 +453,7 @@ var joliCreator = function() {
rows = joli.connection.execute(query);
return this.getCount(rows);
case 'insert_into':
case 'insert_replace':
joli.connection.execute(query);
return joli.connection.lastInsertRowId();
case 'select':
Expand Down Expand Up @@ -497,6 +498,8 @@ var joliCreator = function() {
return 'delete from ' + this.data.from;
case 'insert_into':
return 'insert into ' + this.data.from + ' (' + this.data.set.join(', ') + ') values (' + this.data.values.join(', ') + ')';
case 'insert_replace':
return 'insert or replace into ' + this.data.from + ' (' + this.data.set.join(', ') + ') values (' + this.data.values.join(', ') + ')';
case 'replace':
return 'replace into ' + this.data.from + ' (' + this.data.set.join(', ') + ') values (' + this.data.values.join(', ') + ')';
case 'select':
Expand Down Expand Up @@ -661,6 +664,11 @@ var joliCreator = function() {
this.data.from = table;
return this;
},
insertReplace: function(table) {
this.data.operation = 'insert_replace';
this.data.from = table;
return this;
},
join: function(table, local_id, foreign_id) {
this.data.join.push([table, local_id, foreign_id]);
return this;
Expand Down

0 comments on commit c2d202c

Please sign in to comment.