📄 rsmeta_impl.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: rsmeta_impl.hpp,v $ * PRODUCTION Revision 1000.0 2003/10/29 20:26:12 gouriano * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.7 * PRODUCTION * =========================================================================== */#ifndef _RSMETA_IMPL_HPP_#define _RSMETA_IMPL_HPP_/* $Id: rsmeta_impl.hpp,v 1000.0 2003/10/29 20:26:12 gouriano Exp $* ===========================================================================** PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information* * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular* purpose. * * Please cite the author in any work or product based on this material. ** ===========================================================================** File Name: $Id: rsmeta_impl.hpp,v 1000.0 2003/10/29 20:26:12 gouriano Exp $** Author: Michael Kholodov* * File Description: Resultset metadata implementation*** $Log: rsmeta_impl.hpp,v $* Revision 1000.0 2003/10/29 20:26:12 gouriano* PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.7** Revision 1.7 2002/11/27 16:56:20 ucko* Use [...] instead of .at(...) for G++ 2.x compatibility.** Revision 1.6 2002/11/25 15:32:06 kholodov* Modified: using STL vector istead of CDynamicArray.** Revision 1.5 2002/09/18 18:49:27 kholodov* Modified: class declaration and Action method to reflect* direct inheritance of CActiveObject from IEventListener** Revision 1.4 2002/09/09 20:48:57 kholodov* Added: Additional trace output about object life cycle* Added: CStatement::Failed() method to check command status** Revision 1.3 2002/06/11 18:21:52 kholodov* Fixed: column numbers are one-based for metadata** Revision 1.2 2002/02/05 17:24:02 kholodov* Put into NCBI scope** Revision 1.1 2002/01/30 14:51:23 kholodov* User DBAPI implementation, first commit****/#include <dbapi/dbapi.hpp>#include "dbexception.hpp"#include "active_obj.hpp"#include <vector>BEGIN_NCBI_SCOPEclass CDB_Result;class CResultSetMetaData : public CActiveObject, public IResultSetMetaData{public: CResultSetMetaData(CDB_Result *rs); virtual ~CResultSetMetaData(); virtual unsigned int GetTotalColumns() const; virtual EDB_Type GetType(unsigned int idx) const; virtual int GetMaxSize(unsigned int idx) const; virtual string GetName(unsigned int idx) const; // Interface IEventListener implementation virtual void Action(const CDbapiEvent& e);private: struct SColMetaData { SColMetaData(const string& name, EDB_Type type, int maxSize) : m_name(name), m_type(type), m_maxSize(maxSize) {} string m_name; EDB_Type m_type; int m_maxSize; }; unsigned int m_totalColumns; vector<SColMetaData> m_colInfo;};//====================================================================inlineunsigned int CResultSetMetaData::GetTotalColumns() const { return m_totalColumns;}inlineEDB_Type CResultSetMetaData::GetType(unsigned int idx) const { return m_colInfo[idx-1].m_type;}inlineint CResultSetMetaData::GetMaxSize(unsigned int idx) const { return m_colInfo[idx-1].m_maxSize;}inlinestring CResultSetMetaData::GetName(unsigned int idx) const { return m_colInfo[idx-1].m_name;}//====================================================================END_NCBI_SCOPE#endif // _RSMETA_IMPL_HPP_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -