pub struct PgConn {
pub(crate) conn: *mut PGconn,
}Fields§
§conn: *mut PGconnImplementations§
Source§impl PgConn
impl PgConn
Sourcepub fn connect_db_env_vars() -> Result<PgConn, NulError>
pub fn connect_db_env_vars() -> Result<PgConn, NulError>
Connect to the database using environment variables.
See the official doc.
pub fn connect_db(s: &str) -> Result<PgConn, NulError>
pub fn status(&self) -> ConnStatusType
pub fn exec(&self, query: &str) -> Result<PgResult, NulError>
pub fn exec_file(&self, file_path: &str) -> Result<PgResult, NulError>
Sourcepub fn exec_params(
&self,
query: &str,
param_values: &[Option<&str>],
) -> Result<PgResult, NulError>
pub fn exec_params( &self, query: &str, param_values: &[Option<&str>], ) -> Result<PgResult, NulError>
Submit a command along with parameters, and wait for the result. Parameters are
passed as text; a None value is sent as SQL NULL. param_types may be shorter
than param_values (or empty) to let the server infer unspecified types.
See the official doc.
Sourcepub fn prepare(
&self,
stmt_name: &str,
query: &str,
) -> Result<PgResult, NulError>
pub fn prepare( &self, stmt_name: &str, query: &str, ) -> Result<PgResult, NulError>
Submit a request to create a prepared statement, and wait for completion. See the official doc.
Sourcepub fn exec_prepared(
&self,
stmt_name: &str,
param_values: &[Option<&str>],
) -> Result<PgResult, NulError>
pub fn exec_prepared( &self, stmt_name: &str, param_values: &[Option<&str>], ) -> Result<PgResult, NulError>
Send a request to execute a prepared statement with given parameters, and wait for
the result. Parameters are passed as text; a None value is sent as SQL NULL.
See the official doc.
Sourcepub fn describe_prepared(&self, stmt_name: &str) -> Result<PgResult, NulError>
pub fn describe_prepared(&self, stmt_name: &str) -> Result<PgResult, NulError>
Submit a request to obtain information about the specified prepared statement, and wait for completion. See the official doc.
Sourcepub fn describe_portal(&self, portal_name: &str) -> Result<PgResult, NulError>
pub fn describe_portal(&self, portal_name: &str) -> Result<PgResult, NulError>
Submit a request to obtain information about the specified portal, and wait for completion. See the official doc.
Sourcepub fn close_prepared(&self, stmt_name: &str) -> Result<PgResult, NulError>
pub fn close_prepared(&self, stmt_name: &str) -> Result<PgResult, NulError>
Submit a request to close the specified prepared statement, and wait for completion. See the official doc.
pub fn trace(&mut self, file: &str)
pub fn untrace(&mut self)
pub fn socket(&self) -> PgSocket
pub fn consume_input(&mut self) -> Result<(), String>
pub fn notifies(&mut self) -> Option<PgNotify>
pub fn error_message(&self) -> String
pub fn notify( &mut self, channel: &str, payload: Option<&str>, ) -> Result<PgResult, NulError>
pub fn listen(&mut self, channel: &str) -> Result<PgResult, NulError>
Sourcepub(crate) extern "C" fn ffi_notice_processor<F>(
arg: *mut c_void,
data: *const c_char,
)
pub(crate) extern "C" fn ffi_notice_processor<F>( arg: *mut c_void, data: *const c_char, )
A callback function to receive notices from the server. https://stackoverflow.com/questions/24191249/working-with-c-void-in-an-ffi https://adventures.michaelfbryan.com/posts/rust-closures-in-ffi/
pub fn set_notice_processor<F>(&mut self, proc: F) -> Box<F>
pub(crate) extern "C" fn ffi_notice_receiver<F>( arg: *mut c_void, data: *const PGresult, )
Sourcepub fn set_notice_receiver<F>(&mut self, proc: F) -> Box<F>
pub fn set_notice_receiver<F>(&mut self, proc: F) -> Box<F>
Sets a notice receiver function to receive notices from the server. Notices are sent to the receiver after command execution is completed. https://www.postgresql.org/docs/current/libpq-notice-processing.html