ezpclib_db.h File Reference


Defines

#define ORA_NOT_FOUND
 no data found.
#define ORA_FETCH_NULL
 fetched column value is NULL.
#define IS_ORA_NULL(s)
 Pro*C null.
#define ROWS_AFFECTED
 rows affected after insert or update or delete.
#define ROW_NUMBER
 current row number at fetched cursor.
#define sql_err_break(s)
 break current loop when sql error occurred.
#define sql_found_break(s)
 break current loop when data found.
#define sql_found_continue(s)
 continue current loop when data found.
#define sql_found_rtn_true(s)
 return true in current function when data found.
#define sql_found_rtn_false(s)
 return false in current function when data found.
#define sql_notfound_break(s)
 break current loop when no data found.
#define sql_notfound_continue(s)
 continue current loop when no data found.
#define sql_notfound_rtn_true(s)
 return true in current function when no data found.
#define sql_notfound_rtn_false(s)
 return false in current function when no data found.

Functions

void sql_err_rpt (sqlca_t sc, void *stv[], unsigned int stl[], const char *file, const char *func, int line, bool bexit)
 print sql error report, it is very useful for SQL debuging.
int sql_open_conn (const char *db_name, const char *conn_str)
 create a new connection.
void sql_close_conn (int db_sn)
 close current connection.
void sql_close_all (void)
 rollback and close all database sessions.
void sql_commit (int db_sn)
 do commit at current transaction.
void sql_rollback (int db_sn)
 do rollback at current transaction.

Define Documentation

#define IS_ORA_NULL (  ) 

Pro*C null.

#define ORA_FETCH_NULL

fetched column value is NULL.

#define ORA_NOT_FOUND

no data found.

#define ROW_NUMBER

current row number at fetched cursor.

#define ROWS_AFFECTED

rows affected after insert or update or delete.

#define sql_err_break (  ) 

break current loop when sql error occurred.

#define sql_found_break (  ) 

break current loop when data found.

#define sql_found_continue (  ) 

continue current loop when data found.

#define sql_found_rtn_false (  ) 

return false in current function when data found.

#define sql_found_rtn_true (  ) 

return true in current function when data found.

#define sql_notfound_break (  ) 

break current loop when no data found.

#define sql_notfound_continue (  ) 

continue current loop when no data found.

#define sql_notfound_rtn_false (  ) 

return false in current function when no data found.

#define sql_notfound_rtn_true (  ) 

return true in current function when no data found.


Function Documentation

void sql_close_all ( void   ) 

rollback and close all database sessions.

Examples:
testcase.pc.

void sql_close_conn ( int  db_sn  ) 

close current connection.

Parameters:
db_sn the current database session number.

void sql_commit ( int  db_sn  ) 

do commit at current transaction.

Parameters:
db_sn the current database session number.

void sql_err_rpt ( sqlca_t  sc,
void *  stv[],
unsigned int  stl[],
const char *  file,
const char *  func,
int  line,
bool  bexit 
)

print sql error report, it is very useful for SQL debuging.

usage: just put this sample code in .pc source.
exec sql whenever sqlerror do sql_err_rpt (sqlca, sqlstm.sqhstv, sqlstm.sqhstl, __FILE__, __FUNCTION__, __LINE__, false or true);

Parameters:
sc use sqlca always.
stv use sqlstm.sqhstv always.
stl use sqlstm.sqhstl always.
file use __FILE__ always.
func use __FUNCTION__ always.
line use __LINE__ always.
bexit if program will call exit().

int sql_open_conn ( const char *  db_name,
const char *  conn_str 
)

create a new connection.

Parameters:
db_name just give this database a name, we use SID or services_name in tnsnames.ora always.
conn_str a connection string in Pro*C format. ex: "user/pass@services_name."
Returns:
a database session number.
Examples:
testcase.pc.

void sql_rollback ( int  db_sn  ) 

do rollback at current transaction.

Parameters:
db_sn the current database session number.


Generated on Fri Jul 10 17:39:37 2009 for Easy Pro*C Lib by  doxygen 1.5.9