Nemiver  0.3
nmv-sql-statement.h
Go to the documentation of this file.
1 /* -*- Mode: C++; indent-tabs-mode:nil; c-basic-offset:4; -*- */
2 /*
3  *This file is part of the Nemiver Project.
4  *
5  *Nemiver is free software; you can redistribute
6  *it and/or modify it under the terms of
7  *the GNU General Public License as published by the
8  *Free Software Foundation; either version 2,
9  *or (at your option) any later version.
10  *
11  *Nemiver is distributed in the hope that it will
12  *be useful, but WITHOUT ANY WARRANTY;
13  *without even the implied warranty of
14  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *See the GNU General Public License for more details.
16  *
17  *You should have received a copy of the
18  *GNU General Public License along with Nemiver;
19  *see the file COPYING.
20  *If not, write to the Free Software Foundation,
21  *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  *See COPYRIGHT file copyright information.
24  */
25 #ifndef __NMV_SQL_STATEMENT_H__
26 #define __NMV_SQL_STATEMENT_H__
27 
28 //#pragma GCC visibility push(default)
29 #include <vector>
30 //#pragma GCC visibility pop
31 
32 #include "nmv-ustring.h"
33 
34 using namespace std;
35 namespace nemiver {
36 
37 namespace common {
38 class UString;
39 class LogStream;
40 }
41 
42 namespace common
43 {
44 
45 class Column
46 {
47  common::UString m_name;
48  common::UString m_value;
49  bool m_auto_increment;
50 
51 public:
52 
53  Column (const common::UString &a_name="empty:empty",
54  const common::UString &a_value="empty:empty",
55  bool a_auto_increment=false):
56  m_name (a_name),
57  m_value (a_value),
58  m_auto_increment (a_auto_increment)
59  {}
60 
61  Column (const common::UString &a_name,
62  long long a_value,
63  bool a_auto_increment=false):
64  m_name (a_name),
65  m_value (common::UString::from_int (a_value)),
66  m_auto_increment (a_auto_increment)
67  {}
68 
70  {
71  return m_name;
72  }
73  void set_name (const common::UString &a_name)
74  {
75  m_name = a_name;
76  }
78  {
79  return m_value;
80  }
81  void set_value (const common::UString &a_value)
82  {
83  m_value = a_value;
84  }
85  void set_auto_increment (bool a_auto)
86  {
87  m_auto_increment = a_auto;
88  }
90  {
91  return m_auto_increment;
92  };
93 };
94 
95 typedef vector<Column> ColumnList;
96 struct SQLStatementPriv;
97 
99 {
100  friend class Connection;
101  friend struct SQLStatementPriv;
102 
103  SQLStatementPriv *m_priv;
104 
105 public:
106 
107  SQLStatement (const common::UString &a_sql_string="");
108 
109  SQLStatement (const SQLStatement &);
110 
111  SQLStatement& operator= (const SQLStatement &);
112 
113  virtual ~SQLStatement ();
114  virtual const common::UString& to_string () const;
115 
116  static common::UString escape_string (const common::UString &a_sql_string);
117 
118  operator const char* () const;
120 };//end LogStream
121 
123  const SQLStatement &);
124 
125 }//end namespace common
126 }//end namespace nemiver
127 #endif //__NMV_SQL_STATEMENT_H__
nemiver
Definition: nmv-address.h:31
nemiver::common::Column::Column
Column(const common::UString &a_name, long long a_value, bool a_auto_increment=false)
Definition: nmv-sql-statement.h:61
nemiver::common::Column::set_auto_increment
void set_auto_increment(bool a_auto)
Definition: nmv-sql-statement.h:85
nmv-ustring.h
NEMIVER_API
#define NEMIVER_API
Definition: nmv-api-macros.h:53
nemiver::common::Column::get_value
const common::UString & get_value()
Definition: nmv-sql-statement.h:77
nemiver::common::Connection
Definition: nmv-connection.h:49
nemiver::common::UString
Definition: nmv-ustring.h:45
nemiver::common::Column::get_auto_increment
bool get_auto_increment()
Definition: nmv-sql-statement.h:89
nemiver::common::Column::set_value
void set_value(const common::UString &a_value)
Definition: nmv-sql-statement.h:81
nemiver::common::LogStream
the log stream class it features logs on cout, cerr, and files. it also features log domains and log ...
Definition: nmv-log-stream.h:57
nemiver::common::Column::set_name
void set_name(const common::UString &a_name)
Definition: nmv-sql-statement.h:73
nemiver::common::SQLStatement
Definition: nmv-sql-statement.h:98
nemiver::common::Column::Column
Column(const common::UString &a_name="empty:empty", const common::UString &a_value="empty:empty", bool a_auto_increment=false)
Definition: nmv-sql-statement.h:53
nemiver::common::ColumnList
vector< Column > ColumnList
Definition: nmv-sql-statement.h:95
nemiver::common::operator<<
common::LogStream & operator<<(common::LogStream &, const SQLStatement &)
common
Definition: nmv-proc-list-dialog.h:32
nemiver::common::Column
Definition: nmv-sql-statement.h:45
nemiver::common::Column::get_name
const common::UString & get_name()
Definition: nmv-sql-statement.h:69