Re: [sqlite] Sqlite installation problems

2004-12-28 Thread Anirban Sarkar
Many thanks for your response.
I carried out the operations as per your instructions. Here is a brief summary 
of what I did.

Mandrake 10.0 - CD1
rpm -i libreadline4-4.3-7mdk.i586.rpm

Mandrake 10.0 - CD2
rpm -i libreadline4-devel-4.3-7mdk.i586.rpm
rpm -i php-readline4-devel-4.3.4-1mdk.i586.rpm

Mandrake 10.0 - CD3
No such package found

Please note that I manually found out all the available libreadline packages in 
each of the 3 discs of Mandrake 10.0 by issuing the find command from the shell 
prompt. I was logged in as 'root' when I performed the entire operation.

After completing the above operation, I again tried to install the Sqlite rpm 
but the same error message popped up.
I performed a find on the stated file on my system which showed that the file 
is present. Here is the output of the find command :

find / -name libreadline*.*

/usr/share/doc/libreadline4-devel-4.3
/usr/lib/libreadline.a
/usr/lib/libreadline.so
/lib/libreadline.so.4
/lib/libreadline.so.4.1
/lib/libreadline.so.4.2
/lib/libreadline.so.4.3
/lib/libreadline.so

Kindly help.

Your's sincerely,
Anirban Sarkar

- Original Message - 
From: "Force3 Team" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, December 28, 2004 10:30 PM
Subject: Re: [sqlite] Sqlite installation problems


> >> Hi! everyone,
> >>
> >> I am a newbie as far as Sqlite is concerend. So I just need some help 
> >> to get things started. I am working on Mandrake Linux 10.0 platform.
> >>
> >> I have downloaded the rpm 'sqlite-2.8.15-1.i386.rpm' from the 
> >> downloads section of www.sqlite.org. I log into my linux system as 
> >> root and execute the above rpm when the following error pops up :
> >>
> >> "Some package requested cannot be installed:
> >> sqlite-2.8.15-1.i386(due to unsatisfied libreadline.so.4)
> >> do you agree?"
> >>  
> >>
> > You have to install the libreadline package, which is either called 
> > libreadline-X.rpm or readline-.rpm (fill in the 's).  If you 
> > can't find it in the package manager, go through the CDs one by one, 
> > then, from the command-line (and as root), do:
> > 
> > rpm -uvh readline-.rpm
> > 
> > (or whatever it is called), with the current directory being in 
> > /mnt/cdrom/Mandrake or similar.
> > 
> 
> Hi, I am facing the similar kind of problem on Encore's Simputer
> can any one help me to find out the source code of libreadline-so.4 lib.
> so that i cam complie it for intel arm procesor.
> 
> Thanks in advance.
> 
> 
> -- 
> 
> Regards, and  Have a nice day.
> 
> Prachait Saxena
> 
> Force3 Team
> ---
> (M) :- +91 98229 44025
> (M) :- +91 93732 81318
> (E) :- prachait (at) force3-india (dot) com
> (W) :- http://www.force3-india.org/
> (W) :- http://www.force3-india.com/
> 
> _
> Our Solution at Microsoft Solution Market Place
> Public Grievance Redressal System version 1.0.0
> http://www.microsoft.com/asia/solutionmarketplace/solutiondetail.asp?ind=3&sid=30101&type=1&solid=1760&language=1&searchresult=true&sLanguage=1
> 
> Checkout Latest:
> http://force3-india.org/downloads/Presentations/Force3-India_inCLASS-Presentation.zip
> 

RE: [sqlite] Running out of memory

2004-12-28 Thread Sandy Ganz
After you leave myfunc2() you don't have valid access to the string I think
the c_str() method is just a fixed up pointer to the buffer (again, depends
on implementation), and when you leave myfunc2() you really don't have
access to that data and it can be trounced by other functions calls or what
ever allocates to the now released spaces that 'str' had when it goes out of
scope. You are just probabally getting lucky that nothing messes with the
memory until the exec goes to town on it.


char someBuffer[1025];

char* myfunc2(char *buff)
{

char* prefix = "insert into sdb
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,
capacity)";

char* str1 = " values (";
char* suffix = ")";

sprintf(buff,"%s values (%d, ...) %s", prefix, id, ... ,suffix);

return(buff);
}

