I am using Vertica .Net data provider 4.1.7 in my .NET appliation. I am facing a strange issue on TEMP table creation.
I have started a new TRANSACTION and exectuing couple of insert and update queries. After that I am creating a TEMP table using the same transaction. But after the CREATE TEMP table ExecuteNonQuery method the transaction automatically committed. I want to commit the transaction after executing couple of statements. My code is as below:
Code: Select all
using (var conn = VerticaHelper.GetConnection())
{
conn.Open();
VerticaTransaction trans = conn.BeginTransaction();
ExecuteNonQuery("insert into testschema.mytable(id,name) values(1,'fdfd')",conn,trans);
string createTempTable = "CREATE LOCAL TEMP TABLE temp_1022(id int,name varchar(100)) ON COMMIT PRESERVE ROWS;";
ExecuteNonQuery(createTempTable,conn,trans); //After executing this command the previous statement also commited why?????
trans.Commit();
}
function ExecuteNonQuery(query,conn,trans){
using (VerticaCommand cmd = new VerticaCommand(query, conn))
{
cmd.CommandType = CommandType.Text;
cmd.Transaction = trans;
int numChanged = cmd.ExecuteNonQuery();
}
}