UltraScan III
Namespaces
Classes
Files
File List
File Members
utils
us_db2.h
Go to the documentation of this file.
1
#ifndef US_DB2_H
3
#define US_DB2_H
4
5
#include <QtCore>
6
7
// The supercomputer does not use the DB
8
#ifndef NO_DB
9
#include "mysql.h"
10
#endif
11
12
#include "
us_extern.h
"
13
18
class
US_UTIL_EXTERN
US_DB2
19
{
20
public
:
21
25
US_DB2
();
26
34
US_DB2
(
const
QString& );
35
39
~
US_DB2
();
40
42
#undef ERROR
43
enum
dbStatus
44
{
45
OK = 0,
46
ERROR = -1,
47
48
NOT_CONNECTED = 1,
49
50
DUP_EMAIL = 101,
51
NO_ACCT = 102,
52
INACTIVE = 103,
53
BADPASS = 104,
54
EMPTY = 105,
55
BAD_CHECKSUM = 106,
56
57
NOTPERMITTED = 201,
58
BADOPERATOR = 202,
59
BADLABLOCATION = 203,
60
BADGUID = 204,
61
62
NOROWS = 301,
63
64
INSERTNULL = 401,
65
INSERTDUP = 402,
66
DUPFIELD = 403,
68
CONSTRAINT_FAILED = 404,
69
70
NO_BUFFER = 501,
71
NO_COMPONENT = 502,
72
NO_ROTOR = 503,
73
NO_ANALYTE = 504,
74
NO_LAB = 505,
75
NO_PERSON = 506,
76
NO_MODEL = 507,
77
NO_EXPERIMENT = 508,
78
NO_RAWDATA = 509,
79
NO_EDITDATA = 510,
80
NO_SOLUTION = 511,
81
CALIB_IN_USE = 512,
82
ROTOR_IN_USE = 513,
84
NO_NOISE = 514,
85
NO_PROJECT = 515,
86
BUFFR_IN_USE = 516,
87
ANALY_IN_USE = 517,
88
SOLUT_IN_USE = 518,
89
NO_CALIB = 519,
90
NO_REPORT = 520,
91
NO_REPORT_DETAIL = 521,
92
NO_REPORT_DOCUMENT = 522,
93
UNKNOWN_ERR = 999
94
};
95
97
enum
dbUserlevels
98
{
99
USER = 0,
100
PRIV = 1,
101
ANALYST = 2,
102
SUPER = 3,
103
ADMIN = 4
104
};
105
106
// Methods
107
118
bool
test_db_connection(
const
QString&,
const
QString&,
119
const
QString&,
const
QString&,
120
QString& );
121
134
bool
test_secure_connection(
const
QString&,
const
QString&,
135
const
QString&,
const
QString&,
136
const
QString&,
const
QString&,
137
QString& );
138
146
bool
connect (
const
QString&, QString& );
147
157
bool
connect (
const
QString&,
const
QString&,
158
const
QString&,
const
QString&,
159
QString& );
160
166
void
rawQuery (
const
QString& );
167
176
int
statusQuery (
const
QString& );
177
184
int
statusQuery (
const
QStringList& );
185
195
int
functionQuery(
const
QStringList& );
196
207
void
query (
const
QString& );
208
216
void
query (
const
QStringList& );
217
223
bool
next (
void
);
224
234
QVariant value (
unsigned
);
235
239
bool
isConnected (
void
);
240
244
int
numRows (
void
);
245
269
int
writeBlobToDB (
const
QString& ,
const
QString& ,
const
int
);
270
293
int
readBlobFromDB(
const
QString&,
const
QString&,
const
int
);
294
295
309
int
readAucFromDB(
const
QString&,
int
);
310
311
324
int
writeAucToDB(
const
QString&,
int
);
325
333
QString
lastError
(
void
) {
return
error; };
334
341
int
lastErrno
(
void
) {
return
db_errno; };
342
346
int
lastInsertID(
void
);
347
357
QString lastDebug(
void
);
358
368
unsigned
long
mysqlEscapeString( QByteArray& , QByteArray& ,
unsigned
long
);
369
370
private
:
371
bool
connected
;
372
#ifndef NO_DB
373
MYSQL*
db
;
374
MYSQL_RES*
result
;
375
MYSQL_ROW
row
;
376
#endif
377
QString
email
;
378
QString
userPW
;
379
QString
guid
;
380
381
QString
certFile
;
382
QString
keyFile
;
383
QString
caFile
;
384
QString
error
;
385
int
db_errno
;
386
387
QString buildQuery (
const
QStringList& );
388
QString buildQuerySelect(
const
QStringList& );
389
};
390
#endif
391
Generated on Sun Jun 21 2015 11:40:41 for UltraScan III by
1.8.3.1-20130324