Skip to content

Commit 23c5242

Browse files
committed
Merge pull request #62 from js-data/develop
Stable Version 0.11.12
2 parents 51c0362 + a457f91 commit 23c5242

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

dist/js-data-sql.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,9 @@ module.exports =
250250
var instance = undefined;
251251
options = options || {};
252252
options.with = options.with || [];
253+
var table = getTable(resourceConfig);
253254
var query = options && options.transaction || this.query;
254-
return query.select('*').from(getTable(resourceConfig)).where(resourceConfig.idAttribute, (0, _lang.toString)(id)).then(function (rows) {
255+
return query.select(table + '.*').from(table).where(table + '.' + resourceConfig.idAttribute, (0, _lang.toString)(id)).then(function (rows) {
255256
if (!rows.length) {
256257
return _bluebird2.default.reject(new Error('Not Found!'));
257258
} else {
@@ -464,7 +465,7 @@ module.exports =
464465
if (v === null) {
465466
query = query.whereNull(field);
466467
} else {
467-
query.where(field, v);
468+
query = query.where(field, v);
468469
}
469470
} else if (op === '!=' || op === '!==') {
470471
if (v === null) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-sql",
33
"description": "Postgres/MySQL/MariaDB/SQLite3 adapter for js-data.",
4-
"version": "0.11.9",
4+
"version": "0.11.12",
55
"homepage": "http://www.js-data.io/docs/dssqladapter",
66
"repository": {
77
"type": "git",

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ class DSSqlAdapter {
174174
let instance
175175
options = options || {}
176176
options.with = options.with || []
177+
let table = getTable(resourceConfig);
177178
let query = options && options.transaction || this.query
178179
return query
179-
.select('*')
180-
.from(getTable(resourceConfig))
181-
.where(resourceConfig.idAttribute, toString(id))
180+
.select(`${table}.*`)
181+
.from(table)
182+
.where(`${table}.${resourceConfig.idAttribute}`, toString(id))
182183
.then(rows => {
183184
if (!rows.length) {
184185
return Promise.reject(new Error('Not Found!'))
@@ -362,7 +363,7 @@ class DSSqlAdapter {
362363
if (v === null) {
363364
query = query.whereNull(field)
364365
} else {
365-
query.where(field, v)
366+
query = query.where(field, v)
366367
}
367368
} else if (op === '!=' || op === '!==') {
368369
if (v === null) {

0 commit comments

Comments
 (0)