-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
147 changed files
with
9,792 additions
and
25,947 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
.idea/ | ||
jars/postgresql-9.4-1206-jdbc42.jar | ||
*.iml |
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,21 @@ | ||
## v0.7.0 | ||
|
||
### Breaking changes | ||
|
||
- Removed `ConnectionPool` constructor, use `Store.initConnectionPool()` instead | ||
- Removed `Storable.prototype._id`, use `Storable.prototype.id` from now on | ||
|
||
### Possibly breaking changes | ||
|
||
- Restructured the whole package, most notably the "lib/sqlstore" directory is gone. If your application directly requires modules of ringo-sqlstore you'll need to adapt the module paths. | ||
|
||
### Bugfixes and Improvements | ||
|
||
- Switched to [HikariCP](https://github.com/brettwooldridge/HikariCP) as connection pool exclusively. All configuration options accepted by HikariCP can be specified in the configuration hash passed as argument to `Store.initConnectionPool()`. | ||
- Added support for auto incremented IDs. From now on ID mappings can define either `autoIncrement: true` or `sequence: <name>`. The default is auto increment. | ||
- Added basic support for `json` and `jsonb` PostgreSQL data types (contributed by [@botic](https://github.com/botic/)). Note that currently the sqlstore query language doesn't support JSON queries. | ||
- Primitive or object mapping definitions can now contain a `unique` flag. [#33](https://github.com/grob/ringo-sqlstore/issues/33) | ||
- `Store.prototype.syncTables()` creates a sequence only if it doesn't already exist. [#35](https://github.com/grob/ringo-sqlstore/issues/35) | ||
- Fixed whitespace matching the empty string in query grammar [#32](https://github.com/grob/ringo-sqlstore/issues/32) | ||
- Data types are now database specific, fixing [19](https://github.com/grob/ringo-sqlstore/issues/19) | ||
- Added special SQL generator for Oracle, fixing [#27](https://github.com/grob/ringo-sqlstore/issues/27) |
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,18 @@ | ||
var term = require("ringo/term"); | ||
|
||
var Key = require("../lib/key"); | ||
|
||
var setUp = exports.setUp = function() {}; | ||
|
||
exports.tearDown = function() {}; | ||
|
||
var start = exports.start = function(cnt) { | ||
cnt || (cnt = 1000000); | ||
var start = Date.now(); | ||
var result = []; | ||
for (let i=0; i<cnt; i+=1) { | ||
result.push(new Key("Author")); | ||
} | ||
var millis = Date.now() - start; | ||
term.writeln(term.GREEN, millis, "ms for", cnt, "instantiations,", millis / cnt + "ms/instantiation", term.RESET); | ||
} |
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,18 @@ | ||
var term = require("ringo/term"); | ||
|
||
var Parser = require("../lib/query/parser"); | ||
var SQL = "select Author.name as author, count(Book.id) as cnt from Author, Book where Book.author = Author.id group by Author.name order by Author.name"; | ||
|
||
exports.setUp = function() {}; | ||
|
||
exports.tearDown = function() {}; | ||
|
||
exports.start = function(cnt) { | ||
cnt || (cnt = 10000); | ||
var start = Date.now(); | ||
for (let i=0; i<cnt; i+=1) { | ||
Parser.parse(SQL); | ||
} | ||
var millis = Date.now() - start; | ||
term.writeln(term.GREEN, millis, "ms for", cnt, "parsings,", millis / cnt + "ms/parse", term.RESET); | ||
}; |
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
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,76 @@ | ||
var term = require("ringo/term"); | ||
|
||
var Store = require("../lib/store"); | ||
var utils = require("../test/utils"); | ||
var Parser = require("../lib/query/parser"); | ||
var SqlGenerator = require("../lib/query/sqlgenerator"); | ||
var SQL = "select Author.name as author, count(Book.id) as cnt from Author, Book where Book.author = Author.id group by Author.name order by Author.name"; | ||
var store = null; | ||
var Author = null; | ||
var Book = null; | ||
var ast = null; | ||
|
||
var MAPPING_AUTHOR = { | ||
"table": "author", | ||
"id": { | ||
"column": "author_id", | ||
"sequence": "author_id" | ||
}, | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"column": "author_name", | ||
"nullable": false | ||
}, | ||
"books": { | ||
"type": "collection", | ||
"query": "from Book where author = :id" | ||
} | ||
} | ||
}; | ||
|
||
var MAPPING_BOOK = { | ||
"table": "book", | ||
"id": { | ||
"column": "book_id", | ||
"sequence": "book_id" | ||
}, | ||
"properties": { | ||
"title": { | ||
"type": "string", | ||
"column": "book_title", | ||
"nullable": false | ||
}, | ||
"author": { | ||
"type": "object", | ||
"column": "book_f_author", | ||
"entity": "Author", | ||
"nullable": false | ||
} | ||
} | ||
}; | ||
|
||
exports.setUp = function(dbProps) { | ||
store = new Store(Store.initConnectionPool(dbProps)); | ||
term.writeln("------------------------------"); | ||
term.writeln("Using", store.connectionPool.getDriverClassName()); | ||
Author = store.defineEntity("Author", MAPPING_AUTHOR); | ||
Book = store.defineEntity("Book", MAPPING_BOOK); | ||
store.syncTables(); | ||
ast = Parser.parse(SQL); | ||
}; | ||
|
||
exports.tearDown = function() { | ||
utils.drop(store, Author, Book); | ||
store.close(); | ||
}; | ||
|
||
exports.start = function(cnt) { | ||
cnt || (cnt = 100000); | ||
var start = Date.now(); | ||
for (let i=0; i<cnt; i+=1) { | ||
SqlGenerator.generate(store, ast); | ||
} | ||
var millis = Date.now() - start; | ||
term.writeln(term.GREEN, millis, "ms for", cnt, "selectors,", millis / cnt + "ms/selector", term.RESET); | ||
}; |
Oops, something went wrong.