@@ -11,6 +11,7 @@ using Memento
11
11
using Memento. TestUtils
12
12
using OffsetArrays
13
13
using SQLStrings
14
+ using DBInterface
14
15
using TimeZones
15
16
using Tables
16
17
using UTCDateTimes
@@ -1893,6 +1894,44 @@ end
1893
1894
1894
1895
close (conn)
1895
1896
end
1897
+
1898
+ @testset " DBInterface integration" begin
1899
+ conn = DBInterface. connect (LibPQ. Connection, " dbname=postgres user=$DATABASE_USER " )
1900
+ @test conn isa LibPQ. Connection
1901
+
1902
+ result = DBInterface. execute (
1903
+ conn,
1904
+ " SELECT typname FROM pg_type WHERE oid = 16" ;
1905
+ )
1906
+ @test result isa LibPQ. Result
1907
+ @test status (result) == LibPQ. libpq_c. PGRES_TUPLES_OK
1908
+ @test isopen (result)
1909
+ @test LibPQ. num_columns (result) == 1
1910
+ @test LibPQ. num_rows (result) == 1
1911
+ @test LibPQ. column_name (result, 1 ) == " typname"
1912
+ @test LibPQ. column_number (result, " typname" ) == 1
1913
+ data = columntable (result)
1914
+ @test data[:typname ][1 ] == " bool"
1915
+
1916
+ qstr = " SELECT \$ 1::double precision as foo, typname FROM pg_type WHERE oid = \$ 2"
1917
+ stmt = DBInterface. prepare (conn, qstr)
1918
+ result = DBInterface. execute (
1919
+ conn,
1920
+ qstr,
1921
+ (1.0 , 16 );
1922
+ )
1923
+ @test result isa LibPQ. Result
1924
+ @test status (result) == LibPQ. libpq_c. PGRES_TUPLES_OK
1925
+ @test isopen (result)
1926
+ @test LibPQ. num_columns (result) == 2
1927
+ @test LibPQ. num_rows (result) == 1
1928
+ @test LibPQ. column_name (result, 1 ) == " foo"
1929
+ @test LibPQ. column_name (result, 2 ) == " typname"
1930
+
1931
+ DBInterface. close! (conn)
1932
+ @test ! isopen (conn)
1933
+
1934
+ end
1896
1935
end
1897
1936
end
1898
1937
0 commit comments