rasdaman complete source
rviewDb.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
23 
43 #ifndef _RVIEW_DB_H_
44 #define _RVIEW_DB_H_
45 
46 
47 
48 #ifdef __GNUG__
49 #pragma interface
50 #endif
51 
52 
53 
54 
55 #include "rasodmg/database.hh"
56 #include "rasodmg/transaction.hh"
57 #include "rasodmg/set.hh"
58 #include "rasodmg/ref.hh"
59 #include "rasodmg/marray.hh"
60 #include "rasodmg/gmarray.hh"
61 #include "rasodmg/iterator.hh"
62 #include "rasodmg/oqlquery.hh"
63 
64 
65 #include "rviewUtils.hh"
66 
67 
68 
69 class r_Fast_Base_Scale;
70 
71 class rviewDatabase
72 {
73 public:
74 
75  rviewDatabase(void);
76  ~rviewDatabase(void);
77  int open(const char *srvname, int srvport, const char *dbname,
78  const char *username, const char *userpassword);
79  void close(void);
80  bool isOpen(void);
81  int createCollection(const char *collName, rviewBaseType bt);
82  int deleteCollection(const char *collName);
83  int lookupCollection(collection_desc *desc);
84  static r_Ref<r_GMarray> getScaledObject(r_Fast_Base_Scale *scaler, const r_Minterval &trimDom, double scale);
85  r_Fast_Base_Scale *lookupScaledObject(collection_desc *desc, double scale);
86  int insertObject(const char *collName, r_Ref<r_GMarray> mddObj, r_Minterval *domain=NULL);
87  int executeQuery(collection_desc *desc, const char *query, r_Ref<r_GMarray> *updateMdd=NULL, bool showProgress=TRUE);
88  int getMinterval(r_Minterval &dom, const char *collName, const double *loid=NULL);
89  const r_Database *getDatabase(void) const;
90  int getErrorInfo(int &line, int &col) const;
91 
92 
93 protected:
94 
95  int collectionToDesc(r_Set<r_Ref<r_GMarray> > &mddColl, collection_desc *desc);
96 
97  int ensureDatabase(void);
98 
99  DynamicString server;
100  int port;
101  DynamicString database;
102  DynamicString username;
103  DynamicString userpassword;
104  DynamicString lastTransferParams;
105  DynamicString lastStorageParams;
106  r_Data_Format lastTransferFormat;
107  r_Data_Format lastStorageFormat;
108 
109  bool dbOpen;
110  r_Database dbase;
111  // For errors in queries
112  int line, col;
113 };
114 
115 #endif