Unix Technical Forum

Clearing a database

This is a discussion on Clearing a database within the MySQL forums, part of the Database Server Software category; --> Hi. I need to empty a database file in SQLite completely without deleting/ recreating the file itself. DROP TABLE ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:30 AM
Mikhail Kovalev
 
Posts: n/a
Default Clearing a database

Hi.

I need to empty a database file in SQLite completely without deleting/
recreating the file itself. DROP TABLE is an option, but I do not
always know what tables or databases are present. Is there a simple
function for that, something like DROP TABLE *; ?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:30 AM
Paul Lautman
 
Posts: n/a
Default Re: Clearing a database

Mikhail Kovalev wrote:
> Hi.
>
> I need to empty a database file in SQLite completely without deleting/
> recreating the file itself. DROP TABLE is an option, but I do not
> always know what tables or databases are present. Is there a simple
> function for that, something like DROP TABLE *; ?
>
> Thanks.


Err, this is a mysql newsgroup (the clue is in the name).


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:30 AM
Paul Lautman
 
Posts: n/a
Default Re: Clearing a database

Mikhail Kovalev wrote:
>
> Very well. What would you do in MySQL?


I would drop the entire database and recreate it. In MySQL a database is
simply a directory. Since you say that in SQLite the database is a file and
you have some (as yet not revealed) reason for not dropping the whole
database and recreating it, us MySQL wallahs simply cannot help you.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:30 AM
Paul Lautman
 
Posts: n/a
Default Re: Clearing a database

Mikhail Kovalev wrote:
> Alas, there is no SQLite or general SQL group.


Whilst there is no obvious SQLite usenet newsgroup, it is not true that
there is no general SQL usenet newsgroup, nor is is correct that there are
no SQLite groups.

I put
sqlite forum
into google and was rewarded with a very active group at the top of the
list.

I'm still intrigued as to why the (to me) obvious method of dropping and
re-creating the database is not a possibility?



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 11:30 AM
Mikhail Kovalev
 
Posts: n/a
Default Re: Clearing a database

On 8 Des, 15:59, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
> Mikhail Kovalev wrote:
> > Alas, there is no SQLite or general SQL group.

>
> Whilst there is no obvious SQLite usenet newsgroup, it is not true that
> there is no general SQL usenet newsgroup, nor is is correct that there are
> no SQLite groups.
>
> I put
> sqlite forum
> into google and was rewarded with a very active group at the top of the
> list.
>
> I'm still intrigued as to why the (to me) obvious method of dropping and
> re-creating the database is not a possibility?


SQLite allows creating tables without a selected database (without
user and password). I'm not the only user of the file (!), and I need
to be able to clear the file completely without replacing it. I
figured out I can use the SHOW function and then eval() queries
through php. It just seems so natural to have a command like "DROP
TABLE *;", but to my confussion it doesn't work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 11:30 AM
Mikhail Kovalev
 
Posts: n/a
Default Re: Clearing a database

On 8 Des, 15:59, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
> Mikhail Kovalev wrote:
> > Alas, there is no SQLite or general SQL group.

>
> Whilst there is no obvious SQLite usenet newsgroup, it is not true that
> there is no general SQL usenet newsgroup, nor is is correct that there are
> no SQLite groups.
>
> I put
> sqlite forum
> into google and was rewarded with a very active group at the top of the
> list.
>
> I'm still intrigued as to why the (to me) obvious method of dropping and
> re-creating the database is not a possibility?


I don't know what databases or tables there might be.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 11:30 AM
Paul Lautman
 
Posts: n/a
Default Re: Clearing a database

Mikhail Kovalev wrote:
> On 8 Des, 15:59, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
>> Mikhail Kovalev wrote:
>>> Alas, there is no SQLite or general SQL group.

