Merge lp:~mmcm/akiban-server/pg-returning-json-with-meta-data into lp:~akiban-technologies/akiban-server/trunk

Proposed by Mike McMahon
Status: Merged
Approved by: Thomas Jones-Low
Approved revision: 2638
Merged at revision: 2638
Proposed branch: lp:~mmcm/akiban-server/pg-returning-json-with-meta-data
Merge into: lp:~akiban-technologies/akiban-server/trunk
Diff against target: 30 lines (+9/-0)
2 files modified
src/main/java/com/akiban/sql/pg/PostgresModifyOperatorStatement.java (+1/-0)
src/test/resources/com/akiban/sql/pg/yaml/functional/test-json-output-format.yaml (+8/-0)
To merge this branch: bzr merge lp:~mmcm/akiban-server/pg-returning-json-with-meta-data
Reviewer Review Type Date Requested Status
Thomas Jones-Low Approve
Review via email: mp+160496@code.launchpad.net

Description of the change

OutputFormat json_with_meta_data meets INSERT ... RETURNING.

One line fix. Includes a simple test.

To post a comment you must log in.
Revision history for this message
Thomas Jones-Low (tjoneslo) wrote :

I'm assuming this works correctly with UPDATE...RETURNING and DELETE...RETURNING?

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

I have no reason to doubt that it does, since they go through the same code path. There was only an INSERT YAML test before for JSON, so I didn't go overboard for JSON w/meta-data.

Revision history for this message
Thomas Jones-Low (tjoneslo) wrote :

Good enough for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main/java/com/akiban/sql/pg/PostgresModifyOperatorStatement.java'
2--- src/main/java/com/akiban/sql/pg/PostgresModifyOperatorStatement.java 2013-03-22 20:05:57 +0000
3+++ src/main/java/com/akiban/sql/pg/PostgresModifyOperatorStatement.java 2013-04-23 20:47:27 +0000
4@@ -153,6 +153,7 @@
5 PostgresOutputter<Row> outputter = null;
6 if (outputResult) {
7 outputter = getRowOutputter(context);
8+ outputter.beforeData();
9 }
10 Row row;
11 while ((row = cursor.next()) != null) {
12
13=== modified file 'src/test/resources/com/akiban/sql/pg/yaml/functional/test-json-output-format.yaml'
14--- src/test/resources/com/akiban/sql/pg/yaml/functional/test-json-output-format.yaml 2012-09-26 03:50:12 +0000
15+++ src/test/resources/com/akiban/sql/pg/yaml/functional/test-json-output-format.yaml 2013-04-23 20:47:27 +0000
16@@ -36,5 +36,13 @@
17 - Statement: INSERT INTO t2(n) VALUES(5),(6) RETURNING id;
18 - output: [['{"id":1}'],['{"id":2}']]
19 ---
20+- Statement: SET OutputFormat TO 'json_with_meta_data';
21+---
22+- Statement: SELECT * FROM t ORDER BY id
23+- output: [['[{"name":"id","oid":23,"type":"INTEGER NOT NULL"},{"name":"name","oid":1043,"type":"VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL","length":32}]'],['{"id":1,"name":"abc"}'],["{\"id\":2,\"name\":\"abc'xyz\"}"],["{\"id\":3,\"name\":\"abc\\\"xyz\"}"],["{\"id\":4,\"name\":\"abc\\nxyz\"}"],["{\"id\":5,\"name\":\"\\u2603\"}"]]
24+---
25+- Statement: INSERT INTO t2(n) VALUES(7),(8) RETURNING id;
26+- output: [['[{"name":"id","oid":23,"type":"INTEGER NOT NULL"}]'],['{"id":3}'],['{"id":4}']]
27+---
28 - Statement: SET OutputFormat TO DEFAULT;
29 ...
30\ No newline at end of file

Subscribers

People subscribed via source and target branches