LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2010, 10:00 AM   #1
eakinpeter
LQ Newbie
 
Registered: Jun 2010
Posts: 1

Rep: Reputation: 0
SQLITE - Include multiple sql files in 1 transaction


All

I have a number of sql files containing creates, updates, selects and deletes. I need a shell script that will create a transaction around all these files to ensure that all statements are successfull otherwise I want to rollback.

i.e. if the machine crashes during the update I want to be left in a known state.

I have attempted this below but I get an error: 'unable to open database file'.

sqlite3 mydatabase.db <<ENDOFTEXT
BEGIN TRANSACTION;

.read populate1.sql
.read populate2.sql
.read populate3.sql

COMMIT;
ENDOFTEXT

Any help would be really appreciated.

Peter
 
Old 06-27-2010, 05:31 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi Peter, welcome to LQ!

I don't actually use sqlite myself, but the obvious first
question to me is:

Are you in the directory where mydatabase.db is when
you execute that?



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: New Benchmark Comparison of ITTIA DB SQL and SQLite LXer Syndicated Linux News 0 03-30-2010 07:00 PM
LXer: New Benchmark Comparison of ITTIA DB SQL and SQLite LXer Syndicated Linux News 0 03-30-2010 09:00 AM
[python] sqlite: Can you combine two database files? BrianK Programming 6 09-11-2008 07:59 AM
How to use variables in SQL insert statement (SQLite) montylee Programming 2 06-13-2008 08:06 AM
C++ Inheritance with Multiple Files, #include crap Hard Help please byteframe Programming 10 12-08-2005 08:04 PM


All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration