in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

does not allow CommandText to be more than 110-120 K

Last post 07-05-2006 4:15 AM by AlexDP. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-26-2006 5:16 AM

    • AlexDP
    • Top 150 Contributor
    • Joined on 06-15-2006
    • Ukraine, Dniepropetrovsk
    • Posts 9

    does not allow CommandText to be more than 110-120 K

    SQLite.NET ExecuteNonQuery() does not allow
    CommandText to be more than 110-120 K, it was found
    out by experimental way. If text is more than 110-120
    K it gives exception, "Attempted to read or write
    protected memory. This is often an indication that
    other memory is corrupt."

    If this is not a bug, but feature :), maybe it's a good idea to trow exception, when size is more than 110 K and add short note to documentation?

    Kind Regards

    Aleksander Blokha.

  • 06-26-2006 7:56 AM In reply to

    Re: does not allow CommandText to be more than 110-120 K

    I'll check it out, thanks.  Are you sure this is happening with the ADO.NET 2.0 provider and not the Finisar ADO.NET 1.1 provider?

    Robert

     

  • 06-26-2006 8:59 AM In reply to

    • AlexDP
    • Top 150 Contributor
    • Joined on 06-15-2006
    • Ukraine, Dniepropetrovsk
    • Posts 9

    Re: does not allow CommandText to be more than 110-120 K

    Yes, I'm sure. I'm using it under Visual Studio 2005 with .net 2.0.

     

  • 06-27-2006 2:15 PM In reply to

    • zapov
    • Top 500 Contributor
    • Joined on 06-27-2006
    • Posts 4

    Re: does not allow CommandText to be more than 110-120 K

    I am having the same problem, but for much "smaller" queries (bunch of queries) - around 20KB.

    Exception:

    System.AccessViolationException was unhandled by user code
      Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
      Source="mscorlib"
      StackTrace:
           at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)
           at System.Runtime.InteropServices.Marshal.Copy(IntPtr source, Byte[] destination, Int32 startIndex, Int32 length)
           at System.Data.SQLite.SQLiteConvert.ToString(IntPtr nativestring, Int32 nativestringlen)
           at System.Data.SQLite.SQLite3.Prepare(String strSql, SQLiteStatement previous, String& strRemain)
           at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
           at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
           at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
  • 06-27-2006 10:36 PM In reply to

    Re: does not allow CommandText to be more than 110-120 K

    Bleh.  I think I know what the problem is.  I need to do some pointer pinning :)

     

  • 06-28-2006 3:04 AM In reply to

    • AlexDP
    • Top 150 Contributor
    • Joined on 06-15-2006
    • Ukraine, Dniepropetrovsk
    • Posts 9

    Re: does not allow CommandText to be more than 110-120 K

    Just a note. I also have a bunch of queries (such a buffer). By the way. Parametrized insert in loop is two times faster, than insert using bunch of queries.

    Aleksander Blokha

  • 06-30-2006 8:39 PM In reply to

    Re: does not allow CommandText to be more than 110-120 K

    I'm having trouble duplicating this ... got any suggestions on how I should go about it?  Here's my sample code which runs fine:

    using (DbCommand cmd = cnn.CreateCommand())

    {

    StringBuilder text = new StringBuilder();

    for (int n = 0; n < 1000; n++)

    {

    text.AppendFormat(@"insert into player(id, value) values({0}, 'foo');

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    -- This is an example of a really big command

    ", n);

    }

    cmd.CommandText = @"BEGIN IMMEDIATE;

    CREATE TABLE player (id integer primary key, value varchar(50));" + text.ToString() + "COMMIT;";

    cmd.ExecuteNonQuery();

    }

    The command being executed is 2,306,979 bytes long.

     

  • 07-01-2006 7:57 PM In reply to

    Re: does not allow CommandText to be more than 110-120 K

    Ok I finally got this duplicated and fixed.

    Robert

     

  • 07-05-2006 4:15 AM In reply to

    • AlexDP
    • Top 150 Contributor
    • Joined on 06-15-2006
    • Ukraine, Dniepropetrovsk
    • Posts 9

    Re: does not allow CommandText to be more than 110-120 K

    Thank you!
Page 1 of 1 (9 items)
Powered by Community Server (Commercial Edition), by Telligent Systems