/*======================================================================
Column FUNCTIONS-ORACOL.C
======================================================================*/
/* Returns column data type * *
ORADB_CALL1 (const char*) ora_column_get_name (
In Ora_column column
);
/* Returns column data type * *
Oradbi_datatype Oradb_call Ora_column_get_type (
In Ora_column column
);
/* Returns column display size * *
size_t Oradb_call Ora_column_get_dispsize (
In Ora_column column
);
/* Returns column precision of numberic data type * *
int Oradb_call Ora_column_get_precision (
In Ora_column column
);
/* Returns column scale of numberic data type * *
int Oradb_call Ora_column_get_scale (
In Ora_column column
);
/* Returns whether column is null OK */
BOOL Oradb_call ORA_COLUMN_IS_NULL_OK (
In Ora_column column
);
/* Returns whether column value is null */
BOOL Oradb_call Ora_column_is_null (
In Ora_column column
);
/* Returns column value As String */
Lresult Oradb_call ora_column_as_string (
In Ora_column column,
Out char **outval,/* Returns address of the pointer to actual data * *
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as Double * *
Lresult Oradb_call ora_column_as_double (
In Ora_column column,
Out Double *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as Float32 * *
Lresult Oradb_call Ora_column_as_float (
In Ora_column column,
Out float *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as Long * *
Lresult Oradb_call Ora_column_as_long (
In Ora_column column,
Out Long *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as unsigned long *
Lresult Oradb_call Ora_column_as_ulong (
In Ora_column column,
Out ULONG *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as Int64 * *
Lresult Oradb_call Ora_column_as_longlong (
In Ora_column column,
Out Longlong *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as UInt64 * *
Lresult Oradb_call Ora_column_as_ulonglong (
In Ora_column column,
Out Ulonglong *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns column value as DateTime */
Lresult Oradb_call Ora_column_as_datetime (
In Ora_column column,
Out Ora_datetime *outval,
Out ora_error_t *error
);
/* Gets LOB size for read. If a column isn ' t a LOB type or NULL, return 0 */
size_t Oradb_call Ora_column_lob_size (
In Ora_column column
);
/* Read LOB column value-pulling mode * *
/* A example of pulling lob data with Ora_column_read_lob:
#define BUFF_SIZE 512
BYTE lob_buf[buff_size];
Lob_siz = Ora_column_lob_size (col);
Lob_data = (byte*) malloc (Lob_siz);
cb_offs = 0;
Cb_read = buff_size;
while (Rc=ora_column_read_lob (col, Lob_siz, Cb_offs, Lob_buf, &cb_read, &err)) ==orc_need_data | | rc==ORC_ SUCCESS)
{
memcpy (Lob_data+cb_offs, Lob_buf, Cb_read);
Cb_offs + = Cb_read;
if (rc==orc_success)
Break
Cb_read = buff_size;
}
ASSERT (cb_offs = = Lob_siz);
*/
Lresult Oradb_call Ora_column_read_lob (
In Ora_column column,
In size_t lobsize_to_read,/* Total bytes to read, usually is lob_size * *
In size_t cb_offset,/* Offset bytes from the start of LOB data * *
INOUT byte* in_buf,/* When returned, IN_BUF has actual data * *
INOUT size_t* cb_read,/* input is BUF size and output are size of bytes be read */
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns LOB column value as bytes once for all. OUT_BUF is allocated by caller for fetch bytes.
* Buf_size is size of out_buf
* Ora_column_as_bytes calls Ora_column_read_lob internally.
*/
/* A example of pulling lob data with Ora_column_as_bytes:
size_t lob_size = ora_column_lob_size (col);
byte* out_buf = malloc (lob_size);
Ora_column_as_bytes (col, Out_buf, &lob_size, NULL);
...
Free (OUT_BUF);
*/
Lresult Oradb_call Ora_column_as_bytes (
In Ora_column column,
INOUT byte* Out_buf,
INOUT size_t* lob_size,/* Size bytes of LOB data which must <= size of buffer * *
Out ora_error_t *error/* NULL for no err msg return */
);
/*======================================================================
Param FUNCTIONS-ORAPARAM.C
======================================================================*/
Oradbi_datatype Oradb_call Ora_param_get_type (
In Ora_param param
);
Lresult Oradb_call Ora_param_set_long (
In Ora_param param,
In Long Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call Ora_param_set_ulong (
In Ora_param param,
In ULONG Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call Ora_param_set_longlong (
In Ora_param param,
In Longlong Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call Ora_param_set_ulonglong (
In Ora_param param,
In Ulonglong Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call Ora_param_set_datetime (
In Ora_param param,
In Ora_datetime Val,
Out ora_error_t *error/* NULL for no err msg return */
);
void Oradb_call Ora_param_set_null (
In Ora_param param
);
Lresult Oradb_call Ora_param_set_float (
In Ora_param param,
In float Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call ora_param_set_double (
In Ora_param param,
In Double Val,
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call ora_param_set_string (
In Ora_param param,
In const char *val,
In short Len,/*-1 for strlen called * *
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call Ora_param_set_bytes (
In Ora_param param,
In const byte *IN_BUF,
In UShort Size_buf,
Out ora_error_t *error/* NULL for no err msg return */
);
BOOL Oradb_call Ora_param_is_null (
In Ora_param param
);
/* Returns column value As String */
Lresult Oradb_call ora_param_as_string (
In Ora_param param,
Out char **outval,/* Returns address of the pointer to actual data * *
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns PARAM value as double * *
Lresult Oradb_call ora_param_as_double (
In Ora_param param,
Out Double *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* returns param value as float32 * *
Lresult Oradb_call Ora_param_as_float (
In Ora_param param,
Out float *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns PARAM value as long * *
Lresult Oradb_call Ora_param_as_long (
In Ora_param param,
Out Long *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns param value as unsigned long *
Lresult Oradb_call Ora_param_as_ulong (
In Ora_param param,
Out ULONG *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns PARAM value as long * *
Lresult Oradb_call Ora_param_as_longlong (
In Ora_param param,
Out Longlong *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns param value as unsigned long *
Lresult Oradb_call Ora_param_as_ulonglong (
In Ora_param param,
Out Ulonglong *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* returns param value as DateTime */
Lresult Oradb_call Ora_param_as_datetime (
In Ora_param param,
Out Ora_datetime *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/* Returns PARAM value AS Rowset * *
Lresult Oradb_call Ora_param_as_rowset (
In Ora_param param,
Out Ora_rowset *outval,
Out ora_error_t *error/* NULL for no err msg return */
);
/*======================================================================
DateTime functions-oradate.c
======================================================================*/
/* Creates a datetime opaque pointer which must is free after using * *
Lresult Oradb_call Ora_datetime_create (
Out Ora_datetime *DT/* Must be a valid pointer * *
);
Lresult Oradb_call Ora_datetime_set_all (
In Ora_datetime DT,
In the short year,/* Gregorian year; Range is-4712 <= Year <= 9999 * *
In Oradbi_dtmonth month,/* month; Range is 1 <= Month < 12 * *
In-byte day,/* day; Range is 1 <= Day <= 31 * *
In byte hours,/* hours; Range is 0 <= hours <=23 * *
In byte minutes,/* minutes; Range is 0 <= minutes <= 59 * *
In byte seconds,/* seconds; Range is 0 <= seconds <= 59 * *
Out ora_error_t *error/* NULL for no err msg return */
);
void Oradb_call Ora_datetime_get_all (
In Ora_datetime DT,
Out of short *year,/* Gregorian year; Range is-4712 <= Year <= 9999 * *
Out Oradbi_dtmonth *month,/* month; Range is 1 <= Month < 12 * *
Out byte *day,/* day; Range is 1 <= Day <= 31 * *
Out byte *hours,/* hours; Range is 0 <= hours <=23 * *
Out byte *minutes,/* minutes; Range is 0 <= minutes <= 59 * *
Out byte *seconds/* seconds; Range is 0 <= seconds <= 59 * *
);
Lresult Oradb_call ORA_DATETIME_SET_FLD (
In Ora_datetime DT,
In Oradbi_dtfield Dt_field,
In the short dt_val,
Out ora_error_t *error/* NULL for no err msg return */
);
Short Oradb_call ora_datetime_get_fld (
In Ora_datetime DT,
In Oradbi_dtfield Dt_field
);
Lresult Oradb_call Ora_string_to_datetime (
In const char *dt_string,/* datetime string Such as:1975-08-14 12:53:42 * *
In char *dt_format,/* DateTime format such as:yyyy-mm-dd hh:uu:ss * *
Out Ora_datetime dt_to,/* datetime that string translated to/*
Out ora_error_t *error/* NULL for no err msg return */
);
Lresult Oradb_call ora_datetime_to_string (
In Ora_datetime dt_in,/* datetime to be translated * *
In char *dt_format,/* DateTime format such as:yyyy-mm-dd hh:uu:ss * *
Out char *string_to,/* datetime string Such as:1975-08-14 12:53:42 * *
Out ora_error_t *error/* NULL for no err msg return */
);
/* Frees a ora_datetime * *
void Oradb_call Ora_datetime_free (
In Ora_datetime DT
);
#ifdef __cplusplus
}
#endif
/*====================================================================*/
#endif/* Ndef oradbi_h_included. Cheungmine@gmail.com *
You can download the entire project (including testing a project) in the links below, open and compile with VS2005 (VC8). If you have any questions, please leave a message or email to me.
Source: http://download.csdn.net/source/399444