-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quote table names and columns (#105)
quote table and column names
- Loading branch information
Showing
99 changed files
with
460 additions
and
691 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
var format = 'delete %s from %s as %s%s'; | ||
var util = require('util'); | ||
const quote = require('../table/quote'); | ||
|
||
function deleteFromSql(table, alias, whereSql) { | ||
var name = table._dbName; | ||
var name = quote(table._dbName); | ||
alias = quote(alias); | ||
return util.format(format, alias, name, alias, whereSql); | ||
} | ||
module.exports = deleteFromSql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
var format = 'delete from %s where %s.rowId in (SELECT %s.rowId FROM %s %s%s)'; | ||
var util = require('util'); | ||
const quote = require('../table/quote'); | ||
|
||
function deleteFromSql(table, alias, whereSql) { | ||
var name = table._dbName; | ||
var name = quote(table._dbName); | ||
alias = quote(alias); | ||
return util.format(format, name, name, alias, name, alias, whereSql); | ||
} | ||
module.exports = deleteFromSql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const quote = require('../table/quote'); | ||
|
||
function formatDateColumn(column, alias) { | ||
return `TO_CHAR(${alias}.${column._dbName}, 'YYYY-MM-DD"T"HH24:MI:SS.FF3')`; | ||
return `TO_CHAR(${alias}.${quote(column._dbName)}, 'YYYY-MM-DD"T"HH24:MI:SS.FF3')`; | ||
} | ||
|
||
module.exports = formatDateColumn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const quote = require('../table/quote'); | ||
|
||
module.exports = function(alias) { | ||
return ' FOR UPDATE OF ' + alias; | ||
return ' FOR UPDATE OF ' + quote(alias); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
var format = 'delete from %s %s%s'; | ||
var util = require('util'); | ||
const quote = require('../table/quote'); | ||
|
||
function deleteFromSql(table, alias, whereSql) { | ||
var name = table._dbName; | ||
var name = quote(table._dbName); | ||
alias = quote(alias); | ||
return util.format(format, name, alias, whereSql); | ||
} | ||
module.exports = deleteFromSql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const quote = require('../table/quote'); | ||
|
||
function formatDateOut(column, alias) { | ||
return `${alias}.${column._dbName}::text`; | ||
return `${alias}.${quote(column._dbName)}::text`; | ||
} | ||
|
||
module.exports = formatDateOut; |
Oops, something went wrong.