Re: [sqlite] sqlite3_step() crash if didn't use sqlite3_bind_int before it

2007-12-01 Thread Ken
You Need to bind for each insert, Sqlite does not bind by address it does a 
copy.
   
  You'll need to populate your variables inside the loop then bind then step:
   
 prepare_v2
   
 for(i = ...) {
assign Variables to be bound.
sqlite bind for each variable/column
  step
  }
  
 finalize/reset
   
 HTH
  
 
So I am thinking to have the bindColumns the tcpAcclRec before the for loop 
so no need to bind the column every single insert.
So I took out the bindColumns for tcpAcclRec in the insert function and 
move right after the begin transaction as below

   


[sqlite] sqlite3_step() crash if didn't use sqlite3_bind_int before it

2007-11-30 Thread Joanne Pham
Hi All,
I have the following code:
   bool insert(Uccls *_uccls, TCPAcclBucket *tcpAcclBucket){
 int nextCol;
   memcpy(, tcpAcclBucket, sizeof (TCPAcclBucket));
 bindColumns for tcpAcclRec
//Execute statement
   sqlite3_step())
   ..
   }

Code to call the insert function:
 begin transaction
 for (int i = 0 ... ) {
   insert ...
}
end transaction

So I am thinking to have the bindColumns the tcpAcclRec before the for loop so 
no need to bind the column every single insert.
So I took out the  bindColumns for tcpAcclRec in the insert function and 
move right after the begin transaction as below
  begin transaction
   bindColumns for tcpAcclRec
 for (int i = 0 ... ) {
   insert 
}
end transaction
The program is crashed right on sqlite3_step()). Do you know what is missing 
here.
I only need to bind all the columns only once time and copy the new data to the 
memory location (tcpAcclRec)
Again the program is crash right after sqlite3_step()) if I move the  
bindColumns for tcpAcclRec out of the insert 
Thanks in advance for the help.
JP


  

Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 

RE: [sqlite] sqlite3_step crash?

2006-03-29 Thread Boris Popov
Thanks, guys. I knew this wasn't going to be enough, I was mostly looking
for suggestions as to how I should pursue the problem and it looks like I'll
have to resort to writing a rusty C sample given that I haven't touched
C/C++ in years. I guess I was still hoping for an "oh yea, we have a bug 123
logged and its been solved post 3.3.4 release" :)

