]> begriffs open source - ai-pg/blob - full-docs/txt/ecpg-library.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / ecpg-library.txt
1
2 34.11. Library Functions #
3
4    The libecpg library primarily contains “hidden” functions that are used
5    to implement the functionality expressed by the embedded SQL commands.
6    But there are some functions that can usefully be called directly. Note
7    that this makes your code unportable.
8      * ECPGdebug(int on, FILE *stream) turns on debug logging if called
9        with the first argument non-zero. Debug logging is done on stream.
10        The log contains all SQL statements with all the input variables
11        inserted, and the results from the PostgreSQL server. This can be
12        very useful when searching for errors in your SQL statements.
13
14 Note
15        On Windows, if the ecpg libraries and an application are compiled
16        with different flags, this function call will crash the application
17        because the internal representation of the FILE pointers differ.
18        Specifically, multithreaded/single-threaded, release/debug, and
19        static/dynamic flags should be the same for the library and all
20        applications using that library.
21      * ECPGget_PGconn(const char *connection_name) returns the library
22        database connection handle identified by the given name. If
23        connection_name is set to NULL, the current connection handle is
24        returned. If no connection handle can be identified, the function
25        returns NULL. The returned connection handle can be used to call
26        any other functions from libpq, if necessary.
27
28 Note
29        It is a bad idea to manipulate database connection handles made
30        from ecpg directly with libpq routines.
31      * ECPGtransactionStatus(const char *connection_name) returns the
32        current transaction status of the given connection identified by
33        connection_name. See Section 32.2 and libpq's PQtransactionStatus
34        for details about the returned status codes.
35      * ECPGstatus(int lineno, const char* connection_name) returns true if
36        you are connected to a database and false if not. connection_name
37        can be NULL if a single connection is being used.