-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLrt.cc
67 lines (44 loc) · 1.42 KB
/
SQLrt.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
-------------------------------------------------------------------------
OBJECT NAME: SQLrt.cc
FULL NAME: Real-time SQl data retriever.
TYPE: Concrete
DESCRIPTION:
COPYRIGHT: University Corporation for Atmospheric Research, 2003
-------------------------------------------------------------------------
*/
#include "SQLrt.h"
/* -------------------------------------------------------------------- */
SQLrt::SQLrt()
{
/* make a connection to the database, use "setenv" environment
* variables for connection info.
*/
conn = PQconnectdb("");
/* check to see that the backend connection was successfully made
*/
if (PQstatus(conn) == CONNECTION_BAD)
{
fprintf(stderr, "Connection to database failed, check environment variables PGHOST, PGDATABASE & PGUSER.\n");
fprintf(stderr, "%s", PQerrorMessage(conn));
PQfinish(conn);
conn = NULL;
}
sprintf(sqlBuff, "LISTEN current");
res = PQexec(conn, sqlBuff);
PQerrorMessage(conn);
PQclear(res);
} /* END CONSTRUCTOR */
/* -------------------------------------------------------------------- */
int SQLrt::GetVariable(const char vn[], char start[], char end[], float buff[])
{
int cnt = 0;
return(cnt);
} /* END GETVARIABLE */
/* -------------------------------------------------------------------- */
int SQLrt::GetSince(const char vn[], char last[], float buff[])
{
int cnt = 0;
return(cnt);
} /* END GETSINCE */
/* END SQLRT.CC */