RE: [sqlite] UPDATE - crash when many columns

2005-07-28 Thread Christian Smith
On Thu, 28 Jul 2005, Mark Allan wrote:

>
>
>Thanks for the replies.
>
>My first assumption was that it was a memory issue. It seems that this is
>only a problem with an UPDATE command, we do not have the same problem
>when using the INSERT command with the same number of columns. Will the
>UPDATE command require more memory to execute?


If all you're doing is sqlite3_prepare, you haven't even reached the
execution stage yet. I presume the issue is that UPDATE takes more parsing
than INSERT, or at least creates a bigger memory footprint in the target
VM. Do you have a stack trace at least?

>
>My embedded platform is as follows:-
>
>Processor: Sharp ARM7 LH79520
>Memory: 2Mb - SRAM cypress
>
>Our stack size is:- 0x7800 bytes (approx 30k)
>Our heap size is:- 0x1C6000 bytes (approx 1.7Mb)


Does the platform return NULL for out of memory errors? If OOM is caught
by the platform, then it's more likely your stack that is running out. You
should be able to verify based on your SP value, but 30K seems very
small.


>
>The code is compiled using the IAR EWARM complier.
>
>Thanks again.
>
>
>
>> -Original Message-
>> From: Christian Smith [mailto:[EMAIL PROTECTED]
>> Sent: 27 July 2005 17:35
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] UPDATE - crash when many columns
>>
>>
>> On Wed, 27 Jul 2005, Mark Allan wrote:
>>
>> >
>> >Hi,
>> >
>> >I am using the SQL command:-
>> >
>> >UPDATE PATIENTS SET
>> FIRSTNAME=?,SURNAME=?,SEX=?,WEIGHT=?,HEIGHT=?,FACTOR=?,DYSPNOE
>> A_SCORE=?,SMOKING_STATUS=?,OCCUPATION=?,REFERRED_BY=? WHERE
>> PATIENT_ID = '296'
>> >
>> >or similar, where the values for the ?'s are all binded via the
>> >appropriate sqlite3_bind_* C functions.
>> >
>> >Now this will run fine when SQLite and our application is
>> compiled and
>> >run on Windows, but when the same code is run on our target
>> harware it
>> >will crash immediately at sqlite3_prepare().
>> >
>> >If I update a smaller number of columns (maximum seems to be
>> 6) then it
>> >runs without any problems, but increase this and it will crash.
>>
>>
>> How big is your stack and heap? You may be running out of memory when
>> parsing the SQL statement. It may help if you stated what
>> your embedded
>> platform is.
>>
>>
>> >
>> >I cannot determine why this happens. Has anybody had the same or a
>> >similar problem? Can anyone help me or help me confirm what
>> the actual
>> >problem may be?
>> >
>> >Thanks in advance for any help
>> >
>> >Mark
>> >
>>
>> --
>> /"\
>> \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
>>  X   - AGAINST MS ATTACHMENTS
>> / \
>>
>

-- 
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \


Re: [sqlite] UPDATE - crash when many columns

2005-07-28 Thread D. Richard Hipp
On Wed, 2005-07-27 at 16:52 +0100, Mark Allan wrote:
> I seem to have a problem when I update more than 6 columns within a
> single record at one time. All columns are in the same table, they are
> either strings, integers or dates.
> 

I just ran a test where create a table with 1 columns, insert
several rows into that table, then change the value of all 1
columns all at once using a single UPDATE statement.  The test
script is over a half megabyte of SQL.  It works fine on my
desktop.

This may be a problem with your embedded system - perhaps
a stack overflow or something like that.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>



RE: [sqlite] UPDATE - crash when many columns

2005-07-28 Thread Mark Allan


Thanks for the replies.

My first assumption was that it was a memory issue. It seems that this is only 
a problem with an UPDATE command, we do not have the same problem when using 
the INSERT command with the same number of columns. Will the UPDATE command 
require more memory to execute?

My embedded platform is as follows:-

Processor: Sharp ARM7 LH79520
Memory: 2Mb - SRAM cypress

Our stack size is:- 0x7800 bytes (approx 30k)
Our heap size is:- 0x1C6000 bytes (approx 1.7Mb)