Cheers!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-Original Message-
From: Christian Smith [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 29, 2006 6:40 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite3_step crash?

On Wed, 29 Mar 2006 [EMAIL PROTECTED] wrote:

>"Boris Popov" <[EMAIL PROTECTED]> wrote:
>>
>> Does this help at all?
>>
>
>No.  A stack trace, especially one without line number
>information, is of no help whatsoever.


I beg to differ. Any stack trace that includes malloc or free is almost
certainly heap corruption. What the OP should do is:
- Check for buffer overflows.
- Check for multiple free()s of the same memory block.
- Run the software under some memory checker. Not sure what to recommend
  on Windows.

The problem is almost certainly in the OP's code.


>D. Richard Hipp   <[EMAIL PROTECTED]>


Christian

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


smime.p7s
Description: S/MIME cryptographic signature


Re: [sqlite] sqlite3_step crash?

2006-03-29 Thread Christian Smith
On Wed, 29 Mar 2006 [EMAIL PROTECTED] wrote:

>"Boris Popov" <[EMAIL PROTECTED]> wrote:
>>
>> Does this help at all?
>>
>
>No.  A stack trace, especially one without line number
>information, is of no help whatsoever.


I beg to differ. Any stack trace that includes malloc or free is almost
certainly heap corruption. What the OP should do is:
- Check for buffer overflows.
- Check for multiple free()s of the same memory block.
- Run the software under some memory checker. Not sure what to recommend
  on Windows.

The problem is almost certainly in the OP's code.


>D. Richard Hipp   <[EMAIL PROTECTED]>


Christian

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


Re: [sqlite] sqlite3_step crash?

2006-03-29 Thread drh
"Boris Popov" <[EMAIL PROTECTED]> wrote:
> 
> Does this help at all?
> 

No.  A stack trace, especially one without line number
information, is of no help whatsoever.

If you think the problem is in SQLite and not in your
own code, then you should do as much of the following
as you can:

  (1)  Explain why you think the problem is in SQLite.
  (2)  Tell us exactly what version of SQLite you are
   using and how you obtained it (did you compile it
   yourself or use a precompiled download.)
  (3)  Provide us with your database schema and the
   query you were executing at the time of failure.
  (4)  Provide a sample database.
  (5)  Provide copies of your source code
  (6)  Come up with a reproducible test case that
   demonstrations the problem using the command-line
   shell, sqlite3.exe

--
D. Richard Hipp   <[EMAIL PROTECTED]>



RE: [sqlite] sqlite3_step crash?

2006-03-28 Thread Boris Popov
Here's a stack from VS2005 (comes with SQL2005, so I install that for now)

Unhandled exception at 0x7c91103c (ntdll.dll) in vwnt.exe: 0xC005:
Access violation writing location 0x6c61766e.

>   ntdll.dll!wcsncpy()  + 0x5ad bytes  
[Frames below may be incorrect and/or missing, no symbols loaded for
ntdll.dll]  
msvcrt.dll!free()  + 0xc3 bytes 
sqlite3.dll!sqlite3_thread_cleanup()  + 0x8bd bytes 
sqlite3.dll!sqlite3_free_table()  + 0x3c2a bytes
sqlite3.dll!sqlite3_db_handle()  + 0x2573 bytes 
sqlite3.dll!sqlite3_db_handle()  + 0x3074 bytes 
sqlite3.dll!sqlite3_db_handle()  + 0x347d bytes 
sqlite3.dll!sqlite3_step()  + 0x17d bytes   
vwntoe.dll!NBAPIInnerCall(threadInfoS * tinfo=0x010561c0)  Line 679
+ 0x6 bytes C
vwntoe.dll!IOStateMachine(threadInfoS * t=0x010561c0, int
stateToEnter=0x0001)  Line 1794 + 0x9 bytes C
vwntoe.dll!InitialIOStateMachine(threadInfoS * t=0x010561c0)  Line
1896 + 0x12 bytes   C
msvcrt.dll!_endthreadex()  + 0xa9 bytes 
kernel32.dll!GetModuleFileNameA()  + 0x1b4 bytes

Does this help at all?

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-Original Message-
From: Boris Popov [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 28, 2006 10:32 PM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] sqlite3_step crash?

As a matter of fact sqlite3_reset and sqlite3_finalize also segfault if
invoked on that prepared sqlite3_stmt, so there's something seriously
screwed up, but not immediately obvious what exactly since the previous
sqlite3_column_* and sqlite3_step calls worked just fine to get all 9 rows
that are supposed to be returned... 

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-Original Message-
From: Boris Popov [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 28, 2006 10:16 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] sqlite3_step crash?

Hmm, I have a fairly specific scenario here where after fetching values from
all the rows in the result set calling sqlite3_step segfaults instead of
returning SQLITE_DONE. I'm at a loss as to how I could extract a little more
info to help figure this out, so any pointers would be greatly appreciated.

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.


smime.p7s
Description: S/MIME cryptographic signature


RE: [sqlite] sqlite3_step crash?

2006-03-28 Thread Boris Popov
As a matter of fact sqlite3_reset and sqlite3_finalize also segfault if
invoked on that prepared sqlite3_stmt, so there's something seriously
screwed up, but not immediately obvious what exactly since the previous
sqlite3_column_* and sqlite3_step calls worked just fine to get all 9 rows
that are supposed to be returned... 

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-Original Message-
From: Boris Popov [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 28, 2006 10:16 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] sqlite3_step crash?

Hmm, I have a fairly specific scenario here where after fetching values from
all the rows in the result set calling sqlite3_step segfaults instead of
returning SQLITE_DONE. I'm at a loss as to how I could extract a little more
info to help figure this out, so any pointers would be greatly appreciated.

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.


smime.p7s
Description: S/MIME cryptographic signature


[sqlite] sqlite3_step crash?

2006-03-28 Thread Boris Popov
Hmm, I have a fairly specific scenario here where after fetching values from
all the rows in the result set calling sqlite3_step segfaults instead of
returning SQLITE_DONE. I'm at a loss as to how I could extract a little more
info to help figure this out, so any pointers would be greatly appreciated.

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.


smime.p7s
Description: S/MIME cryptographic signature