@@ -45,12 +45,11 @@ testDriver = testGroup "Driver"
45
45
]
46
46
47
47
makeQuery1 :: B. ByteString -> Query
48
- makeQuery1 n = Query " SELECT $1" (V. fromList [(Oid 23 , Just n)])
49
- Text Text AlwaysCache
48
+ makeQuery1 n = Query " SELECT $1" [(Oid 23 , Just n)] Text Text AlwaysCache
50
49
51
50
makeQuery2 :: B. ByteString -> B. ByteString -> Query
52
51
makeQuery2 n1 n2 = Query " SELECT $1 + $2"
53
- ( V. fromList [(Oid 23 , Just n1), (Oid 23 , Just n2)]) Text Text AlwaysCache
52
+ [(Oid 23 , Just n1), (Oid 23 , Just n2)] Text Text AlwaysCache
54
53
55
54
fromRight :: Either e a -> a
56
55
fromRight (Right v) = v
@@ -108,12 +107,12 @@ testMultipleBatches = withConnection $ replicateM_ 10 . assertSingleBatch
108
107
-- | Query is empty string.
109
108
testEmptyQuery :: IO ()
110
109
testEmptyQuery = assertQueryNoData $
111
- Query " " V. empty Text Text NeverCache
110
+ Query " " [] Text Text NeverCache
112
111
113
112
-- | Query than returns no datarows.
114
113
testQueryWithoutResult :: IO ()
115
114
testQueryWithoutResult = assertQueryNoData $
116
- Query " SET client_encoding TO UTF8" V. empty Text Text NeverCache
115
+ Query " SET client_encoding TO UTF8" [] Text Text NeverCache
117
116
118
117
-- | Asserts that query returns no data rows.
119
118
assertQueryNoData :: Query -> IO ()
@@ -141,9 +140,9 @@ checkInvalidResult conn n = readNextData conn >>=
141
140
testInvalidBatch :: IO ()
142
141
testInvalidBatch = do
143
142
let rightQuery = makeQuery1 " 5"
144
- q1 = Query " SEL $1" ( V. fromList [(Oid 23 , Just " 5" )]) Text Text NeverCache
145
- q2 = Query " SELECT $1" ( V. fromList [(Oid 23 , Just " a" )]) Text Text NeverCache
146
- q4 = Query " SELECT $1" ( V. fromList [] ) Text Text NeverCache
143
+ q1 = Query " SEL $1" [(Oid 23 , Just " 5" )] Text Text NeverCache
144
+ q2 = Query " SELECT $1" [(Oid 23 , Just " a" )] Text Text NeverCache
145
+ q4 = Query " SELECT $1" [] Text Text NeverCache
147
146
148
147
assertInvalidBatch " Parse error" [q1]
149
148
assertInvalidBatch " Invalid param" [ q2]
@@ -162,7 +161,7 @@ testValidAfterError :: IO ()
162
161
testValidAfterError = withConnection $ \ c -> do
163
162
let a = " 5"
164
163
rightQuery = makeQuery1 a
165
- invalidQuery = Query " SELECT $1" ( V. fromList [] ) Text Text NeverCache
164
+ invalidQuery = Query " SELECT $1" [] Text Text NeverCache
166
165
sendBatchAndSync c [invalidQuery]
167
166
checkInvalidResult c 1
168
167
waitReadyForQuery c
@@ -186,15 +185,15 @@ testDescribeStatement = withConnectionCommon $ \c -> do
186
185
testDescribeStatementNoData :: IO ()
187
186
testDescribeStatementNoData = withConnectionCommon $ \ c -> do
188
187
r <- fromRight <$> describeStatement c " SET client_encoding TO UTF8"
189
- assertBool " Should be empty" $ V. null (fst r)
190
- assertBool " Should be empty" $ V. null (snd r)
188
+ assertBool " Should be empty" $ null (fst r)
189
+ assertBool " Should be empty" $ null (snd r)
191
190
192
191
-- | Describes statement that is empty string.
193
192
testDescribeStatementEmpty :: IO ()
194
193
testDescribeStatementEmpty = withConnectionCommon $ \ c -> do
195
194
r <- fromRight <$> describeStatement c " "
196
- assertBool " Should be empty" $ V. null (fst r)
197
- assertBool " Should be empty" $ V. null (snd r)
195
+ assertBool " Should be empty" $ null (fst r)
196
+ assertBool " Should be empty" $ null (snd r)
198
197
199
198
-- | Query using simple query protocol.
200
199
testSimpleQuery :: IO ()
@@ -231,7 +230,7 @@ testPreparedStatementCache = withConnection $ \c -> do
231
230
-- | Test that large responses are properly handled
232
231
testLargeQuery :: IO ()
233
232
testLargeQuery = withConnection $ \ c -> do
234
- sendBatchAndSync c [Query largeStmt V. empty Text Text NeverCache ]
233
+ sendBatchAndSync c [Query largeStmt [] Text Text NeverCache ]
235
234
r <- readNextData c
236
235
waitReadyForQuery c
237
236
assertBool " Should be Right" $ isRight r
@@ -243,7 +242,7 @@ testLargeQuery = withConnection $ \c -> do
243
242
testCorrectDatarows :: IO ()
244
243
testCorrectDatarows = withConnection $ \ c -> do
245
244
let stmt = " SELECT * FROM generate_series(1, 1000)"
246
- sendBatchAndSync c [Query stmt V. empty Text Text NeverCache ]
245
+ sendBatchAndSync c [Query stmt [] Text Text NeverCache ]
247
246
r <- readNextData c
248
247
case r of
249
248
Left e -> error $ show e
0 commit comments