The code is compiled using the IAR EWARM complier.

Thanks again.



> -Original Message-
> From: Christian Smith [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2005 17:35
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] UPDATE - crash when many columns
> 
> 
> On Wed, 27 Jul 2005, Mark Allan wrote:
> 
> >
> >Hi,
> >
> >I am using the SQL command:-
> >
> >UPDATE PATIENTS SET 
> FIRSTNAME=?,SURNAME=?,SEX=?,WEIGHT=?,HEIGHT=?,FACTOR=?,DYSPNOE
> A_SCORE=?,SMOKING_STATUS=?,OCCUPATION=?,REFERRED_BY=? WHERE 
> PATIENT_ID = '296'
> >
> >or similar, where the values for the ?'s are all binded via the
> >appropriate sqlite3_bind_* C functions.
> >
> >Now this will run fine when SQLite and our application is 
> compiled and
> >run on Windows, but when the same code is run on our target 
> harware it
> >will crash immediately at sqlite3_prepare().
> >
> >If I update a smaller number of columns (maximum seems to be 
> 6) then it
> >runs without any problems, but increase this and it will crash.
> 
> 
> How big is your stack and heap? You may be running out of memory when
> parsing the SQL statement. It may help if you stated what 
> your embedded
> platform is.
> 
> 
> >
> >I cannot determine why this happens. Has anybody had the same or a
> >similar problem? Can anyone help me or help me confirm what 
> the actual
> >problem may be?
> >
> >Thanks in advance for any help
> >
> >Mark
> >
> 
> -- 
> /"\
> \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
>  X   - AGAINST MS ATTACHMENTS
> / \
> 


RE: [sqlite] UPDATE - crash when many columns

2005-07-27 Thread Fred Williams
-Original Message-
From: Mark Allan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 27, 2005 10:53 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] UPDATE - crash when many columns



Hi,

I am using SQLite on an embedded software product.

I seem to have a problem when I update more than 6 columns within a
single record at one time. All columns are in the same table, they are
either strings, integers or dates.

I am using the SQL command:-

UPDATE PATIENTS SET
FIRSTNAME=?,SURNAME=?,SEX=?,WEIGHT=?,HEIGHT=?,FACTOR=?,DYSPNOEA_SCORE=?,
SMOKING_STATUS=?,OCCUPATION=?,REFERRED_BY=? WHERE PATIENT_ID = '296'

or similar, where the values for the ?'s are all binded via the
appropriate sqlite3_bind_* C functions.

Now this will run fine when SQLite and our application is compiled and
run on Windows, but when the same code is run on our target harware it
will crash immediately at sqlite3_prepare().

If I update a smaller number of columns (maximum seems to be 6) then it
runs without any problems, but increase this and it will crash.

I cannot determine why this happens. Has anybody had the same or a
similar problem? Can anyone help me or help me confirm what the actual
problem may be?

Thanks in advance for any help

Mark


Furnishing no hardware specs requires one to presume there is some form
of hardware constraint (most likely memory) causing you issue.

Fred



[sqlite] UPDATE - crash when many columns

2005-07-27 Thread Mark Allan

Hi,

I am using SQLite on an embedded software product.

I seem to have a problem when I update more than 6 columns within a single 
record at one time. All columns are in the same table, they are either strings, 
integers or dates.

I am using the SQL command:-

UPDATE PATIENTS SET 
FIRSTNAME=?,SURNAME=?,SEX=?,WEIGHT=?,HEIGHT=?,FACTOR=?,DYSPNOEA_SCORE=?,SMOKING_STATUS=?,OCCUPATION=?,REFERRED_BY=?
 WHERE PATIENT_ID = '296' 

or similar, where the values for the ?'s are all binded via the appropriate 
sqlite3_bind_* C functions.

Now this will run fine when SQLite and our application is compiled and run on 
Windows, but when the same code is run on our target harware it will crash 
immediately at sqlite3_prepare().

If I update a smaller number of columns (maximum seems to be 6) then it runs 
without any problems, but increase this and it will crash.

I cannot determine why this happens. Has anybody had the same or a similar 
problem? Can anyone help me or help me confirm what the actual problem may be?

Thanks in advance for any help

Mark