1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * sqldbclass.h --
|
---|
4 | * Copyright (C) 2008 DL Consulting Ltd
|
---|
5 | * Copyright (C) 2010 New Zealand Digital Library Project
|
---|
6 | *
|
---|
7 | * A component of the Greenstone digital library software
|
---|
8 | * from the New Zealand Digital Library Project at the
|
---|
9 | * University of Waikato, New Zealand.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or modify
|
---|
12 | * it under the terms of the GNU General Public License as published by
|
---|
13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
14 | * (at your option) any later version.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
24 | *
|
---|
25 | *********************************************************************/
|
---|
26 |
|
---|
27 | #ifndef SQLDBCLASS_H
|
---|
28 | #define SQLDBCLASS_H
|
---|
29 |
|
---|
30 |
|
---|
31 | #include "dbclass.h"
|
---|
32 | #include "text_t.h"
|
---|
33 |
|
---|
34 |
|
---|
35 | class sqldbclass : public dbclass
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | sqldbclass(const text_t& gsdlhome);
|
---|
39 | virtual ~sqldbclass();
|
---|
40 |
|
---|
41 | // returns array of document OIDs
|
---|
42 | virtual text_tarray get_documents_where (const text_t& sql_initial_cmd,
|
---|
43 | const text_t& sort_by_metadata_element_name);
|
---|
44 |
|
---|
45 | // returns array of document OIDs
|
---|
46 | virtual text_tarray get_documents_with_metadata_value (const text_tarray &metadata_element_names,
|
---|
47 | const text_t &metadata_value,
|
---|
48 | const text_t &sort_by_metadata_element_name) = 0;
|
---|
49 |
|
---|
50 | // returns array of values
|
---|
51 | virtual text_tarray get_metadata_values (const text_tarray &metadata_element_names,
|
---|
52 | const text_t &metadata_value_filter,
|
---|
53 | const text_t &metadata_value_grouping_expression) = 0;
|
---|
54 |
|
---|
55 | protected:
|
---|
56 | virtual text_t sql_safe (const text_t &value_arg) = 0;
|
---|
57 |
|
---|
58 | virtual bool sqlexec(const text_t &sql_cmd) = 0;
|
---|
59 | virtual bool sqlgetarray(const text_t& sql_cmd,
|
---|
60 | vector<text_tmap>& sql_results) = 0;
|
---|
61 | virtual bool sqltableexists(const text_t &table_name) = 0;
|
---|
62 |
|
---|
63 | };
|
---|
64 |
|
---|
65 |
|
---|
66 | #endif
|
---|