Just make sure your buffer is larger then would ever be or you will die. Or
you can just do something like this at the end of your old function -
char *ret_ptr;

ret_ptr = new char[Str.Length() + 1]; // or what ever gets you the 
lenght +
term

strcpy(ret_ptr, Str.c_str());

return(ret_ptr);

Rember now you have allocated memory to ret_ptr and later on you will have
to delete it.

By the way C++ strings are slow :-) Hope I got it all right, but you have
the idea...

Sandy

}-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 1:26 PM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Running out of memory



Sandy,
Thanks for the help. I used string and then kept

char* myfunc2()
{
char* prefix = "insert into sdb
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,
capacity)";

char* str1 = " values (";
char* suffix = ")";
string str;

  str += prefix;
  ...
  I filled in the variables here
  ...
  str += suffix;

 return(str.c_str());

}

char* query = myfunc2();

then I passed this query to the function we are talking about.

BTW, both query and newquery look exactly same after I print them before
the exec funciton call.


On Tue, 28 Dec 2004, Sandy Ganz wrote:

> The strcmp might be misleading you, depending on the implementation if a
> parameter is actually NULL it can return 0. But the easiest thing would be
> to print the queries right before you call the exec function and see what
it
> shows. Also how did you allocate the query value that is passed in?
>
> Sandy
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 28, 2004 12:43 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Running out of memory
>
>
>
> Hi All,
>
> To give some more information
>
> void myfunction(char* query)
> {
>
>   printf(" Query is: %s \n",query);
>
> char* newquery = "insert into sdb
>
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,
> capacity)
> values (43,'HARDWARE','MONITOR','GE','NA','XYZ',0,0,4,2)"
>
>  int cmpval = strcmp(query,newquery);
>
>   if (cmpval == 0)
>  printf("strings match \n");
>  else
>printf("Strings dont match\n")
>
> printf("--\n");
>   rc = sqlite3_exec(db,query, NULL, 0, &zErrMsg);
>
>if( rc!=SQLITE_OK )
> {
>   fprintf(stderr, "SQL error while registering: %s\n",zErrMsg);
> }
>
> }
>
> Now if I use sqlite3_exec(db,newquery, NULL, 0, &zErrMsg) it works fine.
> But if I use sqlite3_exec(db,query, NULL, 0, &zErrMsg); it gives me the
> unrecognized token "" error.
>
> Eventhough my strcmp function tells me that the two strings match, but
> sql_exec does not think so. I am bit confused as to why the same
> hard-coded string works but not the other one.
>
> Any help on this would be great.
>
> Regards,
> --Sameer.
>
> On Tue, 28 Dec 2004, D. Richard Hipp wrote:
>
> > Roger Binns wrote:
> >  > [M]ost software does not play well with running out of memory...
> >  >
> >
> > FWIW:  If a malloc() ever fails with SQLite, it will return
> > SQLITE_NOMEM.  It also sets a flag and will forever after
> > continue to return SQLITE_NOMEM even if you free up a bunch
> > of memory so that malloc() would start working again.  There
> > is no way to reset this condition.  Once a malloc() fails,
> > the party is over and you might as well shut down the process.
> >
> > If malloc() fails, SQLite might also leak memory.  (Ironic,
> > isn't it?)
> >
> > The only guarantees that SQLite makes after a malloc failure
> > is that it will not abort() or panic() or segfault.  Basically,
> > it just gives you a chance to shutdown gracefully.  This might
> > not sound like much, but as Roger points out, it is a lot
> > more than most other software packages offer.
> >
> >
>
>



RE: [sqlite] Running out of memory

2004-12-28 Thread stilak1

Sandy,
Thanks for the help. I used string and then kept

char* myfunc2()
{
char* prefix = "insert into sdb 
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,capacity)";

char* str1 = " values (";
char* suffix = ")";
string str;

  str += prefix;
  ...
  I filled in the variables here
  ...
  str += suffix;

 return(str.c_str());

}

char* query = myfunc2();

then I passed this query to the function we are talking about.

BTW, both query and newquery look exactly same after I print them before
the exec funciton call.


On Tue, 28 Dec 2004, Sandy Ganz wrote:

