-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4f7c5d
commit 2f7164f
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var Columns = require('../stmt/columns'); | ||
var Where = require('../stmt/where'); | ||
var Conditionals = require('../stmt/conditionals'); | ||
var Options = require('../stmt/options'); | ||
var Base = require('./base'); | ||
var util = require('../../util'); | ||
|
||
function Truncate () { | ||
Base.apply(this, arguments); | ||
|
||
this.parts = { table: null }; | ||
} | ||
|
||
Truncate.prototype = new Base(); | ||
|
||
/** | ||
* Sets the table to truncate. | ||
* @param {String|Table} table | ||
* @return {Truncate} | ||
*/ | ||
Truncate.prototype.table = function (table) { | ||
this.parts.table = util.resolveName(table); | ||
return this; | ||
}; | ||
|
||
/** | ||
* Parameterizes the query, returning an array of parameters followed | ||
* by the string representation. | ||
* | ||
* @return {[Array, String]} | ||
*/ | ||
Truncate.prototype.parameterize = function () { | ||
return [[], 'TRUNCATE ' + this.parts.table + ';']; | ||
}; | ||
|
||
module.exports = Truncate; |
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