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

Commit

Permalink
hstore with array value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Waldmann committed Sep 2, 2015
1 parent e53828b commit 1af1744
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/stores/postgres/data_types/hstore.js
Expand Up @@ -26,7 +26,7 @@ exports.store = {


for(var key in tmp){
if(tmp.hasOwnProperty(key) && typeof tmp[key] === 'string' && tmp[key].match(/^\{"/)){
if(tmp.hasOwnProperty(key) && typeof tmp[key] === 'string' && tmp[key].match(/(^\{"|\[)/)){
try{
tmp[key] = JSON.parse(tmp[key]);
}catch(e){}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "openrecord",
"version": "1.10.4",
"version": "1.10.5",
"description": "Active record like ORM for nodejs",
"keywords": ["orm", "record", "sql", "sqlite3", "postgres", "pg", "mysql", "database", "activerecord", "promise", "rest", "restify", "nested set", "ldap", "activedirectory", "active directory", "ad"],
"author": "Philipp Waldmann <philipp.waldmann@s-team.at>",
Expand Down
4 changes: 2 additions & 2 deletions test/sql/postgres/attributes-test.js
Expand Up @@ -197,8 +197,8 @@ describe('Postgres: all Attributes', function(){
store.ready(function(){
var AttributeTest = store.Model('AttributeTest');

var obj = {a:'\\"', b:true, c: 40, d:null, e:'{=>\/?öä#+-,.,123\'"}', f:'C:\\files\\shares\\user.name', g:'H:', h:' \'', i:'\\\\', j:'"foo"=>"bar"', k:'null', foo:{bar:['phil', 'michl\\/', {a:1, b:true}]}};
var after = {a:'\\"', b:false, c: 40, d:null, e:'{=>\/?öä#+-,.,123\'"}', f:'C:\\files\\shares\\user.name', g:'H:', h:' \'', i:'\\\\', j:'"foo"=>"bar"', k:'null', foo:{bar:['phil', 'michl\\/', {a:1, b:true}, 'foo']}};
var obj = {a:'\\"', b:true, c: 40, d:null, e:'{=>\/?öä#+-,.,123\'"}', f:'C:\\files\\shares\\user.name', g:'H:', h:' \'', i:'\\\\', j:'"foo"=>"bar"', k:'null', l:[1, 2, 3, 4], foo:{bar:['phil', 'michl\\/', {a:1, b:true}]}};
var after = {a:'\\"', b:false, c: 40, d:null, e:'{=>\/?öä#+-,.,123\'"}', f:'C:\\files\\shares\\user.name', g:'H:', h:' \'', i:'\\\\', j:'"foo"=>"bar"', k:'null', l:[1, 2, 3, 4], foo:{bar:['phil', 'michl\\/', {a:1, b:true}, 'foo']}};

AttributeTest.create({
hstore_attribute: obj
Expand Down

0 comments on commit 1af1744

Please sign in to comment.