InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Pg.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 Mark Travis <mtravis15432+src@gmail.com>
3
* All rights reserved. No warranty, explicit or implicit, provided.
4
*
5
* This file is part of InfiniSQL(tm).
6
7
* InfiniSQL is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 3
9
* as published by the Free Software Foundation.
10
*
11
* InfiniSQL is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with InfiniSQL. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
30
#ifndef INFINISQLPG_H
31
#define INFINISQLPG_H
32
33
#include "
gch.h
"
34
#include "
infinisql.h
"
35
47
class
Pg
:
public
ApiInterface
48
{
49
public
:
54
enum
states_e
55
{
56
STATE_NONE
= 0,
57
STATE_BEGIN
,
58
STATE_AUTH
,
59
STATE_ESTABLISHED
,
60
STATE_ABORTED
,
61
STATE_EXITING
62
};
63
64
Pg
(
class
TransactionAgent
*entrypoint,
int
statePtr);
65
virtual
~Pg
();
66
67
/* for the ApiInterface base class */
68
void
doit
()
69
{
70
;
71
}
72
void
continueFunc1
(int64_t entrypoint,
void
*statePtr)
73
{
74
;
75
}
76
void
continueFunc2
(int64_t entrypoint,
void
*statePtr)
77
{
78
;
79
}
97
void
continuePgFunc
(int64_t entrypoint,
void
*statePtr);
107
void
continuePgCommitimplicit
(int64_t entrypoint,
void
*statePtr);
117
void
continuePgCommitexplicit
(int64_t entrypoint,
void
*statePtr);
127
void
continuePgRollbackimplicit
(int64_t entrypoint,
void
*statePtr);
136
void
continuePgRollbackexplicit
(int64_t entrypoint,
void
*statePtr);
137
/* end ApiInterface base class functions */
138
147
bool
readsocket
(
string
&buf);
153
void
closesocket
(
class
TransactionAgent
&taRef);
160
static
void
pgclosesocket
(
class
TransactionAgent
&taRef,
int
socketfd);
167
void
cont
();
175
short
initcmd
(
string
&newdata);
180
void
replymsg
();
189
short
writesocket
();
198
short
rewritesocket
();
199
207
bool
get
(int16_t *val);
215
bool
get
(int32_t *val);
223
bool
get
(int64_t *val);
232
bool
get
(vector<int16_t> &val,
size_t
nelem);
241
bool
get
(vector<int32_t> &val,
size_t
nelem);
250
bool
get
(vector<int64_t> &val,
size_t
nelem);
258
bool
get
(
char
*val);
267
bool
get
(
string
&val,
size_t
nelem);
275
bool
get
(
string
&val);
281
void
put
(int16_t val);
287
void
put
(int32_t val);
293
void
put
(int64_t val);
299
void
put
(vector<int16_t> &val);
305
void
put
(vector<int32_t> &val);
311
void
put
(vector<int64_t> &val);
317
void
put
(
char
val);
324
void
put
(
char
*val,
size_t
nelem);
330
void
put
(
string
&val);
336
void
put
(
char
*val);
342
void
putCommandComplete
(
char
*tag);
350
void
putErrorResponse
(
char
*severity,
char
*code,
char
*message);
358
void
putNoticeResponse
(
char
*severity,
char
*code,
char
*message);
363
void
putRowDescription
();
368
void
putDataRows
();
373
void
putAuthenticationOk
();
381
void
putParameterStatus
(
char
*name,
char
*value);
382
390
void
sqlcommitimplicit
();
398
void
sqlcommitexplicit
();
406
void
sqlrollbackimplicit
();
413
void
sqlrollbackexplicit
();
420
bool
sqlbegin
();
421
428
void
continueLogin
(
int
cmdstate,
class
MessageUserSchema
&msgrcvref);
434
void
executeStatement
(
string
&stmtstr);
440
void
errorStatus
(int64_t status);
441
442
//private:
443
444
states_e
state
;
445
int
sockfd
;
446
447
char
pgcmdtype
;
448
uint32_t
size
;
449
std::string
inbuf
;
450
size_t
pos
;
451
char
outcmd
;
452
std::string
outmsg
;
453
std::string
outbuf
;
454
455
int64_t
userid
;
456
class
Schema
*
schemaPtr
;
457
458
// startupArgs["user"] and "database" are username & dbname
459
boost::unordered_map<std::string, std::string>
startupArgs
;
460
461
std::string
procedureprefix
;
462
463
// session settings
464
bool
session_isautocommit
;
465
// autocommit a command that started without being in a transaction block
466
bool
command_autocommit
;
467
bool
isintransactionblock
;
468
};
469
470
#endif
/* INFINISQLPG_H */
infinisqld
Pg.h
Generated on Tue Dec 24 2013 06:05:45 for InfiniSQL by
1.8.4