odbx_column_type(3)

πŸ’… odbx_column_type(3) β€” the OpenDBX manual, bestie edition πŸŽ€

okay so real talk: this is the odbx_column_type(3) page from the OpenDBX manual, and it's literally just one function that tells you what type your column is. tiny function, big slay. let's get into it ✨


🌸 NAME 🌸

odbx_column_type β€” returns the SQL data type of a column in the current result set. that's it, that's the whole job, and she does it flawlessly πŸ’–


✨ SYNOPSIS ✨

#include <opendbx/api.h>

int odbx_column_type (odbx_result_t* result, unsigned long pos);

two args, one int back. immaculate signature, no notes 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so odbx_column_type() returns the data type of the column you asked for, inside the current result set that came from odbx_result(). and like β€” the column type applies to all the fields sitting at that same position across every row you fetch with odbx_row_fetch(). same position, every row, same type. consistent queen behavior πŸ’…

the type definitions are based on the SQL2003 standard, and the data types of your database server have to comply to that standard's specification. (yes, "have to". it's giving strict.) and if your database implementation ships some special data type that the SQL2003 standard just... doesn't cover? it gets subsumed as ODBX_TYPE_UNKNOWN. no cap, that's the bucket πŸͺ£

the result parameter is required by this function and it must be a valid result set returned by odbx_result(), and it must not has been feed to odbx_result_finish() before. (that's the original's grammar and honestly it ate, so it stays 😌) basically: don't hand her an already-finished result set. she will not be entertaining that.

valid column indices for the column you request via pos start at zero and end at the value returned by odbx_column_count() minus one. classic zero-indexed situation, you know the vibe πŸ”₯


πŸ‘‘ RETURN VALUE πŸ‘‘

if a value less than zero comes back, an error happened, periodt. possible error codes are listed down in the error section, and your application can retrieve a textual message of the error by calling odbx_error(). very demure, very helpful πŸ’œ

a positive return value including zero indicates one of the SQL2003 compliant data types listed below ✨

🚨 lore drop: before release 1.1.5 of the OpenDBX library, types were defined as ODBX_* instead of ODBX_TYPE_*. the old definitions are kept for backward compatibility but shouldn't be used any more, and they will be removed at some point in the future. so like... migrate bestie. don't get attached πŸ’€

πŸ”’ Exact numeric values

  • ODBX_TYPE_BOOLEAN: true/false values
  • ODBX_TYPE_SMALLINT: signed 16 bit integer
  • ODBX_TYPE_INTEGER: signed 32 bit integer
  • ODBX_TYPE_BIGINT: signed 64 bit integer
  • ODBX_TYPE_DECIMAL: exact signed numeric values with user defined precision

🌈 Approximate numeric values

  • ODBX_TYPE_REAL: approximate numeric values (signed) with 32 bit precision
  • ODBX_TYPE_DOUBLE: approximate numeric values (signed) with 64 bit precision
  • ODBX_TYPE_FLOAT: approximate numeric values (signed) with user defined precision

πŸŽ€ String values

  • ODBX_TYPE_CHAR: fixed number of characters
  • ODBX_TYPE_NCHAR: fixed number of characters using a national character set
  • ODBX_TYPE_VARCHAR: variable number of characters
  • ODBX_TYPE_NVARCHAR: variable number of characters using a national character set

πŸ“ Large objects

  • ODBX_TYPE_CLOB: large text object
  • ODBX_TYPE_NCLOB: large text object using a national character set
  • ODBX_TYPE_XML: XML tree in text format
  • ODBX_TYPE_BLOB: large binary object

πŸ•°οΈ Date and time values

  • ODBX_TYPE_TIME: time including hours, minutes and seconds
  • ODBX_TYPE_TIME_TZ: time with timezone information
  • ODBX_TYPE_TIMESTAMP: date and time
  • ODBX_TYPE_TIMESTAMP_TZ: date and time with timezone information
  • ODBX_TYPE_DATE: date including year, month and day
  • ODBX_TYPE_INTERVAL: date interval

🧚 Arrays and sets

  • ODBX_TYPE_ARRAY: array of values
  • ODBX_TYPE_MULTISET: associative arrays
  • ODBX_TYPE_DATALINK: URI locators like URL links

πŸ™ˆ Vendor specific

  • ODBX_TYPE_UNKNOWN: vendor specific data type without representation in SQL2003

πŸ’€ ERRORS πŸ’€

  • -ODBX_ERR_BACKEND β€” the native database library returned an error. not her fault, blame the backend 😭
  • -ODBX_ERR_PARAM β€” either the result parameter is NULL respectively is invalid, or the value of pos is out of range. check your args bestie, she's not a mind reader πŸ™ˆ

🌟 SEE ALSO 🌟

odbx_column_count(), odbx_column_name(), odbx_field_value(), odbx_result() β€” the whole friend group, go say hi 🫢


and that's the page!! this one's from OpenDBX, dated 6 February 2026, and it's odbx_column_type(3) β€” type-check your columns, stay iconic, and remember: zero-indexed, always πŸ’œβœ¨

πŸ“¦ where this page comes from