Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

altered create table grammar

  • Loading branch information...
commit 84a2384044de01d34bfc15b4b68525005da975fc 1 parent 8b2cd1a
Chris Dew authored
2  grammar.pegjs
@@ -5,7 +5,7 @@ start
5 5
   / "subscribe" el:ExprList fc:FromClause?
6 6
     { return {subscribe:{exprs:el,from:fc}}; }
7 7
   / "create" _ "table" _ TableName _? "(" _? lines:CreateLines _? ")" 
8  
-    { return {createTable:lines}; }
  8
+    { return {createTable:{fields:lines}}; }
9 9
   / "use" _ DatabaseName
10 10
   / "create" _ DatabaseName
11 11
   / "insert into" _ tn:TableName _? "(" _? fields:FieldList _? ")" _? "values" _? "(" _? values:ValueList ")"
2  test/parser-test.js
@@ -8,7 +8,7 @@ describe('grammar', function() {
8 8
     assert.deepEqual({"select":{"exprs":["id","foo"],"from":["bar"]}}, parser.parse('select id, foo from bar'));
9 9
   });
10 10
   it('create table bar (id integer primary key auto_increment, foo varchar)', function() {
11  
-    assert.deepEqual({"createTable":[{"field":"id","type":"integer","pk":true,"ai":true},{"field":"foo","type":"varchar"}]},
  11
+    assert.deepEqual({"createTable":{fields:[{"field":"id","type":"integer","pk":true,"ai":true},{"field":"foo","type":"varchar"}]}},
12 12
                      parser.parse('create table bar (id integer primary key auto_increment, foo varchar)'));
13 13
   });
14 14
   it('insert into bar (id, foo) values (1, "hello")', function() {

0 notes on commit 84a2384

Please sign in to comment.
Something went wrong with that request. Please try again.