Next: , Previous: , Up: SXEmacs PostgreSQL libpq API   [Contents][Index]


61.2.6 Other libpq Functions

Function: pq-finish conn

Destroy a database connection object by calling free on it. conn a database connection object

It is possible to not call this routine because the usual SXEmacs garbage collection mechanism will call the underlying libpq routine whenever it is releasing stale PGconn objects. However, this routine is useful in unwind-protect clauses to make connections go away quickly when unrecoverable errors have occurred.

After calling this routine, the printed representation of the SXEmacs wrapper object will contain the string “DEAD”.

Function: pq-client-encoding conn

Return the client encoding as an integer code. conn a database connection object

(pq-client-encoding P)
     ⇒ 1

Compatibility note: This function did not exist prior to libpq-7.0 and does not exist in a non-Mule SXEmacs.

Function: pq-set-client-encoding conn encoding

Set client coding system. conn a database connection object encoding a string representing the desired coding system

(pq-set-client-encoding P "EUC_JP")
     ⇒ 0

The current idiom for ensuring proper coding system conversion is the following (illustrated for EUC Japanese encoding):

(setq P (pq-connectdb "..."))
(let ((file-name-coding-system 'euc-jp)
      (pg-coding-system 'euc-jp))
  (pq-set-client-encoding "EUC_JP")
  ...)
(pq-finish P)

Compatibility note: This function did not exist prior to libpq-7.0 and does not exist in a non-Mule SXEmacs.

Function: pq-env-2-encoding

Return the integer code representing the coding system in PGCLIENTENCODING.

(pq-env-2-encoding)
     ⇒ 0

Compatibility note: This function did not exist prior to libpq-7.0 and does not exist in a non-Mule SXEmacs.

Function: pq-clear res

Destroy a query result object by calling free() on it. res a query result object

Note: The memory allocation systems of libpq and SXEmacs are different. The SXEmacs representation of a query result object will have both the SXEmacs version and the libpq version freed at the next garbage collection when the object is no longer being referenced. Calling this function does not release the SXEmacs object, it is still subject to the usual rules for Lisp objects. The printed representation of the SXEmacs object will contain the string “DEAD” after this routine is called indicating that it is no longer useful for anything.

Function: pq-conn-defaults

Return a data structure that represents the connection defaults. The data is returned as a list of lists, where each sublist contains info regarding a single option.


Next: , Previous: , Up: SXEmacs PostgreSQL libpq API   [Contents][Index]