Merge branch 'feature/QQQ-38-app-home-widgets' into feature/sprint-10

This commit is contained in:
2022-08-31 15:59:32 -05:00
31 changed files with 1618 additions and 45 deletions

View File

@ -298,8 +298,6 @@ public class QueryManager
*******************************************************************************/
public static List<Map<String, Object>> executeStatementForRows(Connection connection, String sql, Object... params) throws SQLException
{
throw (new NotImplementedException());
/*
List<Map<String, Object>> rs = new ArrayList<>();
PreparedStatement statement = prepareStatementAndBindParams(connection, sql, params);
@ -318,7 +316,6 @@ public class QueryManager
}
return (rs);
*/
}

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.module.rdbms.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import com.kingsrook.qqq.backend.core.instances.QMetaDataVariableInterpreter;
import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSBackendMetaData;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -101,13 +102,21 @@ class ConnectionManagerTest
private RDBMSBackendMetaData getAuroraBacked()
{
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
String vendor = interpreter.interpret("${env.RDBMS_VENDOR}");
String hostname = interpreter.interpret("${env.RDBMS_HOSTNAME}");
Integer port = Integer.valueOf(interpreter.interpret("${env.RDBMS_PORT}"));
String databaseName = interpreter.interpret("${env.RDBMS_DATABASE_NAME}");
String username = interpreter.interpret("${env.RDBMS_USERNAME}");
String password= interpreter.interpret("${env.RDBMS_PASSWORD}");
return new RDBMSBackendMetaData()
.withName("aurora-test")
.withVendor("aurora")
.withHostName("nf-one-development-aurora.cwuhqcx1inwx.us-east-2.rds.amazonaws.com")
.withPort(3306)
.withDatabaseName("nutrifresh_one")
.withUsername("nf_admin")
.withPassword("%!2rwcH+fb#WgPg");
.withVendor(vendor)
.withHostName(hostname)
.withPort(port)
.withDatabaseName(databaseName)
.withUsername(username)
.withPassword(password);
}
}

View File

@ -36,6 +36,8 @@ import java.time.LocalTime;
import java.time.Month;
import java.time.OffsetDateTime;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import com.kingsrook.qqq.backend.module.rdbms.TestUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@ -381,4 +383,25 @@ class QueryManagerTest
assertEquals("Q", simpleEntity.get("CHAR_COL"));
}
/*******************************************************************************
**
*******************************************************************************/
@Test
void testQueryForRows() throws SQLException
{
Connection connection = getConnection();
QueryManager.executeUpdate(connection, """
INSERT INTO test_table
( int_col, datetime_col, char_col, date_col, time_col )
VALUES
( 47, '2022-08-10 19:22:08', 'Q', '2022-08-10', '19:22:08')
""");
List<Map<String, Object>> rows = QueryManager.executeStatementForRows(connection, "SELECT * FROM test_table");
assertNotNull(rows);
assertEquals(47, rows.get(0).get("INT_COL"));
assertEquals("Q", rows.get(0).get("CHAR_COL"));
}
}