@@ -302,6 +302,7 @@ impl Client {
302
302
///
303
303
/// The `query` argument can either be a `Statement`, or a raw query string. The data in the provided reader is
304
304
/// passed along to the server verbatim; it is the caller's responsibility to ensure it uses the proper format.
305
+ /// PostgreSQL does not support parameters in `COPY` statements, so this method does not take any.
305
306
///
306
307
/// The copy *must* be explicitly completed via the `finish` method. If it is not, the copy will be aborted.
307
308
///
@@ -314,27 +315,24 @@ impl Client {
314
315
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
315
316
/// let mut client = Client::connect("host=localhost user=postgres", NoTls)?;
316
317
///
317
- /// let mut writer = client.copy_in("COPY people FROM stdin", &[] )?;
318
+ /// let mut writer = client.copy_in("COPY people FROM stdin")?;
318
319
/// writer.write_all(b"1\tjohn\n2\tjane\n")?;
319
320
/// writer.finish()?;
320
321
/// # Ok(())
321
322
/// # }
322
323
/// ```
323
- pub fn copy_in < T > (
324
- & mut self ,
325
- query : & T ,
326
- params : & [ & ( dyn ToSql + Sync ) ] ,
327
- ) -> Result < CopyInWriter < ' _ > , Error >
324
+ pub fn copy_in < T > ( & mut self , query : & T ) -> Result < CopyInWriter < ' _ > , Error >
328
325
where
329
326
T : ?Sized + ToStatement ,
330
327
{
331
- let sink = self . runtime . block_on ( self . client . copy_in ( query, params ) ) ?;
328
+ let sink = self . runtime . block_on ( self . client . copy_in ( query) ) ?;
332
329
Ok ( CopyInWriter :: new ( & mut self . runtime , sink) )
333
330
}
334
331
335
332
/// Executes a `COPY TO STDOUT` statement, returning a reader of the resulting data.
336
333
///
337
- /// The `query` argument can either be a `Statement`, or a raw query string.
334
+ /// The `query` argument can either be a `Statement`, or a raw query string. PostgreSQL does not support parameters
335
+ /// in `COPY` statements, so this method does not take any.
338
336
///
339
337
/// # Examples
340
338
///
@@ -345,21 +343,17 @@ impl Client {
345
343
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
346
344
/// let mut client = Client::connect("host=localhost user=postgres", NoTls)?;
347
345
///
348
- /// let mut reader = client.copy_out("COPY people TO stdout", &[] )?;
346
+ /// let mut reader = client.copy_out("COPY people TO stdout")?;
349
347
/// let mut buf = vec![];
350
348
/// reader.read_to_end(&mut buf)?;
351
349
/// # Ok(())
352
350
/// # }
353
351
/// ```
354
- pub fn copy_out < T > (
355
- & mut self ,
356
- query : & T ,
357
- params : & [ & ( dyn ToSql + Sync ) ] ,
358
- ) -> Result < CopyOutReader < ' _ > , Error >
352
+ pub fn copy_out < T > ( & mut self , query : & T ) -> Result < CopyOutReader < ' _ > , Error >
359
353
where
360
354
T : ?Sized + ToStatement ,
361
355
{
362
- let stream = self . runtime . block_on ( self . client . copy_out ( query, params ) ) ?;
356
+ let stream = self . runtime . block_on ( self . client . copy_out ( query) ) ?;
363
357
CopyOutReader :: new ( & mut self . runtime , stream)
364
358
}
365
359
0 commit comments