@@ -288,24 +288,22 @@ defmodule Ch.ConnectionTest do
288288 end
289289
290290 test "values" , % { table: table } = ctx do
291- assert { :ok , % { num_rows: 3 } } =
292- parameterize_query (
293- ctx ,
294- "insert into {table:Identifier} values (1, 'a'),(2,'b'), (null, null)" ,
295- % { "table" => table }
296- )
291+ parameterize_query (
292+ ctx ,
293+ "insert into {table:Identifier} values (1, 'a'),(2,'b'), (null, null)" ,
294+ % { "table" => table }
295+ )
297296
298297 assert { :ok , % { rows: rows } } =
299298 parameterize_query ( ctx , "select * from {table:Identifier}" , % { "table" => table } )
300299
301300 assert rows == [ [ 1 , "a" ] , [ 2 , "b" ] , [ 1 , "" ] ]
302301
303- assert { :ok , % { num_rows: 2 } } =
304- parameterize_query (
305- ctx ,
306- "insert into {$0:Identifier}(a, b) values ({$1:UInt8},{$2:String}),({$3:UInt8},{$4:String})" ,
307- [ table , 4 , "d" , 5 , "e" ]
308- )
302+ parameterize_query (
303+ ctx ,
304+ "insert into {$0:Identifier}(a, b) values ({$1:UInt8},{$2:String}),({$3:UInt8},{$4:String})" ,
305+ [ table , 4 , "d" , 5 , "e" ]
306+ )
309307
310308 assert { :ok , % { rows: rows } } =
311309 parameterize_query ( ctx , "select * from {table:Identifier} where a >= 4" , % {
@@ -333,7 +331,8 @@ defmodule Ch.ConnectionTest do
333331 stmt = "insert into #{ table } (a, b) format RowBinary"
334332 types = [ "UInt8" , "String" ]
335333 rows = [ [ 1 , "a" ] , [ 2 , "b" ] ]
336- assert % { num_rows: 2 } = parameterize_query! ( ctx , stmt , rows , types: types )
334+
335+ parameterize_query! ( ctx , stmt , rows , types: types )
337336
338337 assert % { rows: rows } =
339338 parameterize_query! ( ctx , "select * from {table:Identifier}" , % { "table" => table } )
@@ -348,7 +347,7 @@ defmodule Ch.ConnectionTest do
348347 rows = [ [ 1 , "a" ] , [ 2 , "b" ] ]
349348 data = RowBinary . encode_rows ( rows , types )
350349
351- assert % { num_rows: 2 } = parameterize_query! ( ctx , stmt , data , encode: false )
350+ parameterize_query! ( ctx , stmt , data , encode: false )
352351
353352 assert % { rows: rows } =
354353 parameterize_query! ( ctx , "select * from {table:Identifier}" , % { "table" => table } )
@@ -365,13 +364,12 @@ defmodule Ch.ConnectionTest do
365364 |> Stream . chunk_every ( 2 )
366365 |> Stream . map ( fn chunk -> RowBinary . encode_rows ( chunk , types ) end )
367366
368- assert { :ok , % { num_rows: 3 } } =
369- parameterize_query (
370- ctx ,
371- "insert into #{ table } (a, b) format RowBinary" ,
372- stream ,
373- encode: false
374- )
367+ parameterize_query (
368+ ctx ,
369+ "insert into #{ table } (a, b) format RowBinary" ,
370+ stream ,
371+ encode: false
372+ )
375373
376374 assert { :ok , % { rows: rows } } =
377375 parameterize_query ( ctx , "select * from {table:Identifier}" , % { "table" => table } )
@@ -380,19 +378,17 @@ defmodule Ch.ConnectionTest do
380378 end
381379
382380 test "select" , % { table: table } = ctx do
383- assert { :ok , % { num_rows: 3 } } =
384- parameterize_query (
385- ctx ,
386- "insert into {table:Identifier} values (1, 'a'), (2, 'b'), (null, null)" ,
387- % { "table" => table }
388- )
381+ parameterize_query (
382+ ctx ,
383+ "insert into {table:Identifier} values (1, 'a'), (2, 'b'), (null, null)" ,
384+ % { "table" => table }
385+ )
389386
390- assert { :ok , % { num_rows: 3 } } =
391- parameterize_query (
392- ctx ,
393- "insert into {table:Identifier}(a, b) select a, b from {table:Identifier}" ,
394- % { "table" => table }
395- )
387+ parameterize_query (
388+ ctx ,
389+ "insert into {table:Identifier}(a, b) select a, b from {table:Identifier}" ,
390+ % { "table" => table }
391+ )
396392
397393 assert { :ok , % { rows: rows } } =
398394 parameterize_query ( ctx , "select * from {table:Identifier}" , % { "table" => table } )
@@ -421,8 +417,7 @@ defmodule Ch.ConnectionTest do
421417
422418 on_exit ( fn -> Ch.Test . query ( "drop table delete_t" ) end )
423419
424- assert { :ok , % { num_rows: 2 } } =
425- parameterize_query ( ctx , "insert into delete_t values (1,'a'), (2,'b')" )
420+ parameterize_query ( ctx , "insert into delete_t values (1,'a'), (2,'b')" )
426421
427422 settings = [ allow_experimental_lightweight_delete: 1 ]
428423
@@ -496,18 +491,17 @@ defmodule Ch.ConnectionTest do
496491 parameterize_query! ( ctx , "create table fixed_string_t(a FixedString(3)) engine = Memory" )
497492 on_exit ( fn -> Ch.Test . query ( "drop table fixed_string_t" ) end )
498493
499- assert { :ok , % { num_rows: 4 } } =
500- parameterize_query (
501- ctx ,
502- "insert into fixed_string_t(a) format RowBinary" ,
503- [
504- [ "" ] ,
505- [ "a" ] ,
506- [ "aa" ] ,
507- [ "aaa" ]
508- ] ,
509- types: [ "FixedString(3)" ]
510- )
494+ parameterize_query (
495+ ctx ,
496+ "insert into fixed_string_t(a) format RowBinary" ,
497+ [
498+ [ "" ] ,
499+ [ "a" ] ,
500+ [ "aa" ] ,
501+ [ "aaa" ]
502+ ] ,
503+ types: [ "FixedString(3)" ]
504+ )
511505
512506 assert parameterize_query! ( ctx , "select * from fixed_string_t" ) . rows == [
513507 [ << 0 , 0 , 0 >> ] ,
@@ -541,17 +535,16 @@ defmodule Ch.ConnectionTest do
541535 parameterize_query! ( ctx , "create table decimal_t(d Decimal32(4)) engine = Memory" )
542536 on_exit ( fn -> Ch.Test . query ( "drop table decimal_t" ) end )
543537
544- assert % { num_rows: 3 } =
545- parameterize_query! (
546- ctx ,
547- "insert into decimal_t(d) format RowBinary" ,
548- _rows = [
549- [ Decimal . new ( "2.66" ) ] ,
550- [ Decimal . new ( "2.6666" ) ] ,
551- [ Decimal . new ( "2.66666" ) ]
552- ] ,
553- types: [ "Decimal32(4)" ]
554- )
538+ parameterize_query! (
539+ ctx ,
540+ "insert into decimal_t(d) format RowBinary" ,
541+ _rows = [
542+ [ Decimal . new ( "2.66" ) ] ,
543+ [ Decimal . new ( "2.6666" ) ] ,
544+ [ Decimal . new ( "2.66666" ) ]
545+ ] ,
546+ types: [ "Decimal32(4)" ]
547+ )
555548
556549 assert parameterize_query! ( ctx , "select * from decimal_t" ) . rows == [
557550 [ Decimal . new ( "2.6600" ) ] ,
@@ -852,16 +845,14 @@ defmodule Ch.ConnectionTest do
852845 parameterize_query! ( ctx , "CREATE TABLE tuples_t (`a` Tuple(String, Int64)) ENGINE = Memory" )
853846 on_exit ( fn -> Ch.Test . query ( "DROP TABLE tuples_t" ) end )
854847
855- assert % { num_rows: 2 } =
856- parameterize_query! ( ctx , "INSERT INTO tuples_t VALUES (('y', 10)), (('x',-10))" )
848+ parameterize_query! ( ctx , "INSERT INTO tuples_t VALUES (('y', 10)), (('x',-10))" )
857849
858- assert % { num_rows: 2 } =
859- parameterize_query! (
860- ctx ,
861- "INSERT INTO tuples_t FORMAT RowBinary" ,
862- _rows = [ [ { "a" , 20 } ] , [ { "b" , 30 } ] ] ,
863- types: [ "Tuple(String, Int64)" ]
864- )
850+ parameterize_query! (
851+ ctx ,
852+ "INSERT INTO tuples_t FORMAT RowBinary" ,
853+ _rows = [ [ { "a" , 20 } ] , [ { "b" , 30 } ] ] ,
854+ types: [ "Tuple(String, Int64)" ]
855+ )
865856
866857 assert parameterize_query! ( ctx , "SELECT a FROM tuples_t ORDER BY a.1 ASC" ) . rows == [
867858 [ { "a" , 20 } ] ,
@@ -1341,13 +1332,12 @@ defmodule Ch.ConnectionTest do
13411332 parameterize_query ( ctx , "SELECT n FROM nullable" )
13421333
13431334 # weird thing about nullables is that, similar to bool, in binary format, any byte larger than 0 is `null`
1344- assert { :ok , % { num_rows: 5 } } =
1345- parameterize_query (
1346- ctx ,
1347- "insert into nullable format RowBinary" ,
1348- << 1 , 2 , 3 , 4 , 5 >> ,
1349- encode: false
1350- )
1335+ parameterize_query (
1336+ ctx ,
1337+ "insert into nullable format RowBinary" ,
1338+ << 1 , 2 , 3 , 4 , 5 >> ,
1339+ encode: false
1340+ )
13511341
13521342 assert % { num_rows: 1 , rows: [ [ count ] ] } =
13531343 parameterize_query! ( ctx , "select count(*) from nullable where n is null" )
@@ -1815,7 +1805,11 @@ defmodule Ch.ConnectionTest do
18151805 ]
18161806 ]
18171807
1818- assert { :ok , % { num_rows: 1 } } = parameterize_query ( ctx , stmt , rows , opts )
1808+ parameterize_query ( ctx , stmt , rows , opts )
1809+
1810+ assert parameterize_query! ( ctx , "select * from row_binary_names_and_types_t" ) . rows == [
1811+ [ "AB" , "rare" , - 42 ]
1812+ ]
18191813 end
18201814
18211815 test "select with lots of columns" , ctx do
0 commit comments