Database Independent Abstraction Layer for C: libdbi Programmer's Guide | ||
---|---|---|
Prev | Chapter 7. libdbi API Reference | Next |
Fetch the data stored in the speficied field, which contains a character (a 1-byte signed integer). This is the default for the "char" type on the x86 platform, as well as on Mac OS X.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains an unsigned character (1-byte unsigned integer). This is the default for the "char" type on Linux for PowerPC.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains a short integer (2-byte signed integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains an unsigned short integer (2-byte unsigned integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains an integer (4-byte signed integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
0.8.0
Fetch the data stored in the speficied field, which contains an unsigned integer (4-byte signed integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
0.8.0
Same as dbi_result_get_int_idx. This function is deprecated as the name implies the wrong return type on 64bit platforms.
Same as dbi_result_get_uint_idx. This function is deprecated as the name implies the wrong return type on 64bit platforms.
Fetch the data stored in the speficied field, which contains a long long integer (8-byte signed integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains an unsigned long long integer (8-byte unsigned integer).
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains a floating-point number.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains a double-precision fractional number.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field, or 0 (zero) if an error occurs. In the latter case the error number is DBI_ERROR_BADTYPE or DBI_ERROR_BADIDX.
Fetch the data stored in the speficied field, which contains a zero-terminated string.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field. If the field contains a NULL value, the function returns a NULL pointer. The string may not be modified, and may not necessairly persist between row fetches. In case of an error, this function returns the string "ERROR". In the latter case the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
Fetch the data stored in the speficied field, which contains a zero-terminated string, and return it in an allocated buffer.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field. If the field contains a NULL value, the function returns a NULL pointer, and no memory is allocated. The newly allocated string may be modified by the host program, but the program is responsible for freeing the string. In case of an error, this function returns an allocated string reading "ERROR". In the latter case the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
Fetch the data stored in the speficied field, which contains binary data. The data may not be modified, and may not necessarily persist between row fetches. If the field contains a NULL value, the function returns a NULL pointer. In case of an error, this function returns the string "ERROR".
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field. The binary data may contain zero bytes and non-printable characters. Use dbi_result_get_field_length or dbi_result_get_field_length_idx to determine the number of bytes contained in the resulting binary string. The data may not be modified, and may not necessarily persist between row fetches. If the field contains a NULL value, the function returns a NULL pointer. In case of an error, this function returns the string "ERROR". In the latter case the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
Fetch the data stored in the speficied field, which contains binary data, and return it in an allocated buffer. The newly allocated memory may be modified by the host program, but the program is responsible for freeing the data. If the field contains a NULL value, the function returns a NULL pointer. In case of an error, this function returns the string "ERROR".
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field. The newly allocated memory may be modified by the host program, but the program is responsible for freeing the data. If the field contains a NULL value, the function returns a NULL pointer. In case of an error, this function returns the string "ERROR". In the latter case the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
Fetch the data stored in the specified field, which contains a DATE and/or TIME value.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field as a time_t value. To convert this into human-readable dates or times, use the C library functions gmtime (3) and localtime (3). In case of an error this function returns 0 (zero) which resolves to the Unix epoch when converted. In case of an error the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
Fetch the data stored in the specified field. Return the contents as a long long integer value, using appropriate casts or conversions if applicable.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
The data stored in the specified field as a long long integer. Integer and floating point data as well as datetime data are cast to long long. Strings are converted using strtoll(). Empty strings, strings that do not translate into an integer, and binary strings are returned as 0 (zero) without raising an error. In case of an error this function returns 0 (zero) and the error number is DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
0.9.0
Fetch the data stored in the specified field. Return the contents as an allocated string, using appropriate conversions if applicable. The caller is responsible for freeing the returned buffer when done.
Result: The target query result.
fieldidx: The index of the target field (starting at 1).
A string representation of the data stored in the specified field. Integer, floating point and datetime data are pretty-printed using snprintf(). Strings are returned as such. Empty strings and binary strings are returned as empty strings without raising an error. In case of an error this function returns the string "ERROR" and the error number is DBI_ERROR_NOMEM, DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, or DBI_ERROR_BADNAME.
0.9.0