28 |
#include <sstream> |
#include <sstream> |
29 |
#include <vector> |
#include <vector> |
30 |
#include <errno.h> |
#include <errno.h> |
31 |
|
#ifndef WIN32 |
32 |
#include <fnmatch.h> |
#include <fnmatch.h> |
33 |
|
#endif |
34 |
|
|
35 |
#include "../common/Exception.h" |
#include "../common/Exception.h" |
36 |
|
|
133 |
db = NULL; |
db = NULL; |
134 |
throw Exception("Cannot open instruments database: " + DbFile); |
throw Exception("Cannot open instruments database: " + DbFile); |
135 |
} |
} |
136 |
|
#ifndef WIN32 |
137 |
rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, NULL, Regexp, NULL, NULL); |
rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, NULL, Regexp, NULL, NULL); |
138 |
if (rc) { throw Exception("Failed to add user function for handling regular expressions."); } |
if (rc) { throw Exception("Failed to add user function for handling regular expressions."); } |
139 |
|
#endif |
140 |
|
|
141 |
// TODO: remove this in the next version |
// TODO: remove this in the next version |
142 |
try { |
try { |
1662 |
} |
} |
1663 |
} |
} |
1664 |
|
|
1665 |
|
#ifndef WIN32 |
1666 |
void InstrumentsDb::Regexp(sqlite3_context* pContext, int argc, sqlite3_value** ppValue) { |
void InstrumentsDb::Regexp(sqlite3_context* pContext, int argc, sqlite3_value** ppValue) { |
1667 |
if (argc != 2) return; |
if (argc != 2) return; |
1668 |
|
|
1673 |
sqlite3_result_int(pContext, 1); |
sqlite3_result_int(pContext, 1); |
1674 |
} |
} |
1675 |
} |
} |
1676 |
|
#endif |
1677 |
|
|
1678 |
String InstrumentsDb::GetDirectoryPath(String File) { |
String InstrumentsDb::GetDirectoryPath(String File) { |
1679 |
if (File.empty()) return String(""); |
if (File.empty()) return String(""); |