BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: executing a script

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Jordan Ivanov
Guest





PostPosted: Wed Mar 09, 2005 3:40 am    Post subject: Re: executing a script Reply with quote



Hi,

If you have transactions in script it is transactional.
If you use MyIsam tables you must use LOCK TABLE statements.

"fnörld" <pvelarde (AT) goshare (DOT) com.es> wrote

Quote:

Hello,

I need to update my database changes on my clients and I'm doing it with
a script. I'm using mysql utility to execute the scripts,

mysql -uuser -ppassword
but I've realized this is not a transactional process. Any idea how can
I do it on transactional mode¿?

thank you all very much.

fnörld




Back to top
Martijn Tonies
Guest





PostPosted: Wed Mar 09, 2005 7:35 am    Post subject: Re: executing a script Reply with quote




Quote:
If you have transactions in script it is transactional.

Only the InnoDB and BDB table-types support transactions.

For all other table types, there won't be any.

Any DDL is non-transactional.

Quote:
If you use MyIsam tables you must use LOCK TABLE statements.


--
With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com



Back to top
Martijn Tonies
Guest





PostPosted: Wed Mar 09, 2005 1:20 pm    Post subject: Re: executing a script Reply with quote




Quote:
yes, my tables are InnoDB. is this script rigth in order to manage
transaction¿?

///////////////////////////////////////////////////////////////
USE `mydatabase`;

# create a table
CREATE TABLE `table1` (
`id` int(11) NOT NULL auto_increment,
`f1` varchar(15) default NULL,
`f2` varchar(15) default NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='table1';

# modify some fields
ALTER TABLE `table2` ADD COLUMN `f3` int(11) AFTER `f2`;
ALTER TABLE `table2` MODIFY COLUMN `f2` DOUBLE int(11) '0';

# create new records
INSERT INTO table1 (f1, f2) VALUES('AAAAA', 'AAAA');
INSERT INTO table2 (f1, f2) VALUES('BBBBB', 1, 4);

COMMIT;
///////////////////////////////////////////////////////////////

if one of the sql sentences fails, everything will be rolledback¿?

I think that the dbExpress driver runs in "auto commit" by default,
this would mean you would have to start a transaction first.


--
With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.