On 8/11/08, Robert Latest <[EMAIL PROTECTED]> 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.

I have no idea what you are talking about... of course, you can drop a
view or a table. Here you go...


[04:23 PM] ~$sqlite3
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> CREATE TABLE foo (a, b);
sqlite> CREATE VIEW bar AS SELECT * FROM foo;
sqlite> .s
CREATE TABLE foo (a, b);
CREATE VIEW bar AS SELECT * FROM foo;
sqlite> DROP VIEW bar;
sqlite> .s
CREATE TABLE foo (a, b);
sqlite> DROP TABLE foo;
sqlite> .s
sqlite>

Maybe I didn't understand your question.


>
>  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
>


-- 
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

Reply via email to