source: main/trunk/greenstone2/common-src/src/lib/mssqldbclass.h@ 22067

Last change on this file since 22067 was 22067, checked in by ak19, 14 years ago
  1. More changes to makefiles: rm JDBMWrapper.jar and jdbm.jar on clean. 2. DB files (argdb, users, key, history) now not only for gdbm but to work with other db types like jdbm, sqlite and mssql.
File size: 2.9 KB
Line 
1/**********************************************************************
2 *
3 * mssqldbclass.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 MSSQLDBCLASS_H
28#define MSSQLDBCLASS_H
29
30
31#include "sqldbclass.h"
32//#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "EndOfFile")
33#import "C:\Program Files\Common Files\System\ado\msado27.tlb" no_namespace rename("EOF", "EndOfFile")
34
35
36class mssqldbclass : public sqldbclass
37{
38 public:
39
40 mssqldbclass (const text_t& gsdlhome);
41 virtual ~mssqldbclass ();
42
43 // returns true if opened
44 bool opendatabase (const text_t &filename, int mode, int num_retrys, bool need_filelock);
45
46 void closedatabase ();
47
48 void deletekey (const text_t &key);
49
50 text_t getfileextension ();
51
52 // returns true on success
53 bool getkeydata (const text_t& key, text_t &data);
54
55 // returns array of keys
56 text_tarray getkeys ();
57
58 // returns true on success
59 bool setkeydata (const text_t &key, const text_t &data);
60
61 // returns array of document OIDs
62 virutal text_tarray get_documents_with_metadata_value (const text_tarray &metadata_element_names,
63 const text_t &metadata_value,
64 const text_t &sort_by_metadata_element_name);
65
66 // returns array of values
67 virtual text_tarray get_metadata_values (const text_tarray &metadata_element_names,
68 const text_t &metadata_value_filter,
69 const text_t &metadata_value_grouping_expression);
70
71
72 protected:
73 _ConnectionPtr dbptr;
74 text_t tableid;
75 bool debug; // To enable the debug string to be output to cerr.
76
77 virutal text_t sql_safe (const text_t &value_arg);
78
79 virtual bool sqlexec (const text_t &sql);
80 virtual bool sqlgetarray (const text_t &sql_cmd, vector<text_tmap> &sql_results);
81 virtual bool sqltableexists (const text_t &table_name);
82
83
84 text_tmap read_infodb_file (text_t filename);
85 void debug_output (text_t output_string);
86 text_t convert_bstr_to_textt (_variant_t in);
87
88};
89
90
91#endif
Note: See TracBrowser for help on using the repository browser.