NCBI C++ ToolKit
cursor_impl.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef _CURSOR_IMPL_HPP_
2 #define _CURSOR_IMPL_HPP_
3 
4 /* $Id: cursor_impl.hpp 79243 2017-08-24 15:46:37Z satskyse $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * File Name: $Id: cursor_impl.hpp 79243 2017-08-24 15:46:37Z satskyse $
30 *
31 * Author: Michael Kholodov
32 *
33 * File Description: Cursor implementation class
34 *
35 */
36 
37 #include <dbapi/dbapi.hpp>
38 #include "active_obj.hpp"
39 #include <corelib/ncbistre.hpp>
40 #include "dbexception.hpp"
41 #include "rw_impl.hpp"
42 #include <map>
43 
45 
46 class CConnection;
47 
48 class CCursor : public CActiveObject,
49  public ICursor
50 {
51 public:
52  CCursor(const string& name,
53  const string& sql,
54  int batchSize,
55  CConnection* conn);
56 
57  virtual ~CCursor();
58 
59  virtual void SetParam(const CVariant& v,
60  const CDBParamVariant& param);
61 
62  virtual IResultSet* Open();
63 
64  // Please use CStatement instead
66  CNcbiOstream& GetBlobOStream(unsigned int col,
67  size_t blob_size,
69  size_t buf_size);
70  // Please use CStatement instead
72  CNcbiOstream& GetBlobOStream(unsigned int col,
73  size_t blob_size,
74  EAllowLog log_it,
75  size_t buf_size);
76 
77  // Please use CStatement instead
79  virtual IWriter* GetBlobWriter(unsigned int col,
80  size_t blob_size,
82  // Please use CStatement instead
84  virtual IWriter* GetBlobWriter(unsigned int col,
85  size_t blob_size,
86  EAllowLog log_it);
87 
88  virtual void Update(const string& table, const string& updateSql);
89  virtual void Delete(const string& table);
90  virtual void Cancel();
91  virtual void Close();
92 
93  virtual IConnection* GetParentConn();
94 
95  // Interface IEventListener implementation
96  virtual void Action(const CDbapiEvent& e);
97 
98 protected:
99 
101 
102  void FreeResources();
103 
104 private:
108  ostream *m_ostr;
110 
111 };
112 
113 //====================================================================
114 
116 
117 #endif // _CURSOR_IMPL_HPP_
map< string, CVariant * > Parameters
CConnection * m_conn
virtual void Update(const string &table, const string &updateSql)
Update statement for cursor.
Definition: cursor_impl.cpp:96
virtual void Close()
Close cursor.
class CxBlobWriter * m_wr
virtual void SetParam(const CVariant &v, const CDBParamVariant &param)
Set input parameter.
Definition: cursor_impl.cpp:76
void FreeResources()
virtual IResultSet * Open()
Open cursor and get corresponding resultset.
Definition: cursor_impl.cpp:88
ostream * m_ostr
CDB_CursorCmd * m_cmd
CNcbiOstream & GetBlobOStream(unsigned int col, size_t blob_size, TBlobOStreamFlags flags, size_t buf_size)
Get output stream for BLOB updates, requires BLOB column number.
virtual ~CCursor()
Definition: cursor_impl.cpp:59
virtual void Cancel()
Cancel cursor.
virtual void Action(const CDbapiEvent &e)
CCursor(const string &name, const string &sql, int batchSize, CConnection *conn)
Definition: cursor_impl.cpp:48
virtual IWriter * GetBlobWriter(unsigned int col, size_t blob_size, TBlobOStreamFlags flags)
Get Blob Writer.
CDB_CursorCmd * GetCursorCmd()
virtual IConnection * GetParentConn()
Get the parent connection.
Definition: cursor_impl.cpp:71
virtual void Delete(const string &table)
Delete statement for cursor.
CVariant –.
Definition: variant.hpp:99
ICursor –.
Definition: dbapi.hpp:570
A very basic data-write interface.
static uch flags
Defines the database API innterfaces for a variety of DBMS.
static CS_CONNECTION * conn
Definition: ct_dynamic.c:25
static char sql[1024]
Definition: putdata.c:19
int TBlobOStreamFlags
Definition: dbapi.hpp:103
EAllowLog
EDataSource –.
Definition: dbapi.hpp:78
#define NCBI_DEPRECATED
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
Modified on Fri Sep 20 14:58:00 2024 by modify_doxy.py rev. 669887