90
91
* This method properly sets the is_active member variable.
92
93
void evaluateActivePlugins();
94
* Helper method which returns the active Transaction message
95
* for the supplied Session. If one is not found, a new Transaction
96
* message is allocated, initialized, and returned.
98
* @param The session processing the transaction
100
message::Transaction *getActiveTransaction(Session *in_session) const;
102
* Helper method which attaches a transaction context
103
* the supplied transaction based on the supplied Session's
104
* transaction information. This method also ensure the
105
* transaction message is attached properly to the Session object
107
* @param The transaction message to initialize
108
* @param The Session processing this transaction
110
void initTransaction(message::Transaction &in_command, Session *in_session) const;
112
* Helper method which finalizes data members for the
113
* supplied transaction's context.
115
* @param The transaction message to finalize
116
* @param The Session processing this transaction
118
void finalizeTransaction(message::Transaction &in_command, Session *in_session) const;
120
* Helper method which deletes transaction memory and
121
* unsets Session's transaction and statement messages.
123
void cleanupTransaction(message::Transaction *in_transaction,
124
Session *in_session) const;
126
* Helper method which initializes a Statement message
128
* @param The statement to initialize
129
* @param The type of the statement
130
* @param The session processing this statement
132
void initStatement(message::Statement &statement,
133
message::Statement::Type in_type,
134
Session *in_session) const;
136
* Helper method which returns an initialized Statement
137
* message for methods doing insertion of data.
139
* @param[in] Pointer to the Session doing the processing
140
* @param[in] Pointer to the Table object being inserted into
142
message::Statement &getInsertStatement(Session *in_session,
143
Table *in_table) const;
146
* Helper method which initializes the header message for
149
* @param[inout] Statement message container to modify
150
* @param[in] Pointer to the Session doing the processing
151
* @param[in] Pointer to the Table being inserted into
153
void setInsertHeader(message::Statement &statement,
155
Table *in_table) const;
157
* Helper method which returns an initialized Statement
158
* message for methods doing updates of data.
160
* @param[in] Pointer to the Session doing the processing
161
* @param[in] Pointer to the Table object being updated
162
* @param[in] Pointer to the old data in the record
163
* @param[in] Pointer to the new data in the record
165
message::Statement &getUpdateStatement(Session *in_session,
167
const unsigned char *old_record,
168
const unsigned char *new_record) const;
170
* Helper method which initializes the header message for
173
* @param[inout] Statement message container to modify
174
* @param[in] Pointer to the Session doing the processing
175
* @param[in] Pointer to the Table being updated
176
* @param[in] Pointer to the old data in the record
177
* @param[in] Pointer to the new data in the record
179
void setUpdateHeader(message::Statement &statement,
182
const unsigned char *old_record,
183
const unsigned char *new_record) const;
185
* Helper method which returns an initialized Statement
186
* message for methods doing deletion of data.
188
* @param[in] Pointer to the Session doing the processing
189
* @param[in] Pointer to the Table object being deleted from
191
message::Statement &getDeleteStatement(Session *in_session,
192
Table *in_table) const;
195
* Helper method which initializes the header message for
198
* @param[inout] Statement message container to modify
199
* @param[in] Pointer to the Session doing the processing
200
* @param[in] Pointer to the Table being deleted from
202
void setDeleteHeader(message::Statement &statement,
204
Table *in_table) const;
206
* Helper method which pushes a constructed message out
207
* to the registered replicator and applier plugins.
96
* Helper method which pushes a constructed message out to the registered
97
* replicator and applier plugins.
209
99
* @param Message to push out
211
void push(message::Transaction &to_push);
101
void pushTransactionMessage(message::Transaction &to_push);
259
148
* @param Pointer to the applier to detach
261
150
void detachApplier(plugin::TransactionApplier *in_applier);
263
* Commits a normal transaction (see above) and pushes the
264
* transaction message out to the replicators.
266
* @param Pointer to the Session committing the transaction
268
void commitTransaction(Session *in_session);
270
* Marks the current active transaction message as being rolled
271
* back and pushes the transaction message out to replicators.
273
* @param Pointer to the Session committing the transaction
275
void rollbackTransaction(Session *in_session);
277
* Finalizes a Statement message and sets the Session's statement
280
* @param The statement to initialize
281
* @param The session processing this statement
283
void finalizeStatement(message::Statement &statement,
284
Session *in_session) const;
286
* Creates a new InsertRecord GPB message and pushes it to
289
* @param Pointer to the Session which has inserted a record
290
* @param Pointer to the Table containing insert information
292
* Grr, returning "true" here on error because of the cursor
293
* reversed bool return crap...fix that.
295
bool insertRecord(Session *in_session, Table *in_table);
297
* Creates a new UpdateRecord GPB message and pushes it to
300
* @param Pointer to the Session which has updated a record
301
* @param Pointer to the Table containing update information
302
* @param Pointer to the raw bytes representing the old record/row
303
* @param Pointer to the raw bytes representing the new record/row
305
void updateRecord(Session *in_session,
307
const unsigned char *old_record,
308
const unsigned char *new_record);
310
* Creates a new DeleteRecord GPB message and pushes it to
313
* @param Pointer to the Session which has deleted a record
314
* @param Pointer to the Table containing delete information
316
void deleteRecord(Session *in_session, Table *in_table);
318
* Creates a CreateSchema Statement GPB message and adds it
319
* to the Session's active Transaction GPB message for pushing
320
* out to the replicator streams.
322
* @param[in] Pointer to the Session which issued the statement
323
* @param[in] message::Schema message describing new schema
325
void createSchema(Session *in_session, const message::Schema &schema);
327
* Creates a DropSchema Statement GPB message and adds it
328
* to the Session's active Transaction GPB message for pushing
329
* out to the replicator streams.
331
* @param[in] Pointer to the Session which issued the statement
332
* @param[in] message::Schema message describing new schema
334
void dropSchema(Session *in_session, const std::string &schema_name);
336
* Creates a CreateTable Statement GPB message and adds it
337
* to the Session's active Transaction GPB message for pushing
338
* out to the replicator streams.
340
* @param[in] Pointer to the Session which issued the statement
341
* @param[in] message::Table message describing new schema
343
void createTable(Session *in_session, const message::Table &table);
345
* Creates a DropTable Statement GPB message and adds it
346
* to the Session's active Transaction GPB message for pushing
347
* out to the replicator streams.
349
* @param[in] Pointer to the Session which issued the statement
350
* @param[in] The schema of the table being dropped
351
* @param[in] The table name of the table being dropped
352
* @param[in] Did the user specify an IF EXISTS clause?
354
void dropTable(Session *in_session,
355
const std::string &schema_name,
356
const std::string &table_name,
359
* Creates a TruncateTable Statement GPB message and adds it
360
* to the Session's active Transaction GPB message for pushing
361
* out to the replicator streams.
363
* @param[in] Pointer to the Session which issued the statement
364
* @param[in] The Table being truncated
366
void truncateTable(Session *in_session, Table *in_table);
368
* Creates a new RawSql GPB message and pushes it to
371
* @TODO With a real data dictionary, this really shouldn't
372
* be needed. CREATE TABLE would map to insertRecord call
373
* on the I_S, etc. Not sure what to do with administrative
374
* commands like CHECK TABLE, though..
376
* @param Pointer to the Session which issued the statement
377
* @param Query string
379
void rawStatement(Session *in_session, const std::string &query);
381
* Returns the timestamp of the last Transaction which was sent to
151
/** Returns the timestamp of the last Transaction which was sent to an
384
154
uint64_t getLastAppliedTimestamp() const;