~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to backend/wbpublic/sqlide/recordset_cdbc_storage.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License as
 
6
 * published by the Free Software Foundation; version 2 of the
 
7
 * License.
 
8
 * 
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
 * GNU General Public License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
17
 * 02110-1301  USA
 
18
 */
 
19
 
 
20
 
 
21
#ifndef _RECORDSET_CDBC_STORAGE_BE_H_
 
22
#define _RECORDSET_CDBC_STORAGE_BE_H_
 
23
 
 
24
 
 
25
#include "wbpublic_public_interface.h"
 
26
#include "sqlide/recordset_sql_storage.h"
 
27
#include "cppdbc.h"
 
28
 
 
29
 
 
30
class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_cdbc_storage : public Recordset_sql_storage
 
31
{
 
32
public:
 
33
  typedef boost::shared_ptr<Recordset_cdbc_storage> Ref;
 
34
  static Ref create(bec::GRTManager *grtm) { return Ref(new Recordset_cdbc_storage(grtm)); }
 
35
  virtual ~Recordset_cdbc_storage();
 
36
protected:
 
37
  Recordset_cdbc_storage(bec::GRTManager *grtm);
 
38
 
 
39
protected:
 
40
  virtual void do_unserialize(Recordset *recordset, sqlite::connection *data_swap_db);
 
41
  virtual void do_fetch_blob_value(Recordset *recordset, sqlite::connection *data_swap_db, RowId rowid, ColumnId column, sqlite::Variant &blob_value);
 
42
 
 
43
protected:
 
44
  virtual void run_sql_script(const Sql_script &sql_script);
 
45
 
 
46
public:
 
47
  std::string decorated_sql_query(); // adds limit clause if defined by options
 
48
 
 
49
public:
 
50
  void dbms_conn(const sql::Dbc_connection_handler::Ref &val) { _dbms_conn= val; }
 
51
  sql::Dbc_connection_handler::Ref dbms_conn() { return _dbms_conn; }
 
52
  void dbc_resultset(boost::shared_ptr<sql::ResultSet>& value) { _dbc_resultset= value; }
 
53
  void dbc_statement(boost::shared_ptr<sql::Statement>& value) { _dbc_statement= value; }
 
54
  bool reloadable() const { return _reloadable; }
 
55
  void reloadable(bool val) { _reloadable= val; }
 
56
protected:
 
57
  sql::Dbc_connection_handler::ConnectionRef dbms_conn_ref();
 
58
private:
 
59
  sql::Dbc_connection_handler::Ref _dbms_conn;
 
60
  boost::shared_ptr<sql::ResultSet> _dbc_resultset; // for 1-time unserialization
 
61
  boost::shared_ptr<sql::Statement> _dbc_statement; // for 1-time unserialization
 
62
  bool _reloadable; // whether can be reloaded using stored sql query
 
63
};
 
64
 
 
65
 
 
66
#endif /* _RECORDSET_CDBC_STORAGE_BE_H_ */