Skip to content

Commit

Permalink
Fixed bug with .valueOf issue #142
Browse files Browse the repository at this point in the history
  • Loading branch information
agershun committed Apr 22, 2015
1 parent f347c7f commit d0c6127
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 59 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
* Fixed MIN and MAX functions and aggregators #93
* Found UPDATE bug with column/columnid

* Todo: INFORMATION_SCHEMA PSEUDO DATABASE
* columns
* Fonts
* Vertices

### 0.0.49 "Beijing" (19.04.2015 - 21.04.2015)
* CREATE CLASS
* INSERT INTO class
Expand Down
28 changes: 14 additions & 14 deletions alasql.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions console/alasql.min.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions dist/alasql.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions dist/alasql.min.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@
"example": "examples",
"test": "test"
},
"devDependencies": {},
"devDependencies": {
"dom-storage":"2.0.1",
"gulp":"3.8.11",
"gulp-changed":"1.2.1",
"gulp-concat-sourcemap":"1.3.1",
"gulp-shell":"0.4.1",
"jison":"0.4.15",
"lodash":"3.7.0",
"xlsjs":"0.7.15",
"xlsx":"0.8.0"
},
"engines": [
"node"
],
Expand Down
8 changes: 4 additions & 4 deletions src/426orderby.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ yy.Select.prototype.compileOrder = function (query) {
// COLLATE NOCASE
if(ord.nocase) dg += '.toUpperCase()';

s += 'if(a[\''+columnid+"']"+dg+(ord.direction == 'ASC'?'>':'<')+'b[\''+columnid+"']"+dg+')return 1;';
s += 'if(a[\''+columnid+"']"+dg+'==b[\''+columnid+"']"+dg+'){';
s += 'if((a[\''+columnid+"']||'')"+dg+(ord.direction == 'ASC'?'>':'<')+'(b[\''+columnid+"']||'')"+dg+')return 1;';
s += 'if((a[\''+columnid+"']||'')"+dg+'==(b[\''+columnid+"']||'')"+dg+'){';

} else {
dg = '.valueOf()';
// COLLATE NOCASE
if(ord.nocase) dg += '.toUpperCase()';
s += 'if('+ord.toJavaScript('a','')+dg+(ord.direction == 'ASC'?'>':'<')+ord.toJavaScript('b','')+dg+')return 1;';
s += 'if('+ord.toJavaScript('a','')+dg+'=='+ord.toJavaScript('b','')+dg+'){';
s += 'if(('+ord.toJavaScript('a','')+"||'')"+dg+(ord.direction == 'ASC'?'>(':'<(')+ord.toJavaScript('b','')+"||'')"+dg+')return 1;';
s += 'if(('+ord.toJavaScript('a','')+"||'')"+dg+'==('+ord.toJavaScript('b','')+"||'')"+dg+'){';
}

// if(columnid == '_') {
Expand Down
4 changes: 3 additions & 1 deletion src/alasqlparser.jison
Original file line number Diff line number Diff line change
Expand Up @@ -2271,7 +2271,9 @@ CreateVertex
{ $$ = new yy.CreateVertex({class:$3}); yy.extend($$,$4); }
;
CreateVertexSet
: SET SetColumnsList
:
{$$ = undefined; }
| SET SetColumnsList
{ $$ = {sets:$2}; }
| CONTENT ExprList
{ $$ = {content:$2}; }
Expand Down
20 changes: 10 additions & 10 deletions src/alasqlparser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/test264.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(typeof exports === 'object') {

if(typeof exports == 'object') {

describe('Test 264 SPRINTF() function', function() {
describe('Test 264 SELECT RECORDSET', function() {

it('1. Test', function(done) {
var data = [{a:1,b:10},{b:2,a:45}];
Expand Down
34 changes: 34 additions & 0 deletions test/test265.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test/test301.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ describe('Test 301 Vertices and Edges', function() {
var res = alasql('CREATE VERTEX Person SET name = "Olga",age=56,sex="F"');
var res = alasql('CREATE VERTEX Person CONTENT {name:"Mike",age:45,sex:"M"},{name:"Paola",age:21,sex:"F"}');
var res = alasql('CREATE VERTEX Person SELECT * FROM ?');
var res = alasql('CREATE VERTEX Person');
var res = alasql('CREATE VERTEX');
var res = alasql('SET @v1 = (CREATE VERTEX)');
var res = alasql('SET @v2 = (CREATE VERTEX)');
var res = alasql('SET @e12 = (CREATE EDGE FROM @v1 TO @v2)');
var res = alasql('SET @e12#name = "Lisa"');
var res = alasql('SET @e12#age = 43');
done();
});

Expand Down

0 comments on commit d0c6127

Please sign in to comment.