Re: [sqlite] How rebuild with larger page size from command line?
Hello! В сообщении от Wednesday 03 December 2008 04:48:48 Jerry Krinock написал(а): > I need a command-line script running on Mac OS 10.5 to rebuild sqlite > 3 database files with a page_size of 4096 bytes. sqlite> PRAGMA page_size; 1024 sqlite> PRAGMA page_size=4096 ;vacuum; sqlite> PRAGMA page_size; 4096 Best regards, Alexey. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
Yeah, if you dump the file to a .read-able file then his idea is simpler and easier. The approach I described is probably better suited to situations where you need to .import a file, because in that case the file is raw data rather than SQL statements. -T On Wed, Dec 3, 2008 at 12:41 AM, Jerry Krinock <[EMAIL PROTECTED]> wrote: > > On 2008 Dec, 02, at 21:19, Thomas Briggs wrote: > >> Try removing the semi-colon at the end of the .read statement. The >> semi-colon is the query terminator, but because dot-commands aren't >> queries they don't require the semi. As such the .read command in >> twoLiner.sh is either seeing a third (and invalid) argument or an >> invalid file name ("placesDump.txt ;"). > > Ah that works. Although I haven't tried Kishor's idea, that should > obviously work too. > > Thanks all, > > Jerry > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
On 2008 Dec, 02, at 21:19, Thomas Briggs wrote: > Try removing the semi-colon at the end of the .read statement. The > semi-colon is the query terminator, but because dot-commands aren't > queries they don't require the semi. As such the .read command in > twoLiner.sh is either seeing a third (and invalid) argument or an > invalid file name ("placesDump.txt ;"). Ah that works. Although I haven't tried Kishor's idea, that should obviously work too. Thanks all, Jerry ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
Try removing the semi-colon at the end of the .read statement. The semi-colon is the query terminator, but because dot-commands aren't queries they don't require the semi. As such the .read command in twoLiner.sh is either seeing a third (and invalid) argument or an invalid file name ("placesDump.txt ;"). -T On Tue, Dec 2, 2008 at 11:56 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote: > > On 2008 Dec, 02, at 19:44, Thomas Briggs wrote: > >> Put both commands (the pragma and the read) into a file (e.g. >> foo.txt) and then do: >> >> sqlite3 newDatabase.sqlite '.read foo.txt' > > Looked like a great idea, Thomas but it doesn't work for me: > > jk$ echo 'PRAGMA page_size=4096 ;' > twoLiner.sh > jk$ echo '.read placesDump.txt ;' >> twoLiner.sh > jk$ sqlite3 places.sqlite '.read twoLiner.sh' > unknown command or invalid arguments: "read". > > The file twoLiner.sh does have the expected contents: > > PRAGMA page_size=4096 ; > .read placesDump.txt ; > > I get the same error if I delete the PRAGMA line and just have > the .read in the file. > > In the man page for sqlite3, .read will "Execute SQL in [a file]". > The problem is probably that .read itself is a meta-command, not > "SQL"; hence .read cannot be nested. > > Any other ideas? > > Thanks, > > Jerry > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
On 12/2/08, Jerry Krinock <[EMAIL PROTECTED]> wrote: > > On 2008 Dec, 02, at 19:44, Thomas Briggs wrote: > > > Put both commands (the pragma and the read) into a file (e.g. > > foo.txt) and then do: > > > > sqlite3 newDatabase.sqlite '.read foo.txt' > > > Looked like a great idea, Thomas but it doesn't work for me: > > jk$ echo 'PRAGMA page_size=4096 ;' > twoLiner.sh > jk$ echo '.read placesDump.txt ;' >> twoLiner.sh > jk$ sqlite3 places.sqlite '.read twoLiner.sh' > unknown command or invalid arguments: "read". > > The file twoLiner.sh does have the expected contents: > > PRAGMA page_size=4096 ; > .read placesDump.txt ; > > I get the same error if I delete the PRAGMA line and just have > the .read in the file. > > In the man page for sqlite3, .read will "Execute SQL in [a file]". > The problem is probably that .read itself is a meta-command, not > "SQL"; hence .read cannot be nested. > > Any other ideas? Add the PRAGMA line to the start of your dump file so it looks like so... PRAGMA page_size=4096; Then run your $ sqlite3 dbname '.read dumpfile_with_pragma_added.sh' > > Thanks, > > > Jerry > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org/ Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/ Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
On 2008 Dec, 02, at 19:44, Thomas Briggs wrote: > Put both commands (the pragma and the read) into a file (e.g. > foo.txt) and then do: > > sqlite3 newDatabase.sqlite '.read foo.txt' Looked like a great idea, Thomas but it doesn't work for me: jk$ echo 'PRAGMA page_size=4096 ;' > twoLiner.sh jk$ echo '.read placesDump.txt ;' >> twoLiner.sh jk$ sqlite3 places.sqlite '.read twoLiner.sh' unknown command or invalid arguments: "read". The file twoLiner.sh does have the expected contents: PRAGMA page_size=4096 ; .read placesDump.txt ; I get the same error if I delete the PRAGMA line and just have the .read in the file. In the man page for sqlite3, .read will "Execute SQL in [a file]". The problem is probably that .read itself is a meta-command, not "SQL"; hence .read cannot be nested. Any other ideas? Thanks, Jerry ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How rebuild with larger page size from command line?
Put both commands (the pragma and the read) into a file (e.g. foo.txt) and then do: sqlite3 newDatabase.sqlite '.read foo.txt' -T On Tue, Dec 2, 2008 at 8:48 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote: > I need a command-line script running on Mac OS 10.5 to rebuild sqlite > 3 database files with a page_size of 4096 bytes. > > The first line of my script dumps the database to a text file, then > next line should read it create a new one. Since the default page > size is 1024 bytes, documentation says that I need to change it with a > PRAGMA before creating the database. So I do this: > >sqlite3 newDatabase.sqlite 'PRAGMA page_size=4096; .read dump.txt' > > Result: > >SQL error: near ".": syntax error > > If I eliminate either the PRAGMA or the .read statement, there is no > error. But I need them both. What can I do? > > Thank you, > > Jerry Krinock > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users