Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 1ca53a32
authored
Dec 11, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored error throw in query-generator super class
1 parent
e10cb517
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
13 deletions
lib/connectors/query-generator.js
lib/connectors/query-generator.js
View file @
1ca53a3
...
@@ -5,14 +5,14 @@ module.exports = (function() {
...
@@ -5,14 +5,14 @@ module.exports = (function() {
Attributes should have the format: {attributeName: type, attr2: type2} --> {title: 'VARCHAR(255)'}
Attributes should have the format: {attributeName: type, attr2: type2} --> {title: 'VARCHAR(255)'}
*/
*/
createTableQuery
:
function
(
tableName
,
attributes
,
options
)
{
createTableQuery
:
function
(
tableName
,
attributes
,
options
)
{
throw
new
Error
(
'Define the method createTableQuery!
'
)
throw
MethodUndefined
.
call
(
'createTableQuery
'
)
},
},
/*
/*
Returns a query for dropping a table.
Returns a query for dropping a table.
*/
*/
dropTableQuery
:
function
(
tableName
,
options
)
{
dropTableQuery
:
function
(
tableName
,
options
)
{
throw
new
Error
(
'Define the method dropTableQuery!
'
)
throw
MethodUndefined
.
call
(
'dropTableQuery
'
)
},
},
/*
/*
...
@@ -22,7 +22,7 @@ module.exports = (function() {
...
@@ -22,7 +22,7 @@ module.exports = (function() {
- futureTableName: Name of the table after execution.
- futureTableName: Name of the table after execution.
*/
*/
renameTableQuery
:
function
(
originalTableName
,
futureTableName
)
{
renameTableQuery
:
function
(
originalTableName
,
futureTableName
)
{
throw
new
Error
(
'Define the method renameQuery!
'
)
throw
MethodUndefined
.
call
(
'renameTableQuery
'
)
},
},
/*
/*
...
@@ -37,7 +37,7 @@ module.exports = (function() {
...
@@ -37,7 +37,7 @@ module.exports = (function() {
- allowNull: Boolean
- allowNull: Boolean
*/
*/
addColumnQuery
:
function
(
tableName
,
attributes
)
{
addColumnQuery
:
function
(
tableName
,
attributes
)
{
throw
new
Error
(
'Define the method addColumnQuery!
'
)
throw
MethodUndefined
.
call
(
'addColumnQuery
'
)
},
},
/*
/*
...
@@ -47,7 +47,7 @@ module.exports = (function() {
...
@@ -47,7 +47,7 @@ module.exports = (function() {
- attributeName: Name of the obsolete attribute.
- attributeName: Name of the obsolete attribute.
*/
*/
removeColumnQuery
:
function
(
tableName
,
attributeName
)
{
removeColumnQuery
:
function
(
tableName
,
attributeName
)
{
throw
new
Error
(
'Define the method removeColumnQuery!
'
)
throw
MethodUndefined
.
call
(
'removeColumnQuery
'
)
},
},
/*
/*
...
@@ -62,7 +62,7 @@ module.exports = (function() {
...
@@ -62,7 +62,7 @@ module.exports = (function() {
- allowNull: Boolean
- allowNull: Boolean
*/
*/
changeColumnQuery
:
function
(
tableName
,
attribute
)
{
changeColumnQuery
:
function
(
tableName
,
attribute
)
{
throw
new
Error
(
'Define the method modifyColumnQuery!
'
)
throw
MethodUndefined
.
call
(
'changeColumnQuery
'
)
},
},
/*
/*
...
@@ -73,7 +73,7 @@ module.exports = (function() {
...
@@ -73,7 +73,7 @@ module.exports = (function() {
- attrNameAfter: The name of the attribute, after renaming.
- attrNameAfter: The name of the attribute, after renaming.
*/
*/
renameColumnQuery
:
function
(
tableName
,
attrNameBefore
,
attrNameAfter
)
{
renameColumnQuery
:
function
(
tableName
,
attrNameBefore
,
attrNameAfter
)
{
throw
new
Error
(
'Define the method renameColumnQuery!
'
)
throw
MethodUndefined
.
call
(
'renameColumnQuery
'
)
},
},
/*
/*
...
@@ -90,14 +90,14 @@ module.exports = (function() {
...
@@ -90,14 +90,14 @@ module.exports = (function() {
- offset -> An offset value to start from. Only useable with limit!
- offset -> An offset value to start from. Only useable with limit!
*/
*/
selectQuery
:
function
(
tableName
,
options
)
{
selectQuery
:
function
(
tableName
,
options
)
{
throw
new
Error
(
'Define the method selectQuery!
'
)
throw
MethodUndefined
.
call
(
'selectQuery
'
)
},
},
/*
/*
Returns an insert into command. Parameters: table name + hash of attribute-value-pairs.
Returns an insert into command. Parameters: table name + hash of attribute-value-pairs.
*/
*/
insertQuery
:
function
(
tableName
,
attrValueHash
)
{
insertQuery
:
function
(
tableName
,
attrValueHash
)
{
throw
new
Error
(
'Define the method insertQuery!
'
)
throw
MethodUndefined
.
call
(
'insertQuery
'
)
},
},
/*
/*
...
@@ -111,7 +111,7 @@ module.exports = (function() {
...
@@ -111,7 +111,7 @@ module.exports = (function() {
If you use a string, you have to escape it on your own.
If you use a string, you have to escape it on your own.
*/
*/
updateQuery
:
function
(
tableName
,
values
,
where
)
{
updateQuery
:
function
(
tableName
,
values
,
where
)
{
throw
new
Error
(
'Define the method updateQuery!
'
)
throw
MethodUndefined
.
call
(
'updateQuery
'
)
},
},
/*
/*
...
@@ -126,14 +126,41 @@ module.exports = (function() {
...
@@ -126,14 +126,41 @@ module.exports = (function() {
- limit -> Maximaum count of lines to delete
- limit -> Maximaum count of lines to delete
*/
*/
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
throw
new
Error
(
'Define the method deleteQuery!'
)
throwMethodUndefined
.
call
(
'deleteQuery'
)
},
/*
Returns an add index query.
Parameters:
- tableName -> Name of an existing table.
- attributes:
An array of attributes as string or as hash.
If the attribute is a hash, it must have the following content:
- attribute: The name of the attribute/column
- length: An integer. Optional
- order: 'ASC' or 'DESC'. Optional
- options:
- indicesType: UNIQUE|FULLTEXT|SPATIAL
- indexName: The name of the index. Default is <tableName>_<attrName1>_<attrName2>
- parser
*/
addIndexQuery
:
function
(
tableName
,
attributes
,
options
)
{
throwMethodUndefined
.
call
(
'addIndexQuery'
)
},
showIndexQuery
:
function
(
tableName
,
options
)
{
throwMethodUndefined
.
call
(
'showIndexQuery'
)
},
removeIndexQuery
:
function
(
tableName
,
options
)
{
throwMethodUndefined
.
call
(
'removeIndexQuery'
)
},
},
/*
/*
Takes something and transforms it into values of a where condition.
Takes something and transforms it into values of a where condition.
*/
*/
getWhereConditions
:
function
(
smth
)
{
getWhereConditions
:
function
(
smth
)
{
throw
new
Error
(
'Define the method getWhereConditions!
'
)
throw
MethodUndefined
.
call
(
'getWhereConditions
'
)
},
},
/*
/*
...
@@ -141,10 +168,14 @@ module.exports = (function() {
...
@@ -141,10 +168,14 @@ module.exports = (function() {
The values are transformed by the relevant datatype.
The values are transformed by the relevant datatype.
*/
*/
hashToWhereConditions
:
function
(
hash
)
{
hashToWhereConditions
:
function
(
hash
)
{
throw
new
Error
(
'Define the method hashToWhereConditions!
'
)
throw
MethodUndefined
.
call
(
'hashToWhereConditions
'
)
}
}
}
}
var
throwMethodUndefined
=
function
(
methodName
)
{
throw
new
Error
(
'The method "'
+
methodName
+
'" was not defined!'
)
}
return
QueryGenerator
return
QueryGenerator
})()
})()
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment