Bluehost.com Web Hosting $6.95

Transactions in version 3 series of mysql

This is a discussion on Transactions in version 3 series of mysql within the MySQL Database forums, part of the Database Forums category; I'm using the C API on a major version3 database and am wondering how transaction control is implemented? In ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-29-2006
Pep
 
Posts: n/a
Default Transactions in version 3 series of mysql

I'm using the C API on a major version3 database and am wondering how
transaction control is implemented?

In major version 4 databases you can set autocommit and do individual
transaction processing using the following functions

mysql_autocommit()
mysql_commit()
mysql_rollback()

So how do you do transaction processing in a major version 3 database.
I cannot find any equivalent functions as those listed above so am
confused?

TIA,
Pep.

Reply With Quote
  #2 (permalink)  
Old 11-29-2006
Martijn Tonies
 
Posts: n/a
Default Re: Transactions in version 3 series of mysql

> I'm using the C API on a major version3 database and am wondering how
> transaction control is implemented?
>
> In major version 4 databases you can set autocommit and do individual
> transaction processing using the following functions
>
> mysql_autocommit()
> mysql_commit()
> mysql_rollback()
>
> So how do you do transaction processing in a major version 3 database.
> I cannot find any equivalent functions as those listed above so am
> confused?


MySQL 3 only supported transactions for the 3rd party InnoDB table type.

InnoDB is included in v4.

So if you're using v3, I guess you have to use a newer version of the C API
that has these calls.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Reply With Quote
  #3 (permalink)  
Old 11-29-2006
Axel Schwenke
 
Posts: n/a
Default Re: Transactions in version 3 series of mysql

"Pep" <pepaltavista@yahoo.co.uk> wrote:
> I'm using the C API on a major version3 database and am wondering how
> transaction control is implemented?
>
> In major version 4 databases you can set autocommit and do individual
> transaction processing using the following functions
>
> mysql_autocommit()
> mysql_commit()
> mysql_rollback()
>
> So how do you do transaction processing in a major version 3 database.
> I cannot find any equivalent functions as those listed above so am
> confused?


Those functions are pure convenience functions. You can achive the same
using mysql_query() & friends. From $MYSQLSOURCE/libmysql/libmysql.c:

my_bool STDCALL mysql_commit(MYSQL * mysql)
{
DBUG_ENTER("mysql_commit");
DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
}


Got the idea?


XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Reply With Quote
  #4 (permalink)  
Old 11-29-2006
Pep
 
Posts: n/a
Default Re: Transactions in version 3 series of mysql


Axel Schwenke wrote:
> "Pep" <pepaltavista@yahoo.co.uk> wrote:
> > I'm using the C API on a major version3 database and am wondering how
> > transaction control is implemented?
> >
> > In major version 4 databases you can set autocommit and do individual
> > transaction processing using the following functions
> >
> > mysql_autocommit()
> > mysql_commit()
> > mysql_rollback()
> >
> > So how do you do transaction processing in a major version 3 database.
> > I cannot find any equivalent functions as those listed above so am
> > confused?

>
> Those functions are pure convenience functions. You can achive the same
> using mysql_query() & friends. From $MYSQLSOURCE/libmysql/libmysql.c:
>
> my_bool STDCALL mysql_commit(MYSQL * mysql)
> {
> DBUG_ENTER("mysql_commit");
> DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
> }
>
>
> Got the idea?
>
>
> XL
> --
> Axel Schwenke, Senior Software Developer, MySQL AB
>
> Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/


I'll investigate your post further when I get some peace in my project
schedule.

For the meantime, do I suppose correct that the series 3 mysql server
automatically commits all changes I make to the database?

Cheers,
Pep.

Reply With Quote
  #5 (permalink)  
Old 11-29-2006
Axel Schwenke
 
Posts: n/a
Default Re: Transactions in version 3 series of mysql

"Pep" <pepaltavista@yahoo.co.uk> wrote:
> Axel Schwenke wrote:


>> > mysql_autocommit()
>> > mysql_commit()
>> > mysql_rollback()

>>
>> Those functions are pure convenience functions. You can achive the same
>> using mysql_query() & friends. From $MYSQLSOURCE/libmysql/libmysql.c:
>>
>> my_bool STDCALL mysql_commit(MYSQL * mysql)
>> {
>> DBUG_ENTER("mysql_commit");
>> DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
>> }



> For the meantime, do I suppose correct that the series 3 mysql server
> automatically commits all changes I make to the database?


It's not that easy. Please do yourself a favour and read this up in the
MySQL manual. In an nutshell:

In all currently available MySQL versions, transaction support is
limited to InnoDB tables. Transactions are controlled with the BEGIN,
COMMIT and ROLLBACK SQL statements and the AUTOCOMMIT server variable.

The C API calls you mentioned above are just convenient abbreviations
for sending COMMIT, ROLLBACK and SET AUTOCOMMIT=0|1 statements to the
server. You get the same effect by just sending those statements to the
server via mysql_query(). Just like the implementation above shows.


HTH, XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Reply With Quote
  #6 (permalink)  
Old 12-04-2006
Pep
 
Posts: n/a
Default Re: Transactions in version 3 series of mysql


Axel Schwenke wrote:
> "Pep" <pepaltavista@yahoo.co.uk> wrote:
> > Axel Schwenke wrote:

>
> >> > mysql_autocommit()
> >> > mysql_commit()
> >> > mysql_rollback()
> >>
> >> Those functions are pure convenience functions. You can achive the same
> >> using mysql_query() & friends. From $MYSQLSOURCE/libmysql/libmysql.c:
> >>
> >> my_bool STDCALL mysql_commit(MYSQL * mysql)
> >> {
> >> DBUG_ENTER("mysql_commit");
> >> DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
> >> }

>
>
> > For the meantime, do I suppose correct that the series 3 mysql server
> > automatically commits all changes I make to the database?

>
> It's not that easy. Please do yourself a favour and read this up in the
> MySQL manual. In an nutshell:
>
> In all currently available MySQL versions, transaction support is
> limited to InnoDB tables. Transactions are controlled with the BEGIN,
> COMMIT and ROLLBACK SQL statements and the AUTOCOMMIT server variable.
>
> The C API calls you mentioned above are just convenient abbreviations
> for sending COMMIT, ROLLBACK and SET AUTOCOMMIT=0|1 statements to the
> server. You get the same effect by just sending those statements to the
> server via mysql_query(). Just like the implementation above shows.
>
>
> HTH, XL
> --
> Axel Schwenke, Senior Software Developer, MySQL AB
>
> Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/


Thanks,
Pep.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:19 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0