i am using adodb for querying mysql database. I am not posting all the code because i think its not starting a transaction

$db_om = NewADOConnection('mysql');
$db_om->PConnect("localhost", "username", "pass", "mydatabase");
$db_om->BeginTrans();
echo $db_om->transCnt;

The result i get is 0. According to my knowledge it should be 1 and should decrease when Rollback or commit is called. Any help would be appreciated.

sanam

    Don't know about ADODB and mysql, but I've always kept my own count of transactions when using ADODB with other database engines.

      Well what i am trying to do so run my queries in transaction. My problem is that i have to connect to 2 databases and updated them accordingly. Therefore i am using ADODB, it lets me connect to 2 databases and query them at same time. I have been able to connect to both databases and run my quries but when i try to use transaction it wont work. I am using following code to test if transaction is starting:
      //start adodb transaction on database
      $db_os = &NewADOConnection('mysql');
      $success=$db_os->PConnect("localhost", "use", "pass", "dbname");
      if (!$success) {
      print_output( "ERROR: Connection failed".$db_os->ErrorMsg());
      }else{
      print_output("Connected To DB<br><br>");
      }
      if (!$db_os->StartTrans()) {
      print '<b>Transactions not supported</b></p>';
      if ($db_os->hasTransactions) print("hasTransactions should be false");
      }

      It fails when i check StartTrans, it dosn't give me error for hasTransactions.
      In my database i have mix of MyISAM and InnoDB tables, could this be a problem. I have run transaction before on same database but with my own code. Any insight into this will be greatly appreciated.

        Write a Reply...