⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 odb.h

📁 一个不错的Oracle数据库封装类(.cpp)
💻 H
字号:
// Odb.h: interface for the COdb class.
//
// Release 1, Copyright (C) 1999 Ben Bryant
// This is sample source code, nothing more is implied. Use it only as such.
// This software is provided 'as-is', without warranty. In no event will the
// author be held liable for any damages arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose.
// The origin of this software must not be misrepresented; you must not claim
// that you wrote the original software. Altered source versions must be plainly
// marked as such, and must not be misrepresented as being the original software.
// Ben Bryant bcbryant@firstobject.com
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ODB_H__6B1568A3_A4E0_11D2_A0C3_00105A27C570__INCLUDED_)
#define AFX_ODB_H__6B1568A3_A4E0_11D2_A0C3_00105A27C570__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class COdb  
{
public:
	COdb();
	virtual ~COdb();

	// Public methods
	HRESULT Open( CString csConnect );
	HRESULT Close();

	HRESULT Exec_Before( void );
	HRESULT Exec_Do( CString csStatement, BOOL bNeedCommit=FALSE );
	HRESULT Exec_After( void );
	HRESULT Exec( CString csStatement, BOOL bNeedCommit=FALSE );
	
	HRESULT Select( CString csStatement );
	HRESULT FetchNext();
	HRESULT FetchMultiNext( int num );

	BOOL IsEOS();
	CString GetErrorDescription();
	CString ProcessQuotes( CString csValue );
	CString GetField( int iField );
	CString GetField( CString csName );
	CString GetMultiRowField( CString csName, int Row );

	BOOL GetField( int iField, CString& csName, CString& csValue, BOOL bQuotesIfValueRequires = FALSE );
	CString GetResults() { return m_csResults; };
	void StartLog() { m_csLog.Empty(); };
	CString GetLog() { return m_csLog; };

protected:
	// These structs are defined in the cpp	because they use oci.h types
	struct OdbContext;		// status of the instantiated COdb
	struct OdbRecordSet;	// defines select list and holds the results
	struct OdbField;		// name, type, and result value of a field

	// Protected members
	OdbContext* m_po;
	CString m_csResults;	// fetch row
	CString m_csLog;		// PL/SQL statement log

	// Internal functions
	void CheckErr( short status );
	static void CleanWhitespace( CString& csStatement );
};

#endif // !defined(AFX_ODB_H__6B1568A3_A4E0_11D2_A0C3_00105A27C570__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -