Merge lp:~mmcm/akiban-sql-parser/dynamic-statements into lp:~akiban-technologies/akiban-sql-parser/trunk

Proposed by Mike McMahon
Status: Merged
Approved by: Jack Orenstein
Approved revision: 284
Merged at revision: 277
Proposed branch: lp:~mmcm/akiban-sql-parser/dynamic-statements
Merge into: lp:~akiban-technologies/akiban-sql-parser/trunk
Prerequisite: lp:~mmcm/akiban-sql-parser/current-schema
Diff against target: 1467 lines (+892/-126)
55 files modified
pom.xml (+1/-1)
src/main/java/com/akiban/sql/parser/CloseStatementNode.java (+70/-0)
src/main/java/com/akiban/sql/parser/DeallocateStatementNode.java (+70/-0)
src/main/java/com/akiban/sql/parser/DeclareStatementNode.java (+106/-0)
src/main/java/com/akiban/sql/parser/ExecSPSNode.java (+0/-98)
src/main/java/com/akiban/sql/parser/ExecuteStatementNode.java (+106/-0)
src/main/java/com/akiban/sql/parser/ExplainStatementNode.java (+1/-1)
src/main/java/com/akiban/sql/parser/FetchStatementNode.java (+80/-0)
src/main/java/com/akiban/sql/parser/NodeFactoryImpl.java (+19/-3)
src/main/java/com/akiban/sql/parser/NodeNames.java (+11/-1)
src/main/java/com/akiban/sql/parser/NodeTypes.java (+10/-2)
src/main/java/com/akiban/sql/parser/PrepareStatementNode.java (+106/-0)
src/main/java/com/akiban/sql/unparser/NodeToString.java (+46/-1)
src/main/javacc/SQLGrammar.jj (+104/-19)
src/test/resources/com/akiban/sql/parser/close-1.expected (+3/-0)
src/test/resources/com/akiban/sql/parser/close-1.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/deallocate-1.expected (+3/-0)
src/test/resources/com/akiban/sql/parser/deallocate-1.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/declare-1.expected (+32/-0)
src/test/resources/com/akiban/sql/parser/declare-1.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/declare-2.expected (+9/-0)
src/test/resources/com/akiban/sql/parser/declare-2.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/execute-1.expected (+5/-0)
src/test/resources/com/akiban/sql/parser/execute-1.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/execute-2.expected (+14/-0)
src/test/resources/com/akiban/sql/parser/execute-2.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/fetch-1.expected (+4/-0)
src/test/resources/com/akiban/sql/parser/fetch-1.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/fetch-2.expected (+4/-0)
src/test/resources/com/akiban/sql/parser/fetch-2.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/fetch-3.expected (+4/-0)
src/test/resources/com/akiban/sql/parser/fetch-3.sql (+1/-0)
src/test/resources/com/akiban/sql/parser/junk-1.error (+4/-0)
src/test/resources/com/akiban/sql/parser/prepare-1.expected (+50/-0)
src/test/resources/com/akiban/sql/parser/prepare-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/close-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/close-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/deallocate-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/deallocate-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/declare-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/declare-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/declare-2.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/declare-2.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/execute-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/execute-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/execute-2.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/execute-2.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-1.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-2.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-2.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-3.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/fetch-3.sql (+1/-0)
src/test/resources/com/akiban/sql/unparser/prepare-1.expected (+1/-0)
src/test/resources/com/akiban/sql/unparser/prepare-1.sql (+1/-0)
To merge this branch: bzr merge lp:~mmcm/akiban-sql-parser/dynamic-statements
Reviewer Review Type Date Requested Status
Jack Orenstein (community) Needs Information
Review via email: mp+140045@code.launchpad.net

Description of the change

Add new prepared statement and cursor statements.

These are compatible with a subset of Postgres.

DECLARE <name> CURSOR FOR <statement>
FETCH [NEXT | ALL | <count>] [FROM] <name>
CLOSE <name>

PREPARE <name> AS <statement>
EXECUTE <name>[(<param>,...)]
DEALLOCATE <name>

Although this is compatible with the current server, the version number is increased in anticipation of a server branch that will depend on it.

To post a comment you must log in.
Revision history for this message
Jack Orenstein (jack-akiban) wrote :

Why are PREPARE, EXECUTE and DEALLOCATE needed?

review: Needs Information
Revision history for this message
Mike McMahon (mmcm) wrote :

It's the whole family of statements corresponding to network protocol level capabilities. There was a request for DEALLOCATE, since some ORMs use it. The request was only to ignore it, but there seemed no real reason not to support it correctly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pom.xml'
2--- pom.xml 2012-11-30 15:38:33 +0000
3+++ pom.xml 2012-12-14 23:54:20 +0000
4@@ -4,7 +4,7 @@
5 <groupId>com.akiban</groupId>
6 <artifactId>akiban-sql-parser</artifactId>
7 <packaging>jar</packaging>
8- <version>1.0.12-SNAPSHOT</version>
9+ <version>1.0.13-SNAPSHOT</version>
10 <name>akiban-sql-parser</name>
11 <url>http://maven.apache.org</url>
12 <properties>
13
14=== added file 'src/main/java/com/akiban/sql/parser/CloseStatementNode.java'
15--- src/main/java/com/akiban/sql/parser/CloseStatementNode.java 1970-01-01 00:00:00 +0000
16+++ src/main/java/com/akiban/sql/parser/CloseStatementNode.java 2012-12-14 23:54:20 +0000
17@@ -0,0 +1,70 @@
18+/**
19+ * Copyright © 2012 Akiban Technologies, Inc. All rights
20+ * reserved.
21+ *
22+ * This program and the accompanying materials are made available
23+ * under the terms of the Eclipse Public License v1.0 which
24+ * accompanies this distribution, and is available at
25+ * http://www.eclipse.org/legal/epl-v10.html
26+ *
27+ * This program may also be available under different license terms.
28+ * For more information, see www.akiban.com or contact
29+ * licensing@akiban.com.
30+ *
31+ * Contributors:
32+ * Akiban Technologies, Inc.
33+ */
34+
35+package com.akiban.sql.parser;
36+
37+import com.akiban.sql.StandardException;
38+
39+/**
40+ * CLOSE an open cursor.
41+ */
42+
43+public class CloseStatementNode extends StatementNode
44+{
45+ private String name;
46+
47+ /**
48+ * Initializer for an CloseStatementNode
49+ *
50+ * @param name The name of the cursor
51+ */
52+
53+ public void init(Object name) {
54+ this.name = (String)name;
55+ }
56+
57+ public String getName() {
58+ return name;
59+ }
60+
61+ /**
62+ * Fill this node with a deep copy of the given node.
63+ */
64+ public void copyFrom(QueryTreeNode node) throws StandardException {
65+ super.copyFrom(node);
66+
67+ CloseStatementNode other = (CloseStatementNode)node;
68+ this.name = other.name;
69+ }
70+
71+ /**
72+ * Convert this object to a String. See comments in QueryTreeNode.java
73+ * for how this should be done for tree printing.
74+ *
75+ * @return This object as a String
76+ */
77+
78+ public String toString() {
79+ return "name: " + name + "\n" +
80+ super.toString();
81+ }
82+
83+ public String statementToString() {
84+ return "CLOSE";
85+ }
86+
87+}
88
89=== added file 'src/main/java/com/akiban/sql/parser/DeallocateStatementNode.java'
90--- src/main/java/com/akiban/sql/parser/DeallocateStatementNode.java 1970-01-01 00:00:00 +0000
91+++ src/main/java/com/akiban/sql/parser/DeallocateStatementNode.java 2012-12-14 23:54:20 +0000
92@@ -0,0 +1,70 @@
93+/**
94+ * Copyright © 2012 Akiban Technologies, Inc. All rights
95+ * reserved.
96+ *
97+ * This program and the accompanying materials are made available
98+ * under the terms of the Eclipse Public License v1.0 which
99+ * accompanies this distribution, and is available at
100+ * http://www.eclipse.org/legal/epl-v10.html
101+ *
102+ * This program may also be available under different license terms.
103+ * For more information, see www.akiban.com or contact
104+ * licensing@akiban.com.
105+ *
106+ * Contributors:
107+ * Akiban Technologies, Inc.
108+ */
109+
110+package com.akiban.sql.parser;
111+
112+import com.akiban.sql.StandardException;
113+
114+/**
115+ * DEALLOCATE a prepared statement.
116+ */
117+
118+public class DeallocateStatementNode extends StatementNode
119+{
120+ private String name;
121+
122+ /**
123+ * Initializer for an DeallocateStatementNode
124+ *
125+ * @param name The name of the cursor
126+ */
127+
128+ public void init(Object name) {
129+ this.name = (String)name;
130+ }
131+
132+ public String getName() {
133+ return name;
134+ }
135+
136+ /**
137+ * Fill this node with a deep copy of the given node.
138+ */
139+ public void copyFrom(QueryTreeNode node) throws StandardException {
140+ super.copyFrom(node);
141+
142+ DeallocateStatementNode other = (DeallocateStatementNode)node;
143+ this.name = other.name;
144+ }
145+
146+ /**
147+ * Convert this object to a String. See comments in QueryTreeNode.java
148+ * for how this should be done for tree printing.
149+ *
150+ * @return This object as a String
151+ */
152+
153+ public String toString() {
154+ return "name: " + name + "\n" +
155+ super.toString();
156+ }
157+
158+ public String statementToString() {
159+ return "DEALLOCATE";
160+ }
161+
162+}
163
164=== added file 'src/main/java/com/akiban/sql/parser/DeclareStatementNode.java'
165--- src/main/java/com/akiban/sql/parser/DeclareStatementNode.java 1970-01-01 00:00:00 +0000
166+++ src/main/java/com/akiban/sql/parser/DeclareStatementNode.java 2012-12-14 23:54:20 +0000
167@@ -0,0 +1,106 @@
168+/**
169+ * Copyright © 2012 Akiban Technologies, Inc. All rights
170+ * reserved.
171+ *
172+ * This program and the accompanying materials are made available
173+ * under the terms of the Eclipse Public License v1.0 which
174+ * accompanies this distribution, and is available at
175+ * http://www.eclipse.org/legal/epl-v10.html
176+ *
177+ * This program may also be available under different license terms.
178+ * For more information, see www.akiban.com or contact
179+ * licensing@akiban.com.
180+ *
181+ * Contributors:
182+ * Akiban Technologies, Inc.
183+ */
184+
185+package com.akiban.sql.parser;
186+
187+import com.akiban.sql.StandardException;
188+
189+/**
190+ * DECLARE a CURSOR on some statement.
191+ */
192+
193+public class DeclareStatementNode extends StatementNode
194+{
195+ private String name;
196+ private StatementNode statement;
197+
198+ /**
199+ * Initializer for an DeclareStatementNode
200+ *
201+ * @param name The name of the statement
202+ * @param statement The statement to be executed
203+ */
204+
205+ public void init(Object name,
206+ Object statement) {
207+ this.name = (String)name;
208+ this.statement = (StatementNode)statement;
209+ }
210+
211+ public String getName() {
212+ return name;
213+ }
214+
215+ public StatementNode getStatement() {
216+ return statement;
217+ }
218+
219+ /**
220+ * Fill this node with a deep copy of the given node.
221+ */
222+ public void copyFrom(QueryTreeNode node) throws StandardException {
223+ super.copyFrom(node);
224+
225+ DeclareStatementNode other = (DeclareStatementNode)node;
226+ this.statement = (StatementNode)getNodeFactory().copyNode(other.statement,
227+ getParserContext());
228+ }
229+
230+ /**
231+ * Convert this object to a String. See comments in QueryTreeNode.java
232+ * for how this should be done for tree printing.
233+ *
234+ * @return This object as a String
235+ */
236+
237+ public String toString() {
238+ return "name: " + name + "\n" +
239+ super.toString();
240+ }
241+
242+ public String statementToString() {
243+ return "DECLARE";
244+ }
245+
246+ /**
247+ * Prints the sub-nodes of this object. See QueryTreeNode.java for
248+ * how tree printing is supposed to work.
249+ *
250+ * @param depth The depth of this node in the tree
251+ */
252+
253+ public void printSubNodes(int depth) {
254+ super.printSubNodes(depth);
255+
256+ printLabel(depth, "statement: ");
257+ statement.treePrint(depth + 1);
258+ }
259+
260+ /**
261+ * Accept the visitor for all visitable children of this node.
262+ *
263+ * @param v the visitor
264+ *
265+ * @exception StandardException on error
266+ */
267+ void acceptChildren(Visitor v) throws StandardException {
268+ super.acceptChildren(v);
269+
270+ statement = (StatementNode)statement.accept(v);
271+ }
272+
273+}
274
275=== removed file 'src/main/java/com/akiban/sql/parser/ExecSPSNode.java'
276--- src/main/java/com/akiban/sql/parser/ExecSPSNode.java 2012-11-07 17:49:31 +0000
277+++ src/main/java/com/akiban/sql/parser/ExecSPSNode.java 1970-01-01 00:00:00 +0000
278@@ -1,98 +0,0 @@
279-/**
280- * Copyright © 2012 Akiban Technologies, Inc. All rights
281- * reserved.
282- *
283- * This program and the accompanying materials are made available
284- * under the terms of the Eclipse Public License v1.0 which
285- * accompanies this distribution, and is available at
286- * http://www.eclipse.org/legal/epl-v10.html
287- *
288- * This program may also be available under different license terms.
289- * For more information, see www.akiban.com or contact
290- * licensing@akiban.com.
291- *
292- * Contributors:
293- * Akiban Technologies, Inc.
294- */
295-
296-/* The original from which this derives bore the following: */
297-
298-/*
299-
300- Derby - Class org.apache.derby.impl.sql.compile.ExecSPSNode
301-
302- Licensed to the Apache Software Foundation (ASF) under one or more
303- contributor license agreements. See the NOTICE file distributed with
304- this work for additional information regarding copyright ownership.
305- The ASF licenses this file to you under the Apache License, Version 2.0
306- (the "License"); you may not use this file except in compliance with
307- the License. You may obtain a copy of the License at
308-
309- http://www.apache.org/licenses/LICENSE-2.0
310-
311- Unless required by applicable law or agreed to in writing, software
312- distributed under the License is distributed on an "AS IS" BASIS,
313- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314- See the License for the specific language governing permissions and
315- limitations under the License.
316-
317- */
318-
319-package com.akiban.sql.parser;
320-
321-import com.akiban.sql.StandardException;
322-
323-/**
324- * A ExecSPSNode is the root of a QueryTree
325- * that represents an EXECUTE STATEMENT
326- * statement. It is a tad abnormal. Duringa
327- * bind, it locates and retrieves the SPSDescriptor
328- * for the particular statement. At generate time,
329- * it generates the prepared statement for the
330- * stored prepared statement and returns it (i.e.
331- * it effectively replaces itself with the appropriate
332- * prepared statement).
333- *
334- */
335-
336-public class ExecSPSNode extends StatementNode
337-{
338- private TableName name;
339-
340- /**
341- * Initializer for a ExecSPSNode
342- *
343- * @param newObjectName The name of the table to be created
344- *
345- */
346-
347- public void init(Object newObjectName) {
348- this.name = (TableName)newObjectName;
349- }
350-
351- /**
352- * Fill this node with a deep copy of the given node.
353- */
354- public void copyFrom(QueryTreeNode node) throws StandardException {
355- super.copyFrom(node);
356-
357- ExecSPSNode other = (ExecSPSNode)node;
358- this.name = (TableName)getNodeFactory().copyNode(other.name,
359- getParserContext());
360- }
361-
362- /** @see StatementNode#executeStatementName */
363- public String executeStatementName() {
364- return name.getTableName();
365- }
366-
367- /** @see StatementNode#executeSchemaName */
368- public String executeSchemaName() {
369- return name.getSchemaName();
370- }
371-
372- public String statementToString() {
373- return "EXECUTE STATEMENT";
374- }
375-
376-}
377
378=== added file 'src/main/java/com/akiban/sql/parser/ExecuteStatementNode.java'
379--- src/main/java/com/akiban/sql/parser/ExecuteStatementNode.java 1970-01-01 00:00:00 +0000
380+++ src/main/java/com/akiban/sql/parser/ExecuteStatementNode.java 2012-12-14 23:54:20 +0000
381@@ -0,0 +1,106 @@
382+/**
383+ * Copyright © 2012 Akiban Technologies, Inc. All rights
384+ * reserved.
385+ *
386+ * This program and the accompanying materials are made available
387+ * under the terms of the Eclipse Public License v1.0 which
388+ * accompanies this distribution, and is available at
389+ * http://www.eclipse.org/legal/epl-v10.html
390+ *
391+ * This program may also be available under different license terms.
392+ * For more information, see www.akiban.com or contact
393+ * licensing@akiban.com.
394+ *
395+ * Contributors:
396+ * Akiban Technologies, Inc.
397+ */
398+
399+package com.akiban.sql.parser;
400+
401+import com.akiban.sql.StandardException;
402+
403+/**
404+ * EXECUTE a previously prepare statement.
405+ */
406+
407+public class ExecuteStatementNode extends StatementNode
408+{
409+ private String name;
410+ private ValueNodeList parameterList;
411+
412+ /**
413+ * Initializer for an ExecuteStatementNode
414+ *
415+ * @param name The name of the prepared statement.
416+ * @param parameterList Any parameter values to be bound.
417+ */
418+
419+ public void init(Object name,
420+ Object parameterList) {
421+ this.name = (String)name;
422+ this.parameterList = (ValueNodeList)parameterList;
423+ }
424+
425+ public String getName() {
426+ return name;
427+ }
428+
429+ public ValueNodeList getParameterList() {
430+ return parameterList;
431+ }
432+
433+ /**
434+ * Fill this node with a deep copy of the given node.
435+ */
436+ public void copyFrom(QueryTreeNode node) throws StandardException {
437+ super.copyFrom(node);
438+
439+ ExecuteStatementNode other = (ExecuteStatementNode)node;
440+ this.name = other.name;
441+ this.parameterList = (ValueNodeList)
442+ getNodeFactory().copyNode(other.parameterList, getParserContext());
443+ }
444+
445+ /**
446+ * Convert this object to a String. See comments in QueryTreeNode.java
447+ * for how this should be done for tree printing.
448+ *
449+ * @return This object as a String
450+ */
451+
452+ public String toString() {
453+ return "name: " + name + "\n" +
454+ super.toString();
455+ }
456+
457+ public String statementToString() {
458+ return "EXECUTE";
459+ }
460+
461+ /**
462+ * Prints the sub-nodes of this object. See QueryTreeNode.java for
463+ * how tree printing is supposed to work.
464+ *
465+ * @param depth The depth of this node in the tree
466+ */
467+
468+ public void printSubNodes(int depth) {
469+ super.printSubNodes(depth);
470+
471+ printLabel(depth, "parameterList: ");
472+ parameterList.treePrint(depth + 1);
473+ }
474+
475+ /**
476+ * Accept the visitor for all visitable children of this node.
477+ *
478+ * @param v the visitor
479+ * @throws StandardException on error in the visitor
480+ */
481+ void acceptChildren(Visitor v) throws StandardException {
482+ super.acceptChildren(v);
483+
484+ parameterList = (ValueNodeList)parameterList.accept(v);
485+ }
486+
487+}
488
489=== modified file 'src/main/java/com/akiban/sql/parser/ExplainStatementNode.java'
490--- src/main/java/com/akiban/sql/parser/ExplainStatementNode.java 2012-11-07 17:49:31 +0000
491+++ src/main/java/com/akiban/sql/parser/ExplainStatementNode.java 2012-12-14 23:54:20 +0000
492@@ -31,7 +31,7 @@
493 /**
494 * Initializer for an ExplainStatementNode
495 *
496- * @param statemen The statement to be explained.
497+ * @param statement The statement to be explained.
498 */
499
500 public void init(Object statement) {
501
502=== added file 'src/main/java/com/akiban/sql/parser/FetchStatementNode.java'
503--- src/main/java/com/akiban/sql/parser/FetchStatementNode.java 1970-01-01 00:00:00 +0000
504+++ src/main/java/com/akiban/sql/parser/FetchStatementNode.java 2012-12-14 23:54:20 +0000
505@@ -0,0 +1,80 @@
506+/**
507+ * Copyright © 2012 Akiban Technologies, Inc. All rights
508+ * reserved.
509+ *
510+ * This program and the accompanying materials are made available
511+ * under the terms of the Eclipse Public License v1.0 which
512+ * accompanies this distribution, and is available at
513+ * http://www.eclipse.org/legal/epl-v10.html
514+ *
515+ * This program may also be available under different license terms.
516+ * For more information, see www.akiban.com or contact
517+ * licensing@akiban.com.
518+ *
519+ * Contributors:
520+ * Akiban Technologies, Inc.
521+ */
522+
523+package com.akiban.sql.parser;
524+
525+import com.akiban.sql.StandardException;
526+
527+/**
528+ * FETCH rows from declared cursor.
529+ */
530+
531+public class FetchStatementNode extends StatementNode
532+{
533+ private String name;
534+ private int count;
535+
536+ /**
537+ * Initializer for an FetchStatementNode
538+ *
539+ * @param name The name of the cursor
540+ * @param count The number of rows to fetch
541+ */
542+
543+ public void init(Object name,
544+ Object count) {
545+ this.name = (String)name;
546+ this.count = (Integer)count;
547+ }
548+
549+ public String getName() {
550+ return name;
551+ }
552+
553+ public int getCount() {
554+ return count;
555+ }
556+
557+ /**
558+ * Fill this node with a deep copy of the given node.
559+ */
560+ public void copyFrom(QueryTreeNode node) throws StandardException {
561+ super.copyFrom(node);
562+
563+ FetchStatementNode other = (FetchStatementNode)node;
564+ this.name = other.name;
565+ this.count = other.count;
566+ }
567+
568+ /**
569+ * Convert this object to a String. See comments in QueryTreeNode.java
570+ * for how this should be done for tree printing.
571+ *
572+ * @return This object as a String
573+ */
574+
575+ public String toString() {
576+ return "name: " + name + "\n" +
577+ "count: " + ((count < 0) ? "ALL" : Integer.toString(count)) + "\n" +
578+ super.toString();
579+ }
580+
581+ public String statementToString() {
582+ return "FETCH";
583+ }
584+
585+}
586
587=== modified file 'src/main/java/com/akiban/sql/parser/NodeFactoryImpl.java'
588--- src/main/java/com/akiban/sql/parser/NodeFactoryImpl.java 2012-11-07 17:49:31 +0000
589+++ src/main/java/com/akiban/sql/parser/NodeFactoryImpl.java 2012-12-14 23:54:20 +0000
590@@ -403,9 +403,6 @@
591 case NodeTypes.COLUMN_DEFINITION_NODE:
592 return NodeNames.COLUMN_DEFINITION_NODE_NAME;
593
594- case NodeTypes.EXEC_SPS_NODE:
595- return NodeNames.EXEC_SPS_NODE_NAME;
596-
597 case NodeTypes.FK_CONSTRAINT_DEFINITION_NODE:
598 return NodeNames.FK_CONSTRAINT_DEFINITION_NODE_NAME;
599
600@@ -629,6 +626,25 @@
601
602 case NodeTypes.AT_RENAME_NODE:
603 return NodeNames.AT_RENAME_NODE_NAME;
604+
605+ case NodeTypes.DECLARE_STATEMENT_NODE:
606+ return NodeNames.DECLARE_STATEMENT_NODE_NAME;
607+
608+ case NodeTypes.FETCH_STATEMENT_NODE:
609+ return NodeNames.FETCH_STATEMENT_NODE_NAME;
610+
611+ case NodeTypes.CLOSE_STATEMENT_NODE:
612+ return NodeNames.CLOSE_STATEMENT_NODE_NAME;
613+
614+ case NodeTypes.PREPARE_STATEMENT_NODE:
615+ return NodeNames.PREPARE_STATEMENT_NODE_NAME;
616+
617+ case NodeTypes.EXECUTE_STATEMENT_NODE:
618+ return NodeNames.EXECUTE_STATEMENT_NODE_NAME;
619+
620+ case NodeTypes.DEALLOCATE_STATEMENT_NODE:
621+ return NodeNames.DEALLOCATE_STATEMENT_NODE_NAME;
622+
623 default:
624 throw new StandardException("Not implemented");
625 }
626
627=== modified file 'src/main/java/com/akiban/sql/parser/NodeNames.java'
628--- src/main/java/com/akiban/sql/parser/NodeNames.java 2012-11-07 17:49:31 +0000
629+++ src/main/java/com/akiban/sql/parser/NodeNames.java 2012-12-14 23:54:20 +0000
630@@ -104,6 +104,8 @@
631
632 static final String CHAR_CONSTANT_NODE_NAME = "com.akiban.sql.parser.CharConstantNode";
633
634+ static final String CLOSE_STATEMENT_NODE_NAME = "com.akiban.sql.parser.CloseStatementNode";
635+
636 static final String COALESCE_FUNCTION_NODE_NAME = "com.akiban.sql.parser.CoalesceFunctionNode";
637
638 static final String COLUMN_DEFINITION_NODE_NAME = "com.akiban.sql.parser.ColumnDefinitionNode";
639@@ -142,6 +144,10 @@
640
641 static final String OCTET_LENGTH_OPERATOR_NODE_NAME = "com.akiban.sql.parser.OctetLengthOperatorNode";
642
643+ static final String DEALLOCATE_STATEMENT_NODE_NAME = "com.akiban.sql.parser.DeallocateStatementNode";
644+
645+ static final String DECLARE_STATEMENT_NODE_NAME = "com.akiban.sql.parser.DeclareStatementNode";
646+
647 static final String DEFAULT_NODE_NAME = "com.akiban.sql.parser.DefaultNode";
648
649 static final String DELETE_NODE_NAME = "com.akiban.sql.parser.DeleteNode";
650@@ -168,7 +174,7 @@
651
652 static final String DROP_VIEW_NODE_NAME = "com.akiban.sql.parser.DropViewNode";
653
654- static final String EXEC_SPS_NODE_NAME = "com.akiban.sql.parser.ExecSPSNode";
655+ static final String EXECUTE_STATEMENT_NODE_NAME = "com.akiban.sql.parser.ExecuteStatementNode";
656
657 static final String EXPLAIN_STATEMENT_NODE_NAME = "com.akiban.sql.parser.ExplainStatementNode";
658
659@@ -176,6 +182,8 @@
660
661 static final String EXTRACT_OPERATOR_NODE_NAME = "com.akiban.sql.parser.ExtractOperatorNode";
662
663+ static final String FETCH_STATEMENT_NODE_NAME = "com.akiban.sql.parser.FetchStatementNode";
664+
665 static final String FK_CONSTRAINT_DEFINITION_NODE_NAME = "com.akiban.sql.parser.FKConstraintDefinitionNode";
666
667 static final String FROM_BASE_TABLE_NAME = "com.akiban.sql.parser.FromBaseTable";
668@@ -270,6 +278,8 @@
669
670 static final String PREDICATE_NAME = "com.akiban.sql.parser.Predicate";
671
672+ static final String PREPARE_STATEMENT_NODE_NAME = "com.akiban.sql.parser.PrepareStatementNode";
673+
674 static final String PRIVILEGE_NAME = "com.akiban.sql.parser.PrivilegeNode";
675
676 static final String PROJECT_RESTRICT_NODE_NAME = "com.akiban.sql.parser.ProjectRestrictNode";
677
678=== modified file 'src/main/java/com/akiban/sql/parser/NodeTypes.java'
679--- src/main/java/com/akiban/sql/parser/NodeTypes.java 2012-11-07 17:49:31 +0000
680+++ src/main/java/com/akiban/sql/parser/NodeTypes.java 2012-12-14 23:54:20 +0000
681@@ -166,7 +166,7 @@
682 public static final int AGGREGATE_NODE = 115;
683 public static final int COLUMN_DEFINITION_NODE = 116;
684 public static final int EXPLAIN_STATEMENT_NODE = 117;
685- public static final int EXEC_SPS_NODE = 118;
686+ // 118 available
687 public static final int FK_CONSTRAINT_DEFINITION_NODE = 119;
688 public static final int FROM_VTI = 120;
689 public static final int MATERIALIZE_RESULT_SET_NODE = 121;
690@@ -277,8 +277,16 @@
691 public static final int WINDOW_REFERENCE_NODE = 229;
692 public static final int WINDOW_RESULTSET_NODE = 230;
693
694+ // Cursors
695+ public static final int DECLARE_STATEMENT_NODE = 233;
696+ public static final int FETCH_STATEMENT_NODE = 234;
697+ public static final int CLOSE_STATEMENT_NODE = 235;
698+ public static final int PREPARE_STATEMENT_NODE = 236;
699+ public static final int EXECUTE_STATEMENT_NODE = 237;
700+ public static final int DEALLOCATE_STATEMENT_NODE = 238;
701+
702 // Final value in set, keep up to date!
703- public static final int FINAL_VALUE = CURRENT_SEQUENCE_NODE;
704+ public static final int FINAL_VALUE = DEALLOCATE_STATEMENT_NODE;
705
706 /**
707 * Extensions to this interface can use nodetypes > MAX_NODE_TYPE with out fear of collision
708
709=== added file 'src/main/java/com/akiban/sql/parser/PrepareStatementNode.java'
710--- src/main/java/com/akiban/sql/parser/PrepareStatementNode.java 1970-01-01 00:00:00 +0000
711+++ src/main/java/com/akiban/sql/parser/PrepareStatementNode.java 2012-12-14 23:54:20 +0000
712@@ -0,0 +1,106 @@
713+/**
714+ * Copyright © 2012 Akiban Technologies, Inc. All rights
715+ * reserved.
716+ *
717+ * This program and the accompanying materials are made available
718+ * under the terms of the Eclipse Public License v1.0 which
719+ * accompanies this distribution, and is available at
720+ * http://www.eclipse.org/legal/epl-v10.html
721+ *
722+ * This program may also be available under different license terms.
723+ * For more information, see www.akiban.com or contact
724+ * licensing@akiban.com.
725+ *
726+ * Contributors:
727+ * Akiban Technologies, Inc.
728+ */
729+
730+package com.akiban.sql.parser;
731+
732+import com.akiban.sql.StandardException;
733+
734+/**
735+ * PREPARE a statement for later execution.
736+ */
737+
738+public class PrepareStatementNode extends StatementNode
739+{
740+ private String name;
741+ private StatementNode statement;
742+
743+ /**
744+ * Initializer for an PrepareStatementNode
745+ *
746+ * @param name The name of the statement
747+ * @param statement The statement to be executed
748+ */
749+
750+ public void init(Object name,
751+ Object statement) {
752+ this.name = (String)name;
753+ this.statement = (StatementNode)statement;
754+ }
755+
756+ public String getName() {
757+ return name;
758+ }
759+
760+ public StatementNode getStatement() {
761+ return statement;
762+ }
763+
764+ /**
765+ * Fill this node with a deep copy of the given node.
766+ */
767+ public void copyFrom(QueryTreeNode node) throws StandardException {
768+ super.copyFrom(node);
769+
770+ PrepareStatementNode other = (PrepareStatementNode)node;
771+ this.statement = (StatementNode)getNodeFactory().copyNode(other.statement,
772+ getParserContext());
773+ }
774+
775+ /**
776+ * Convert this object to a String. See comments in QueryTreeNode.java
777+ * for how this should be done for tree printing.
778+ *
779+ * @return This object as a String
780+ */
781+
782+ public String toString() {
783+ return "name: " + name + "\n" +
784+ super.toString();
785+ }
786+
787+ public String statementToString() {
788+ return "PREPARE";
789+ }
790+
791+ /**
792+ * Prints the sub-nodes of this object. See QueryTreeNode.java for
793+ * how tree printing is supposed to work.
794+ *
795+ * @param depth The depth of this node in the tree
796+ */
797+
798+ public void printSubNodes(int depth) {
799+ super.printSubNodes(depth);
800+
801+ printLabel(depth, "statement: ");
802+ statement.treePrint(depth + 1);
803+ }
804+
805+ /**
806+ * Accept the visitor for all visitable children of this node.
807+ *
808+ * @param v the visitor
809+ *
810+ * @exception StandardException on error
811+ */
812+ void acceptChildren(Visitor v) throws StandardException {
813+ super.acceptChildren(v);
814+
815+ statement = (StatementNode)statement.accept(v);
816+ }
817+
818+}
819
820=== modified file 'src/main/java/com/akiban/sql/unparser/NodeToString.java'
821--- src/main/java/com/akiban/sql/unparser/NodeToString.java 2012-11-07 17:49:31 +0000
822+++ src/main/java/com/akiban/sql/unparser/NodeToString.java 2012-12-14 23:54:20 +0000
823@@ -211,6 +211,18 @@
824 return callStatementNode((CallStatementNode)node);
825 case NodeTypes.INDEX_CONSTRAINT_NODE:
826 return indexConstraint((IndexConstraintDefinitionNode)node);
827+ case NodeTypes.DECLARE_STATEMENT_NODE:
828+ return declareStatementNode((DeclareStatementNode)node);
829+ case NodeTypes.FETCH_STATEMENT_NODE:
830+ return fetchStatementNode((FetchStatementNode)node);
831+ case NodeTypes.CLOSE_STATEMENT_NODE:
832+ return closeStatementNode((CloseStatementNode)node);
833+ case NodeTypes.PREPARE_STATEMENT_NODE:
834+ return prepareStatementNode((PrepareStatementNode)node);
835+ case NodeTypes.EXECUTE_STATEMENT_NODE:
836+ return executeStatementNode((ExecuteStatementNode)node);
837+ case NodeTypes.DEALLOCATE_STATEMENT_NODE:
838+ return deallocateStatementNode((DeallocateStatementNode)node);
839 default:
840 return "**UNKNOWN(" + node.getNodeType() +")**";
841 }
842@@ -1014,8 +1026,41 @@
843 return bd.substring(0, bd.length() -2); // delete the last (<COMMA> <SPACE>)
844 }
845
846+ protected String declareStatementNode(DeclareStatementNode node)
847+ throws StandardException {
848+ return "DECLARE " + node.getName() + " CURSOR FOR " +
849+ toString(node.getStatement());
850+ }
851+
852+ protected String fetchStatementNode(FetchStatementNode node)
853+ throws StandardException {
854+ return "FETCH " +
855+ ((node.getCount() < 0) ? "ALL" : Integer.toString(node.getCount())) +
856+ " FROM " + node.getName();
857+ }
858+
859+ protected String closeStatementNode(CloseStatementNode node)
860+ throws StandardException {
861+ return "CLOSE " + node.getName();
862+ }
863+
864+ protected String prepareStatementNode(PrepareStatementNode node)
865+ throws StandardException {
866+ return "PREPARE " + node.getName() + " AS " +
867+ toString(node.getStatement());
868+ }
869+
870+ protected String executeStatementNode(ExecuteStatementNode node)
871+ throws StandardException {
872+ return "EXECUTE " + node.getName() +
873+ "(" + nodeList(node.getParameterList(), true) + ")";
874+ }
875+
876+ protected String deallocateStatementNode(DeallocateStatementNode node)
877+ throws StandardException {
878+ return "DEALLOCATE " + node.getName();
879+ }
880
881-
882 protected void doPrint(QueryTreeNode node, StringBuilder bd) throws StandardException
883 {
884 if (node instanceof RowConstructorNode)
885
886=== modified file 'src/main/javacc/SQLGrammar.jj'
887--- src/main/javacc/SQLGrammar.jj 2012-12-14 23:54:20 +0000
888+++ src/main/javacc/SQLGrammar.jj 2012-12-14 23:54:20 +0000
889@@ -2983,10 +2983,12 @@
890 |
891 statementNode = spsAlterStatement()
892 |
893- statementNode = globalTemporaryTableDeclaration()
894-|
895 statementNode = preparableSQLDataStatement()
896 |
897+ statementNode = cursorStatement()
898+|
899+ statementNode = executeStatement()
900+|
901 statementNode = spsSetStatement()
902 |
903 statementNode = truncateStatement()
904@@ -2995,8 +2997,6 @@
905 |
906 statementNode = revokeStatement()
907 |
908- statementNode = execStatement()
909-|
910 statementNode = explainStatement()
911 |
912 statementNode = transactionControlStatement()
913@@ -11917,20 +11917,6 @@
914 }
915 }
916
917-StatementNode
918-execStatement() throws StandardException :
919-{
920- TableName stmtName;
921-}
922-{
923- <EXECUTE> <STATEMENT> stmtName = qualifiedName()
924- {
925- return (StatementNode)nodeFactory.getNode(NodeTypes.EXEC_SPS_NODE,
926- stmtName,
927- parserContext);
928- }
929-}
930-
931 TransactionStatementNode
932 setIsolationStatement() throws StandardException :
933 {
934@@ -14124,13 +14110,112 @@
935 }
936
937 StatementNode
938+cursorStatement() throws StandardException :
939+{
940+ String name;
941+ StatementNode stmt;
942+ int count = 1;
943+ Token[] tokenHolder = new Token[1];
944+}
945+{
946+ <DECLARE> name = identifier() [<NO> <SCROLL>] <CURSOR>
947+ <FOR> stmt = declarableStatement(tokenHolder)
948+ {
949+ return (StatementNode)nodeFactory.getNode(NodeTypes.DECLARE_STATEMENT_NODE,
950+ name, stmt,
951+ parserContext);
952+ }
953+|
954+ <FETCH>
955+ [
956+ <NEXT>
957+ |
958+ count = uint_value()
959+ |
960+ <ALL> { count = -1; }
961+ ]
962+ [ <FROM> ]
963+ name = identifier()
964+ {
965+ return (StatementNode)nodeFactory.getNode(NodeTypes.FETCH_STATEMENT_NODE,
966+ name, count,
967+ parserContext);
968+ }
969+|
970+ <CLOSE>
971+ name = identifier()
972+ {
973+ return (StatementNode)nodeFactory.getNode(NodeTypes.CLOSE_STATEMENT_NODE,
974+ name,
975+ parserContext);
976+ }
977+|
978+ <PREPARE> name = identifier()
979+ <AS> stmt = proceduralStatement(tokenHolder)
980+ {
981+ stmt.setBeginOffset(tokenHolder[0].beginOffset);
982+ stmt.setEndOffset(getToken(0).endOffset);
983+ return (StatementNode)nodeFactory.getNode(NodeTypes.PREPARE_STATEMENT_NODE,
984+ name, stmt,
985+ parserContext);
986+ }
987+|
988+ <DEALLOCATE>
989+ name = identifier()
990+ {
991+ return (StatementNode)nodeFactory.getNode(NodeTypes.DEALLOCATE_STATEMENT_NODE,
992+ name,
993+ parserContext);
994+ }
995+}
996+
997+StatementNode
998+declarableStatement(Token[] tokenHolder) throws StandardException :
999+{
1000+ StatementNode stmt;
1001+ tokenHolder[0] = getToken(1);
1002+}
1003+{
1004+(
1005+ stmt = proceduralStatement(tokenHolder)
1006+|
1007+ stmt = executeStatement()
1008+)
1009+ {
1010+ stmt.setBeginOffset(tokenHolder[0].beginOffset);
1011+ stmt.setEndOffset(getToken(0).endOffset);
1012+ return stmt;
1013+ }
1014+}
1015+
1016+StatementNode
1017+executeStatement() throws StandardException :
1018+{
1019+ String name;
1020+ List<ValueNode> params = new ArrayList<ValueNode>();
1021+}
1022+{
1023+ <EXECUTE> name = identifier() [ methodCallParameterList(params) ]
1024+ {
1025+ ValueNodeList parameterList = (ValueNodeList)
1026+ nodeFactory.getNode(NodeTypes.VALUE_NODE_LIST,
1027+ parserContext);
1028+ for (ValueNode param : params)
1029+ parameterList.add(param);
1030+ return (StatementNode)nodeFactory.getNode(NodeTypes.EXECUTE_STATEMENT_NODE,
1031+ name, parameterList,
1032+ parserContext);
1033+ }
1034+}
1035+
1036+StatementNode
1037 explainStatement() throws StandardException :
1038 {
1039 StatementNode stmt;
1040 Token[] tokenHolder = new Token[1];
1041 }
1042 {
1043- <EXPLAIN> stmt = proceduralStatement(tokenHolder)
1044+ <EXPLAIN> stmt = declarableStatement(tokenHolder)
1045 {
1046 return (StatementNode)nodeFactory.getNode(NodeTypes.EXPLAIN_STATEMENT_NODE,
1047 stmt,
1048
1049=== added file 'src/test/resources/com/akiban/sql/parser/close-1.expected'
1050--- src/test/resources/com/akiban/sql/parser/close-1.expected 1970-01-01 00:00:00 +0000
1051+++ src/test/resources/com/akiban/sql/parser/close-1.expected 2012-12-14 23:54:20 +0000
1052@@ -0,0 +1,3 @@
1053+com.akiban.sql.parser.CloseStatementNode@6baa9f99
1054+name: curs
1055+statementType: CLOSE
1056\ No newline at end of file
1057
1058=== added file 'src/test/resources/com/akiban/sql/parser/close-1.sql'
1059--- src/test/resources/com/akiban/sql/parser/close-1.sql 1970-01-01 00:00:00 +0000
1060+++ src/test/resources/com/akiban/sql/parser/close-1.sql 2012-12-14 23:54:20 +0000
1061@@ -0,0 +1,1 @@
1062+CLOSE curs
1063\ No newline at end of file
1064
1065=== added file 'src/test/resources/com/akiban/sql/parser/deallocate-1.expected'
1066--- src/test/resources/com/akiban/sql/parser/deallocate-1.expected 1970-01-01 00:00:00 +0000
1067+++ src/test/resources/com/akiban/sql/parser/deallocate-1.expected 2012-12-14 23:54:20 +0000
1068@@ -0,0 +1,3 @@
1069+com.akiban.sql.parser.DeallocateStatementNode@7dce784b
1070+name: ps
1071+statementType: DEALLOCATE
1072\ No newline at end of file
1073
1074=== added file 'src/test/resources/com/akiban/sql/parser/deallocate-1.sql'
1075--- src/test/resources/com/akiban/sql/parser/deallocate-1.sql 1970-01-01 00:00:00 +0000
1076+++ src/test/resources/com/akiban/sql/parser/deallocate-1.sql 2012-12-14 23:54:20 +0000
1077@@ -0,0 +1,1 @@
1078+DEALLOCATE ps
1079\ No newline at end of file
1080
1081=== added file 'src/test/resources/com/akiban/sql/parser/declare-1.expected'
1082--- src/test/resources/com/akiban/sql/parser/declare-1.expected 1970-01-01 00:00:00 +0000
1083+++ src/test/resources/com/akiban/sql/parser/declare-1.expected 2012-12-14 23:54:20 +0000
1084@@ -0,0 +1,32 @@
1085+com.akiban.sql.parser.DeclareStatementNode@5de9ac4
1086+name: pc
1087+statementType: DECLARE
1088+statement:
1089+ com.akiban.sql.parser.CursorNode@5982bcde
1090+ name: null
1091+ updateMode: UNSPECIFIED
1092+ statementType: SELECT
1093+ resultSet:
1094+ com.akiban.sql.parser.SelectNode@163dc0bb
1095+ isDistinct: false
1096+ resultColumns:
1097+ com.akiban.sql.parser.ResultColumnList@30384065
1098+
1099+ [0]:
1100+ com.akiban.sql.parser.AllResultColumn@3d0bbf9e
1101+ tableName: null
1102+ exposedName: null
1103+ name: null
1104+ tableName: null
1105+ isDefaultColumn: false
1106+ type: null
1107+ fromList:
1108+ com.akiban.sql.parser.FromList@4e513d61
1109+
1110+ [0]:
1111+ com.akiban.sql.parser.FromBaseTable@3794d372
1112+ tableName: t1
1113+ updateOrDelete: null
1114+ null
1115+ correlation Name: null
1116+ null
1117\ No newline at end of file
1118
1119=== added file 'src/test/resources/com/akiban/sql/parser/declare-1.sql'
1120--- src/test/resources/com/akiban/sql/parser/declare-1.sql 1970-01-01 00:00:00 +0000
1121+++ src/test/resources/com/akiban/sql/parser/declare-1.sql 2012-12-14 23:54:20 +0000
1122@@ -0,0 +1,1 @@
1123+DECLARE pc CURSOR FOR SELECT * FROM t1
1124\ No newline at end of file
1125
1126=== added file 'src/test/resources/com/akiban/sql/parser/declare-2.expected'
1127--- src/test/resources/com/akiban/sql/parser/declare-2.expected 1970-01-01 00:00:00 +0000
1128+++ src/test/resources/com/akiban/sql/parser/declare-2.expected 2012-12-14 23:54:20 +0000
1129@@ -0,0 +1,9 @@
1130+com.akiban.sql.parser.DeclareStatementNode@739e8329
1131+name: pc
1132+statementType: DECLARE
1133+statement:
1134+ com.akiban.sql.parser.ExecuteStatementNode@2bb5340c
1135+ name: ps
1136+ statementType: EXECUTE
1137+ parameterList:
1138+ com.akiban.sql.parser.ValueNodeList@56c163f
1139\ No newline at end of file
1140
1141=== added file 'src/test/resources/com/akiban/sql/parser/declare-2.sql'
1142--- src/test/resources/com/akiban/sql/parser/declare-2.sql 1970-01-01 00:00:00 +0000
1143+++ src/test/resources/com/akiban/sql/parser/declare-2.sql 2012-12-14 23:54:20 +0000
1144@@ -0,0 +1,1 @@
1145+DECLARE pc CURSOR FOR EXECUTE ps
1146\ No newline at end of file
1147
1148=== added file 'src/test/resources/com/akiban/sql/parser/execute-1.expected'
1149--- src/test/resources/com/akiban/sql/parser/execute-1.expected 1970-01-01 00:00:00 +0000
1150+++ src/test/resources/com/akiban/sql/parser/execute-1.expected 2012-12-14 23:54:20 +0000
1151@@ -0,0 +1,5 @@
1152+com.akiban.sql.parser.ExecuteStatementNode@788ab708
1153+name: ps
1154+statementType: EXECUTE
1155+parameterList:
1156+ com.akiban.sql.parser.ValueNodeList@5af6ac0b
1157\ No newline at end of file
1158
1159=== added file 'src/test/resources/com/akiban/sql/parser/execute-1.sql'
1160--- src/test/resources/com/akiban/sql/parser/execute-1.sql 1970-01-01 00:00:00 +0000
1161+++ src/test/resources/com/akiban/sql/parser/execute-1.sql 2012-12-14 23:54:20 +0000
1162@@ -0,0 +1,1 @@
1163+EXECUTE ps
1164\ No newline at end of file
1165
1166=== added file 'src/test/resources/com/akiban/sql/parser/execute-2.expected'
1167--- src/test/resources/com/akiban/sql/parser/execute-2.expected 1970-01-01 00:00:00 +0000
1168+++ src/test/resources/com/akiban/sql/parser/execute-2.expected 2012-12-14 23:54:20 +0000
1169@@ -0,0 +1,14 @@
1170+com.akiban.sql.parser.ExecuteStatementNode@789934d4
1171+name: ps
1172+statementType: EXECUTE
1173+parameterList:
1174+ com.akiban.sql.parser.ValueNodeList@125b8827
1175+
1176+ [0]:
1177+ com.akiban.sql.parser.NumericConstantNode@3747c1db
1178+ value: 100
1179+ type: INTEGER NOT NULL
1180+ [1]:
1181+ com.akiban.sql.parser.CharConstantNode@48082d37
1182+ value: Smith
1183+ type: CHAR(5) NOT NULL
1184\ No newline at end of file
1185
1186=== added file 'src/test/resources/com/akiban/sql/parser/execute-2.sql'
1187--- src/test/resources/com/akiban/sql/parser/execute-2.sql 1970-01-01 00:00:00 +0000
1188+++ src/test/resources/com/akiban/sql/parser/execute-2.sql 2012-12-14 23:54:20 +0000
1189@@ -0,0 +1,1 @@
1190+EXECUTE ps(100,'Smith')
1191\ No newline at end of file
1192
1193=== added file 'src/test/resources/com/akiban/sql/parser/fetch-1.expected'
1194--- src/test/resources/com/akiban/sql/parser/fetch-1.expected 1970-01-01 00:00:00 +0000
1195+++ src/test/resources/com/akiban/sql/parser/fetch-1.expected 2012-12-14 23:54:20 +0000
1196@@ -0,0 +1,4 @@
1197+com.akiban.sql.parser.FetchStatementNode@f5e0873
1198+name: pc
1199+count: 1
1200+statementType: FETCH
1201\ No newline at end of file
1202
1203=== added file 'src/test/resources/com/akiban/sql/parser/fetch-1.sql'
1204--- src/test/resources/com/akiban/sql/parser/fetch-1.sql 1970-01-01 00:00:00 +0000
1205+++ src/test/resources/com/akiban/sql/parser/fetch-1.sql 2012-12-14 23:54:20 +0000
1206@@ -0,0 +1,1 @@
1207+FETCH pc
1208\ No newline at end of file
1209
1210=== added file 'src/test/resources/com/akiban/sql/parser/fetch-2.expected'
1211--- src/test/resources/com/akiban/sql/parser/fetch-2.expected 1970-01-01 00:00:00 +0000
1212+++ src/test/resources/com/akiban/sql/parser/fetch-2.expected 2012-12-14 23:54:20 +0000
1213@@ -0,0 +1,4 @@
1214+com.akiban.sql.parser.FetchStatementNode@667cbde6
1215+name: pc
1216+count: 2
1217+statementType: FETCH
1218\ No newline at end of file
1219
1220=== added file 'src/test/resources/com/akiban/sql/parser/fetch-2.sql'
1221--- src/test/resources/com/akiban/sql/parser/fetch-2.sql 1970-01-01 00:00:00 +0000
1222+++ src/test/resources/com/akiban/sql/parser/fetch-2.sql 2012-12-14 23:54:20 +0000
1223@@ -0,0 +1,1 @@
1224+FETCH 2 FROM pc
1225\ No newline at end of file
1226
1227=== added file 'src/test/resources/com/akiban/sql/parser/fetch-3.expected'
1228--- src/test/resources/com/akiban/sql/parser/fetch-3.expected 1970-01-01 00:00:00 +0000
1229+++ src/test/resources/com/akiban/sql/parser/fetch-3.expected 2012-12-14 23:54:20 +0000
1230@@ -0,0 +1,4 @@
1231+com.akiban.sql.parser.FetchStatementNode@7977b9b
1232+name: pc
1233+count: ALL
1234+statementType: FETCH
1235\ No newline at end of file
1236
1237=== added file 'src/test/resources/com/akiban/sql/parser/fetch-3.sql'
1238--- src/test/resources/com/akiban/sql/parser/fetch-3.sql 1970-01-01 00:00:00 +0000
1239+++ src/test/resources/com/akiban/sql/parser/fetch-3.sql 2012-12-14 23:54:20 +0000
1240@@ -0,0 +1,1 @@
1241+FETCH ALL FROM pc
1242\ No newline at end of file
1243
1244=== modified file 'src/test/resources/com/akiban/sql/parser/junk-1.error'
1245--- src/test/resources/com/akiban/sql/parser/junk-1.error 2012-01-19 19:46:51 +0000
1246+++ src/test/resources/com/akiban/sql/parser/junk-1.error 2012-12-14 23:54:20 +0000
1247@@ -2,13 +2,17 @@
1248 Was expecting one of:
1249 "alter" ...
1250 "begin" ...
1251+ "close" ...
1252 "commit" ...
1253 "create" ...
1254+ "deallocate" ...
1255 "declare" ...
1256 "delete" ...
1257 "drop" ...
1258 "execute" ...
1259+ "fetch" ...
1260 "insert" ...
1261+ "prepare" ...
1262 "rollback" ...
1263 "select" ...
1264 "update" ...
1265
1266=== added file 'src/test/resources/com/akiban/sql/parser/prepare-1.expected'
1267--- src/test/resources/com/akiban/sql/parser/prepare-1.expected 1970-01-01 00:00:00 +0000
1268+++ src/test/resources/com/akiban/sql/parser/prepare-1.expected 2012-12-14 23:54:20 +0000
1269@@ -0,0 +1,50 @@
1270+com.akiban.sql.parser.PrepareStatementNode@46edf730
1271+name: ps
1272+statementType: PREPARE
1273+statement:
1274+ com.akiban.sql.parser.CursorNode@30ff94b1
1275+ name: null
1276+ updateMode: UNSPECIFIED
1277+ statementType: SELECT
1278+ resultSet:
1279+ com.akiban.sql.parser.SelectNode@5b7b0998
1280+ isDistinct: false
1281+ resultColumns:
1282+ com.akiban.sql.parser.ResultColumnList@6ab30913
1283+
1284+ [0]:
1285+ com.akiban.sql.parser.ResultColumn@1018f51f
1286+ exposedName: name
1287+ name: name
1288+ tableName: null
1289+ isDefaultColumn: false
1290+ type: null
1291+ expression:
1292+ com.akiban.sql.parser.ColumnReference@5684ce7a
1293+ columnName: name
1294+ tableName: null
1295+ type: null
1296+ fromList:
1297+ com.akiban.sql.parser.FromList@290fd7f6
1298+
1299+ [0]:
1300+ com.akiban.sql.parser.FromBaseTable@4f2b6c89
1301+ tableName: customers
1302+ updateOrDelete: null
1303+ null
1304+ correlation Name: null
1305+ null
1306+ whereClause:
1307+ com.akiban.sql.parser.BinaryRelationalOperatorNode@2be2befa
1308+ operator: =
1309+ methodName: equals
1310+ type: null
1311+ leftOperand:
1312+ com.akiban.sql.parser.ColumnReference@33682598
1313+ columnName: cid
1314+ tableName: null
1315+ type: null
1316+ rightOperand:
1317+ com.akiban.sql.parser.ParameterNode@7a7c3885
1318+ number: 0
1319+ type: null
1320\ No newline at end of file
1321
1322=== added file 'src/test/resources/com/akiban/sql/parser/prepare-1.sql'
1323--- src/test/resources/com/akiban/sql/parser/prepare-1.sql 1970-01-01 00:00:00 +0000
1324+++ src/test/resources/com/akiban/sql/parser/prepare-1.sql 2012-12-14 23:54:20 +0000
1325@@ -0,0 +1,1 @@
1326+PREPARE ps AS SELECT name FROM customers WHERE cid = $1
1327\ No newline at end of file
1328
1329=== added file 'src/test/resources/com/akiban/sql/unparser/close-1.expected'
1330--- src/test/resources/com/akiban/sql/unparser/close-1.expected 1970-01-01 00:00:00 +0000
1331+++ src/test/resources/com/akiban/sql/unparser/close-1.expected 2012-12-14 23:54:20 +0000
1332@@ -0,0 +1,1 @@
1333+CLOSE curs
1334\ No newline at end of file
1335
1336=== added file 'src/test/resources/com/akiban/sql/unparser/close-1.sql'
1337--- src/test/resources/com/akiban/sql/unparser/close-1.sql 1970-01-01 00:00:00 +0000
1338+++ src/test/resources/com/akiban/sql/unparser/close-1.sql 2012-12-14 23:54:20 +0000
1339@@ -0,0 +1,1 @@
1340+CLOSE curs
1341\ No newline at end of file
1342
1343=== added file 'src/test/resources/com/akiban/sql/unparser/deallocate-1.expected'
1344--- src/test/resources/com/akiban/sql/unparser/deallocate-1.expected 1970-01-01 00:00:00 +0000
1345+++ src/test/resources/com/akiban/sql/unparser/deallocate-1.expected 2012-12-14 23:54:20 +0000
1346@@ -0,0 +1,1 @@
1347+DEALLOCATE ps
1348\ No newline at end of file
1349
1350=== added file 'src/test/resources/com/akiban/sql/unparser/deallocate-1.sql'
1351--- src/test/resources/com/akiban/sql/unparser/deallocate-1.sql 1970-01-01 00:00:00 +0000
1352+++ src/test/resources/com/akiban/sql/unparser/deallocate-1.sql 2012-12-14 23:54:20 +0000
1353@@ -0,0 +1,1 @@
1354+DEALLOCATE ps
1355\ No newline at end of file
1356
1357=== added file 'src/test/resources/com/akiban/sql/unparser/declare-1.expected'
1358--- src/test/resources/com/akiban/sql/unparser/declare-1.expected 1970-01-01 00:00:00 +0000
1359+++ src/test/resources/com/akiban/sql/unparser/declare-1.expected 2012-12-14 23:54:20 +0000
1360@@ -0,0 +1,1 @@
1361+DECLARE pc CURSOR FOR SELECT * FROM t1
1362\ No newline at end of file
1363
1364=== added file 'src/test/resources/com/akiban/sql/unparser/declare-1.sql'
1365--- src/test/resources/com/akiban/sql/unparser/declare-1.sql 1970-01-01 00:00:00 +0000
1366+++ src/test/resources/com/akiban/sql/unparser/declare-1.sql 2012-12-14 23:54:20 +0000
1367@@ -0,0 +1,1 @@
1368+DECLARE pc CURSOR FOR SELECT * FROM t1
1369\ No newline at end of file
1370
1371=== added file 'src/test/resources/com/akiban/sql/unparser/declare-2.expected'
1372--- src/test/resources/com/akiban/sql/unparser/declare-2.expected 1970-01-01 00:00:00 +0000
1373+++ src/test/resources/com/akiban/sql/unparser/declare-2.expected 2012-12-14 23:54:20 +0000
1374@@ -0,0 +1,1 @@
1375+DECLARE pc CURSOR FOR EXECUTE ps()
1376\ No newline at end of file
1377
1378=== added file 'src/test/resources/com/akiban/sql/unparser/declare-2.sql'
1379--- src/test/resources/com/akiban/sql/unparser/declare-2.sql 1970-01-01 00:00:00 +0000
1380+++ src/test/resources/com/akiban/sql/unparser/declare-2.sql 2012-12-14 23:54:20 +0000
1381@@ -0,0 +1,1 @@
1382+DECLARE pc CURSOR FOR EXECUTE ps
1383\ No newline at end of file
1384
1385=== added file 'src/test/resources/com/akiban/sql/unparser/execute-1.expected'
1386--- src/test/resources/com/akiban/sql/unparser/execute-1.expected 1970-01-01 00:00:00 +0000
1387+++ src/test/resources/com/akiban/sql/unparser/execute-1.expected 2012-12-14 23:54:20 +0000
1388@@ -0,0 +1,1 @@
1389+EXECUTE ps()
1390\ No newline at end of file
1391
1392=== added file 'src/test/resources/com/akiban/sql/unparser/execute-1.sql'
1393--- src/test/resources/com/akiban/sql/unparser/execute-1.sql 1970-01-01 00:00:00 +0000
1394+++ src/test/resources/com/akiban/sql/unparser/execute-1.sql 2012-12-14 23:54:20 +0000
1395@@ -0,0 +1,1 @@
1396+EXECUTE ps
1397\ No newline at end of file
1398
1399=== added file 'src/test/resources/com/akiban/sql/unparser/execute-2.expected'
1400--- src/test/resources/com/akiban/sql/unparser/execute-2.expected 1970-01-01 00:00:00 +0000
1401+++ src/test/resources/com/akiban/sql/unparser/execute-2.expected 2012-12-14 23:54:20 +0000
1402@@ -0,0 +1,1 @@
1403+EXECUTE ps(100, 'Smith')
1404\ No newline at end of file
1405
1406=== added file 'src/test/resources/com/akiban/sql/unparser/execute-2.sql'
1407--- src/test/resources/com/akiban/sql/unparser/execute-2.sql 1970-01-01 00:00:00 +0000
1408+++ src/test/resources/com/akiban/sql/unparser/execute-2.sql 2012-12-14 23:54:20 +0000
1409@@ -0,0 +1,1 @@
1410+EXECUTE ps(100,'Smith')
1411\ No newline at end of file
1412
1413=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-1.expected'
1414--- src/test/resources/com/akiban/sql/unparser/fetch-1.expected 1970-01-01 00:00:00 +0000
1415+++ src/test/resources/com/akiban/sql/unparser/fetch-1.expected 2012-12-14 23:54:20 +0000
1416@@ -0,0 +1,1 @@
1417+FETCH 1 FROM pc
1418\ No newline at end of file
1419
1420=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-1.sql'
1421--- src/test/resources/com/akiban/sql/unparser/fetch-1.sql 1970-01-01 00:00:00 +0000
1422+++ src/test/resources/com/akiban/sql/unparser/fetch-1.sql 2012-12-14 23:54:20 +0000
1423@@ -0,0 +1,1 @@
1424+FETCH pc
1425\ No newline at end of file
1426
1427=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-2.expected'
1428--- src/test/resources/com/akiban/sql/unparser/fetch-2.expected 1970-01-01 00:00:00 +0000
1429+++ src/test/resources/com/akiban/sql/unparser/fetch-2.expected 2012-12-14 23:54:20 +0000
1430@@ -0,0 +1,1 @@
1431+FETCH 2 FROM pc
1432\ No newline at end of file
1433
1434=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-2.sql'
1435--- src/test/resources/com/akiban/sql/unparser/fetch-2.sql 1970-01-01 00:00:00 +0000
1436+++ src/test/resources/com/akiban/sql/unparser/fetch-2.sql 2012-12-14 23:54:20 +0000
1437@@ -0,0 +1,1 @@
1438+FETCH 2 FROM pc
1439\ No newline at end of file
1440
1441=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-3.expected'
1442--- src/test/resources/com/akiban/sql/unparser/fetch-3.expected 1970-01-01 00:00:00 +0000
1443+++ src/test/resources/com/akiban/sql/unparser/fetch-3.expected 2012-12-14 23:54:20 +0000
1444@@ -0,0 +1,1 @@
1445+FETCH ALL FROM pc
1446\ No newline at end of file
1447
1448=== added file 'src/test/resources/com/akiban/sql/unparser/fetch-3.sql'
1449--- src/test/resources/com/akiban/sql/unparser/fetch-3.sql 1970-01-01 00:00:00 +0000
1450+++ src/test/resources/com/akiban/sql/unparser/fetch-3.sql 2012-12-14 23:54:20 +0000
1451@@ -0,0 +1,1 @@
1452+FETCH ALL FROM pc
1453\ No newline at end of file
1454
1455=== added file 'src/test/resources/com/akiban/sql/unparser/prepare-1.expected'
1456--- src/test/resources/com/akiban/sql/unparser/prepare-1.expected 1970-01-01 00:00:00 +0000
1457+++ src/test/resources/com/akiban/sql/unparser/prepare-1.expected 2012-12-14 23:54:20 +0000
1458@@ -0,0 +1,1 @@
1459+PREPARE ps AS SELECT name FROM customers WHERE cid = $1
1460\ No newline at end of file
1461
1462=== added file 'src/test/resources/com/akiban/sql/unparser/prepare-1.sql'
1463--- src/test/resources/com/akiban/sql/unparser/prepare-1.sql 1970-01-01 00:00:00 +0000
1464+++ src/test/resources/com/akiban/sql/unparser/prepare-1.sql 2012-12-14 23:54:20 +0000
1465@@ -0,0 +1,1 @@
1466+PREPARE ps AS SELECT name FROM customers WHERE cid = $1
1467\ No newline at end of file

Subscribers

People subscribed via source and target branches