Struct libpq::connection::Connection [−][src]
pub struct Connection { /* fields omitted */ }
Implementations
impl Connection
impl Connection
pub fn send_query(&self, command: &str) -> Result<(), String>
pub fn send_query(&self, command: &str) -> Result<(), String>
Submits a command to the server without waiting for the result(s).
See PQsendQuery.
Submits a command and separate parameters to the server without waiting for the result(s).
See PQsendQueryParams.
Sends a request to create a prepared statement with the given parameters, without waiting for completion.
See PQsendPrepare.
Sends a request to execute a prepared statement with given parameters, without waiting for the result(s).
See PQsendQueryPrepared.
Submits a request to obtain information about the specified prepared statement, without waiting for completion.
See PQsendDescribePortal.
Submits a request to obtain information about the specified portal, without waiting for completion.
See PQsendDescribePortal.
Waits for the next result a prior send_*
call, and returns it.
See PQgetResult.
pub fn consume_input(&self) -> Result<(), String>
pub fn consume_input(&self) -> Result<(), String>
If input is available from the server, consume it.
See PQconsumeInput.
Returns true
if a command is busy, that is, Result
would block waiting for input.
See PQisBusy.
pub fn set_non_blocking(&self, non_blocking: bool) -> Result<(), ()>
pub fn set_non_blocking(&self, non_blocking: bool) -> Result<(), ()>
Sets the nonblocking status of the connection.
See PQsetnonblocking.
pub fn is_non_blocking(&self) -> bool
pub fn is_non_blocking(&self) -> bool
Returns the blocking status of the database connection.
See PQisnonblocking.
impl Connection
impl Connection
Creates a data structure containing the information needed to cancel a command issued through a particular database connection.
See PQgetCancel.
impl Connection
impl Connection
Makes a new connection to the database server.
See PQconnectdb.
Makes a new connection to the database server.
See PQconnectdbParams.
Make a connection to the database server in a nonblocking manner.
See PQconnectStart.
Make a connection to the database server in a nonblocking manner.
See PQconnectStartParams.
Makes a new connection to the database server.
See PQsetdb.
Makes a new connection to the database server.
See PQsetdbLogin.
See PQconnectPoll.
pub fn reset_start(&self)
pub fn reset_start(&self)
Reset the communication channel to the server, in a nonblocking manner.
See PQresetStart.
pub fn reset_poll(&self) -> Status
pub fn reset_poll(&self) -> Status
See PQresetPoll.
Reports the status of the server.
It accepts connection parameters identical to those of libpq::Connection::with_params
. It
is not necessary to supply correct user name, password, or database name values to obtain
the server status; however, if incorrect values are provided, the server will log a failed
connection attempt.
See PQpingParams.
Reports the status of the server.
It accepts connection parameters identical to those of libpq::Connection::new
. It is not
necessary to supply correct user name, password, or database name values to obtain the
server status; however, if incorrect values are provided, the server will log a failed
connection attempt.
See PQping.
Return the connection options used for the connection
See PQconninfo.
impl Connection
impl Connection
pub fn client_encoding(&self) -> Encoding
pub fn client_encoding(&self) -> Encoding
Returns the client encoding.
See PQclientEncoding.
pub fn set_client_encoding(&self, encoding: Encoding)
pub fn set_client_encoding(&self, encoding: Encoding)
Sets the client encoding.
See PQsetClientEncoding.
pub fn set_error_verbosity(&self, verbosity: Verbosity) -> Verbosity
pub fn set_error_verbosity(&self, verbosity: Verbosity) -> Verbosity
Determines the verbosity of messages returned by libpq::Connection::error_message
and
libpq::Result::error_message
.
See PQsetErrorVerbosity.
impl Connection
impl Connection
Sends data to the server during libpq::Status::CopyIn
state.
See PQputCopyData.
Sends end-of-data indication to the server during libpq::Status::CopyIn
state.
See PQputCopyEnd.
impl Connection
impl Connection
Submits a command to the server and waits for the result.
See PQexec.
Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.
See PQexecParams.
Submits a request to create a prepared statement with the given parameters, and waits for completion.
See PQprepare.
Sends a request to execute a prepared statement with given parameters, and waits for the result.
See PQexecPrepared.
pub fn describe_prepared(&self, name: Option<&str>) -> Result
pub fn describe_prepared(&self, name: Option<&str>) -> Result
Submits a request to obtain information about the specified prepared statement, and waits for completion.
See PQdescribePrepared.
pub fn describe_portal(&self, name: Option<&str>) -> Result
pub fn describe_portal(&self, name: Option<&str>) -> Result
Submits a request to obtain information about the specified portal, and waits for completion.
See PQdescribePortal.
pub fn escape_literal(&self, str: &str) -> Result<String, String>
pub fn escape_literal(&self, str: &str) -> Result<String, String>
Escape a string for use within an SQL command.
See PQescapeLiteral.
pub fn escape_identifier(&self, str: &str) -> Result<String, String>
pub fn escape_identifier(&self, str: &str) -> Result<String, String>
Escapes a string for use as an SQL identifier, such as a table, column, or function name.
See PQescapeIdentifier.
pub fn escape_string(&self, from: &str) -> Result<String, String>
pub fn escape_string(&self, from: &str) -> Result<String, String>
Escape string literals, much like libpq::Connection::literal
.
See PQescapeStringConn.
Escapes binary data for use within an SQL command with the type bytea.
See PQescapeByteaConn.
impl Connection
impl Connection
pub unsafe fn set_notice_processor(
&self,
proc: NoticeProcessor,
arg: *mut c_void
) -> NoticeProcessor
pub unsafe fn set_notice_processor(
&self,
proc: NoticeProcessor,
arg: *mut c_void
) -> NoticeProcessor
Safety
This function takes a void*
pointer as argument.
pub unsafe fn set_notice_receiver(
&self,
proc: NoticeReceiver,
arg: *mut c_void
) -> NoticeReceiver
pub unsafe fn set_notice_receiver(
&self,
proc: NoticeReceiver,
arg: *mut c_void
) -> NoticeReceiver
Safety
This function takes a void*
pointer as argument.
impl Connection
impl Connection
impl Connection
impl Connection
pub fn set_single_row_mode(&self) -> Result<(), ()>
pub fn set_single_row_mode(&self) -> Result<(), ()>
Select single-row mode for the currently-executing query.
See PQsetSingleRowMode.
impl Connection
impl Connection
pub fn init_openssl(do_ssl: bool, do_crypto: bool)
pub fn init_openssl(do_ssl: bool, do_crypto: bool)
Allows applications to select which security libraries to initialize.
See PQinitOpenSSL.
impl Connection
impl Connection
Returns the server host name of the active connection.
This can be a host name, an IP address, or a directory path if the connection is via Unix socket. (The path case can be distinguished because it will always be an absolute path, beginning with /.)
See PQhost.
👎 Deprecated: the server no longer pays attention to the TTY setting, but the function remains for backward compatibility.
the server no longer pays attention to the TTY setting, but the function remains for backward compatibility.
Returns the debug TTY of the connection.
See PQtty.
Returns the command-line options passed in the connection request.
See PQoptions.
pub fn transaction_status(&self) -> Status
pub fn transaction_status(&self) -> Status
Returns the current in-transaction status of the server.
See PQtransactionStatus.
pub fn parameter_status(&self, param: &str) -> String
pub fn parameter_status(&self, param: &str) -> String
Looks up a current parameter setting of the server.
See PQparameterStatus.
pub fn protocol_version(&self) -> i32
pub fn protocol_version(&self) -> i32
Interrogates the frontend/backend protocol being used.
See PQprotocolVersion.
pub fn server_version(&self) -> i32
pub fn server_version(&self) -> i32
Returns an integer representing the server version.
See PQserverVersion.
pub fn error_message(&self) -> Option<String>
pub fn error_message(&self) -> Option<String>
Returns the error message most recently generated by an operation on the connection.
See PQerrorMessage.
Obtains the file descriptor number of the connection socket to the server.
See PQsocket.
pub fn backend_pid(&self) -> u32
pub fn backend_pid(&self) -> u32
Returns the process ID (PID) of the backend process handling this connection.
See PQbackendPID.
pub fn needs_password(&self) -> bool
pub fn needs_password(&self) -> bool
Returns true
if the connection authentication method required a password, but none was
available. Returns false
if not.
pub fn used_password(&self) -> bool
pub fn used_password(&self) -> bool
Returns true
if the connection authentication method used a password. Returns false
if
not.
pub fn ssl_in_use(&self) -> bool
pub fn ssl_in_use(&self) -> bool
Returns true
if the connection uses SSL, false
if not.
See PQsslInUse.
pub fn ssl_attribute(&self, attribute: Attribute) -> Option<String>
pub fn ssl_attribute(&self, attribute: Attribute) -> Option<String>
Returns SSL-related information about the connection.
See PQsslAttribute.
pub fn ssl_attribute_names(&self) -> Vec<Attribute>
pub fn ssl_attribute_names(&self) -> Vec<Attribute>
Return an array of SSL attribute names available.
See PQsslAttributeNames.
pub unsafe fn ssl_struct(&self, struct_name: &str) -> *const c_void
pub unsafe fn ssl_struct(&self, struct_name: &str) -> *const c_void
Return a pointer to an SSL-implementation-specific object describing the connection.
See PQsslStruct.
Safety
This function returns a void*
pointer.
impl Connection
impl Connection
pub fn is_thread_safe() -> bool
pub fn is_thread_safe() -> bool
Returns the thread safety status of the libpq library.
See PQisthreadsafe.
impl Connection
impl Connection
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Connection
impl !Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations
Mutably borrows from an owned value. Read more