> The strcmp might be misleading you, depending on the implementation if a
> parameter is actually NULL it can return 0. But the easiest thing would be
> to print the queries right before you call the exec function and see what it
> shows. Also how did you allocate the query value that is passed in?
>
> Sandy
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 28, 2004 12:43 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Running out of memory
>
>
>
> Hi All,
>
> To give some more information
>
> void myfunction(char* query)
> {
>
>   printf(" Query is: %s \n",query);
>
> char* newquery = "insert into sdb
> (id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,
> capacity)
> values (43,'HARDWARE','MONITOR','GE','NA','XYZ',0,0,4,2)"
>
>  int cmpval = strcmp(query,newquery);
>
>   if (cmpval == 0)
>  printf("strings match \n");
>  else
>printf("Strings dont match\n")
>
> printf("--\n");
>   rc = sqlite3_exec(db,query, NULL, 0, &zErrMsg);
>
>if( rc!=SQLITE_OK )
> {
>   fprintf(stderr, "SQL error while registering: %s\n",zErrMsg);
> }
>
> }
>
> Now if I use sqlite3_exec(db,newquery, NULL, 0, &zErrMsg) it works fine.
> But if I use sqlite3_exec(db,query, NULL, 0, &zErrMsg); it gives me the
> unrecognized token "" error.
>
> Eventhough my strcmp function tells me that the two strings match, but
> sql_exec does not think so. I am bit confused as to why the same
> hard-coded string works but not the other one.
>
> Any help on this would be great.
>
> Regards,
> --Sameer.
>
> On Tue, 28 Dec 2004, D. Richard Hipp wrote:
>
> > Roger Binns wrote:
> >  > [M]ost software does not play well with running out of memory...
> >  >
> >
> > FWIW:  If a malloc() ever fails with SQLite, it will return
> > SQLITE_NOMEM.  It also sets a flag and will forever after
> > continue to return SQLITE_NOMEM even if you free up a bunch
> > of memory so that malloc() would start working again.  There
> > is no way to reset this condition.  Once a malloc() fails,
> > the party is over and you might as well shut down the process.
> >
> > If malloc() fails, SQLite might also leak memory.  (Ironic,
> > isn't it?)
> >
> > The only guarantees that SQLite makes after a malloc failure
> > is that it will not abort() or panic() or segfault.  Basically,
> > it just gives you a chance to shutdown gracefully.  This might
> > not sound like much, but as Roger points out, it is a lot
> > more than most other software packages offer.
> >
> >
>
>


Re: [sqlite] question about pager.c / statement journals and normal journals

2004-12-28 Thread Rolf Schaeuble
Thanks. Now it's clear what's going on.
Thank you for this great piece of code.
Rolf
D. Richard Hipp wrote:
Rolf Schaeuble wrote:
Hello,
I've had a look at pager.c to understand what's going on in there. 
While I think I understand most of it, there's one point I don't 
understand:
The comment for pager_stmt_playback says:

**(2)  In addition to playing back the statement journal, also
** playback all pages of the transaction journal beginning
** at offset pPager->stmtJSize.
I don't understand why it is not enough to just play back the 
statement journal but also parts of the normal journal have to be 
played back.
For me, the comment implies that changes could be done to the db that 
only go into the normal journal, but not into the statement journal. 
Otherwise, it should be enough to play back the statement journal, 
right?
Now I don't understand which statements don't make it into the 
statement journal, even if a statement is active.

I would be grateful I someone could enlighten me.
pPager->stmtJSize is the size of the normal rollback journal when
the statement is started.  As new pages are added to the journals, they
are only written to the statement journal if they are already in the
normal journal.  If a page is unchanged prior to the start of the
statement (if that page is not previously in the normal journal)
then the page is written to the normal journal only.  This saves
a single write of the page and that can significantly enhance
performance.



RE: [sqlite] Running out of memory

2004-12-28 Thread Sandy Ganz
The strcmp might be misleading you, depending on the implementation if a
parameter is actually NULL it can return 0. But the easiest thing would be
to print the queries right before you call the exec function and see what it
shows. Also how did you allocate the query value that is passed in?

Sandy

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 12:43 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Running out of memory



Hi All,

To give some more information

void myfunction(char* query)
{

  printf(" Query is: %s \n",query);

char* newquery = "insert into sdb
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,
capacity)
values (43,'HARDWARE','MONITOR','GE','NA','XYZ',0,0,4,2)"

 int cmpval = strcmp(query,newquery);

  if (cmpval == 0)
 printf("strings match \n");
 else
   printf("Strings dont match\n")

printf("--\n");
  rc = sqlite3_exec(db,query, NULL, 0, &zErrMsg);

   if( rc!=SQLITE_OK )
{
  fprintf(stderr, "SQL error while registering: %s\n",zErrMsg);
}

}

