Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MySQLConnectionPrivate.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MySQLConnectionPrivate.h
1
// $Id: MySQLConnectionPrivate.h,v 1.1.1.1 2004/02/18 20:58:02 dave Exp $
2
3
#ifndef RDBC_MySQLConnectionPrivate_h
4
#define RDBC_MySQLConnectionPrivate_h
5
6
//
7
// Very private MySQL part of TSQLConnection
8
//
9
10
#include <mysql.h>
11
13
class
MySQLConnectionPrivate
14
{
15
friend
class
TSQLConnection
;
16
17
private
:
18
static
const
Int_t
fgCheckIfAlive
;
//Seconds between queries for ping (MyODBC-2.50.36)
19
20
static
Int_t
fgMaxAllowedPacket
= 65536;
21
static
Int_t
fgNetBufferLength
= 16384;
22
static
Int_t
fgMaxReconnects
= 3;
23
static
Int_t
fgInitialTimeout
= 2.0;
24
25
//static const TString gPING_COMMAND = "SELECT 1";
26
27
28
MYSQL*
fMYSQL
;
//
29
Bool_t
fIsConnected
;
//
30
Bool_t
fLocked
;
//
31
32
Bool_t
fReadOnly
;
//
33
TSQLUrl
fURL
;
//
34
time_t
fLastQueryTime
;
//
35
Int_t
fLoginTimeout
;
//
36
37
MySQLConnectionPrivate
() { mysql_init(
fMYSQL
); }
38
39
public
:
40
Bool_t
CheckIfServerIsAlive
();
41
42
};
43
44
45
const
Int_t
MySQLConnectionPrivate::fgCheckIfAlive
= 3600;
46
47
//___________________________________________________________________
48
Bool_t
MySQLConnectionPrivate::CheckIfServerIsAlive
()
49
{
50
//
51
time_t seconds = (time_t)
time
((time_t*) 0);
52
Bool_t result = kFALSE;
53
54
if
((ULong_t) (seconds -
fLastQueryTime
) >=
fgCheckIfAlive
) {
55
result = (mysql_ping(&dbc->mysql) &&
56
mysql_errno(&dbc->mysql) == CR_SERVER_GONE_ERROR);
57
}
58
59
fLastQueryTime
= seconds;
60
return
result;
61
}
62
63
64
#endif // RDBC_MySQLConnectionPrivate_h
RDBC
blob
master
mysql
MySQLConnectionPrivate.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:48
using
1.8.2 with
sPHENIX GitHub integration