Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
handle function calls as raw sql in GROUP
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Waldmann committed Jul 7, 2014
1 parent 5b6e015 commit 72d7dd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/stores/sql/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ exports.definition = {
this.select(group);
}

for(var i = 0; i < group.length; i++){
//check for function calls => don't escape them!
if(group[i].match(/(\(|\))/)){
group[i] = self.store.connection.raw(group[i]);
}
}

query.groupBy.apply(query, group);

if(having){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openrecord",
"version": "1.0.0",
"version": "1.0.1",
"description": "Active record like ORM for nodejs",
"keywords": ["orm", "record", "sql", "sqlite3", "postgres", "pg", "mysql", "database", "activerecord", "promise", "rest", "restify", "nested set"],
"author": "Philipp Waldmann <philipp.waldmann@s-team.at>",
Expand Down

0 comments on commit 72d7dd0

Please sign in to comment.