On Mon, Apr 19, 2010 at 1:05 PM, David Lyon <[email protected]> wrote: > sqlite3 ".import FILE TABLE "; > > > can someone clarify: > > 1) Can I import into a file into a db table where they are more columns in > the db table than in the file to upload? > From my understanding its a no. >
You are correct. However, you could import the file into a temp table, and then do a INSERT INTO realtable (columns in real table) VALUES SELECT columns from temptable; > > 2) In this case the ordering of the columns of the table has to be consistent > with the ordering of the columns in the file that is to be uploaded > From my understanding its a yes. > Yes, but see above. > 3) From a linux box whats the easiest way of backing up the db in perl or > shell? > > Can I lock the $sqlitedb first (how?) and then cp $sqlitedb > /usr/local/db/backup > There is no concept of locking a db in sqlite. A sqlite db is just a file, just like any other file in your computer... a file that you can see, touch, move, rename. Just rename the db to db.backup, and create a new db. If you want to do all these shenanigans while you have other users connected to your db then -- you should either use sqlite's new backup facility (which I have never bothered learning, yet) or, use a real client/server db such as Pg which will allow you to shut down/lock the db. > > Thanks > > > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

