Example #1
0
void deleteVal(ConnectionPtr & conn, const char * b)
{
	string insert("delete from dpak where col2=");
	insert += string("'") + string(b) + string("'");
	try
	{
		StatementPtr stmt = conn->createStatement();
		int rows = stmt->executeUpdate(insert.c_str());
		cerr << "Number of rows delete: " << rows << endl;
	}catch(BaseException & e){
		cerr << "BaseException: " << e.getMessage() << endl;
	}
}
Example #2
0
void deleteVal(ConnectionPtr & conn, int a)
{
	char col1_val[10];
	memset(col1_val, 0, 10);
	snprintf(col1_val, 10, "%li", a);

	string insert("delete from dpak where col1=");
	insert += col1_val;
	try
	{
		StatementPtr stmt = conn->createStatement();
		int rows = stmt->executeUpdate(insert.c_str());
		cerr << "Number of rows delete: " << rows << endl;
	}catch(BaseException & e){
		cerr << "BaseException: " << e.getMessage() << endl;
	}
}
Example #3
0
void updateVal(ConnectionPtr & conn, int a, const char* b)
{
	char col1_val[10];
	memset(col1_val, 0, 10);
	snprintf(col1_val, 10, "%li", a);

	string insert("update dpak set col2=");
	insert += string("'") + string(b) + string("'");
	insert += string("where col1=");
	insert += col1_val;
	try
	{
		StatementPtr stmt = conn->createStatement();
		int rows = stmt->executeUpdate(insert.c_str());
		cerr << "Number of rows updated: " << rows << endl;
	}catch(BaseException & e){
		cerr << "BaseException: " << e.getMessage() << endl;
	}
}
Example #4
0
void rollback(ConnectionPtr & conn)
{
	StatementPtr stmt = conn->createStatement();
	stmt->executeUpdate("rollback");
	cerr<<"Rollback..." << endl;
}
Example #5
0
void begin(ConnectionPtr & conn)
{
	StatementPtr stmt = conn->createStatement();
	stmt->executeUpdate("begin transaction");
	cerr<<"Begin..." << endl;
}
Example #6
0
void commit(ConnectionPtr & conn)
{
	StatementPtr stmt = conn->createStatement();
	stmt->executeUpdate("commit");
	cerr<<"Commit..." << endl;
}