Created the following method.
private void CompoundedTransactedEntry(IList CompoundedList)
{
SQLiteCommand cmd = new SQLiteCommand();
cmd.Connection = Connection;
Connection.Open();
//Create transaction since we are assigning large block.
Trans = Connection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
cmd.Transaction = Trans;
try
{
foreach (Buffer buf in CompoundedList)
{
cmd.CommandText = SQL.ProvisionEntry();
// Create the parameters.
cmd.Parameters.Add("IDMEFXML", buf.IDMEFXML);
cmd.Parameters.Add("COLLECTOR", buf.CollectorName);
int aff = cmd.ExecuteNonQuery();
}
Trans.Commit();
}
catch (SQLiteException e)
{
Trans.Rollback();
//TODO: Report failure and drop to directory create.
}
finally
{
Connection.Close();
}
}
to wrap a number of inserts around a transaction as suggested by Sqlite3 pattern for fast optimal db inserts.
Using the following insert.
"insert into IDMEF(MESSAGENO,MESSAGE,COLLECTORNAME) values(null, :IDMEFXML, :COLLECTOR)";
Using the following table definition IDMEF.
MESSAGENO INTEGER PRIMARY KEY,
CREATEDATE DEFAULT CURRENT_TIMESTAMP,
MESSAGE VARCHAR(40000),
COLLECTORNAME VARCHAR(32)
It works for one row but fails for two or more. Returning an exception
2nd parameter to sqlite3_bind() out of range
I'm unable to identify whats causing the problem, but I think it's something to do with null on the primary key, but can't identify whats causing it.
Any help would be appreciated.
Thanks.
Unable to fix 2nd parameter to sqlite3_bind() out of range
-
- Posts: 12
- Joined: Mon 24 Jan 2011 18:21
1. As I understood, your SQL.ProvisionEntry() method returns "insert into IDMEF(MESSAGENO,MESSAGE,COLLECTORNAME) values(null, :IDMEFXML, :COLLECTOR)". But you didn show the definition for your Buffer type and the way you are invoking the CompoundedTransactedEntry() method (the value you are passing to it).
Please send us a small complete test project with the corresponding DDL/DML script to reproduce the issue in our environment.
2. The version (x.xx.xxx) and edition of your dotConnect for SQLite. You can find it in the Tools > SQLite > About menu of Visual Studio.
3. If your edition is Professional, try to debug your application with the dbMonitor tool that performs per-component tracing of database events such as commit, rollback, SQL statement execute etc.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/sqlite ... nitor.html
In dbMonitor you will find the SQL statement that fails to execute and the values of parameters. Try executing the same statement (with the same parameters) using another tool. Does the problem persist in this case as well?
Please send us a small complete test project with the corresponding DDL/DML script to reproduce the issue in our environment.
2. The version (x.xx.xxx) and edition of your dotConnect for SQLite. You can find it in the Tools > SQLite > About menu of Visual Studio.
3. If your edition is Professional, try to debug your application with the dbMonitor tool that performs per-component tracing of database events such as commit, rollback, SQL statement execute etc.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/sqlite ... nitor.html
In dbMonitor you will find the SQL statement that fails to execute and the values of parameters. Try executing the same statement (with the same parameters) using another tool. Does the problem persist in this case as well?
-
- Posts: 12
- Joined: Mon 24 Jan 2011 18:21
Forwarded project as suggested
Forwarded the wee test project as suggested with db included. Its a vs2010 project on windows 2008 enterprise sp2, call stack is very slim, only 3 calls deeps and is easy to determine.
Version is 3.0.86.0 which I think is the latest version.
Bob.
Version is 3.0.86.0 which I think is the latest version.
Bob.
-
- Posts: 12
- Joined: Mon 24 Jan 2011 18:21
Forwarded project as suggested
Shalex,
Has there been any update on this. I forwarded the test project 4 days ago.
Has there been any update on this. I forwarded the test project 4 days ago.
-
- Posts: 12
- Joined: Mon 24 Jan 2011 18:21
Operation completed.
Tried the fix that Aleksandr posted in email. It works as expected. A case on my part of RTFM. At least I followed Pearly Soames maxim, of giving a little taking a little.
You can close this.
Thanks to both.
Bob.
You can close this.
Thanks to both.
Bob.