You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2017/02/09 01:58:59 UTC

[2/3] calcite git commit: [CALCITE-1622] Bugs in website example code (Damjan Jovanovic)

[CALCITE-1622] Bugs in website example code (Damjan Jovanovic)


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/4f257149
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/4f257149
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/4f257149

Branch: refs/heads/master
Commit: 4f257149f1f52d5f42d505ee53186e88a578fc3f
Parents: fdf017a
Author: Damjan Jovanovic <da...@apache.org>
Authored: Wed Feb 8 12:56:13 2017 -0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Wed Feb 8 12:56:13 2017 -0800

----------------------------------------------------------------------
 site/_docs/index.md | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/4f257149/site/_docs/index.md
----------------------------------------------------------------------
diff --git a/site/_docs/index.md b/site/_docs/index.md
index f0c4afd..c1a5d71 100644
--- a/site/_docs/index.md
+++ b/site/_docs/index.md
@@ -48,8 +48,10 @@ info.setProperty("lex", "JAVA");
 Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
 CalciteConnection calciteConnection =
     connection.unwrap(CalciteConnection.class);
-ReflectiveSchema.create(calciteConnection,
-    calciteConnection.getRootSchema(), "hr", new HrSchema());
+SchemaPlus rootSchema = calciteConnection.getRootSchema();
+Schema schema = ReflectiveSchema.create(calciteConnection,
+    rootSchema, "hr", new HrSchema());
+rootSchema.add("hr", schema);
 Statement statement = calciteConnection.createStatement();
 ResultSet resultSet = statement.executeQuery(
     "select d.deptno, min(e.empid)\n"
@@ -76,8 +78,8 @@ library. But Calcite can also process data in other data formats, such
 as JDBC. In the first example, replace
 
 {% highlight java %}
-ReflectiveSchema.create(calciteConnection,
-    calciteConnection.getRootSchema(), "hr", new HrSchema());
+Schema schema = ReflectiveSchema.create(calciteConnection,
+    rootSchema, "hr", new HrSchema());
 {% endhighlight %}
 
 with
@@ -88,8 +90,8 @@ BasicDataSource dataSource = new BasicDataSource();
 dataSource.setUrl("jdbc:mysql://localhost");
 dataSource.setUsername("username");
 dataSource.setPassword("password");
-JdbcSchema.create(calciteConnection.getRootSchema(), "name", dataSource,
-    null, "hr");
+Schema schema = JdbcSchema.create(rootSchema, "hr", dataSource,
+    null, "name");
 {% endhighlight %}
 
 and Calcite will execute the same query in JDBC. To the application,