Ejemplo n.º 1
0
        public void Insert(Insert value, Action<long> yield)
        {
            WithConnection(
             c =>
             {
                 value.ExecuteNonQuery(c);

                 yield(c.LastInsertRowId);
             }
           );
        }
Ejemplo n.º 2
0
        public Task<long> Insert(Insert value)
        {
            var id = -1L;

            WithConnection(
                c =>
                {
                    value.ExecuteNonQuery(c);

                    id = c.LastInsertRowId;
                }
            );

            return Task.FromResult(id);
        }
Ejemplo n.º 3
0
        public long Insert(Insert value)
        {
            var id = -1L;

            WithConnection(
                c =>
                {
                    value.ExecuteNonQuery(c);

                    id = c.LastInsertRowId;
                }
            );

            return id;
        }
Ejemplo n.º 4
0
        public Task <long> Insert(Insert value)
        {
            var id = -1L;

            WithConnection(
                c =>
            {
                value.ExecuteNonQuery(c);

                id = c.LastInsertRowId;
            }
                );

            return(Task.FromResult(id));
        }
Ejemplo n.º 5
0
        public long Insert(Insert value)
        {
            var id = -1L;

            WithConnection(
                c =>
            {
                value.ExecuteNonQuery(c);

                id = c.LastInsertRowId;
            }
                );

            return(id);
        }
Ejemplo n.º 6
0
        public void Insert(Insert value, Action<long> yield)
        {
            Console.WriteLine("Insert enter");
            WithWriteConnection(
                c =>
                {
                    Console.WriteLine("Insert before ExecuteNonQuery");
                    value.ExecuteNonQuery(c);

                    yield(c.LastInsertRowId);
                    Console.WriteLine("Insert after ExecuteNonQuery");
                }
             );
            Console.WriteLine("Insert exit");
        }
Ejemplo n.º 7
0
        public void Insert(Insert value, Action<long> yield)
        {
            //enter upload
            //enter upload
            //{ ContentType = image/jpeg, FileName = emspectrum.jpg, ContentLength = 82548, Length = 82548 }
            //{ ContentType = image/jpeg, FileName = emspectrum.jpg, ContentLength = 82548, Length = 82548 }
            //before insert { ManagedThreadId = 34 }
            //before insert { ManagedThreadId = 13 }
            //AsWithConnection... error: { ex = System.Data.SQLite.SQLiteBusyException (0x80004005)
            //   at System.Data.SQLite.SQLiteCommand.ExecuteStatement(Vdbe pStmt, Int32& cols, IntPtr& pazValue, IntPtr& pazColName)
            //   at System.Data.SQLite.SQLiteCommand.ExecuteStatement(Vdbe pStmt)
            //   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior, Boolean want_results, Int32& rows_affected)
            //   at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
            //   at DropFileIntoSQLite.Schema.Table1Extensions.ExecuteNonQuery(Insert , IDbConnection )

            WithConnection(
             c =>
             {
                 value.ExecuteNonQuery(c);

                 yield(c.LastInsertRowId);
             }
           );
        }
Ejemplo n.º 8
0
        public void Insert(Insert content, Action<string> key)
        {
            Trace.w("Insert... " + new { content.AppSnapshotContent.Length });

            // "C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\my.ini"

            //Caused by: java.lang.RuntimeException: Packet for query is too large (1199750 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
            //        at ScriptCoreLibJava.BCLImplementation.System.Data.SQLite.__SQLiteCommand.ExecuteNonQuery(__SQLiteCommand.java:275)
            // Caused by: java.sql.SQLException: Data truncation: Data too long for column 'AppSnapshotContent' at row 1
            // http://stackoverflow.com/questions/8878779/sql-error-1406-data-too-long-for-column

            WithConnection(
                c =>
                {
                    content.ExecuteNonQuery(c);

                    var LastInsertRowId = "" + c.LastInsertRowId;

                    Trace.w("Insert " + new { LastInsertRowId });

                    key(LastInsertRowId);
                }
            );
        }
Ejemplo n.º 9
0
        public void Insert(Insert value, Action<long> yield)
        {
            //{ Message = "Attempt to write a read-only database\r\nattempt to write a readonly database", StackTrace = "   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)\r\n   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)\r\n   at System.Data.SQLite.SQLiteDataReader.NextResult()\r\n   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)\r\n   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()\r\n   at SQLiteWithDataGridView.Schema.TheGridTableExtensions.ExecuteNonQuery(Insert , SQLiteConnection )\r\n   at SQLiteWithDataGridView.Schema.TheGridTable.<>c__DisplayClass13.<Insert>b__12(SQLiteConnection c) in x:\\jsc.svn\\examples\\javascript\\forms\\SQLiteWithDataGridView\\SQLiteWithDataGridView\\Schema\\TheGridTable.cs:line 95\r\n   at SQLiteWithDataGridView.Schema.XX.<>c__DisplayClass1.<AsWithConnection>b__0(Action`1 y) in x:\\jsc.svn\\examples\\javascript\\forms\\SQLiteWithDataGridView\\SQLiteWithDataGridView\\Schema\\TheGridTable.cs:line 161" }


            //WithConnection(
            WithWriteConnection(
                c =>
                {
                    value.ExecuteNonQuery(c);

                    yield(c.LastInsertRowId);
                }
             );
        }
Ejemplo n.º 10
0
        public void Insert(Insert value)
        {
#if DEBUG
            //Console.WriteLine("before Insert");
#endif


            WithWriteConnection(
                c =>
                {
                    if (ListMode)
                    {
                        InsertList.Add(value);

                        // garbage collect

                        // lesser values will cause glitches in slower clients
                        // IE for example is not streaming, this will need a longer buffer for reconnects
                        var memento = 64;
                        if (InsertList.Count > memento)
                            InsertList[InsertList.Count - memento] = null;

                        //Console.Title = ("@ " + InsertList.Count);
                        return;
                    };

                    value.ExecuteNonQuery(c);
                }
             );

#if DEBUG
            //Console.WriteLine("after Insert");
#endif
        }