Now if I use sqlite3_exec(db,newquery, NULL, 0, &zErrMsg) it works fine.
But if I use sqlite3_exec(db,query, NULL, 0, &zErrMsg); it gives me the
unrecognized token "" error.

Eventhough my strcmp function tells me that the two strings match, but
sql_exec does not think so. I am bit confused as to why the same
hard-coded string works but not the other one.

Any help on this would be great.

Regards,
--Sameer.

On Tue, 28 Dec 2004, D. Richard Hipp wrote:

> Roger Binns wrote:
>  > [M]ost software does not play well with running out of memory...
>  >
>
> FWIW:  If a malloc() ever fails with SQLite, it will return
> SQLITE_NOMEM.  It also sets a flag and will forever after
> continue to return SQLITE_NOMEM even if you free up a bunch
> of memory so that malloc() would start working again.  There
> is no way to reset this condition.  Once a malloc() fails,
> the party is over and you might as well shut down the process.
>
> If malloc() fails, SQLite might also leak memory.  (Ironic,
> isn't it?)
>
> The only guarantees that SQLite makes after a malloc failure
> is that it will not abort() or panic() or segfault.  Basically,
> it just gives you a chance to shutdown gracefully.  This might
> not sound like much, but as Roger points out, it is a lot
> more than most other software packages offer.
>
>



RE: [sqlite] Running out of memory

2004-12-28 Thread Sandy Ganz
I like that, it solves the problem of someone having to fix a problem that
might otherwise go un-noticed, probabally not good for a process that can't
automatically restarted, but I'm not building a mars rover! The memory leak
takes care of itself hopefully when the whole process dies (well get shut
down) :-)

Sandy


