@@ -48,7 +48,7 @@ fn spi_return_query() -> Result<
4848
4949 Spi :: connect ( |client| {
5050 client
51- . select ( query, None , None ) ?
51+ . select ( query, None , & [ ] ) ?
5252 . map ( |row| Ok ( ( row[ "oid" ] . value ( ) ?, row[ 2 ] . value ( ) ?) ) )
5353 . collect :: < Result < Vec < _ > , _ > > ( )
5454 } )
@@ -62,21 +62,14 @@ fn spi_query_random_id() -> Result<Option<i64>, pgrx::spi::Error> {
6262
6363#[ pg_extern]
6464fn spi_query_title ( title : & str ) -> Result < Option < i64 > , pgrx:: spi:: Error > {
65- Spi :: get_one_with_args (
66- "SELECT id FROM spi.spi_example WHERE title = $1;" ,
67- vec ! [ ( PgBuiltInOids :: TEXTOID . oid( ) , title. into_datum( ) ) ] ,
68- )
65+ Spi :: get_one_with_args ( "SELECT id FROM spi.spi_example WHERE title = $1;" , & [ title. into ( ) ] )
6966}
7067
7168#[ pg_extern]
7269fn spi_query_by_id ( id : i64 ) -> Result < Option < String > , spi:: Error > {
7370 let ( returned_id, title) = Spi :: connect ( |client| {
7471 let tuptable = client
75- . select (
76- "SELECT id, title FROM spi.spi_example WHERE id = $1" ,
77- None ,
78- Some ( vec ! [ ( PgBuiltInOids :: INT8OID . oid( ) , id. into_datum( ) ) ] ) ,
79- ) ?
72+ . select ( "SELECT id, title FROM spi.spi_example WHERE id = $1" , None , & [ id. into ( ) ] ) ?
8073 . first ( ) ;
8174
8275 tuptable. get_two :: < i64 , String > ( )
@@ -90,7 +83,7 @@ fn spi_query_by_id(id: i64) -> Result<Option<String>, spi::Error> {
9083fn spi_insert_title ( title : & str ) -> Result < Option < i64 > , spi:: Error > {
9184 Spi :: get_one_with_args (
9285 "INSERT INTO spi.spi_example(title) VALUES ($1) RETURNING id" ,
93- vec ! [ ( PgBuiltInOids :: TEXTOID . oid ( ) , title. into_datum ( ) ) ] ,
86+ & [ title. into ( ) ] ,
9487 )
9588}
9689
@@ -100,7 +93,7 @@ fn spi_insert_title2(
10093) -> TableIterator < ( name ! ( id, Option <i64 >) , name ! ( title, Option <String >) ) > {
10194 let tuple = Spi :: get_two_with_args (
10295 "INSERT INTO spi.spi_example(title) VALUES ($1) RETURNING id, title" ,
103- vec ! [ ( PgBuiltInOids :: TEXTOID . oid ( ) , title. into_datum ( ) ) ] ,
96+ & [ title. into ( ) ] ,
10497 )
10598 . unwrap ( ) ;
10699
@@ -110,7 +103,7 @@ fn spi_insert_title2(
110103#[ pg_extern]
111104fn issue1209_fixed ( ) -> Result < Option < String > , Box < dyn std:: error:: Error > > {
112105 let res = Spi :: connect ( |c| {
113- let mut cursor = c. open_cursor ( "SELECT 'hello' FROM generate_series(1, 10000)" , None ) ;
106+ let mut cursor = c. try_open_cursor ( "SELECT 'hello' FROM generate_series(1, 10000)" , & [ ] ) ? ;
114107 let table = cursor. fetch ( 10000 ) ?;
115108 table. into_iter ( ) . map ( |row| row. get :: < & str > ( 1 ) ) . collect :: < Result < Vec < _ > , _ > > ( )
116109 } ) ?;
0 commit comments