randolf.ca
1.00
Randolf Richardson's C++ classes
|
The result class is an object-oriented interface to the PostgreSQL C library API's PGresult structure. More...
#include <pq/result>
Public Member Functions | |
result (PGresult *pg_result) | |
Constructor. | |
~result () noexcept | |
Destructor, which automatically performs the following actions once the instantiated object of this class goes out of scope: | |
PGresult * | _handle (const bool handover=false) noexcept |
Obtain the underlying PostgreSQL query result handle. | |
PGresult * | _to_strict (const bool strict=false) noexcept |
Whether to only convert binary data type sizes that match exactly in methods with names beginning with to_ (when strict mode is enabled, to_int will only interpret binary data that is exactly 4 bytes, and will reject binary data that's less than 4 bytes instead of converting it). | |
char * | at (const int col) |
Obtain column data. | |
char * | at (const int row, const int col) |
Obtain column data. | |
bool | binaryTuples () noexcept |
Find out whether all columns contain binary data. | |
char * | cmdStatus () |
Obtain the command status tag from the SQL command that generated this result. | |
char * | cmdTuples () |
Obtain the number of rows affected by the SQL command. | |
int | cmdTuples_stoi () |
Obtain the number of rows affected by the SQL command. | |
long | cmdTuples_stol () |
Obtain the number of rows affected by the SQL command. | |
long long | cmdTuples_stoll () |
Obtain the number of rows affected by the SQL command. | |
const char * | col_name (const int col) |
Obtain the name of a specific column (field). | |
uint | current () |
Obtain the current row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
result & | current (const int row) |
Specify the current row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
int | fformat (const int col) |
Obtain the format code indicating the format of the given column. | |
result & | first () |
Change the current row to the first valid row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
int | fmod (const int col) |
Obtain the type modifier of the column associated with the given column number. | |
int | fsize (const int col) |
Obtain the size in bytes of the column associated with the given column number as it is stored internally in the database. | |
Oid | ftable (const int col) |
Obtain the OID of the table from which the given column was fetched. | |
uint | ftablecol (const int col) |
Obtain the column number (within its table) of the column making up the result column. | |
Oid | ftype (const int col) |
Obtain the OID of the data type associated with the given column number. | |
bool | getisnull (const int col) |
Find out whether the current row's specified column is NULL in the database. | |
bool | getisnull (const int row, const int col) |
Find out whether the specified row and column is NULL in the database. | |
size_t | getlength (const int row, const int col) |
Obtain the length of the data at the specified row and column. | |
char * | getvalue (const int row, const int col) |
Obtain column data. | |
result & | last () |
Change the current row to the last valid row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
bool | next () |
Increment the current row number to the next row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
uint | nfields () |
Obtain the total number of columns (fields). | |
uint | nparams () |
Obtain the total number of parameters of the prepared statement that this result manifested from. | |
uint | ntuples () |
Obtain the total number of rows (tuples). | |
char * | oidStatus () |
Obtain the OID of the inserted row in the form of an ASCIIZ string. | |
Oid | oidValue () |
Obtain the OID of the inserted row, if the SQL command was an INSERT that inserted exactly one row into a table that has OIDs, or an EXECUTE of a prepared query containing a suitable INSERT statement. | |
result & | operator= (const result &source) |
Copy-operator. | |
Oid | paramtype (const int parameter) |
Obtain the OID of the data type of the given statement parameter. | |
bool | prev () |
Decrement the current row number to the previous row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number. | |
result & | print (FILE *fout, const PQprintOpt *po) |
Prints out all the rows and, optionally, the column names to the specified output stream. | |
char * | resultErrorField (const int field_code) |
Returns an individual field of an error report. | |
char * | resultErrorMessage () |
Returns the error message associated with the most recent command, or an empty string if there was no error. | |
ExecStatusType | resultStatus () |
Returns the result status of the most recent command, which will be one of the following values: | |
char * | resultVerboseErrorMessage (const PGVerbosity verbosity, const PGContextVisibility show_context) |
Returns a reformatted version of the error message associated with this result, which contains more detail than usual. | |
bool | to_bool (const int col, const std::optional< const bool > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
char | to_char (const int col, const std::optional< const char > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
const char * | to_cstr (const int col, const std::optional< const char * > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
double | to_double (const int col, const std::optional< const double > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
float | to_float (const int col, const std::optional< const float > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
int32_t | to_int (const int col, const std::optional< const int32_t > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
int64_t | to_long (const int col, const std::optional< const int64_t > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
int16_t | to_short (const int col, const std::optional< const int16_t > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
std::string | to_string (const int col, const std::optional< const std::string > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
std::string_view | to_string_view (const int col, const std::optional< const std::string_view > null_fallback={}) |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported). | |
Static Public Member Functions | |
static char * | resStatus (const ExecStatusType status) |
Converts the enumerated type returned by the resultStatus method into a string constant describing the status code. (The caller must not free the result.) | |
The result class is an object-oriented interface to the PostgreSQL C library API's PGresult structure.
An ASCIIZ string is a C-string (char* array) that includes a terminating null (0) character at the end.
I use the term "ASCIIZ string" to indicate an array of characters that's terminated by a 0 (a.k.a., null). Although this is very much the same as a C-string, the difference is that in many API functions a C-string must often be accompanied by its length value. When referring to an ASCIIZ string, I'm intentionally indicating that the length of the string is not needed because the string is null-terminated. (This term was also commonly used in assembly language programming in the 1970s, 1980s, and 1990s, and as far as I know is still used by machine language programmers today.)
Parameter stacking is also supported (with methods that return result&
).
|
inline |
Constructor.
pg_result | Pointer to PGresult structure |
|
inlinenoexcept |
Destructor, which automatically performs the following actions once the instantiated object of this class goes out of scope:
Copy-operator.
handover
flag in the source will be set, even though the source
reference is passed in as a as a constant. (The only exception to this occurs when the source is the same object, in which case no copy will be performed since it's also not necessary.) source | Same class, but a different object |
|
inlinenoexcept |
Obtain the underlying PostgreSQL query result handle.
This is primarily needed for utilizing functionality from the PostgreSQL C programming API directly.
PGresult
handle automatically (unless the handover
flag is set). libpq
handover | Whether to prevent destructor invalidation of the underlying handle TRUE = prevent destructor invalidation FALSE = don't prevent destructor invalidation (default) |
|
inlinenoexcept |
Whether to only convert binary data type sizes that match exactly in methods with names beginning with to_
(when strict mode is enabled, to_int will only interpret binary data that is exactly 4 bytes, and will reject binary data that's less than 4 bytes instead of converting it).
This setting has no effect on strings.
strict | TRUE = reject binary type sizes that don't match the data type FALSE = accpet binary type sizes that are shorter than the data type (this is the default behaviour) |
|
inline |
|
inline |
Obtain column data.
pq::pq_position_error | If the row or column number is out of range |
row | Row number (0 = first row; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlinenoexceptLIBPQ |
Find out whether all columns contain binary data.
COPY
), because it is possible for a single PGresult
to contain text data in some columns and binary data in others; fformat is preferred. TRUE
= all columns are binary (a.k.a., format 1) FALSE
= at least one column contains non-binary/text data
|
inlineLIBPQ |
Obtain the command status tag from the SQL command that generated this result.
|
inlineLIBPQ |
Obtain the number of rows affected by the SQL command.
SELECT
, CREATE TABLE AS
, INSERT
, UPDATE
, DELETE
, MERGE
, MOVE
, FETCH
, or COPY
statement, or an EXECUTE
of a prepared query that contains an INSERT
, UPDATE
, DELETE
, or MERGE
statement; if the command that generated this result was anything else, and empty string will be returned.
|
inline |
Obtain the number of rows affected by the SQL command.
SELECT
, CREATE TABLE AS
, INSERT
, UPDATE
, DELETE
, MERGE
, MOVE
, FETCH
, or COPY
statement, or an EXECUTE
of a prepared query that contains an INSERT
, UPDATE
, DELETE
, or MERGE
statement; if the command that generated this result was anything else -1 will be returned. -1
= value exceeds LONG_MAX
-2
= non-numeric value returned
|
inline |
Obtain the number of rows affected by the SQL command.
SELECT
, CREATE TABLE AS
, INSERT
, UPDATE
, DELETE
, MERGE
, MOVE
, FETCH
, or COPY
statement, or an EXECUTE
of a prepared query that contains an INSERT
, UPDATE
, DELETE
, or MERGE
statement; if the command that generated this result was anything else -1 will be returned. -1
= value exceeds LONG_MAX
-2
= non-numeric value returned
|
inline |
Obtain the number of rows affected by the SQL command.
SELECT
, CREATE TABLE AS
, INSERT
, UPDATE
, DELETE
, MERGE
, MOVE
, FETCH
, or COPY
statement, or an EXECUTE
of a prepared query that contains an INSERT
, UPDATE
, DELETE
, or MERGE
statement; if the command that generated this result was anything else -1 will be returned. -1
= value exceeds LONG_MAX
-2
= non-numeric value returned
|
inline |
Obtain the name of a specific column (field).
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inline |
|
inline |
Specify the current row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number.
row | Row number (0 = first row; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inline |
Change the current row to the first valid row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number.
If there are no rows, then the current row will be set to -1
.
|
inlineLIBPQ |
Obtain the format code indicating the format of the given column.
pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column (PQfformat doesn't return a different error code when an out-of-range column is specified, so we perform an additional check for this beforehand.) |
0
= textual data representation1
= binary data representationcol | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the type modifier of the column associated with the given column number.
pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column (PQfmod doesn't return a different error code when an out-of-range column is specified, so we perform an additional check for this beforehand.) |
n
= type modifier-1
= indicates "no information available" (typically because most types do not use modifiers) col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the size in bytes of the column associated with the given column number as it is stored internally in the database.
pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column (PQfsize doesn't return a different error code when an out-of-range column is specified, so we perform an additional check for this beforehand.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the OID of the table from which the given column was fetched.
pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the column number (within its table) of the column making up the result column.
pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column |
col | Table Column number (1 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the OID of the data type associated with the given column number.
pg_type
to obtain the names and properties of the various data types. The OIDs of the built-in data types are defined in the file catalog/pg_type_d.h
(which can be found in the PostgreSQL installation's include/
directory). pq::pq_position_error | If the column number is out of range, or if the specified column is not a simple reference to a table column (PQftype doesn't return a different error code when an out-of-range column is specified, so we perform an additional check for this beforehand.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inline |
Find out whether the current row's specified column is NULL in the database.
pq::pq_position_error | If the row or column number is out of range |
TRUE
= column is NULLFALSE
= column contains 0 or more bytes of data col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Find out whether the specified row and column is NULL in the database.
pq::pq_position_error | If the row or column number is out of range |
TRUE
= column is NULLFALSE
= column contains 0 or more bytes of data row | Row number (0 = first row; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain the length of the data at the specified row and column.
pq::pq_position_error | If the row or column number is out of range |
row | Row number (0 = first row; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inlineLIBPQ |
Obtain column data.
pq::pq_position_error | If the row or column number is out of range |
row | Row number (0 = first row; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inline |
Change the current row to the last valid row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number.
If no rows are available, then the current row will be set to -1
.
|
inline |
Increment the current row number to the next row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number.
If there are no more rows, then FALSE
is returned and the current row number will not be incremented beyond the total number of rows.
TRUE
= the current row was incremented to a valid row number FALSE
= the current row was incremented beyond the last valid row
|
inlineLIBPQ |
|
inlineLIBPQ |
Obtain the total number of parameters of the prepared statement that this result manifested from.
|
inlineLIBPQ |
Obtain the total number of rows (tuples).
|
inlineLIBPQ |
Obtain the OID of the inserted row in the form of an ASCIIZ string.
|
inlineLIBPQ |
Obtain the OID of the inserted row, if the SQL command was an INSERT
that inserted exactly one row into a table that has OIDs, or an EXECUTE
of a prepared query containing a suitable INSERT
statement.
Oid
of the inserted rowInvalidOid
= not an INSERT
statement, or the affected table does not contain OIDs
|
inlineLIBPQ |
Obtain the OID of the data type of the given statement parameter.
parameter | Parameter number (0 = first parameter; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
|
inline |
Decrement the current row number to the previous row (0 = first row), which is used in conjunction with methods that access data by column without also specifying a row number.
If there are no more rows, then FALSE
is returned and the current row number will not be decremented below -1
.
TRUE
= the current row was decremented to a valid row number FALSE
= the current row was decremented to -1
|
inlineLIBPQ |
Prints out all the rows and, optionally, the column names to the specified output stream.
psql
command-line shell to snd the query results to STDOUT
, but this is no longer the case. fout | Output stream handle |
po | Structure that provides additional parameters |
|
inlineLIBPQ |
Returns an individual field of an error report.
Field values will normally not include a trailing newline. (The caller must not free the result directly.)
The following field codes are available:
PG_DIAG_SEVERITY
ERROR
, FATAL
, or PANIC
(in an error message), or WARNING
, NOTICE
, DEBUG
, INFO
, or LOG
(in a notice message), or a localized translation of one of these. Always present. PG_DIAG_SEVERITY_NONLOCALIZED
ERROR
, FATAL
, or PANIC
(in an error message), or WARNING
, NOTICE
, DEBUG
, INFO
, or LOG
(in a notice message). This is identical to the PG_DIAG_SEVERITY
field except that the contents are never localized. This is present only in reports generated by PostgreSQL versions 9.6 and newer. PG_DIAG_SQLSTATE
SQLSTATE
code for the error. The SQLSTATE
code identifies the type of error that has occurred; it can be used by front-end applications to perform specific operations (such as error handling) in response to a particular database error. For a list of the possible SQLSTATE
codes, see Appendix A in the official PostgreSQL documentation. This field is not localizable, and is always present. PG_DIAG_MESSAGE_PRIMARY
PG_DIAG_MESSAGE_DETAIL
PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
1
, and positions are measured in characters (not bytes). PG_DIAG_INTERNAL_POSITION
PG_DIAG_STATEMENT_POSITION
field, but it is used when the cursor position refers to an internally generated command rather than the one submitted by the client. The PG_DIAG_INTERNAL_QUERY
field will always appear when this field appears. PG_DIAG_INTERNAL_QUERY
PG_DIAG_CONTEXT
PG_DIAG_SCHEMA_NAME
PG_DIAG_TABLE_NAME
PG_DIAG_COLUMN_NAME
PG_DIAG_DATATYPE_NAME
PG_DIAG_CONSTRAINT_NAME
PG_DIAG_SOURCE_FILE
PG_DIAG_SOURCE_LINE
PG_DIAG_SOURCE_FUNCTION
The client is responsible for formatting displayed information to meet its needs; in particular, it should break long lines as needed. Newline characters appearing in the error message fields should be treated as paragraph breaks, not line breaks.
Errors generated internally by libpq
will have severity and primary message, but typically no other fields.
result
objects, not connection objects; and there exists no errorField
method. pq_command_error | If this is not an error or warning result, or does not include the specified field |
field_code | Error field identifier |
|
inlineLIBPQ |
Returns the error message associated with the most recent command, or an empty string if there was no error.
If there was an error, the returned string will include a trailing newline. (The caller must not free the result directly.)
Immediately following the use of the connection::exec or connection::getResult methods, the connection::errorMessage method (on the connection object) will return the same string as this resultErrorMessage method (on the result). However, a result object will retain its error message until destroyed, whereas the connection's error message will change following subsequent operations.
Use resultErrorMessage when you want to know the status associated with a particular result; use connection::errorMessage when you want to know the status from the most recent operation on the connection.
|
inlinestaticLIBPQ |
Converts the enumerated type returned by the resultStatus method into a string constant describing the status code. (The caller must not free the result.)
ExecStatusType
status code, that was most likely returned by the resultStatus method status | Status code to enumerate |
|
inlineLIBPQ |
Returns the result status of the most recent command, which will be one of the following values:
PGRES_EMPTY_QUERY
PGRES_COMMAND_OK
PGRES_TUPLES_OK
SELECT
or SHOW
commands). PGRES_COPY_OUT
PGRES_COPY_IN
PGRES_BAD_RESPONSE
PGRES_NONFATAL_ERROR
PGRES_FATAL_ERROR
PGRES_COPY_BOTH
PGRES_SINGLE_TUPLE
PGRES_TUPLES_CHUNK
PGRES_PIPELINE_SYNC
PGRES_PIPELINE_ABORTED
PGRES_PIPELINE_SYNC
and normal processing can resume.If the result status is PGRES_TUPLES_OK
, PGRES_SINGLE_TUPLE
, or PGRES_TUPLES_CHUNK
, then some methods can be used to retrieve the rows returned by the query. Note that a SELECT
command that happens to retrieve zero rows still shows PGRES_TUPLES_OK
. Also, PGRES_COMMAND_OK
is for commands that can never return rows (INSERT
or UPDATE
without a RETURNING
clause, etc.). A response of PGRES_EMPTY_QUERY
might indicate a bug in the client software.
A result of status PGRES_NONFATAL_ERROR
will never be returned directly by connection::exec or other query execution functions; results of this kind are instead passed to the notice processor (see Section 32.13 of the official PostgreSQL documentation).
|
inlineLIBPQ |
Returns a reformatted version of the error message associated with this result, which contains more detail than usual.
pq_command_error | If insufficient memory |
verbosity | Verbosity level |
show_context | Context visibility setting |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
Do not attempt to free the data the returned pointer addresses because it's part of a larger structure that is managed by this class's destructor.
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
std::invalid_argument | If the column data could not be converted (e.g., text contained invalid characters) |
std::out_of_range | If the column data could not be converted because it is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
std::invalid_argument | If the column data could not be converted (e.g., text contained invalid characters) |
std::out_of_range | If the column data could not be converted because it is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
std::invalid_argument | If the column data could not be converted (e.g., text contained invalid characters) |
std::out_of_range | If the column data could not be converted because it is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
std::invalid_argument | If the column data could not be converted (e.g., text contained invalid characters) |
std::out_of_range | If the column data could not be converted because it is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
std::invalid_argument | If the column data could not be converted (e.g., text contained invalid characters) |
std::out_of_range | If the column data could not be converted because it is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |
|
inline |
Retrieves data from the column and converts it to the required datatype (both binary and text result formats are supported).
std::domain_error | If the column data is NULL |
std::length_error | If the column is the wrong size |
pq::pq_position_error | If the column number is out of range |
col | Column number (0 = first column; negative values count backward from the end, wherein -1 = last, -2 = penultimate, etc.) |
null_fallback | The value to revert to instead of throwing the std::length_error exception if the binary column data is NULL |