From a0774e7e02fc5511eaa428393efa5f683d808392 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 30 Jan 2025 14:25:18 -0500 Subject: [PATCH] read table by name, SQL_Query --- .../0.0.0-dev/src/JDBC/Generic_JDBC_Connection.enso | 3 +-- .../src/Database/JDBC/Generic_JDBC_Connection_Spec.enso | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/JDBC/Generic_JDBC_Connection.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/JDBC/Generic_JDBC_Connection.enso index 01dd9f0c03bc..fce57d9bfe7c 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/JDBC/Generic_JDBC_Connection.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/JDBC/Generic_JDBC_Connection.enso @@ -103,7 +103,7 @@ type Generic_JDBC_Connection read self sql_query:SQL_Query -> Table = resolved_sql = case sql_query of SQL_Query.Raw_SQL raw_sql -> raw_sql - SQL_Query.Table_Name table_name -> "select * from "+(self.quote table_name) + SQL_Query.Table_Name table_name -> "select * from "+(self.quote_identifier table_name) self.jdbc_connection.with_prepared_statement resolved_sql Statement_Setter.default stmt-> rs = stmt.executeQuery @@ -112,7 +112,6 @@ type Generic_JDBC_Connection table = result_set_to_table rs make_fallback_fetcher SQL_Warning_Helper.process_warnings stmt <| table -- ## ALIAS catalog schema database GROUP Standard.Base.Metadata diff --git a/test/Table_Tests/src/Database/JDBC/Generic_JDBC_Connection_Spec.enso b/test/Table_Tests/src/Database/JDBC/Generic_JDBC_Connection_Spec.enso index 447aca637689..e8ca8a680394 100644 --- a/test/Table_Tests/src/Database/JDBC/Generic_JDBC_Connection_Spec.enso +++ b/test/Table_Tests/src/Database/JDBC/Generic_JDBC_Connection_Spec.enso @@ -5,7 +5,7 @@ from Standard.Test import all import Standard.Database.Errors.SQL_Error import Standard.Database.JDBC.Generic_JDBC_Connection.Generic_JDBC_Connection -import project.SQL_Query.SQL_Query +import Standard.Database.SQL_Query.SQL_Query add_specs suite_builder = data_dir = enso_project.data / "transient" @@ -180,11 +180,11 @@ add_specs suite_builder = conn.execute "insert into bar (c, d) values (20, 'qqqq')" conn.execute "insert into bar (c, d) values (30, 'zzzz')" - r = conn.read (SQL_Query.Table_Name "foo") + r = conn.read (SQL_Query.Table_Name "FOO") r.at "A" . to_vector . should_equal [10, 20] r.at "B" . to_vector . should_equal ['asdf', 'zxcv'] - r2 = conn.read (SQL_Query.Table_Name "bar") + r2 = conn.read (SQL_Query.Table_Name "BAR") r2.at "C" . to_vector . should_equal [20, 30] r2.at "D" . to_vector . should_equal ['qqqq', 'zzzz']