822
822
if (shouldConstructMessages())
824
824
cleanupTransactionMessage(getActiveTransactionMessage(session), session);
825
message::Transaction *savepoint_transaction= sv.getTransactionSavepoint();
827
google::protobuf::RepeatedPtrField< message::Statement> *statements=
828
savepoint_transaction->mutable_statement();
830
/* A iterator is used here rather then the other GPB functions as there needs
831
to be a check for the case where there are no statements (a NULL value) */
832
if (statements != NULL)
825
message::Transaction *savepoint_transaction= sv.getTransactionMessage();
826
if (savepoint_transaction != NULL)
834
google::protobuf::RepeatedPtrField< message::Statement>::iterator it=
836
google::protobuf::RepeatedPtrField< message::Statement>::iterator end_it=
839
message::Statement *new_statement= NULL;
841
for (; it != end_it; ++it)
828
/* Make a copy of the savepoint transaction, this is necessary to assure proper cleanup.
829
Upon commit the savepoint_transaction_copy will be cleaned up by a call to
830
cleanupTransactionMessage(). The Transaction message in NamedSavepoint will be cleaned
831
up when the savepoint is cleaned up. This avoids calling delete twice on the Transaction.
833
message::Transaction *savepoint_transaction_copy= new message::Transaction(*sv.getTransactionMessage());
834
uint32_t num_statements = savepoint_transaction_copy->statement_size();
835
if (num_statements == 0)
837
session->setStatementMessage(NULL);
846
session->setTransactionMessage(savepoint_transaction);
847
session->setStatementMessage(new_statement);
841
session->setStatementMessage(savepoint_transaction_copy->mutable_statement(num_statements - 1));
843
session->setTransactionMessage(savepoint_transaction_copy);