?? oracle.h
字號:
/*
* Header: oracle.h,v 1.0 2000/7/20 lhj
*/
/*
NAME
oracle.h - header file for Oracle Call Interface Program
MODIFIED (MM/DD/YY)
lhj 7/20/2000
*/
#ifndef _ORCALE_H
#define _ORCALE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oci.h>
#include <ocidem.h>
/* oparse flags */
#define DEFER_PARSE 1
#define NATIVE 1
#define VERSION_7 2
/* Class forward declarations */
class connection;
class cursor;
/*
* This class represents a connection to ORACLE database.
*
* NOTE: This connection class is just given as an example and all possible
* operations on a connection have not been defined.
*/
class connection
{
friend class cursor;
public:
connection()
{ state = not_connected; memset(hda,'\0', HDA_SIZE); }
~connection();
sword connect(text *user, text *pass,text *service);
sword disconnect();
void display_error(FILE* file) const;
private:
Lda_Def lda;
ub1 hda[HDA_SIZE];
enum conn_state
{
not_connected,
connected
};
conn_state state;
};
/*
* This class represents an ORACLE cursor.
*
* NOTE: This cursor class is just given as an example and all possible
* operations on a cursor have not been defined.
*/
class cursor
{
public:
cursor()
{state = not_opened; conn = (connection *)0; }
~cursor();
sword open(connection *conn_param);
sword close();
sword parse(const text *stmt)
{ return (oparse(&cda, (text *)stmt, (sb4)-1,
DEFER_PARSE, (ub4) VERSION_7)); }
/* Describe select-list items. */
sword describe();
sword execute()
{ return (oexec(&cda)); }
sword fetch()
{ return (ofetch(&cda)); }
sword fetch_data(RecordSet* pSet);
sword get_error_code() const
{ return (cda.rc); }
void display_error( FILE* file) const;
void print_header(sword ncols);
void print_rows(sword ncols);
sword getrows(){return cda.rpc;};
sword getfunction(){return cda.ft;};
private:
Cda_Def cda;
connection *conn;
enum cursor_state
{
not_opened,
opened
};
cursor_state state;
/* Define arrays of describe and define structs. */
struct _cs_datefmt desc[MAX_SELECT_LIST_SIZE];
struct _column_data def[MAX_SELECT_LIST_SIZE];
public:
sword sql_function;
};
sword execute_cmd(connection conn,cursor crsr,char* sql,RecordSet* pSet);
sword execute_cmd(connection conn,cursor crsr,char* sql);
/*
* Error number macros
*/
#define CONERR_ALRCON -1 /* already connected */
#define CONERR_NOTCON -2 /* not connected */
#define CURERR_ALROPN -3 /* cursor is already open */
#define CURERR_NOTOPN -4 /* cursor is not opened */
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -