[prev in list] [next in list] [prev in thread] [next in thread]
List: sqlite-users
Subject: Re: [sqlite] VACUUM function problem
From: stilak1 () binghamton ! edu
Date: 2004-12-28 17:58:03
Message-ID: Pine.GSO.4.58.0412281257520.25220 () bingsun2 ! cc ! binghamton ! edu
[Download RAW message or body]
Hello All,
Recently, I have installed sqlite3 and trying to get a very simple
database application working with it. My application is in C++. I am
trying to use sqllite3_exec and sqlite3_get_table etc to insert records
into my database. I have already created a table and database pointer is
already pointing to the opened database. Now I have following query to
execute:
my query string is:
insert into sdb
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,capacity)
values (43,'HARDWARE','MONITOR','GE','NA','XYZ',0,0,4,2)
Same string on commandline works just fine. I think it might be related to
string variables and escape charasters. So I tried using the following:
sqlite3_exec(db,query, NULL, 0, &zErrMsg);
I was getting unrecognized token: ""
I also tried doing this: this
char* tpquery;
tpquery = sqlite3_mprintf("%q",query);
Now I get SQL error near "HARDWARE": syntax error
Can someone please give me some hint.
Regards,
--Sameer.
On Tue, 28 Dec 2004, D.W. wrote:
> Thank you very much to all who replied to me. I misunderstood the vacuum
> function.
> I had problems with my output routine because of the empty spaces. I thought
> to solve the problem that way.
> I have just solved the problem by using another output routine.
> Regards Daniel
>
>
> > > I have deleted some objects in my database. Now I have objects at id
> > > (INTEGER PRIMARY KEY) =1,3,4,5,7,8,9,16,17,20.... .
> > > id=2,6,10,.. are empty. I want to defrag the database so that I have
> > objects
> > > continuously at id=1,2,3,4,5,6,7,...
> >
> > The first question I'd have to ask is why you want to do that? If those
> > primary keys are referred to by foreign keys in child tables, you'd have
> to
> > change all those values as well. With a large number of child tables,
> this
> > seems like more work than it's work. Any mistakes and you destroy your
> > database's referential integrity.
> >
> > > Is the vacuum function not the right function?
> >
> > I don't believe so. I think your only recourse is to define another table
> > with the same structure, then select all the records from the old one into
> > the new one, delete the old one, then do the same back again to the old
> > name. Unless there's some pragma or something that allows one to rename a
> > table.
> >
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic