On 8/11/08, Mihai Limbasan <[EMAIL PROTECTED]> wrote: > Robert Latest wrote: > > > Hello people, > > > > why is it that I can look at the ".schema" of a db with the sqlite3 > > command line tool, but can't drop a table or view? After all, if the > > db file weren't open, I couldn't even see the schema. > > > > My problem is that I've written an app that uses views to access data. > > After usage, I don't want those views no more. Unfortunately I can't > > DROP them, so I create more and more views with different names and > > keep littering my db with an increasing number of usesless views that > > I can't delete. > > > > CREATE TEMPORARY VIEW produces an "unable to open database file" error as > well. > > > > I'm up a bit of a stump here because re-creating the database (which > > contains millions of lines but is only about 140M total file size) > > takes about a week. > > > > Here's a screenshot that should tell the whole story. I happened to > > try to drop a table, but it really doesn't matter what I drop. > > > > $ sqlite3.exe clhist.sqlite > > SQLite version 3.5.1 > > Enter ".help" for instructions > > sqlite> .schema > > CREATE TABLE Batches ( > > Id TEXT PRIMARY KEY, > > Moves_V1 INTEGER, > > Moves_V2 INTEGER, > > Moves_V3 INTEGER, > > Moves_V4 INTEGER, > > Moves_V5 INTEGER, > > Moves_R1 INTEGER, > > Moves_R2 INTEGER, > > Moves_R3 INTEGER, > > Moves_R4 INTEGER, > > Moves_R5 INTEGER > > ); > > CREATE TABLE Logs ( > > Shortname TEXT PRIMARY KEY, > > Status INTEGER > > ); > > CREATE TABLE Modules ( > > Name TEXT > > ); > > CREATE TABLE Moves ( > > Batch TEXT, > > SlotNo INTEGER, > > Tool TEXT, > > Module TEXT, > > TimeStart INTEGER, > > Duration INTEGER, > > ZipDate TEXT > > ); > > CREATE TABLE Tools ( > > Name TEXT > > ); > > CREATE VIEW "B470330" AS SELECT * FROM Moves WHERE Batch="470330"; > > CREATE VIEW BatchMoves AS SELECT * FROM Moves WHERE Batch="P"; > > CREATE VIEW "R1" AS SELECT * FROM "B470330" WHERE Tool="R1"; > > CREATE INDEX MovesBatch ON Moves(Batch); > > sqlite> DROP TABLE "Batches" ; > > SQL error: unable to open database file > > sqlite> .quit > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > Is it possible that the database file is at the same time in use from a > different process? If yes, try shutting down the other database consumers > and retry then.
ahhh... I did misread the question. Yes, the above explanation seems logical. Your app is probably tying up the db, so you can't drop the table from the command line. > > -- > Multumesc, > Mihai Limbasan > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- Puneet Kishor http://punkish.eidesis.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