Skip to content

Commit

Permalink
test temp table
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Nov 12, 2024
1 parent 183144f commit 9de1e8c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions databend-jdbc/src/test/java/com/databend/jdbc/TestTempTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.databend.jdbc;

import org.junit.Assert;
import org.testng.annotations.Test;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestTempTable {

@Test
public void testTempTable() throws SQLException {
try(Connection c1 = Utils.createConnection()) {
Statement statement= c1.createStatement();
statement.execute("create or replace temp table table1(i int)");
statement.execute("insert into table1 values (1), (2)");
statement.executeQuery("select * from table1");
ResultSet rs = statement.getResultSet();
Assert.assertEquals(true, rs.next());
Assert.assertEquals(1, rs.getInt(1));
Assert.assertEquals(true, rs.next());
Assert.assertEquals(2, rs.getInt(1));
Assert.assertEquals(false, rs.next());
}
}
}

0 comments on commit 9de1e8c

Please sign in to comment.