[17476] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * mssqldbclass.h --
|
---|
| 4 | * Copyright (C) 2008 DL Consulting Ltd
|
---|
| 5 | *
|
---|
| 6 | * A component of the Greenstone digital library software
|
---|
| 7 | * from the New Zealand Digital Library Project at the
|
---|
| 8 | * University of Waikato, New Zealand.
|
---|
| 9 | *
|
---|
| 10 | * This program is free software; you can redistribute it and/or modify
|
---|
| 11 | * it under the terms of the GNU General Public License as published by
|
---|
| 12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 13 | * (at your option) any later version.
|
---|
| 14 | *
|
---|
| 15 | * This program is distributed in the hope that it will be useful,
|
---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 18 | * GNU General Public License for more details.
|
---|
| 19 | *
|
---|
| 20 | * You should have received a copy of the GNU General Public License
|
---|
| 21 | * along with this program; if not, write to the Free Software
|
---|
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 23 | *
|
---|
| 24 | *********************************************************************/
|
---|
| 25 |
|
---|
| 26 | #ifndef MSSQLDBCLASS_H
|
---|
| 27 | #define MSSQLDBCLASS_H
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | #include "sqldbclass.h"
|
---|
| 31 | //#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "EndOfFile")
|
---|
| 32 | #import "C:\Program Files\Common Files\System\ado\msado27.tlb" no_namespace rename("EOF", "EndOfFile")
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | class mssqldbclass : public sqldbclass
|
---|
| 36 | {
|
---|
| 37 | private:
|
---|
| 38 |
|
---|
| 39 | _ConnectionPtr dbptr;
|
---|
| 40 |
|
---|
| 41 | text_t tableid;
|
---|
| 42 |
|
---|
| 43 | // To enable the debug string to be output to cerr.
|
---|
| 44 | bool debug;
|
---|
| 45 |
|
---|
| 46 | text_tmap read_infodb_file (text_t filename);
|
---|
| 47 |
|
---|
| 48 | void debug_output (text_t output_string);
|
---|
| 49 |
|
---|
| 50 | text_t convert_bstr_to_textt (_variant_t in);
|
---|
| 51 |
|
---|
| 52 | bool dbquery (const text_t &sql);
|
---|
| 53 |
|
---|
| 54 | bool sqlgetarray (const text_t &sql_cmd, vector<text_tmap> &sql_results);
|
---|
| 55 |
|
---|
| 56 | text_t mssql_safe (const text_t &value_arg);
|
---|
| 57 |
|
---|
| 58 | public:
|
---|
| 59 |
|
---|
| 60 | mssqldbclass ();
|
---|
| 61 |
|
---|
| 62 | ~mssqldbclass ();
|
---|
| 63 |
|
---|
| 64 | // returns true if opened
|
---|
| 65 | bool opendatabase (const text_t &filename, int mode, int num_retrys, bool need_filelock);
|
---|
| 66 |
|
---|
| 67 | void closedatabase ();
|
---|
| 68 |
|
---|
| 69 | void deletekey (const text_t &key);
|
---|
| 70 |
|
---|
| 71 | text_t getfileextension ();
|
---|
| 72 |
|
---|
| 73 | // returns true on success
|
---|
| 74 | bool getkeydata (const text_t& key, text_t &data);
|
---|
| 75 |
|
---|
| 76 | // returns array of keys
|
---|
| 77 | text_tarray getkeys ();
|
---|
| 78 |
|
---|
| 79 | // returns true on success
|
---|
| 80 | bool setkeydata (const text_t &key, const text_t &data);
|
---|
| 81 |
|
---|
| 82 | // returns array of document OIDs
|
---|
| 83 | text_tarray get_documents_with_metadata_value (const text_tarray &metadata_element_names,
|
---|
| 84 | const text_t &metadata_value,
|
---|
| 85 | const text_t &sort_by_metadata_element_name);
|
---|
| 86 |
|
---|
| 87 | // returns array of values
|
---|
| 88 | text_tarray get_metadata_values (const text_tarray &metadata_element_names,
|
---|
| 89 | const text_t &metadata_value_filter,
|
---|
| 90 | const text_t &metadata_value_grouping_expression);
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | #endif
|
---|