xc
SqLiteObject.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 //SqLiteObject.h
22 //Envoltorio para objetos de SqLite++.
23 
24 #ifndef SQLITEOBJECT_H
25 #define SQLITEOBJECT_H
26 
27 #include "../kernel/CommandEntity.h"
28 
29 class SqLiteDatabase;
30 class SqLiteQuery;
31 
33 //
35 //
38  {
39  public:
40  typedef std::map<std::string,SqLiteObject *> map_sql_objs;
41  typedef map_sql_objs::iterator sql_objs_iterator;
42  typedef map_sql_objs::const_iterator sql_objs_const_iterator;
43  protected:
44  static map_sql_objs SqLiteObjs;
45 
46  static void borra_queries(void);
47  static void borra_databases(void);
48  static void borra_objetos(void);
49  static void insert_object(const std::string &nmb,SqLiteObject *ptr);
50  static SqLiteObject *find_object(const std::string &nmb);
51 
52  std::string preprocesa_str_sql(const std::string &str) const;
53  public:
54  SqLiteObject(void);
55  virtual ~SqLiteObject(void);
56 
57  static void NuevaDatabase(const std::string &nmb);
58  static void NuevaQuery(const std::string &nmb,const std::string &nmb_db);
59 
60  static void BorraObjeto(const std::string &nmb);
61  static void clearAll(void);
62 
63  static SqLiteDatabase *getDatabase(const std::string &nmb);
64  static SqLiteQuery *getQuery(const std::string &nmb);
65  };
66 #endif
static map_sql_objs SqLiteObjs
Contenedor de objetos de SqLite.
Definition: SqLiteObject.h:44
static void NuevaQuery(const std::string &nmb, const std::string &nmb_db)
Creates a query with the name being passed as parameter.
Definition: SqLiteObject.cc:124
map_sql_objs::const_iterator sql_objs_const_iterator
Iterador a objetos de base de datos.
Definition: SqLiteObject.h:42
virtual ~SqLiteObject(void)
Destructor.
Definition: SqLiteObject.cc:107
static void borra_objetos(void)
Borra todos los objetos.
Definition: SqLiteObject.cc:64
Clase para consulta SQL.
Definition: SqLiteQuery.h:35
map_sql_objs::iterator sql_objs_iterator
Iterador a objetos de base de datos.
Definition: SqLiteObject.h:41
SqLiteObject(void)
Constructor.
Definition: SqLiteObject.cc:103
std::string preprocesa_str_sql(const std::string &str) const
Preprocesa una text string que contiene una sentencia SQL.
Definition: SqLiteObject.cc:136
Objet that can execute python scripts.
Definition: CommandEntity.h:40
static void borra_databases(void)
Borra las bases de datos.
Definition: SqLiteObject.cc:48
std::map< std::string, SqLiteObject * > map_sql_objs
Contenedor de objetos de base de datos.
Definition: SqLiteObject.h:40
static void borra_queries(void)
Borra las consultas.
Definition: SqLiteObject.cc:33
static void BorraObjeto(const std::string &nmb)
Removes from container the object which name is being passed as parameter.
Definition: SqLiteObject.cc:164
Clase base de los objetos de base de datos.
Definition: SqLiteObject.h:37
Clase para consulta SQL.
Definition: SqLiteDatabase.h:35
static SqLiteObject * find_object(const std::string &nmb)
Return a pointer to the object which name is being passed as parameter.
Definition: SqLiteObject.cc:92
static void NuevaDatabase(const std::string &nmb)
Creates the database with the name being passed as parameter.
Definition: SqLiteObject.cc:114
static void insert_object(const std::string &nmb, SqLiteObject *ptr)
Inerts the object into the container.
Definition: SqLiteObject.cc:76
static SqLiteQuery * getQuery(const std::string &nmb)
Return the query with the name being passed as parameter.
Definition: SqLiteObject.cc:153
static SqLiteDatabase * getDatabase(const std::string &nmb)
Return the database with the name being passed as parameter.
Definition: SqLiteObject.cc:143