>>
>> Whilst there is no obvious SQLite usenet newsgroup, it is not true
>> that there is no general SQL usenet newsgroup, nor is is correct
>> that there are no SQLite groups.
>>
>> I put
>> sqlite forum
>> into google and was rewarded with a very active group at the top of
>> the list.
>>
>> I'm still intrigued as to why the (to me) obvious method of dropping
>> and re-creating the database is not a possibility?

>
> SQLite allows creating tables without a selected database (without
> user and password). I'm not the only user of the file (!), and I need
> to be able to clear the file completely without replacing it. I
> figured out I can use the SHOW function and then eval() queries
> through php. It just seems so natural to have a command like "DROP
> TABLE *;", but to my confussion it doesn't work.


Seems to me that if you are going to empty the file completey then you might
just as well dump it.

However if the file really can hold tables even when it is totally empty,
then you have just explained to yourself why it was of no use asking for
this sort of help in a MySQL or even a general SQL newsgroup.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-28-2008, 11:30 AM
Jerry Stuckle
 
Posts: n/a
Default Re: Clearing a database

Paul Lautman wrote:
> Mikhail Kovalev wrote:
>> On 8 Des, 15:59, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
>>> Mikhail Kovalev wrote:
>>>> Alas, there is no SQLite or general SQL group.
>>> Whilst there is no obvious SQLite usenet newsgroup, it is not true
>>> that there is no general SQL usenet newsgroup, nor is is correct
>>> that there are no SQLite groups.
>>>
>>> I put
>>> sqlite forum
>>> into google and was rewarded with a very active group at the top of
>>> the list.
>>>
>>> I'm still intrigued as to why the (to me) obvious method of dropping
>>> and re-creating the database is not a possibility?

>> SQLite allows creating tables without a selected database (without
>> user and password). I'm not the only user of the file (!), and I need
>> to be able to clear the file completely without replacing it. I
>> figured out I can use the SHOW function and then eval() queries
>> through php. It just seems so natural to have a command like "DROP
>> TABLE *;", but to my confussion it doesn't work.

>
> Seems to me that if you are going to empty the file completey then you might
> just as well dump it.
>
> However if the file really can hold tables even when it is totally empty,
> then you have just explained to yourself why it was of no use asking for
> this sort of help in a MySQL or even a general SQL newsgroup.
>
>
>


Paul,

The problem is that SQLLite is quite a bit "looser" in what you can do
with it. A lot more like Access than MySQL, for instance.

There are many things in MySQL which have no equivalent in SQLLite.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-28-2008, 11:30 AM
Gary L. Burnore
 
Posts: n/a
Default Re: Clearing a database

On Sat, 8 Dec 2007 14:59:55 -0000, "Paul Lautman"
<paul.lautman@btinternet.com> wrote:

>Mikhail Kovalev wrote:
>> Alas, there is no SQLite or general SQL group.

>
>Whilst there is no obvious SQLite usenet newsgroup, it is not true that
>there is no general SQL usenet newsgroup, nor is is correct that there are
>no SQLite groups.
>
>I put
>sqlite forum
>into google and was rewarded with a very active group at the top of the
>list.


You're confusing google groups with USENet groups. Perhaps he's smart
enough to know that?
--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
================================================== =========================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-28-2008, 11:30 AM
Paul Lautman
 
Posts: n/a
Default Re: Clearing a database

Gary L. Burnore wrote:
> On Sat, 8 Dec 2007 14:59:55 -0000, "Paul Lautman"
> <paul.lautman@btinternet.com> wrote:
>
>> Mikhail Kovalev wrote:
>>> Alas, there is no SQLite or general SQL group.

>>
>> Whilst there is no obvious SQLite usenet newsgroup, it is not true
>> that there is no general SQL usenet newsgroup, nor is is correct
>> that there are no SQLite groups.
>>
>> I put
>> sqlite forum
>> into google and was rewarded with a very active group at the top of
>> the list.

>
> You're confusing google groups with USENet groups. Perhaps he's smart
> enough to know that?


No I'm not.

I searched in Google and found web based forums on SQLite. There are more
sorts of discussion groups than USENet and Google Groups!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com