xc
SqLiteQuery.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //SqLiteQuery.h
22 
23 #ifndef SQLITEQUERY_H
24 #define SQLITEQUERY_H
25 
26 #include "SqLiteObject.h"
27 #include <sqlite3.h>
28 #include "utility/utils/sqlitepp/IError.h"
29 #include "utility/utils/sqlitepp/Database.h"
30 #include "utility/utils/sqlitepp/Query.h"
31 
33 //
36  {
37  Query q;
38 
39  public:
40  SqLiteQuery(Database &db);
42  SqLiteQuery(Database &db,const std::string &sql);
43 
44  int GetErrno(void);
45  std::string getError(void) const;
46  bool execute(const std::string &sql);
47  sqlite3_stmt *get_result(const std::string& sql);
48  void free_result();
49  bool fetch_row(void) const;
50  long num_rows(void) const;
51  bool insert_blob1(const std::string &sql,const void *blobData,const size_t &numBytes);
52 
53  const void *getBlob(const std::string &fieldName) const;
54  std::string getStr(const std::string &fieldName) const;
55  int getInt(const std::string &fieldName) const;
56  size_t getSizeT(const std::string &fieldName) const;
57  long int getLongInt(const std::string &fieldName) const;
58  unsigned long int getULongInt(const std::string &fieldName) const;
59  double getDouble(const std::string &fieldName) const;
60 
61  const void *getBlob(const int &index) const;
62  std::string getStr(const int &index) const;
63  int getInt(const int &index) const;
64  size_t getSizeT(const int &index) const;
65  long int getLongInt(const int &index) const;
66  unsigned long int getULongInt(const int &index) const;
67  double getDouble(const int &index) const;
68 
69  std::string getStr(void) const;
70  int getInt(void) const;
71  size_t getSizeT(void) const;
72  long int getLongInt(void) const;
73  unsigned long int getULongInt(void) const;
74  double getDouble(void) const;
75 
76  };
77 #endif
size_t getSizeT(void) const
Return el valor del siguiente campo como entero sin signo.
Definition: SqLiteQuery.cc:130
std::string getStr(void) const
Return el valor del siguiente campo como text string.
Definition: SqLiteQuery.cc:122
int getInt(void) const
Return el valor del siguiente campo como entero.
Definition: SqLiteQuery.cc:126
Definition: Database.h:53
unsigned long int getULongInt(void) const
Return el valor del siguiente campo como entero largo sin signo.
Definition: SqLiteQuery.cc:138
SqLiteQuery(Database &db)
Constructor.
Definition: SqLiteQuery.cc:28
double getDouble(void) const
Return el valor del siguiente campo como double.
Definition: SqLiteQuery.cc:142
Clase para consulta SQL.
Definition: SqLiteQuery.h:35
SQL Statement execute / result.
Definition: Query.h:49
const void * getBlob(const std::string &fieldName) const
Return el valor del campo denominado fieldName como BLOB.
Definition: SqLiteQuery.cc:65
long int getLongInt(void) const
Return el valor del siguiente campo como entero largo.
Definition: SqLiteQuery.cc:134
Clase base de los objetos de base de datos.
Definition: SqLiteObject.h:37
Clase para consulta SQL.
Definition: SqLiteDatabase.h:35