-Original Message-
From: D. Richard Hipp [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 12:41 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Running out of memory


Roger Binns wrote:
 > [M]ost software does not play well with running out of memory...
 >

FWIW:  If a malloc() ever fails with SQLite, it will return
SQLITE_NOMEM.  It also sets a flag and will forever after
continue to return SQLITE_NOMEM even if you free up a bunch
of memory so that malloc() would start working again.  There
is no way to reset this condition.  Once a malloc() fails,
the party is over and you might as well shut down the process.

If malloc() fails, SQLite might also leak memory.  (Ironic,
isn't it?)

The only guarantees that SQLite makes after a malloc failure
is that it will not abort() or panic() or segfault.  Basically,
it just gives you a chance to shutdown gracefully.  This might
not sound like much, but as Roger points out, it is a lot
more than most other software packages offer.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Re: [sqlite] Running out of memory

2004-12-28 Thread stilak1

Hi All,

To give some more information

void myfunction(char* query)
{

  printf(" Query is: %s \n",query);

char* newquery = "insert into sdb
(id,resclass,type,manufacturer,method,ownership,precision,minrange,maxrange,capacity)
values (43,'HARDWARE','MONITOR','GE','NA','XYZ',0,0,4,2)"

 int cmpval = strcmp(query,newquery);

  if (cmpval == 0)
 printf("strings match \n");
 else
   printf("Strings dont match\n")

printf("--\n");
  rc = sqlite3_exec(db,query, NULL, 0, &zErrMsg);

   if( rc!=SQLITE_OK )
{
  fprintf(stderr, "SQL error while registering: %s\n",zErrMsg);
}

}

Now if I use sqlite3_exec(db,newquery, NULL, 0, &zErrMsg) it works fine.
But if I use sqlite3_exec(db,query, NULL, 0, &zErrMsg); it gives me the
unrecognized token "" error.

Eventhough my strcmp function tells me that the two strings match, but
sql_exec does not think so. I am bit confused as to why the same
hard-coded string works but not the other one.

Any help on this would be great.

Regards,
--Sameer.

On Tue, 28 Dec 2004, D. Richard Hipp wrote:

> Roger Binns wrote:
>  > [M]ost software does not play well with running out of memory...
>  >
>
> FWIW:  If a malloc() ever fails with SQLite, it will return
> SQLITE_NOMEM.  It also sets a flag and will forever after
> continue to return SQLITE_NOMEM even if you free up a bunch
> of memory so that malloc() would start working again.  There
> is no way to reset this condition.  Once a malloc() fails,
> the party is over and you might as well shut down the process.
>
> If malloc() fails, SQLite might also leak memory.  (Ironic,
> isn't it?)
>
> The only guarantees that SQLite makes after a malloc failure
> is that it will not abort() or panic() or segfault.  Basically,
> it just gives you a chance to shutdown gracefully.  This might
> not sound like much, but as Roger points out, it is a lot
> more than most other software packages offer.
>
>


[sqlite] Running out of memory

2004-12-28 Thread D. Richard Hipp
Roger Binns wrote:
> [M]ost software does not play well with running out of memory...
>
FWIW:  If a malloc() ever fails with SQLite, it will return
SQLITE_NOMEM.  It also sets a flag and will forever after
continue to return SQLITE_NOMEM even if you free up a bunch
of memory so that malloc() would start working again.  There
is no way to reset this condition.  Once a malloc() fails,
the party is over and you might as well shut down the process.
If malloc() fails, SQLite might also leak memory.  (Ironic,
isn't it?)
The only guarantees that SQLite makes after a malloc failure
is that it will not abort() or panic() or segfault.  Basically,
it just gives you a chance to shutdown gracefully.  This might
not sound like much, but as Roger points out, it is a lot
more than most other software packages offer.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


Re: [sqlite] Re:New to SQLite, couple of questions

2004-12-28 Thread Roger Binns
I have to write and maintain this code. Currently I have over 30mm records
and that could easily double and what I want to do is dump it all in memory
and do a federator ontop of SQLite. The DB's are read only and as long as I
can do sql to them, I'm a-ok.
It sounds like you are trying to do an early optimisation of putting all
your data in memory since RAM can be faster than disk.  Are you sure there
is any benefit to this, instead of just using 'pragma cache_size' and/or
letting the operating do normal filesystem caching?
You can also create indexes etc to speed things up (which takes more space/memory), 
but having everything in memory is very fragile if you hit the address space 
limits.  And most software does not play well with running out of memory (have 
you checked every single library you use will gracefully handle it and will your
code also do so?)

Roger


[sqlite] Re:New to SQLite, couple of questions

2004-12-28 Thread Sandy Ganz
Hope this gets to the right thread, I'm lame and can't figure out the mlm
:-)

The main reason that I want to use SQLite is to have the SQL ability on a
bunch of data in memory. The other is that I don't want to write any more
non-standard interfaces where the SQL to SQLite is pretty good. I have other
processes that do much of what others have said, (preallocate all memory,
hash, etc) but it is a pain to make this easier for the users to query _and_
I have to write and maintain this code. Currently I have over 30mm records
and that could easily double and what I want to do is dump it all in memory
and do a federator ontop of SQLite. The DB's are read only and as long as I
can do sql to them, I'm a-ok. Unless someone knows of a nicer way to split
the tables up and still have reasonable respone time, or if someone has the
open source 'magic' federator software I'm open for lots of options. Just
started looking at MySQL Merge tables, but I'm guessing it may be slow (all
dbs stuffed on the NAS)...

Thanks for the input so far, I'll be using SQLite for my other projects to
be sure.

Sandy



Re: [sqlite] sqlite3_step() and sqlite3_reset() return values

2004-12-28 Thread Roger Binns
I tried inserting two rows the same unique index.
sqlite3_step() failed, as expected, but returned 1 (SQLITE_ERROR).
Even sqlite3_errcode() returned 1 (SQLITE_ERROR). I would have
expected error 19 (SQLITE_CONSTRAINT) to be returned.
I got bit by this as well.  However go and look at the docs where
it clearly states what happens.
http://www.sqlite.org/capi3ref.html#sqlite3_step
  The return value will be either SQLITE_BUSY, SQLITE_DONE, SQLITE_ROW, 
  SQLITE_ERROR, or SQLITE_MISUSE. 

You have to use finalize or reset to get the actual error code.  That
isn't a burden since you always have to call finalize (or reset) anyway.
Roger


Re: [sqlite] Filtering out return receipts in mailing list messages

2004-12-28 Thread D. Richard Hipp
D. Richard Hipp wrote:
Who can give me a clue about how I can configure
ezmlm so that it filters out those annoying return
receipt requests?
Clay Dowling sent me a clue.  I've implemented it.  Now
I'm testing.  I've requested a return receipt with this
message.  If you do not get a return receipt message
when you receive this message, that means Clay's
suggestion worked and the subject is closed.  If you
do see a return receipt request, then I still have
some more fixing to do and will entertain additional
hints.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


[sqlite] Filtering out return receipts in mailing list messages

2004-12-28 Thread D. Richard Hipp
Who can give me a clue about how I can configure
ezmlm so that it filters out those annoying return
receipt requests?
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


Re: [sqlite] VACUUM function problem

2004-12-28 Thread stilak1


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


Re: [sqlite] VACUUM function problem

2004-12-28 Thread D.W.
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.
>



[sqlite] problem while executing a query

2004-12-28 Thread stilak1

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.



Re: [sqlite] loading Sqlite on Encore's Simputer

2004-12-28 Thread Ishwar . Jasuja

Return Receipt
   
Your  Re: [sqlite] loading Sqlite on Encore's Simputer 
document   
:  
   
was   Ishwar Jasuja/NA/Johnson_Controls
received   
by:
   
at:   12/28/2004 09:10:31 AM PST   
   






Re: [sqlite] Sqlite installation problems

2004-12-28 Thread Ishwar . Jasuja

Return Receipt
   
Your  Re: [sqlite] Sqlite installation problems
document   
:  
   
was   Ishwar Jasuja/NA/Johnson_Controls
received   
by:
   
at:   12/28/2004 09:10:29 AM PST   
   






Re: [sqlite] VACUUM function problem

2004-12-28 Thread Brass Tilde
> 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.



Re: [sqlite] VACUUM function problem

2004-12-28 Thread bbum
On Dec 28, 2004, at 11:44 AM, D.W. wrote:
Is there a function that does what I have described?
[described... 'compact' the primary keys of a database so that there 
are no unused gaps after a row or rows have been deleted]

No.  And, generally, you really don't want to do that.
The primary keys are generally used to create relationships between 
tables.  That is, the primary key of a row in table A will appear in 
fields of row or rows in table B (thus called a foreign key).

If you were to go and change the primary keys in table A, it would also 
require changing all of the foreign keys to A in table B (and all other 
tables).

This can be significantly expensive and is one of the reasons why it is 
generally preferable to keep primary keys meaningless beyond being a 
unique and unchanging row identifier.

If you need a field in table A that acts as a sort of numeric counter 
of the rows of that table, then create a field to do exactly that and 
don't use it as a key.   in general, I have seen few schemas that 
actually use such a column of data that requires every number to be 
consecutive.

If order of insertion is important, most schemas use a creation date 
column.   The database representation is generally an INT containing 
the number of seconds since some significant date;  Jan 1, 1970 or 2000 
being the most common.With that, you can always sort on said column 
to determine insert order and the "index" of a particular row in the 
overall table can generally be implied by the query itself, though not 
always.




Re: [sqlite] Sqlite installation problems

2004-12-28 Thread Force3 Team
Hi! everyone,
I am a newbie as far as Sqlite is concerend. So I just need some help 
to get things started. I am working on Mandrake Linux 10.0 platform.

I have downloaded the rpm 'sqlite-2.8.15-1.i386.rpm' from the 
downloads section of www.sqlite.org. I log into my linux system as 
root and execute the above rpm when the following error pops up :

"Some package requested cannot be installed:
sqlite-2.8.15-1.i386(due to unsatisfied libreadline.so.4)
do you agree?"
 

You have to install the libreadline package, which is either called 
libreadline-X.rpm or readline-.rpm (fill in the 's).  If you 
can't find it in the package manager, go through the CDs one by one, 
then, from the command-line (and as root), do:

rpm -uvh readline-.rpm
(or whatever it is called), with the current directory being in 
/mnt/cdrom/Mandrake or similar.

Hi, I am facing the similar kind of problem on Encore's Simputer
can any one help me to find out the source code of libreadline-so.4 lib.
so that i cam complie it for intel arm procesor.
Thanks in advance.
--
Regards, and  Have a nice day.
Prachait Saxena
Force3 Team
---
(M) :- +91 98229 44025
(M) :- +91 93732 81318
(E) :- prachait (at) force3-india (dot) com
(W) :- http://www.force3-india.org/
(W) :- http://www.force3-india.com/
_
Our Solution at Microsoft Solution Market Place
Public Grievance Redressal System version 1.0.0
http://www.microsoft.com/asia/solutionmarketplace/solutiondetail.asp?ind=3&sid=30101&type=1&solid=1760&language=1&searchresult=true&sLanguage=1
Checkout Latest:
http://force3-india.org/downloads/Presentations/Force3-India_inCLASS-Presentation.zip


[sqlite] explaination for libreadline.so.4

2004-12-28 Thread Force3 Team
Hi,
today I received a copy of Sqlite library for the Encore's Simputer
I put all the lib in /lib folder
and when i try to run ./sqllite ..
i give me an error as can not read / find "libreadline.so.4"
Can any one explain me about this error ?
--
Regards, and  Have a nice day.
Prachait Saxena
Force3 Team
---
(M) :- +91 98229 44025
(M) :- +91 93732 81318
(E) :- prachait (at) force3-india (dot) com
(W) :- http://www.force3-india.org/
(W) :- http://www.force3-india.com/
_
Our Solution at Microsoft Solution Market Place
Public Grievance Redressal System version 1.0.0
http://www.microsoft.com/asia/solutionmarketplace/solutiondetail.asp?ind=3&sid=30101&type=1&solid=1760&language=1&searchresult=true&sLanguage=1
Checkout Latest:
http://force3-india.org/downloads/Presentations/Force3-India_inCLASS-Presentation.zip


Re: [sqlite] loading Sqlite on Encore's Simputer

2004-12-28 Thread Force3 Team
Roger Binns wrote:
As I start the compilation the scrept ./autogen.sh work fine
and the make will stuck and did not able to run lemon.

Just use the preprocessed source (the zip file).  Although it is
primarily aimed at Windows, it actually works perfectly on all
platforms.  This is how I compile SQLite, making an archive for
static linking:
$ unzip sqlite-source-3.0.8.zip
$ rm tclsqlite.c# Not needed $ gcc -DTHREADSAFE -O3 -c 
*.c   # Adding -DNDEBUG will turn off assertion checking and
   # improve performance (about 25%) at the 

expense of safety
$ ar r libsqlite3.a *.o
$ ranlib libsqlite3.a
Roger
Yes, You are correct, but Please tell me I am compling it
for intel arm processor via arm-linux-gcc.
Do we have some different source code or make file of arm processor ?
I will try your solution, and get back to you with the result.
--
Regards, and  Have a nice day.
Prachait Saxena
Force3 Team
---
(M) :- +91 98229 44025
(M) :- +91 93732 81318
(E) :- prachait (at) force3-india (dot) com
(W) :- http://www.force3-india.org/
(W) :- http://www.force3-india.com/
_
Our Solution at Microsoft Solution Market Place
Public Grievance Redressal System version 1.0.0
http://www.microsoft.com/asia/solutionmarketplace/solutiondetail.asp?ind=3&sid=30101&type=1&solid=1760&language=1&searchresult=true&sLanguage=1
Checkout Latest:
http://force3-india.org/downloads/Presentations/Force3-India_inCLASS-Presentation.zip


Re: [sqlite] VACUUM function problem

2004-12-28 Thread D.W.
Is there a function that does what I have described?


> Defragging the database just removes empty pages making the database
> file smaller.  It doesn't actually touch any data.
>
> Have a look here:
> http://www.sqlite.org/lang.html#vacuum
>
> AJ
>
> On Tue, 28 Dec 2004 17:30:10 +0100, D.W. <[EMAIL PROTECTED]> wrote:
> > 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,...
> > Is the vacuum function not the right function?
> > Daniel
>



Re: [sqlite] VACUUM function problem

2004-12-28 Thread AJ Bourg
Defragging the database just removes empty pages making the database
file smaller.  It doesn't actually touch any data.

Have a look here:
http://www.sqlite.org/lang.html#vacuum

AJ

On Tue, 28 Dec 2004 17:30:10 +0100, D.W. <[EMAIL PROTECTED]> wrote:
> 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,...
> Is the vacuum function not the right function?
> Daniel


Re: [sqlite] VACUUM function problem

2004-12-28 Thread D.W.
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,...
Is the vacuum function not the right function?
Daniel
- Original Message -
From: "Ulrik Petersen" <[EMAIL PROTECTED]>
To: 
Sent: Monday, December 27, 2004 10:40 PM
Subject: Re: [sqlite] VACUUM function problem


> D.W. wrote:
>
> >Thanks for your reply.
> >I  have just checked the version. It's 2.8.15.
> >There's no active transaction.
> >Do you have another idea?
> >
> >
> How do you verify that nothing happens?
>
> Ulrik
>
> --
> Ulrik Petersen, MA, B.Sc.
> University of Aalborg, Denmark
>
>



Re: [sqlite] Sqlite installation problems

2004-12-28 Thread Ulrik Petersen
Hi Anirban,
Anirban Sarkar wrote:
Hi! everyone,
I am a newbie as far as Sqlite is concerend. So I just need some help to get 
things started. I am working on Mandrake Linux 10.0 platform.
I have downloaded the rpm 'sqlite-2.8.15-1.i386.rpm' from the downloads section 
of www.sqlite.org. I log into my linux system as root and execute the above rpm 
when the following error pops up :
"Some package requested cannot be installed:
sqlite-2.8.15-1.i386(due to unsatisfied libreadline.so.4)
do you agree?"
 

You have to install the libreadline package, which is either called 
libreadline-X.rpm or readline-.rpm (fill in the 's).  If you 
can't find it in the package manager, go through the CDs one by one, 
then, from the command-line (and as root), do:

rpm -uvh readline-.rpm
(or whatever it is called), with the current directory being in 
/mnt/cdrom/Mandrake or similar.

HTH
Ulrik
--
Ulrik Petersen, MA, B.Sc.
University of Aalborg, Denmark
Homepage: http://ulrikp.org



Re: [sqlite] Any way of using an implicit BTree ordering in SQLite?

2004-12-28 Thread Bertrand Mansion
Andrew Piskorski wrote:

>On Sun, Dec 19, 2004 at 12:09:08PM +0100, Bertrand Mansion wrote:
>
>> For web applications (sqlite being now the default database for PHP5), 
>> COUNT(*)
>> performance is more important than INSERTs and DELETEs performance. The 
>> obvious
>
>That sounds VERY much like a matter of opinion.  I strongly suspect I
>could find plenty of high-powered database backed website developers
>who would argue the exact opposite.

That's not an opinion, that's the way it is for the large majority of web
applications. I am not talking about the few exceptions that do INSERTs on every
pages instead of using log files...

Bertrand Mansion
Mamasam



[sqlite] sqlite3_step() and sqlite3_reset() return values

2004-12-28 Thread Ron Avriel
Hi,

I tried inserting two rows the same unique index.
sqlite3_step() failed, as expected, but returned 1 (SQLITE_ERROR).
Even sqlite3_errcode() returned 1 (SQLITE_ERROR). I would have
expected error 19 (SQLITE_CONSTRAINT) to be returned.

I was also surprised that the next sqlite3_reset() returned 19
(SQLITE_CONSTRAINT) instead of 0. Only the second consecutive
sqlite3_reset() returned 0.

Should a non-zero result from sqlite3_reset() be considered an error?
How can I get a more detailed NUMERIC error result (in this case error
19) from sqlite3_step()?

Thanks,
Ron


[sqlite] Sqlite installation problems

2004-12-28 Thread Anirban Sarkar
Hi! everyone,

I am a newbie as far as Sqlite is concerend. So I just need some help to get 
things started. I am working on Mandrake Linux 10.0 platform.

I have downloaded the rpm 'sqlite-2.8.15-1.i386.rpm' from the downloads section 
of www.sqlite.org. I log into my linux system as root and execute the above rpm 
when the following error pops up :

"Some package requested cannot be installed:
sqlite-2.8.15-1.i386(due to unsatisfied libreadline.so.4)
do you agree?"

Here, I only have the option of clicking on OK or Cancel. The installation 
process terminates if I click on either of these options.

Any help in this regard will be highly appreciated. Please be informed that I 
am stuck at a very critical point. So any early responses will be very helpful.

Thanks in advance.

Your's sincerely,
Anirban Sarkar