Skip to content

Commit

Permalink
Minor changes from # to !
Browse files Browse the repository at this point in the history
  • Loading branch information
agershun committed May 5, 2015
1 parent c476c8c commit 8fb9dbd
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 54 deletions.
31 changes: 17 additions & 14 deletions alasql.js
Original file line number Diff line number Diff line change
Expand Up @@ -4301,20 +4301,23 @@ yy.Search.prototype.execute = function (databaseid, params, cb) {
var search = {};
var stope = {};

if(this.selectors[0].srchid == 'PROP') {
if(typeof this.selectors != 'undefined' && this.selectors.length > 0) {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
if(this.selectors[0].srchid == 'PROP') {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
}
}
}

};
if(this.from instanceof yy.Column) {
var fromdata = alasql.databases[databaseid].tables[this.from.columnid].data;
this.selectors.unshift({srchid:'CHILD'});
Expand Down Expand Up @@ -7976,7 +7979,7 @@ yy.Op.prototype.toString = function() {
if(this.allsome) {
return this.left.toString()+" "+P(this.op)+" "+this.allsome+' ('+this.right.toString()+')';
}
if(this.op == '->' || this.op == '#') {
if(this.op == '->' || this.op == '!') {
var s = this.left.toString()+this.op;
// console.log(this.right);
if(typeof this.right != 'string' && typeof this.right != 'number' ) s += '(';
Expand Down Expand Up @@ -8038,7 +8041,7 @@ yy.Op.prototype.toJavaScript = function(context,tableid,defcols) {
}
};

if(this.op == '#') {
if(this.op == '!') {
if(typeof this.right == "string") {
return 'alasql.databases[alasql.useid].objects['+this.left.toJavaScript(context,tableid, defcols)+']["'+this.right+'"]';
}
Expand Down
6 changes: 3 additions & 3 deletions console/alasql.min.js

Large diffs are not rendered by default.

31 changes: 17 additions & 14 deletions dist/alasql.js
Original file line number Diff line number Diff line change
Expand Up @@ -4301,20 +4301,23 @@ yy.Search.prototype.execute = function (databaseid, params, cb) {
var search = {};
var stope = {};

if(this.selectors[0].srchid == 'PROP') {
if(typeof this.selectors != 'undefined' && this.selectors.length > 0) {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
if(this.selectors[0].srchid == 'PROP') {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
}
}
}

};
if(this.from instanceof yy.Column) {
var fromdata = alasql.databases[databaseid].tables[this.from.columnid].data;
this.selectors.unshift({srchid:'CHILD'});
Expand Down Expand Up @@ -7976,7 +7979,7 @@ yy.Op.prototype.toString = function() {
if(this.allsome) {
return this.left.toString()+" "+P(this.op)+" "+this.allsome+' ('+this.right.toString()+')';
}
if(this.op == '->' || this.op == '#') {
if(this.op == '->' || this.op == '!') {
var s = this.left.toString()+this.op;
// console.log(this.right);
if(typeof this.right != 'string' && typeof this.right != 'number' ) s += '(';
Expand Down Expand Up @@ -8038,7 +8041,7 @@ yy.Op.prototype.toJavaScript = function(context,tableid,defcols) {
}
};

if(this.op == '#') {
if(this.op == '!') {
if(typeof this.right == "string") {
return 'alasql.databases[alasql.useid].objects['+this.left.toJavaScript(context,tableid, defcols)+']["'+this.right+'"]';
}
Expand Down
2 changes: 1 addition & 1 deletion dist/alasql.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/alasql.min.js

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions src/35search.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ yy.Search.prototype.execute = function (databaseid, params, cb) {
var search = {};
var stope = {};

if(this.selectors[0].srchid == 'PROP') {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
}
}
if(typeof this.selectors != 'undefined' && this.selectors.length > 0) {

if(this.selectors[0].srchid == 'PROP') {

if(this.selectors[0].args[0].toUpperCase() == 'XML') {
stope.mode = 'XML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'HTML') {
stope.mode = 'HTML';
this.selectors.shift();
} else if(this.selectors[0].args[0].toUpperCase() == 'JSON') {
stope.mode = 'JSON';
this.selectors.shift();
}
}
};

if(this.from instanceof yy.Column) {
var fromdata = alasql.databases[databaseid].tables[this.from.columnid].data;
this.selectors.unshift({srchid:'CHILD'});
Expand Down
4 changes: 2 additions & 2 deletions src/50expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ yy.Op.prototype.toString = function() {
if(this.allsome) {
return this.left.toString()+" "+P(this.op)+" "+this.allsome+' ('+this.right.toString()+')';
}
if(this.op == '->' || this.op == '#') {
if(this.op == '->' || this.op == '!') {
var s = this.left.toString()+this.op;
// console.log(this.right);
if(typeof this.right != 'string' && typeof this.right != 'number' ) s += '(';
Expand Down Expand Up @@ -174,7 +174,7 @@ yy.Op.prototype.toJavaScript = function(context,tableid,defcols) {
}
};

if(this.op == '#') {
if(this.op == '!') {
if(typeof this.right == "string") {
return 'alasql.databases[alasql.useid].objects['+this.left.toJavaScript(context,tableid, defcols)+']["'+this.right+'"]';
}
Expand Down
4 changes: 2 additions & 2 deletions test/test301.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ describe('Test 301 Vertices and Edges', function() {
it('4. +() and *() and NOT()',function(done){
alasql('SET @heather = (CREATE VERTEX "Heather")');
alasql('CREATE EDGE "loves" FROM @steven TO @heather');
var res = alasql('SEARCH VERTEX !(>) name');
var res = alasql('SEARCH VERTEX NOT(>) name');
assert.deepEqual(res,[ 'Helen', 'Heather' ]);

var res = alasql('SEARCH VERTEX !(>"loves">"Steven") name');
var res = alasql('SEARCH VERTEX NOT(>"loves">"Steven") name');
assert.deepEqual(res,[ 'Peter', 'Helen', 'Steven', 'Heather' ]);

var res = alasql('SEARCH VERTEX IF(>"loves">"Steven") name');
Expand Down
2 changes: 1 addition & 1 deletion test/test302.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Test 302 CREATE CLASS ', function() {
});

it('9. SEARCH AS', function(done) {
var res = alasql('search city as @c ! ?(name like "M%") ex({city:name,country:(@c!country!name)}) FROM Person');
var res = alasql('search city as @c ! ok(name like "M%") ex({city:name,country:(@c!country!name)}) FROM Person');
assert.deepEqual(res,[ { city: 'Milano', country: 'Italy' } ]);
done();
});
Expand Down
2 changes: 1 addition & 1 deletion test/test303.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Test 303 SEARCH over JSON', function() {
var res = alasql('SEARCH / OK(name = "John") age FROM @[{name:"John",age:25},{name:"Mary",age:18}]');
assert.deepEqual(res, [25]);

var res = alasql('SEARCH / ?(name = "Mary") age FROM @[{name:"John",age:25},{name:"Mary",age:18}]');
var res = alasql('SEARCH / ok(name = "Mary") age FROM @[{name:"John",age:25},{name:"Mary",age:18}]');
assert.deepEqual(res, [18]);

done();
Expand Down

0 comments on commit 8fb9dbd

Please sign in to comment.