Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / XS / WritableDatabase.xs
blobed888a7a43db3c5650a2350fc67232efad88ab60
1 MODULE = Search::Xapian         PACKAGE = Search::Xapian::WritableDatabase
3 PROTOTYPES: ENABLE
5 WritableDatabase *
6 new1(file, opts)
7     string      file
8     int         opts
9     CODE:
10         try {
11             RETVAL = new WritableDatabase(file, opts);
12         } catch (...) {
13             handle_exception();
14         }
15     OUTPUT:
16         RETVAL
18 WritableDatabase *
19 new2(database)
20     WritableDatabase *  database
21     CODE:
22         RETVAL = new WritableDatabase(*database);
23     OUTPUT:
24         RETVAL
26 WritableDatabase *
27 new3()
28     CODE:
29         try {
30 #if XAPIAN_AT_LEAST(1,5,0)
31             RETVAL = new WritableDatabase(std::string(), Xapian::DB_BACKEND_INMEMORY);
32 #else
33             RETVAL = new WritableDatabase(InMemory::open());
34 #endif
35         } catch (...) {
36             handle_exception();
37         }
38     OUTPUT:
39         RETVAL
41 void
42 WritableDatabase::flush()
43    CODE:
44         try {
45             THIS->commit();
46         } catch (...) {
47             handle_exception();
48         }
50 void
51 WritableDatabase::commit()
52    CODE:
53         try {
54             THIS->commit();
55         } catch (...) {
56             handle_exception();
57         }
59 void
60 WritableDatabase::begin_transaction(flushed = NO_INIT)
61     bool flushed
62     CODE:
63         try {
64             if (items == 2) { /* items includes the hidden this pointer */
65                 THIS->begin_transaction(flushed);
66             } else {
67                 THIS->begin_transaction();
68             }
69         } catch (...) {
70             handle_exception();
71         }
73 void
74 WritableDatabase::commit_transaction()
75     CODE:
76         try {
77             THIS->commit_transaction();
78         } catch (...) {
79             handle_exception();
80         }
82 void
83 WritableDatabase::cancel_transaction()
84     CODE:
85         try {
86             THIS->cancel_transaction();
87         } catch (...) {
88             handle_exception();
89         }
91 docid
92 WritableDatabase::add_document(document)
93     Document *  document
94     CODE:
95         try {
96             RETVAL = THIS->add_document(*document);
97         } catch (...) {
98             handle_exception();
99         }
100     OUTPUT:
101         RETVAL
103 void
104 WritableDatabase::delete_document(did)
105     docid       did
106     CODE:
107         try {
108             THIS->delete_document(did);
109         } catch (...) {
110             handle_exception();
111         }
113 void
114 WritableDatabase::delete_document_by_term(unique_term)
115     string      unique_term
116     CODE:
117         try {
118             THIS->delete_document(unique_term);
119         } catch (...) {
120             handle_exception();
121         }
123 void
124 WritableDatabase::replace_document(did, document)
125     docid       did
126     Document *  document
127     CODE:
128         try {
129             THIS->replace_document(did, *document);
130         } catch (...) {
131             handle_exception();
132         }
134 void
135 WritableDatabase::replace_document_by_term(unique_term, document)
136     string      unique_term
137     Document *  document
138     CODE:
139         try {
140             THIS->replace_document(unique_term, *document);
141         } catch (...) {
142             handle_exception();
143         }
145 void
146 WritableDatabase::set_metadata(string key, string value)
147     CODE:
148         try {
149             THIS->set_metadata(key, value);
150         } catch (...) {
151             handle_exception();
152         }
154 void
155 WritableDatabase::DESTROY()
157 void
158 WritableDatabase::add_synonym(string term, string synonym)
159     CODE:
160         try {
161             THIS->add_synonym(term, synonym);
162         } catch (...) {
163             handle_exception();
164         }
166 void
167 WritableDatabase::remove_synonym(string term, string synonym)
168     CODE:
169         try {
170             THIS->remove_synonym(term, synonym);
171         } catch (...) {
172             handle_exception();
173         }
175 void
176 WritableDatabase::clear_synonyms(string term)
177     CODE:
178         try {
179             THIS->clear_synonyms(term);
180         } catch (...) {
181             handle_exception();
182         }
184 void
185 WritableDatabase::add_spelling(word, freqinc = 1)
186     string word
187     termcount freqinc
188     CODE:
189         try {
190             THIS->add_spelling(word, freqinc);
191         } catch (...) {
192             handle_exception();
193         }
195 void
196 WritableDatabase::remove_spelling(word, freqdec  = 1)
197     string word
198     termcount freqdec
199     CODE:
200         try {
201             THIS->remove_spelling(word, freqdec);
202         } catch (...) {
203             handle_exception();
204         }