From d662eab5fd8af7d26536a3595aa2cedfe658b980 Mon Sep 17 00:00:00 2001 From: Stewart Adcock Date: Fri, 17 Aug 2012 12:05:01 +0100 Subject: [PATCH 01/19] Remove several variables that are declared/assigned, but their values are unused, to eliminate some build warnings with Mono. --- .../TestDriver_src/SQLiteClientTestDriver.cs | 6 +----- .../src/SqliteCommand.cs | 2 +- .../src/SqliteConnection.cs | 2 +- .../src/SqliteDataReader.cs | 2 +- Community.CsharpSqlite/src/attach_c.cs | 9 ++++---- Community.CsharpSqlite/src/btree_c.cs | 7 +++---- Community.CsharpSqlite/src/build_c.cs | 2 +- Community.CsharpSqlite/src/crypto.cs | 2 +- Community.CsharpSqlite/src/delete_c.cs | 6 ++---- Community.CsharpSqlite/src/expr_c.cs | 21 +++++++++---------- Community.CsharpSqlite/src/func_c.cs | 8 +++---- Community.CsharpSqlite/src/insert_c.cs | 10 ++++----- Community.CsharpSqlite/src/main_c.cs | 4 ++-- Community.CsharpSqlite/src/memjournal_c.cs | 17 +++++++-------- Community.CsharpSqlite/src/pager_c.cs | 18 +++++++--------- Community.CsharpSqlite/src/random_c.cs | 2 +- Community.CsharpSqlite/src/resolve_c.cs | 4 +--- Community.CsharpSqlite/src/select_c.cs | 5 ++--- Community.CsharpSqlite/src/vdbe_c.cs | 3 +-- Community.CsharpSqlite/src/vdbeapi_c.cs | 4 ++-- Community.CsharpSqlite/src/vdbeaux_c.cs | 8 +++---- Community.CsharpSqlite/src/vdbetrace_c.cs | 1 - Community.CsharpSqlite/src/vtab_c.cs | 4 ++-- Community.CsharpSqlite/src/where_c.cs | 2 +- 24 files changed, 66 insertions(+), 83 deletions(-) diff --git a/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs b/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs index bfb7b1c..5506465 100644 --- a/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs +++ b/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs @@ -13,8 +13,6 @@ namespace SQLiteClientTests { public class SQLiteClientTestDriver { - StringBuilder TempDirectory = new StringBuilder( "B:/TEMP/" ); - public void Test1() { Console.WriteLine( "Test1 Start." ); @@ -537,8 +535,6 @@ private void MultiInsertsSameThread_T7() private void T7_ThreadStart( object iSequence ) { int aValue = (int)iSequence * 1000; - int op = aValue % 2; - int rows = 0; SqliteConnection con = new SqliteConnection(); con.ConnectionString = connstring_T7; @@ -549,7 +545,7 @@ private void T7_ThreadStart( object iSequence ) cmd.CommandText = commandt; try { - rows = cmd.ExecuteNonQuery(); + cmd.ExecuteNonQuery(); Console.WriteLine( "Created table: ATABLE" + aValue ); } catch ( Exception ex ) diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteCommand.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteCommand.cs index 8586823..20c76ca 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteCommand.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteCommand.cs @@ -315,7 +315,7 @@ private void BindParameters3( Sqlite3.Vdbe pStmt ) private void GetNextStatement( string pzStart, ref string pzTail, ref Sqlite3.Vdbe pStmt ) { - UTF8Encoding encoding = new UTF8Encoding(); + ////UTF8Encoding encoding = new UTF8Encoding(); SqliteError err = (SqliteError)Sqlite3.sqlite3_prepare_v2( parent_conn.Handle2, pzStart, pzStart.Length, ref pStmt, ref pzTail ); if ( err != SqliteError.OK ) throw new SqliteSyntaxException( parent_conn.Handle2.errCode, GetError3() ); diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs index 48eb95d..8849472 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs @@ -343,8 +343,8 @@ public override void Open () return; } - IntPtr errmsg = IntPtr.Zero; /* + IntPtr errmsg = IntPtr.Zero; if (Version == 2){ try { sqlite_handle = Sqlite.sqlite_open(db_file, db_mode, out errmsg); diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs index 79b4dc1..c9e88fc 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs @@ -198,7 +198,7 @@ internal void ReadpVm (Sqlite3.Vdbe pVm, int version, SqliteCommand cmd) else data_row[i] = DateTime.Parse((string)data_row[i], System.Globalization.CultureInfo.InvariantCulture); break; case 4: - int blobbytes = Sqlite3.sqlite3_column_bytes16 (pVm, i); + //int blobbytes = Sqlite3.sqlite3_column_bytes16 (pVm, i); byte[] blob = Sqlite3.sqlite3_column_blob(pVm, i); //byte[] blob = new byte[blobbytes]; //Marshal.Copy (blobptr, blob, 0, blobbytes); diff --git a/Community.CsharpSqlite/src/attach_c.cs b/Community.CsharpSqlite/src/attach_c.cs index 98ed2d5..775a2be 100644 --- a/Community.CsharpSqlite/src/attach_c.cs +++ b/Community.CsharpSqlite/src/attach_c.cs @@ -375,7 +375,6 @@ static void codeAttach( Expr pKey /* Database key for encryption extension */ ) { - int rc; NameContext sName; Vdbe v; sqlite3 db = pParse.db; @@ -385,9 +384,9 @@ static void codeAttach( sName.pParse = pParse; if ( - SQLITE_OK != ( rc = resolveAttachExpr( sName, pFilename ) ) || - SQLITE_OK != ( rc = resolveAttachExpr( sName, pDbname ) ) || - SQLITE_OK != ( rc = resolveAttachExpr( sName, pKey ) ) + SQLITE_OK != resolveAttachExpr( sName, pFilename ) || + SQLITE_OK != resolveAttachExpr( sName, pDbname ) || + SQLITE_OK != resolveAttachExpr( sName, pKey ) ) { pParse.nErr++; @@ -402,7 +401,7 @@ static void codeAttach( }else{ zAuthArg = 0; } -rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); +int rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); if(rc!=SQLITE_OK ){ goto attach_end; } diff --git a/Community.CsharpSqlite/src/btree_c.cs b/Community.CsharpSqlite/src/btree_c.cs index 75edc08..a197839 100644 --- a/Community.CsharpSqlite/src/btree_c.cs +++ b/Community.CsharpSqlite/src/btree_c.cs @@ -2666,7 +2666,7 @@ static int lockBtree( BtShared pBt ) MemPage pPage1 = null; /* Page 1 of the database file */ Pgno nPage; /* Number of pages in the database */ Pgno nPageFile = 0; /* Number of pages in the database file */ - Pgno nPageHeader; /* Number of pages in the database according to hdr */ + ////Pgno nPageHeader; /* Number of pages in the database according to hdr */ Debug.Assert( sqlite3_mutex_held( pBt.mutex ) ); Debug.Assert( pBt.pPage1 == null ); @@ -2680,7 +2680,7 @@ static int lockBtree( BtShared pBt ) /* Do some checking to help insure the file we opened really is ** a valid database file. */ - nPage = nPageHeader = sqlite3Get4byte( pPage1.aData, 28 );//get4byte(28+(u8*)pPage1->aData); + nPage = sqlite3Get4byte( pPage1.aData, 28 );//get4byte(28+(u8*)pPage1->aData); sqlite3PagerPagecount( pBt.pPager, out nPageFile ); if ( nPage == 0 || memcmp( pPage1.aData, 24, pPage1.aData, 92, 4 ) != 0 )//memcmp(24 + (u8*)pPage1.aData, 92 + (u8*)pPage1.aData, 4) != 0) { @@ -7755,7 +7755,7 @@ static int balance( BtCursor pCur ) ** copied either into the body of a database page or into the new ** pSpace buffer passed to the latter call to balance_nonroot(). */ - u8[] pSpace = new u8[pCur.pBt.pageSize];// u8 pSpace = sqlite3PageMalloc( pCur.pBt.pageSize ); + ////u8[] pSpace = new u8[pCur.pBt.pageSize];// u8 pSpace = sqlite3PageMalloc( pCur.pBt.pageSize ); rc = balance_nonroot( pParent, iIdx, null, iPage == 1 ? 1 : 0 ); //if (pFree != null) //{ @@ -9201,7 +9201,6 @@ ref int pnErr /* Write number of errors seen to this variable */ int nRef; IntegrityCk sCheck = new IntegrityCk(); BtShared pBt = p.pBt; - StringBuilder zErr = new StringBuilder( 100 );//char zErr[100]; sqlite3BtreeEnter( p ); Debug.Assert( p.inTrans > TRANS_NONE && pBt.inTransaction > TRANS_NONE ); diff --git a/Community.CsharpSqlite/src/build_c.cs b/Community.CsharpSqlite/src/build_c.cs index 679000a..f59d080 100644 --- a/Community.CsharpSqlite/src/build_c.cs +++ b/Community.CsharpSqlite/src/build_c.cs @@ -2648,7 +2648,7 @@ int flags /* Conflict resolution algorithms. */ { for ( i = 0; i < nCol; i++ ) { - int n = sqlite3Strlen30( pToCol.a[i].zName ); + ////int n = sqlite3Strlen30( pToCol.a[i].zName ); if ( pFKey.aCol[i] == null ) pFKey.aCol[i] = new FKey.sColMap(); pFKey.aCol[i].zCol = pToCol.a[i].zName; diff --git a/Community.CsharpSqlite/src/crypto.cs b/Community.CsharpSqlite/src/crypto.cs index f8c1f98..f41c215 100644 --- a/Community.CsharpSqlite/src/crypto.cs +++ b/Community.CsharpSqlite/src/crypto.cs @@ -548,7 +548,7 @@ static int sqlite3CodecAttach( sqlite3 db, int nDb, string zKey, int nKey ) #endif codec_ctx ctx; int rc; - Pager pPager = pDb.pBt.pBt.pPager; + ////Pager pPager = pDb.pBt.pBt.pPager; sqlite3_file fd; ctx = new codec_ctx();//sqlite3Malloc(sizeof(codec_ctx); diff --git a/Community.CsharpSqlite/src/delete_c.cs b/Community.CsharpSqlite/src/delete_c.cs index 380e2e5..8ee2636 100644 --- a/Community.CsharpSqlite/src/delete_c.cs +++ b/Community.CsharpSqlite/src/delete_c.cs @@ -259,7 +259,6 @@ Expr pWhere /* The WHERE clause. May be null */ { Vdbe v; /* The virtual database engine */ Table pTab; /* The table from which records will be deleted */ - string zDb; /* Name of database holding pTab */ int end, addr = 0; /* A couple addresses of generated code */ int i; /* Loop counter */ WhereInfo pWInfo; /* Information about the WHERE clause */ @@ -323,9 +322,9 @@ Expr pWhere /* The WHERE clause. May be null */ } iDb = sqlite3SchemaToIndex( db, pTab.pSchema ); Debug.Assert( iDb < db.nDb ); - zDb = db.aDb[iDb].zName; #if !SQLITE_OMIT_AUTHORIZATION -rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb); + string zDb = db.aDb[iDb].zName; /* Name of database holding pTab */ + rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb); #else rcauth = SQLITE_OK; #endif @@ -382,7 +381,6 @@ Expr pWhere /* The WHERE clause. May be null */ goto delete_from_cleanup; } - /* Initialize the counter of the number of rows deleted, if ** we are counting rows. */ diff --git a/Community.CsharpSqlite/src/expr_c.cs b/Community.CsharpSqlite/src/expr_c.cs index e257e35..486b5f1 100644 --- a/Community.CsharpSqlite/src/expr_c.cs +++ b/Community.CsharpSqlite/src/expr_c.cs @@ -943,7 +943,7 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) if ( p != null ) { bool isReduced = ( flags & EXPRDUP_REDUCE ) != 0; - Expr zAlloc = new Expr(); + ////Expr zAlloc = new Expr(); u32 staticFlag = 0; Debug.Assert( pzBuffer == null || isReduced ); @@ -961,14 +961,14 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) // (Expr)zAlloc; //if ( pNew != null ) - { + ////{ /* Set nNewSize to the size allocated for the structure pointed to ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed ** by the copy of the p->u.zToken string (if any). */ int nStructSize = dupedExprStructSize( p, flags ); - int nNewSize = nStructSize & 0xfff; + ////int nNewSize = nStructSize & 0xfff; int nToken; if ( !ExprHasProperty( p, EP_IntValue ) && !String.IsNullOrEmpty( p.u.zToken ) ) { @@ -985,7 +985,7 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) } else { - int nSize = exprStructSize( p ); + ////int nSize = exprStructSize( p ); //memcpy( zAlloc, p, nSize ); pNew = p.Copy(); //memset( &zAlloc[nSize], 0, EXPR_FULLSIZE - nSize ); @@ -1000,11 +1000,11 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) pNew.flags |= (ushort)staticFlag; /* Copy the p->u.zToken string, if any. */ - if ( nToken != 0 ) - { - string zToken;// = pNew.u.zToken = (char)&zAlloc[nNewSize]; - zToken = p.u.zToken.Substring( 0, nToken );// memcpy( zToken, p.u.zToken, nToken ); - } + ////if ( nToken != 0 ) + ////{ + //// string zToken;// = pNew.u.zToken = (char)&zAlloc[nNewSize]; + //// zToken = p.u.zToken.Substring( 0, nToken );// memcpy( zToken, p.u.zToken, nToken ); + ////} if ( 0 == ( ( p.flags | pNew.flags ) & EP_TokenOnly ) ) { @@ -1042,7 +1042,7 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) pNew.pRight = sqlite3ExprDup( db, p.pRight, 0 ); } } - } + ////} } return pNew; } @@ -1233,7 +1233,6 @@ static ExprList sqlite3ExprListAppend( Expr pExpr /* Expression to be appended. Might be NULL */ ) { - sqlite3 db = pParse.db; if ( pList == null ) { pList = new ExprList(); //sqlite3DbMallocZero(db, ExprList).Length; diff --git a/Community.CsharpSqlite/src/func_c.cs b/Community.CsharpSqlite/src/func_c.cs index b6a4c32..59a1980 100644 --- a/Community.CsharpSqlite/src/func_c.cs +++ b/Community.CsharpSqlite/src/func_c.cs @@ -1260,8 +1260,6 @@ sqlite3_value[] argv string zRep; /* The replacement string C */ string zOut = null; /* The output */ int nStr; /* Size of zStr */ - int nPattern; /* Size of zPattern */ - int nRep; /* Size of zRep */ int nOut; /* Maximum size of zOut */ //int loopLimit; /* Last zStr[] that might match zPattern[] */ int i, j = 0; /* Loop counters */ @@ -1287,17 +1285,19 @@ sqlite3_value[] argv sqlite3_result_value( context, argv[0] ); return; } - nPattern = sqlite3_value_bytes( argv[1] ); + ////nPattern = sqlite3_value_bytes( argv[1] ); Debug.Assert( zPattern == sqlite3_value_text( argv[1] ) ); /* No encoding change */ zRep = sqlite3_value_text( argv[2] ); if ( zRep == null ) return; - nRep = sqlite3_value_bytes( argv[2] ); + ////nRep = sqlite3_value_bytes( argv[2] ); Debug.Assert( zRep == sqlite3_value_text( argv[2] ) ); nOut = nStr + 1; Debug.Assert( nOut < SQLITE_MAX_LENGTH ); if ( nOut <= sqlite3_context_db_handle( context ).aLimit[SQLITE_LIMIT_LENGTH] ) { + //int nPattern; /* Size of zPattern */ + //int nRep; /* Size of zRep */ //zOut = contextMalloc(context, (i64)nOut); //if( zOut==0 ){ // return; diff --git a/Community.CsharpSqlite/src/insert_c.cs b/Community.CsharpSqlite/src/insert_c.cs index cda4225..78bf0ff 100644 --- a/Community.CsharpSqlite/src/insert_c.cs +++ b/Community.CsharpSqlite/src/insert_c.cs @@ -503,7 +503,6 @@ int onError /* How to handle constraint errors */ sqlite3 db; /* The main database structure */ Table pTab; /* The table to insert into. aka TABLE */ string zTab; /* Name of the table into which we are inserting */ - string zDb; /* Name of the database holding this table */ int i = 0; int j = 0; int idx = 0; /* Loop counters */ @@ -563,11 +562,12 @@ int onError /* How to handle constraint errors */ iDb = sqlite3SchemaToIndex( db, pTab.pSchema ); Debug.Assert( iDb < db.nDb ); pDb = db.aDb[iDb]; - zDb = pDb.zName; #if !SQLITE_OMIT_AUTHORIZATION -if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab.zName, 0, zDb) ){ -goto insert_cleanup; -} + string zDb; /* Name of the database holding this table */ + zDb = pDb.zName; + if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab.zName, 0, zDb) ){ + goto insert_cleanup; + } #endif /* Figure out if we have any triggers and if the table being ** inserted into is a view diff --git a/Community.CsharpSqlite/src/main_c.cs b/Community.CsharpSqlite/src/main_c.cs index f77d35f..7e6773b 100644 --- a/Community.CsharpSqlite/src/main_c.cs +++ b/Community.CsharpSqlite/src/main_c.cs @@ -256,7 +256,7 @@ static public int sqlite3_initialize() memset( pHash, 0, sizeof( sqlite3GlobalFunctions ) ); #else sqlite3GlobalFunctions = new FuncDefHash(); - FuncDefHash pHash = sqlite3GlobalFunctions; + ////FuncDefHash pHash = sqlite3GlobalFunctions; #endif sqlite3RegisterGlobalFunctions(); if ( sqlite3GlobalConfig.isPCacheInit == 0 ) @@ -859,7 +859,7 @@ static int nocaseCollatingFunc( int nKey2, string pKey2 ) { - int n = ( nKey1 < nKey2 ) ? nKey1 : nKey2; + ////int n = ( nKey1 < nKey2 ) ? nKey1 : nKey2; int r = sqlite3StrNICmp( pKey1, pKey2, ( nKey1 < nKey2 ) ? nKey1 : nKey2 ); UNUSED_PARAMETER( NotUsed ); if ( 0 == r ) diff --git a/Community.CsharpSqlite/src/memjournal_c.cs b/Community.CsharpSqlite/src/memjournal_c.cs index 4c3f5fc..6e5ed67 100644 --- a/Community.CsharpSqlite/src/memjournal_c.cs +++ b/Community.CsharpSqlite/src/memjournal_c.cs @@ -218,16 +218,16 @@ sqlite3_int64 iOfst /* Begin writing at this offset into the file */ static int memjrnlTruncate( sqlite3_file pJfd, sqlite3_int64 size ) { MemJournal p = (MemJournal)pJfd; - FileChunk pChunk; + ////FileChunk pChunk; Debug.Assert( size == 0 ); UNUSED_PARAMETER( size ); - pChunk = p.pFirst; - while ( pChunk != null ) - { - FileChunk pTmp = pChunk; - pChunk = pChunk.pNext; - //sqlite3_free( ref pTmp ); - } + ////pChunk = p.pFirst; + ////while ( pChunk != null ) + ////{ + ////FileChunk pTmp = pChunk; + ////pChunk = pChunk.pNext; + ////sqlite3_free( ref pTmp ); + ////} sqlite3MemJournalOpen( pJfd ); return SQLITE_OK; } @@ -241,7 +241,6 @@ static int memjrnlClose( MemJournal pJfd ) return SQLITE_OK; } - /* ** Sync the file. ** diff --git a/Community.CsharpSqlite/src/pager_c.cs b/Community.CsharpSqlite/src/pager_c.cs index cc24d74..c8faf88 100644 --- a/Community.CsharpSqlite/src/pager_c.cs +++ b/Community.CsharpSqlite/src/pager_c.cs @@ -4252,7 +4252,6 @@ static int pagerSyncHotJournal( Pager pPager ) */ static int sqlite3PagerClose( Pager pPager ) { - u8[] pTmp = pPager.pTmpSpace; #if SQLITE_TEST disable_simulated_io_errors(); #endif @@ -4260,17 +4259,16 @@ static int sqlite3PagerClose( Pager pPager ) /* pPager.errCode = 0; */ pPager.exclusiveMode = false; #if !SQLITE_OMIT_WAL -sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp); -pPager.pWal = 0; + u8[] pTmp = pPager.pTmpSpace; + sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp); + pPager.pWal = 0; #endif pager_reset( pPager ); - if ( #if SQLITE_OMIT_MEMORYDB -1==MEMDB + if ( 1 == MEMDB ) #else - 1 == pPager.memDb + if ( 1 == pPager.memDb ) #endif - ) { pager_unlock( pPager ); } @@ -4924,7 +4922,6 @@ dxReiniter xReinit /* Function to reinitialize pages */ */ if ( !String.IsNullOrEmpty( zFilename ) ) { - string z; nPathname = pVfs.mxPathname + 1; zPathname = new StringBuilder( nPathname * 2 );// sqlite3Malloc( nPathname * 2 ); //if ( zPathname == null ) @@ -4935,13 +4932,14 @@ dxReiniter xReinit /* Function to reinitialize pages */ rc = sqlite3OsFullPathname( pVfs, zFilename, nPathname, zPathname ); nPathname = sqlite3Strlen30( zPathname ); - z = zUri = zFilename;//.Substring(sqlite3Strlen30( zFilename ) ); + zUri = zFilename; + //string z = zUri = zFilename;//.Substring(sqlite3Strlen30( zFilename ) ); //while ( *z ) //{ // z += sqlite3Strlen30( z ) + 1; // z += sqlite3Strlen30( z ) + 1; //} - nUri = zUri.Length;// &z[1] - zUri; + //nUri = zUri.Length;// &z[1] - zUri; if ( rc == SQLITE_OK && nPathname + 8 > pVfs.mxPathname ) { /* This branch is taken when the journal path required by diff --git a/Community.CsharpSqlite/src/random_c.cs b/Community.CsharpSqlite/src/random_c.cs index 0e45f81..1db1d8d 100644 --- a/Community.CsharpSqlite/src/random_c.cs +++ b/Community.CsharpSqlite/src/random_c.cs @@ -137,7 +137,7 @@ struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng); */ static void sqlite3_randomness( int N, ref i64 pBuf ) { - u8[] zBuf = new u8[N]; + //u8[] zBuf = new u8[N]; pBuf = 0; #if SQLITE_THREADSAFE sqlite3_mutex mutex = sqlite3MutexAlloc( SQLITE_MUTEX_STATIC_PRNG ); diff --git a/Community.CsharpSqlite/src/resolve_c.cs b/Community.CsharpSqlite/src/resolve_c.cs index cba9d0b..43be2c7 100644 --- a/Community.CsharpSqlite/src/resolve_c.cs +++ b/Community.CsharpSqlite/src/resolve_c.cs @@ -1116,8 +1116,6 @@ static int resolveSelectStep( Walker pWalker, Select p ) int i; /* Loop counter */ ExprList pGroupBy; /* The GROUP BY clause */ Select pLeftmost; /* Left-most of SELECT of a compound */ - sqlite3 db; /* Database connection */ - Debug.Assert( p != null ); if ( ( p.selFlags & SF_Resolved ) != 0 ) @@ -1126,7 +1124,7 @@ static int resolveSelectStep( Walker pWalker, Select p ) } pOuterNC = pWalker.u.pNC; pParse = pWalker.pParse; - db = pParse.db; + //sqlite3 db = pParse.db; /* Normally sqlite3SelectExpand() will be called first and will have ** already expanded this SELECT. However, if this is a subquery within diff --git a/Community.CsharpSqlite/src/select_c.cs b/Community.CsharpSqlite/src/select_c.cs index 6fe9fcd..c4d78f0 100644 --- a/Community.CsharpSqlite/src/select_c.cs +++ b/Community.CsharpSqlite/src/select_c.cs @@ -1584,7 +1584,7 @@ static void selectAddColumnTypeAndCollation( Select pSelect /* SELECT used to determine types and collations */ ) { - sqlite3 db = pParse.db; + //sqlite3 db = pParse.db; NameContext sNC; Column pCol; CollSeq pColl; @@ -4041,10 +4041,9 @@ static void sqlite3SelectPrep( NameContext pOuterNC /* Name context for container */ ) { - sqlite3 db; if ( NEVER( p == null ) ) return; - db = pParse.db; + //sqlite3 db = pParse.db; if ( ( p.selFlags & SF_HasTypeInfo ) != 0 ) return; sqlite3SelectExpand( pParse, p ); diff --git a/Community.CsharpSqlite/src/vdbe_c.cs b/Community.CsharpSqlite/src/vdbe_c.cs index 6b01f73..7396eed 100644 --- a/Community.CsharpSqlite/src/vdbe_c.cs +++ b/Community.CsharpSqlite/src/vdbe_c.cs @@ -3132,7 +3132,6 @@ Vdbe p /* The VDBE */ { int p1; /* Value of P1 operand */ string zName; /* Name of savepoint */ - int nName; Savepoint pNew; Savepoint pSavepoint; Savepoint pTmp; @@ -3163,7 +3162,7 @@ Vdbe p /* The VDBE */ } else { - nName = sqlite3Strlen30( zName ); + ////nName = sqlite3Strlen30( zName ); #if !SQLITE_OMIT_VIRTUALTABLE /* This call is Ok even if this savepoint is actually a transaction diff --git a/Community.CsharpSqlite/src/vdbeapi_c.cs b/Community.CsharpSqlite/src/vdbeapi_c.cs index 6635520..039a8ff 100644 --- a/Community.CsharpSqlite/src/vdbeapi_c.cs +++ b/Community.CsharpSqlite/src/vdbeapi_c.cs @@ -806,8 +806,8 @@ object pAux if ( null == pVdbeFunc || pVdbeFunc.nAux <= iArg ) { int nAux = ( pVdbeFunc != null ? pVdbeFunc.nAux : 0 ); - int nMalloc = iArg; - ;//VdbeFunc+ sizeof(struct AuxData)*iArg; + ////int nMalloc = iArg; + ////VdbeFunc+ sizeof(struct AuxData)*iArg; if ( pVdbeFunc == null ) { //pVdbeFunc = (VdbeFunc)sqlite3DbRealloc( pCtx.s.db, pVdbeFunc, nMalloc ); diff --git a/Community.CsharpSqlite/src/vdbeaux_c.cs b/Community.CsharpSqlite/src/vdbeaux_c.cs index cde6fe5..3d9191e 100644 --- a/Community.CsharpSqlite/src/vdbeaux_c.cs +++ b/Community.CsharpSqlite/src/vdbeaux_c.cs @@ -1121,9 +1121,9 @@ static void sqlite3VdbeChangeP4( Vdbe p, int addr, union_p4 _p4, int n ) else if ( n == P4_KEYINFO ) { KeyInfo pKeyInfo; - int nField, nByte; + int nByte; - nField = _p4.pKeyInfo.nField; + //int nField = _p4.pKeyInfo.nField; //nByte = sizeof(*pKeyInfo) + (nField-1)*sizeof(pKeyInfo.aColl[0]) + nField; pKeyInfo = new KeyInfo();//sqlite3DbMallocRaw(0, nByte); pOp.p4.pKeyInfo = pKeyInfo; @@ -1551,7 +1551,7 @@ static void releaseMemArray( Mem[] p, int starting, int N ) if ( p != null && p.Length > starting && p[starting] != null && N != 0 ) { Mem pEnd; - sqlite3 db = p[starting].db; + //sqlite3 db = p[starting].db; //u8 malloc_failed = db.mallocFailed; //if ( db != null ) //&& db.pnBytesFreed != 0 ) //{ @@ -3987,7 +3987,7 @@ UnpackedRecord pPKey2 /* Right key */ int nField; int rc = 0; - byte[] aKey1 = new byte[pKey1.Length - offset]; + //byte[] aKey1 = new byte[pKey1.Length - offset]; //Buffer.BlockCopy( pKey1, offset, aKey1, 0, aKey1.Length ); KeyInfo pKeyInfo; diff --git a/Community.CsharpSqlite/src/vdbetrace_c.cs b/Community.CsharpSqlite/src/vdbetrace_c.cs index 3d89e5c..82849ad 100644 --- a/Community.CsharpSqlite/src/vdbetrace_c.cs +++ b/Community.CsharpSqlite/src/vdbetrace_c.cs @@ -98,7 +98,6 @@ string zRawSql /* Raw text of the SQL statement */ int i; /* Loop counter */ Mem pVar; /* Value of a host parameter */ StrAccum _out = new StrAccum( 1000 ); /* Accumulate the _output here */ - StringBuilder zBase = new StringBuilder( 100 ); /* Initial working space */ int izRawSql = 0; db = p.db; diff --git a/Community.CsharpSqlite/src/vtab_c.cs b/Community.CsharpSqlite/src/vtab_c.cs index ae468f7..19b1407 100644 --- a/Community.CsharpSqlite/src/vtab_c.cs +++ b/Community.CsharpSqlite/src/vtab_c.cs @@ -376,9 +376,9 @@ static void addArgumentToVtab( Parse pParse ) if ( pParse.sArg.z != null && ALWAYS( pParse.pNewTable ) ) { string z = pParse.sArg.z.Substring( 0, pParse.sArg.n ); - int n = pParse.sArg.n; + ////int n = pParse.sArg.n; sqlite3 db = pParse.db; - addModuleArgument( db, pParse.pNewTable, z );///sqlite3DbStrNDup( db, z, n ) ); + addModuleArgument( db, pParse.pNewTable, z );////sqlite3DbStrNDup( db, z, n ) ); } } diff --git a/Community.CsharpSqlite/src/where_c.cs b/Community.CsharpSqlite/src/where_c.cs index 06b55b6..4e1b3f4 100644 --- a/Community.CsharpSqlite/src/where_c.cs +++ b/Community.CsharpSqlite/src/where_c.cs @@ -456,7 +456,7 @@ static int whereClauseInsert( WhereClause pWC, Expr p, u8 wtFlags ) if ( pWC.nTerm >= pWC.nSlot ) { //WhereTerm pOld = pWC.a; - sqlite3 db = pWC.pParse.db; + //sqlite3 db = pWC.pParse.db; Array.Resize( ref pWC.a, pWC.nSlot * 2 ); //pWC.a = sqlite3DbMallocRaw(db, sizeof(pWC.a[0])*pWC.nSlot*2 ); //if( pWC.a==null ){ From 1d116da2dd0a336b6d65fb4f9790f36666720f1e Mon Sep 17 00:00:00 2001 From: Stewart Adcock Date: Fri, 17 Aug 2012 12:11:26 +0100 Subject: [PATCH 02/19] Fixed Issue 153 - SqliteConnectionStringBuilder separates with ; but SqliteConnection expects , --- .../src/SqliteConnection.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs index 8849472..129e505 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteConnection.cs @@ -174,15 +174,10 @@ private void SetConnectionString(string connstring) db_file = null; db_mode = 0644; - string[] conn_pieces = connstring.Split (','); + string[] conn_pieces = connstring.Split(new char[]{',',';'}, StringSplitOptions.RemoveEmptyEntries); for ( int i = 0; i < conn_pieces.Length; i++ ) { string piece = conn_pieces[i].Trim(); - // ignore empty elements - if ( piece.Length == 0 ) - { - continue; - } int firstEqual = piece.IndexOf( '=' ); if ( firstEqual == -1 ) { From 52d59e1a389240ce8fad54ba351fd414b1e36ee0 Mon Sep 17 00:00:00 2001 From: Stewart Adcock Date: Mon, 20 Aug 2012 14:47:33 +0100 Subject: [PATCH 03/19] Partial fix for bug 138 - accept '@' as prefix for parameters. --- .../src/SqliteParameterCollection.cs | 599 +++++++++--------- 1 file changed, 300 insertions(+), 299 deletions(-) diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteParameterCollection.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteParameterCollection.cs index 4f40199..cdaa53e 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteParameterCollection.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteParameterCollection.cs @@ -1,299 +1,300 @@ -// -// Community.CsharpSqlite.SQLiteClient.SqliteParameterCollection.cs -// -// Represents a collection of parameters relevant to a SqliteCommand as well as -// their respective mappings to columns in a DataSet. -// -//Author(s): Vladimir Vukicevic -// Everaldo Canuto -// Chris Turchin -// Jeroen Zwartepoorte -// Thomas Zoechling -// Alex West -// -// Copyright (C) 2002 Vladimir Vukicevic -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Data; -using System.Data.Common; -using System.Collections; -using System.Collections.Generic ; - -namespace Community.CsharpSqlite.SQLiteClient -{ - public class SqliteParameterCollection : DbParameterCollection - { - - #region Fields - - List numeric_param_list = new List(); - Dictionary named_param_hash = new Dictionary(); - - #endregion - - #region Private Methods - - private void CheckSqliteParam (object value) - { - if (!(value is SqliteParameter)) - throw new InvalidCastException ("Can only use SqliteParameter objects"); - SqliteParameter sqlp = value as SqliteParameter; - if (sqlp.ParameterName == null || sqlp.ParameterName.Length == 0) - sqlp.ParameterName = this.GenerateParameterName(); - } - - private void RecreateNamedHash () - { - for (int i = 0; i < numeric_param_list.Count; i++) - { - named_param_hash[((SqliteParameter) numeric_param_list[i]).ParameterName] = i; - } - } - - //FIXME: if the user is calling Insert at various locations with unnamed parameters, this is not going to work.... - private string GenerateParameterName() - { - int index = this.Count + 1; - string name = String.Empty; - - while (index > 0) - { - name = ":" + index.ToString(); - if (this.IndexOf(name) == -1) - index = -1; - else - index++; - } - return name; - } - - #endregion - - #region Properties - - private bool isPrefixed (string parameterName) - { - return parameterName.Length > 1 && (parameterName[0] == ':' || parameterName[0] == '$'); - } - - protected override DbParameter GetParameter (int parameterIndex) - { - if (this.Count >= parameterIndex+1) - return (SqliteParameter) numeric_param_list[parameterIndex]; - else - throw new IndexOutOfRangeException("The specified parameter index does not exist: " + parameterIndex.ToString()); - } - - protected override DbParameter GetParameter (string parameterName) - { - if (this.Contains(parameterName)) - return this[(int) named_param_hash[parameterName]]; - else if (isPrefixed(parameterName) && this.Contains(parameterName.Substring(1))) - return this[(int) named_param_hash[parameterName.Substring(1)]]; - else - throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName); - } - - protected override void SetParameter (int parameterIndex, DbParameter parameter) - { - if (this.Count >= parameterIndex+1) - numeric_param_list[parameterIndex] = (SqliteParameter)parameter; - else - throw new IndexOutOfRangeException("The specified parameter index does not exist: " + parameterIndex.ToString()); - } - - protected override void SetParameter (string parameterName, DbParameter parameter) - { - if (this.Contains(parameterName)) - numeric_param_list[(int)named_param_hash[parameterName]] = (SqliteParameter)parameter; - else if (parameterName.Length > 1 && this.Contains(parameterName.Substring(1))) - numeric_param_list[(int) named_param_hash[parameterName.Substring(1)]] = (SqliteParameter)parameter; - else - throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName); - } - - public override int Count - { - get - { - return this.numeric_param_list.Count; - } - } - - public override bool IsSynchronized - { - get { return ((IList)this.numeric_param_list).IsSynchronized ; } - } - - public override bool IsFixedSize - { - get { return ((IList)this.numeric_param_list).IsFixedSize; } - } - - public override bool IsReadOnly - { - get { return ((IList)this.numeric_param_list).IsReadOnly; } - } - - public override object SyncRoot - { - get { return ((IList)this.numeric_param_list).SyncRoot ; } - } - - #endregion - - #region Public Methods - - public override void AddRange (Array values) - { - if (values == null || values.Length == 0) - return; - - foreach (object value in values) - Add (value); - } - - public override int Add (object value) - { - CheckSqliteParam (value); - SqliteParameter sqlp = value as SqliteParameter; - if (named_param_hash.ContainsKey(sqlp.ParameterName)) - throw new DuplicateNameException ("Parameter collection already contains the a SqliteParameter with the given ParameterName."); - numeric_param_list.Add(sqlp); - named_param_hash.Add(sqlp.ParameterName, numeric_param_list.IndexOf(sqlp)); - return (int) named_param_hash[sqlp.ParameterName]; - } - - public SqliteParameter Add (SqliteParameter param) - { - Add ((object)param); - return param; - } - - public SqliteParameter Add (string name, object value) - { - return Add (new SqliteParameter (name, value)); - } - - public SqliteParameter Add (string name, DbType type) - { - return Add (new SqliteParameter (name, type)); - } - - public override void Clear () - { - numeric_param_list.Clear (); - named_param_hash.Clear (); - } - - public override void CopyTo (Array array, int index) - { - this.numeric_param_list.CopyTo((SqliteParameter[])array, index); - } - - public override bool Contains (object value) - { - return Contains ((SqliteParameter) value); - } - - public override bool Contains (string parameterName) - { - return named_param_hash.ContainsKey(parameterName); - } - - public bool Contains (SqliteParameter param) - { - return Contains (param.ParameterName); - } - - public override IEnumerator GetEnumerator() - { - return this.numeric_param_list.GetEnumerator(); - } - - public override int IndexOf (object param) - { - return IndexOf ((SqliteParameter) param); - } - - public override int IndexOf (string parameterName) - { - if (isPrefixed (parameterName)){ - string sub = parameterName.Substring (1); - if (named_param_hash.ContainsKey(sub)) - return (int) named_param_hash [sub]; - } - if (named_param_hash.ContainsKey(parameterName)) - return (int) named_param_hash[parameterName]; - else - return -1; - } - - public int IndexOf (SqliteParameter param) - { - return IndexOf (param.ParameterName); - } - - public override void Insert (int index, object value) - { - CheckSqliteParam (value); - if (numeric_param_list.Count == index) - { - Add (value); - return; - } - - numeric_param_list.Insert(index,(SqliteParameter) value); - RecreateNamedHash (); - } - - public override void Remove (object value) - { - CheckSqliteParam (value); - RemoveAt ((SqliteParameter) value); - } - - public override void RemoveAt (int index) - { - RemoveAt (((SqliteParameter) numeric_param_list[index]).ParameterName); - } - - public override void RemoveAt (string parameterName) - { - if (!named_param_hash.ContainsKey (parameterName)) - throw new ApplicationException ("Parameter " + parameterName + " not found"); - - numeric_param_list.RemoveAt((int) named_param_hash[parameterName]); - named_param_hash.Remove (parameterName); - - RecreateNamedHash (); - } - - public void RemoveAt (SqliteParameter param) - { - RemoveAt (param.ParameterName); - } - - #endregion - } -} +// +// Community.CsharpSqlite.SQLiteClient.SqliteParameterCollection.cs +// +// Represents a collection of parameters relevant to a SqliteCommand as well as +// their respective mappings to columns in a DataSet. +// +//Author(s): Vladimir Vukicevic +// Everaldo Canuto +// Chris Turchin +// Jeroen Zwartepoorte +// Thomas Zoechling +// Alex West +// Stewart Adcock +// +// Copyright (C) 2002 Vladimir Vukicevic +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Data; +using System.Data.Common; +using System.Collections; +using System.Collections.Generic ; + +namespace Community.CsharpSqlite.SQLiteClient +{ + public class SqliteParameterCollection : DbParameterCollection + { + + #region Fields + + List numeric_param_list = new List(); + Dictionary named_param_hash = new Dictionary(); + + #endregion + + #region Private Methods + + private void CheckSqliteParam (object value) + { + if (!(value is SqliteParameter)) + throw new InvalidCastException ("Can only use SqliteParameter objects"); + SqliteParameter sqlp = value as SqliteParameter; + if (sqlp.ParameterName == null || sqlp.ParameterName.Length == 0) + sqlp.ParameterName = this.GenerateParameterName(); + } + + private void RecreateNamedHash () + { + for (int i = 0; i < numeric_param_list.Count; i++) + { + named_param_hash[((SqliteParameter) numeric_param_list[i]).ParameterName] = i; + } + } + + //FIXME: if the user is calling Insert at various locations with unnamed parameters, this is not going to work.... + private string GenerateParameterName() + { + int index = this.Count + 1; + string name = String.Empty; + + while (index > 0) + { + name = ":" + index.ToString(); + if (this.IndexOf(name) == -1) + index = -1; + else + index++; + } + return name; + } + + #endregion + + #region Properties + + private bool isPrefixed (string parameterName) + { + return parameterName.Length > 1 && (parameterName[0] == ':' || parameterName[0] == '$' || parameterName[0] == '@'); + } + + protected override DbParameter GetParameter (int parameterIndex) + { + if (this.Count >= parameterIndex+1) + return (SqliteParameter) numeric_param_list[parameterIndex]; + else + throw new IndexOutOfRangeException("The specified parameter index does not exist: " + parameterIndex.ToString()); + } + + protected override DbParameter GetParameter (string parameterName) + { + if (this.Contains(parameterName)) + return this[(int) named_param_hash[parameterName]]; + else if (isPrefixed(parameterName) && this.Contains(parameterName.Substring(1))) + return this[(int) named_param_hash[parameterName.Substring(1)]]; + else + throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName); + } + + protected override void SetParameter (int parameterIndex, DbParameter parameter) + { + if (this.Count >= parameterIndex+1) + numeric_param_list[parameterIndex] = (SqliteParameter)parameter; + else + throw new IndexOutOfRangeException("The specified parameter index does not exist: " + parameterIndex.ToString()); + } + + protected override void SetParameter (string parameterName, DbParameter parameter) + { + if (this.Contains(parameterName)) + numeric_param_list[(int)named_param_hash[parameterName]] = (SqliteParameter)parameter; + else if (parameterName.Length > 1 && this.Contains(parameterName.Substring(1))) + numeric_param_list[(int) named_param_hash[parameterName.Substring(1)]] = (SqliteParameter)parameter; + else + throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName); + } + + public override int Count + { + get + { + return this.numeric_param_list.Count; + } + } + + public override bool IsSynchronized + { + get { return ((IList)this.numeric_param_list).IsSynchronized ; } + } + + public override bool IsFixedSize + { + get { return ((IList)this.numeric_param_list).IsFixedSize; } + } + + public override bool IsReadOnly + { + get { return ((IList)this.numeric_param_list).IsReadOnly; } + } + + public override object SyncRoot + { + get { return ((IList)this.numeric_param_list).SyncRoot ; } + } + + #endregion + + #region Public Methods + + public override void AddRange (Array values) + { + if (values == null || values.Length == 0) + return; + + foreach (object value in values) + Add (value); + } + + public override int Add (object value) + { + CheckSqliteParam (value); + SqliteParameter sqlp = value as SqliteParameter; + if (named_param_hash.ContainsKey(sqlp.ParameterName)) + throw new DuplicateNameException ("Parameter collection already contains the a SqliteParameter with the given ParameterName."); + numeric_param_list.Add(sqlp); + named_param_hash.Add(sqlp.ParameterName, numeric_param_list.IndexOf(sqlp)); + return (int) named_param_hash[sqlp.ParameterName]; + } + + public SqliteParameter Add (SqliteParameter param) + { + Add ((object)param); + return param; + } + + public SqliteParameter Add (string name, object value) + { + return Add (new SqliteParameter (name, value)); + } + + public SqliteParameter Add (string name, DbType type) + { + return Add (new SqliteParameter (name, type)); + } + + public override void Clear () + { + numeric_param_list.Clear (); + named_param_hash.Clear (); + } + + public override void CopyTo (Array array, int index) + { + this.numeric_param_list.CopyTo((SqliteParameter[])array, index); + } + + public override bool Contains (object value) + { + return Contains ((SqliteParameter) value); + } + + public override bool Contains (string parameterName) + { + return named_param_hash.ContainsKey(parameterName); + } + + public bool Contains (SqliteParameter param) + { + return Contains (param.ParameterName); + } + + public override IEnumerator GetEnumerator() + { + return this.numeric_param_list.GetEnumerator(); + } + + public override int IndexOf (object param) + { + return IndexOf ((SqliteParameter) param); + } + + public override int IndexOf (string parameterName) + { + if (isPrefixed (parameterName)){ + string sub = parameterName.Substring (1); + if (named_param_hash.ContainsKey(sub)) + return (int) named_param_hash [sub]; + } + if (named_param_hash.ContainsKey(parameterName)) + return (int) named_param_hash[parameterName]; + else + return -1; + } + + public int IndexOf (SqliteParameter param) + { + return IndexOf (param.ParameterName); + } + + public override void Insert (int index, object value) + { + CheckSqliteParam (value); + if (numeric_param_list.Count == index) + { + Add (value); + return; + } + + numeric_param_list.Insert(index,(SqliteParameter) value); + RecreateNamedHash (); + } + + public override void Remove (object value) + { + CheckSqliteParam (value); + RemoveAt ((SqliteParameter) value); + } + + public override void RemoveAt (int index) + { + RemoveAt (((SqliteParameter) numeric_param_list[index]).ParameterName); + } + + public override void RemoveAt (string parameterName) + { + if (!named_param_hash.ContainsKey (parameterName)) + throw new ApplicationException ("Parameter " + parameterName + " not found"); + + numeric_param_list.RemoveAt((int) named_param_hash[parameterName]); + named_param_hash.Remove (parameterName); + + RecreateNamedHash (); + } + + public void RemoveAt (SqliteParameter param) + { + RemoveAt (param.ParameterName); + } + + #endregion + } +} From 6b3c68f6d019f779292c453a59fa69fd2c873a54 Mon Sep 17 00:00:00 2001 From: Stewart Adcock Date: Mon, 20 Aug 2012 15:13:13 +0100 Subject: [PATCH 04/19] Minor change just to simplify some logic. --- Community.CsharpSqlite/src/pcache1_c.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Community.CsharpSqlite/src/pcache1_c.cs b/Community.CsharpSqlite/src/pcache1_c.cs index 5e0db1f..ae0f193 100644 --- a/Community.CsharpSqlite/src/pcache1_c.cs +++ b/Community.CsharpSqlite/src/pcache1_c.cs @@ -729,17 +729,18 @@ static sqlite3_pcache pcache1Create( int szPage, bool bPurgeable ) //sz = sizeof( PCache1 ) + sizeof( PGroup ) * separateCache; pCache = new PCache1();//(PCache1)sqlite3_malloc( sz ); //if ( pCache != null ) - { + //{ //memset( pCache, 0, sz ); - if ( separateCache != 0 ) - { - //pGroup = new PGroup();//(PGroup)pCache[1]; - //pGroup.mxPinned = 10; - } - else + if ( separateCache == 0 ) { pGroup = pcache1.grp; } + ////else + ////{ + ////pGroup = new PGroup();//(PGroup)pCache[1]; + ////pGroup.mxPinned = 10; + ////} + pCache.pGroup = pGroup; pCache.szPage = szPage; pCache.bPurgeable = bPurgeable;//( bPurgeable ? 1 : 0 ); @@ -751,7 +752,7 @@ static sqlite3_pcache pcache1Create( int szPage, bool bPurgeable ) pGroup.mxPinned = pGroup.nMaxPage + 10 - pGroup.nMinPage; pcache1LeaveMutex( pGroup ); } - } + //} return (sqlite3_pcache)pCache; } @@ -1168,4 +1169,4 @@ static void sqlite3PcacheStats( } #endif } -} \ No newline at end of file +} From db14d83eb0801e578b67179ee7b5eac67235476e Mon Sep 17 00:00:00 2001 From: Stewart Adcock Date: Thu, 23 Aug 2012 13:54:36 +0100 Subject: [PATCH 05/19] Remove a few MonoDevelop build warnings. Remove some redundant code. Handle case of null expression argument (zTopken) gracefully. --- Community.CsharpSqlite/src/expr_c.cs | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Community.CsharpSqlite/src/expr_c.cs b/Community.CsharpSqlite/src/expr_c.cs index 486b5f1..c6637ab 100644 --- a/Community.CsharpSqlite/src/expr_c.cs +++ b/Community.CsharpSqlite/src/expr_c.cs @@ -502,8 +502,8 @@ int dequote /* True to dequote */ //pNew.u.zToken = (char)&pNew[1]; if ( pToken.n > 0 ) pNew.u.zToken = pToken.z.Substring( 0, pToken.n );//memcpy(pNew.u.zToken, pToken.z, pToken.n); - else if ( pToken.n == 0 && pToken.z == "" ) - pNew.u.zToken = ""; + else if ( pToken.n == 0 && string.IsNullOrEmpty(pToken.z)) + pNew.u.zToken = string.Empty; //pNew.u.zToken[pToken.n] = 0; if ( dequote != 0 && nExtra >= 3 && ( ( c = pToken.z[0] ) == '\'' || c == '"' || c == '[' || c == '`' ) ) @@ -537,7 +537,7 @@ string zToken /* Token argument. Might be NULL */ { Token x = new Token(); x.z = zToken; - x.n = !String.IsNullOrEmpty( zToken ) ? sqlite3Strlen30( zToken ) : 0; + x.n = !string.IsNullOrEmpty( zToken ) ? sqlite3Strlen30( zToken ) : 0; return sqlite3ExprAlloc( db, op, x, 0 ); } @@ -961,7 +961,7 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) // (Expr)zAlloc; //if ( pNew != null ) - ////{ + { /* Set nNewSize to the size allocated for the structure pointed to ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed @@ -969,26 +969,26 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) */ int nStructSize = dupedExprStructSize( p, flags ); ////int nNewSize = nStructSize & 0xfff; - int nToken; - if ( !ExprHasProperty( p, EP_IntValue ) && !String.IsNullOrEmpty( p.u.zToken ) ) - { - nToken = sqlite3Strlen30( p.u.zToken ); - } - else - { - nToken = 0; - } + ////int nToken; + ////if ( !ExprHasProperty( p, EP_IntValue ) && !string.IsNullOrEmpty( p.u.zToken ) ) + ////{ + //// nToken = sqlite3Strlen30( p.u.zToken ); + ////} + ////else + ////{ + //// nToken = 0; + ////} if ( isReduced ) { Debug.Assert( !ExprHasProperty( p, EP_Reduced ) ); - pNew = p.Copy( EXPR_TOKENONLYSIZE );//memcpy( zAlloc, p, nNewSize ); + pNew = p.Copy( EXPR_TOKENONLYSIZE );////memcpy( zAlloc, p, nNewSize ); } else { ////int nSize = exprStructSize( p ); - //memcpy( zAlloc, p, nSize ); + ////memcpy( zAlloc, p, nSize ); pNew = p.Copy(); - //memset( &zAlloc[nSize], 0, EXPR_FULLSIZE - nSize ); + ////memset( &zAlloc[nSize], 0, EXPR_FULLSIZE - nSize ); } /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */ @@ -1042,7 +1042,7 @@ static Expr exprDup( sqlite3 db, Expr p, int flags, ref Expr pzBuffer ) pNew.pRight = sqlite3ExprDup( db, p.pRight, 0 ); } } - ////} + } } return pNew; } @@ -1075,7 +1075,7 @@ static ExprList sqlite3ExprListDup( sqlite3 db, ExprList p, int flags ) ExprList pNew; ExprList_item pItem; ExprList_item pOldItem; - int i; + if ( p == null ) return null; pNew = new ExprList();//sqlite3DbMallocRaw(db, sizeof(*pNew) ); @@ -1088,7 +1088,7 @@ static ExprList sqlite3ExprListDup( sqlite3 db, ExprList p, int flags ) // return null; //} //pOldItem = p.a; - for ( i = 0; i < p.nExpr; i++ ) + for (int i = 0; i < p.nExpr; i++ ) {//pItem++, pOldItem++){ pItem = pNew.a[i] = new ExprList_item(); pOldItem = p.a[i]; @@ -1114,7 +1114,6 @@ static ExprList sqlite3ExprListDup( sqlite3 db, ExprList p, int flags ) static SrcList sqlite3SrcListDup( sqlite3 db, SrcList p, int flags ) { SrcList pNew; - int i; int nByte; if ( p == null ) return null; @@ -1125,7 +1124,7 @@ static SrcList sqlite3SrcListDup( sqlite3 db, SrcList p, int flags ) if ( pNew == null ) return null; pNew.nSrc = pNew.nAlloc = p.nSrc; - for ( i = 0; i < p.nSrc; i++ ) + for (int i = 0; i < p.nSrc; i++ ) { pNew.a[i] = new SrcList_item(); SrcList_item pNewItem = pNew.a[i]; @@ -1233,6 +1232,7 @@ static ExprList sqlite3ExprListAppend( Expr pExpr /* Expression to be appended. Might be NULL */ ) { + ////sqlite3 db = pParse.db; if ( pList == null ) { pList = new ExprList(); //sqlite3DbMallocZero(db, ExprList).Length; @@ -1294,7 +1294,7 @@ int dequote /* True to cause the name to be dequoted */ pItem = pList.a[pList.nExpr - 1]; Debug.Assert( pItem.zName == null ); pItem.zName = pName.z.Substring( 0, pName.n );//sqlite3DbStrNDup(pParse.db, pName.z, pName.n); - if ( dequote != 0 && !String.IsNullOrEmpty( pItem.zName ) ) + if ( dequote != 0 && !string.IsNullOrEmpty( pItem.zName ) ) sqlite3Dequote( ref pItem.zName ); } } @@ -1949,7 +1949,7 @@ static int sqlite3CodeSubselect( if ( pParse.explain == 2 ) { string zMsg = sqlite3MPrintf( - pParse.db, "EXECUTE %s%s SUBQUERY %d", testAddr != 0 ? "" : "CORRELATED ", + pParse.db, "EXECUTE %s%s SUBQUERY %d", testAddr != 0 ? string.Empty : "CORRELATED ", pExpr.op == TK_IN ? "LIST" : "SCALAR", pParse.iNextSelectId ); sqlite3VdbeAddOp4( v, OP_Explain, pParse.iSelectId, 0, 0, zMsg, P4_DYNAMIC ); @@ -2316,7 +2316,7 @@ static void sqlite3ExprCodeIN( */ static void codeReal( Vdbe v, string z, bool negateFlag, int iMem ) { - if ( ALWAYS( !String.IsNullOrEmpty( z ) ) ) + if ( ALWAYS( !string.IsNullOrEmpty( z ) ) ) { double value = 0; //string zV; @@ -2352,7 +2352,7 @@ static void codeInteger( Parse pParse, Expr pExpr, bool negFlag, int iMem ) int c; i64 value = 0; string z = pExpr.u.zToken; - Debug.Assert( !String.IsNullOrEmpty( z ) ); + Debug.Assert( !string.IsNullOrEmpty( z ) ); c = sqlite3Atoi64( z, ref value, sqlite3Strlen30( z ), SQLITE_UTF8 ); if ( c == 0 || ( c == 2 && negFlag ) ) { @@ -2366,7 +2366,7 @@ static void codeInteger( Parse pParse, Expr pExpr, bool negFlag, int iMem ) else { #if SQLITE_OMIT_FLOATING_POINT -sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); +sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : string.Empty, z); #else codeReal( v, z, negFlag, iMem ); #endif From 7d35c1a01b4d501ca8b31e095618c31496a7aa96 Mon Sep 17 00:00:00 2001 From: Uygar Yilmaz Date: Sun, 25 Nov 2012 17:50:37 +0200 Subject: [PATCH 06/19] Fixed: Issue 173 - SqliteDataReader.GetBoolean(int i) throws exception. --- Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs index c9e88fc..b73b01e 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteDataReader.cs @@ -323,7 +323,8 @@ public override bool Read () public override bool GetBoolean (int i) { - return Convert.ToBoolean (((object[]) rows[current_row])[i]); + int result = Convert.ToInt32(((object[])rows[current_row])[i]); + return Convert.ToBoolean(result); } public override byte GetByte (int i) From 0289b544e7ae2273d7ef7b7bb0a43fa926c5816f Mon Sep 17 00:00:00 2001 From: Uygar Yilmaz Date: Sun, 25 Nov 2012 17:50:51 +0200 Subject: [PATCH 07/19] Fixed: Issue 174 - Community.CsharpSqlite.SQLiteClient should be switched to AnyCPU. --- .../Community.CsharpSqlite.SQLiteClient.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community.CsharpSqlite.SQLiteClient/Community.CsharpSqlite.SQLiteClient.csproj b/Community.CsharpSqlite.SQLiteClient/Community.CsharpSqlite.SQLiteClient.csproj index e24dd4b..d3c4583 100644 --- a/Community.CsharpSqlite.SQLiteClient/Community.CsharpSqlite.SQLiteClient.csproj +++ b/Community.CsharpSqlite.SQLiteClient/Community.CsharpSqlite.SQLiteClient.csproj @@ -44,7 +44,7 @@ prompt 4 0168 ; 0169; 0414; 0618; 0649 - x86 + AnyCPU true AllRules.ruleset From ab7f81485c47e5350bfc6f9ceae6dfb4fa7d5da6 Mon Sep 17 00:00:00 2001 From: Uygar Yilmaz Date: Mon, 26 Nov 2012 08:12:44 +0200 Subject: [PATCH 08/19] Added XML documentation comments to SqliteExceptions. --- .../src/SqliteExceptions.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Community.CsharpSqlite.SQLiteClient/src/SqliteExceptions.cs b/Community.CsharpSqlite.SQLiteClient/src/SqliteExceptions.cs index d0f9f50..4cebf8d 100644 --- a/Community.CsharpSqlite.SQLiteClient/src/SqliteExceptions.cs +++ b/Community.CsharpSqlite.SQLiteClient/src/SqliteExceptions.cs @@ -4,7 +4,9 @@ namespace Community.CsharpSqlite.SQLiteClient { - //This is the base exception of all sqlite exceptions + /// + /// Base exception for all Sqlite exceptions. + /// public class SqliteException : DbException { public int SqliteErrorCode { get; protected set; } @@ -26,7 +28,9 @@ public SqliteException(string message) } } - // This exception is raised whenever a statement cannot be compiled. + /// + /// The exception that is raised whenever a statement cannot be compiled. + /// public class SqliteSyntaxException : SqliteException { public SqliteSyntaxException(int errcode) @@ -44,8 +48,9 @@ public SqliteSyntaxException(string message) } } - // This exception is raised whenever the execution - // of a statement fails. + /// + /// The exception that is raised whenever the execution of a statement fails. + /// public class SqliteExecutionException : SqliteException { public SqliteExecutionException() @@ -66,8 +71,9 @@ public SqliteExecutionException(string message) } } - // This exception is raised whenever Sqlite says it - // cannot run a command because something is busy. + /// + /// The exception that is raised whenever Sqlite reports it cannot run a command due to being busy. + /// public class SqliteBusyException : SqliteException { public SqliteBusyException() From 7fa20106df238f4150b55e0a8558c2233d784cac Mon Sep 17 00:00:00 2001 From: stewart Date: Wed, 19 Dec 2012 12:38:04 +0000 Subject: [PATCH 09/19] Add a text file that reminds explicitly of the license conditions and copyrights. --- License | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 License diff --git a/License b/License new file mode 100644 index 0000000..f1f67c0 --- /dev/null +++ b/License @@ -0,0 +1,12 @@ +C#-SQLite is an independent reimplementation of the SQLite software library. +SQLite® is a registered trademark of Hipp, Wyrick & Company, Inc. + +The overall C#-SQLite package is distributed under the terms of the MIT License, given below. Some parts are distributed under more permissive licenses, see individual source files for details. + +Copyright (c) 2009-2012 Noah Hart and others, see individual source files for details. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file From bf731fefedf081e7248067752616d2b5cfbbe1d8 Mon Sep 17 00:00:00 2001 From: stewart Date: Wed, 19 Dec 2012 12:58:31 +0000 Subject: [PATCH 10/19] Some pedantic fixes: Let VS reformat file ; Spelling corrections ; Remove unneed using statements ; Correct the "Press Enter to Continue" message. --- .../TestDriver_src/SQLiteClientTestDriver.cs | 563 +++++++++--------- 1 file changed, 281 insertions(+), 282 deletions(-) diff --git a/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs b/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs index 5506465..080c109 100644 --- a/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs +++ b/Community.CsharpSqlite.SQLiteClient/TestDriver_src/SQLiteClientTestDriver.cs @@ -1,13 +1,12 @@ using System; +using System.Collections.Generic; using System.Data; -using System.Data.Common; +using System.Globalization; using System.IO; -using System.Text; using System.Threading; -using System.Collections.Generic; + using Community.CsharpSqlite; using Community.CsharpSqlite.SQLiteClient; -using System.Globalization; namespace SQLiteClientTests { @@ -15,36 +14,36 @@ public class SQLiteClientTestDriver { public void Test1() { - Console.WriteLine( "Test1 Start." ); + Console.WriteLine("Test1 Start."); - Console.WriteLine( "Create connection..." ); + Console.WriteLine("Create connection..."); SqliteConnection con = new SqliteConnection(); string dbFilename = @"SqliteTest3.db"; - string cs = string.Format( "Version=3,uri=file:{0}", dbFilename ); + string cs = string.Format("Version=3,uri=file:{0}", dbFilename); - Console.WriteLine( "Set connection String: {0}", cs ); + Console.WriteLine("Set connection String: {0}", cs); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); con.ConnectionString = cs; - Console.WriteLine( "Open database..." ); + Console.WriteLine("Open database..."); con.Open(); - Console.WriteLine( "create command..." ); + Console.WriteLine("create command..."); IDbCommand cmd = con.CreateCommand(); - Console.WriteLine( "create table TEST_TABLE..." ); + Console.WriteLine("create table TEST_TABLE..."); cmd.CommandText = "CREATE TABLE TEST_TABLE ( COLA INTEGER, COLB TEXT, COLC DATETIME )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 1..." ); + Console.WriteLine("insert row 1..."); cmd.CommandText = "INSERT INTO TEST_TABLE ( COLA, COLB, COLC ) VALUES (123,'ABC','2008-12-31 18:19:20' )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 2..." ); + Console.WriteLine("insert row 2..."); cmd.CommandText = "INSERT INTO TEST_TABLE ( COLA, COLB, COLC ) VALUES (124,'DEF', '2009-11-16 13:35:36' )"; cmd.ExecuteNonQuery(); @@ -52,75 +51,75 @@ public void Test1() //cmd.CommandText = "COMMIT"; //cmd.ExecuteNonQuery(); - Console.WriteLine( "SELECT data from TEST_TABLE..." ); + Console.WriteLine("SELECT data from TEST_TABLE..."); cmd.CommandText = "SELECT COLA, COLB, COLC FROM TEST_TABLE"; IDataReader reader = cmd.ExecuteReader(); int r = 0; - Console.WriteLine( "Read the data..." ); - while ( reader.Read() ) + Console.WriteLine("Read the data..."); + while (reader.Read()) { - Console.WriteLine( " Row: {0}", r ); - int i = reader.GetInt32( reader.GetOrdinal( "COLA" ) ); - Console.WriteLine( " COLA: {0}", i ); + Console.WriteLine(" Row: {0}", r); + int i = reader.GetInt32(reader.GetOrdinal("COLA")); + Console.WriteLine(" COLA: {0}", i); - string s = reader.GetString( reader.GetOrdinal( "COLB" ) ); - Console.WriteLine( " COLB: {0}", s ); + string s = reader.GetString(reader.GetOrdinal("COLB")); + Console.WriteLine(" COLB: {0}", s); - DateTime dt = reader.GetDateTime( reader.GetOrdinal( "COLC" ) ); - Console.WriteLine( " COLB: {0}", dt.ToString( "MM/dd/yyyy HH:mm:ss" ) ); + DateTime dt = reader.GetDateTime(reader.GetOrdinal("COLC")); + Console.WriteLine(" COLB: {0}", dt.ToString("MM/dd/yyyy HH:mm:ss")); r++; } - Console.WriteLine( "Rows retrieved: {0}", r ); + Console.WriteLine("Rows retrieved: {0}", r); -//alxwest: DataTable & SqliteDataAdapter currently unavailable for Silverlight -#if !SQLITE_SILVERLIGHT - SqliteCommand command = new SqliteCommand( "PRAGMA table_info('TEST_TABLE')", con ); + //alxwest: DataTable & SqliteDataAdapter currently unavailable for Silverlight +#if !SQLITE_SILVERLIGHT + SqliteCommand command = new SqliteCommand("PRAGMA table_info('TEST_TABLE')", con); DataTable dataTable = new DataTable(); SqliteDataAdapter dataAdapter = new SqliteDataAdapter(); dataAdapter.SelectCommand = command; - dataAdapter.Fill( dataTable ); - DisplayDataTable( dataTable, "Columns" ); + dataAdapter.Fill(dataTable); + DisplayDataTable(dataTable, "Columns"); #endif - Console.WriteLine( "Close and cleanup..." ); + Console.WriteLine("Close and cleanup..."); con.Close(); con = null; - Console.WriteLine( "Test1 Done." ); + Console.WriteLine("Test1 Done."); } public void Test2() { - Console.WriteLine( "Test2 Start." ); + Console.WriteLine("Test2 Start."); - Console.WriteLine( "Create connection..." ); + Console.WriteLine("Create connection..."); SqliteConnection con = new SqliteConnection(); string dbFilename = @"SqliteTest3.db"; - string cs = string.Format( "Version=3,uri=file:{0}", dbFilename ); + string cs = string.Format("Version=3,uri=file:{0}", dbFilename); - Console.WriteLine( "Set connection String: {0}", cs ); + Console.WriteLine("Set connection String: {0}", cs); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); con.ConnectionString = cs; - Console.WriteLine( "Open database..." ); + Console.WriteLine("Open database..."); con.Open(); - Console.WriteLine( "create command..." ); + Console.WriteLine("create command..."); IDbCommand cmd = con.CreateCommand(); - Console.WriteLine( "create table TEST_TABLE..." ); + Console.WriteLine("create table TEST_TABLE..."); cmd.CommandText = "CREATE TABLE TBL ( ID NUMBER, NAME TEXT)"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 1..." ); + Console.WriteLine("insert row 1..."); cmd.CommandText = "INSERT INTO TBL ( ID, NAME ) VALUES (1, 'ONE' )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 2..." ); + Console.WriteLine("insert row 2..."); cmd.CommandText = "INSERT INTO TBL ( ID, NAME ) VALUES (2, '中文' )"; cmd.ExecuteNonQuery(); @@ -128,67 +127,67 @@ public void Test2() //cmd.CommandText = "COMMIT"; //cmd.ExecuteNonQuery(); - Console.WriteLine( "SELECT data from TBL..." ); + Console.WriteLine("SELECT data from TBL..."); cmd.CommandText = "SELECT id,NAME FROM tbl WHERE name = '中文'"; IDataReader reader = cmd.ExecuteReader(); int r = 0; - Console.WriteLine( "Read the data..." ); - while ( reader.Read() ) + Console.WriteLine("Read the data..."); + while (reader.Read()) { - Console.WriteLine( " Row: {0}", r ); - int i = reader.GetInt32( reader.GetOrdinal( "ID" ) ); - Console.WriteLine( " ID: {0}", i ); + Console.WriteLine(" Row: {0}", r); + int i = reader.GetInt32(reader.GetOrdinal("ID")); + Console.WriteLine(" ID: {0}", i); - string s = reader.GetString( reader.GetOrdinal( "NAME" ) ); - Console.WriteLine( " NAME: {0} = {1}", s, s == "中文" ); + string s = reader.GetString(reader.GetOrdinal("NAME")); + Console.WriteLine(" NAME: {0} = {1}", s, s == "中文"); r++; } - Console.WriteLine( "Rows retrieved: {0}", r ); + Console.WriteLine("Rows retrieved: {0}", r); //alxwest: DataTable & SqliteDataAdapter currently unavailable for Silverlight -#if !SQLITE_SILVERLIGHT - SqliteCommand command = new SqliteCommand( "PRAGMA table_info('TEST_TABLE')", con ); +#if !SQLITE_SILVERLIGHT + SqliteCommand command = new SqliteCommand("PRAGMA table_info('TEST_TABLE')", con); DataTable dataTable = new DataTable(); SqliteDataAdapter dataAdapter = new SqliteDataAdapter(); dataAdapter.SelectCommand = command; - dataAdapter.Fill( dataTable ); - DisplayDataTable( dataTable, "Columns" ); + dataAdapter.Fill(dataTable); + DisplayDataTable(dataTable, "Columns"); #endif - Console.WriteLine( "Close and cleanup..." ); + Console.WriteLine("Close and cleanup..."); con.Close(); con = null; - Console.WriteLine( "Test1 Done." ); + Console.WriteLine("Test1 Done."); } public void Test3() { - Console.WriteLine( "Test3 (Date Paramaters) Start." ); + Console.WriteLine("Test3 (Date Parameters) Start."); - Console.WriteLine( "Create connection..." ); + Console.WriteLine("Create connection..."); SqliteConnection con = new SqliteConnection(); string dbFilename = @"SqliteTest3.db"; - string cs = string.Format( "Version=3,uri=file:{0}", dbFilename ); + string cs = string.Format("Version=3,uri=file:{0}", dbFilename); - Console.WriteLine( "Set connection String: {0}", cs ); + Console.WriteLine("Set connection String: {0}", cs); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); con.ConnectionString = cs; - Console.WriteLine( "Open database..." ); + Console.WriteLine("Open database..."); con.Open(); - Console.WriteLine( "create command..." ); + Console.WriteLine("create command..."); IDbCommand cmd = con.CreateCommand(); - Console.WriteLine( "create table TEST_TABLE..." ); + Console.WriteLine("create table TEST_TABLE..."); cmd.CommandText = "CREATE TABLE TBL ( ID NUMBER, DATE_TEXT REAL)"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert ..." ); + Console.WriteLine("insert ..."); cmd.CommandText = "INSERT INTO TBL ( ID, DATE_TEXT) VALUES ( 1, @DATETEXT)"; cmd.Parameters.Add( new SqliteParameter @@ -201,29 +200,29 @@ public void Test3() cmd.ExecuteNonQuery(); - Console.WriteLine( "SELECT data from TBL..." ); + Console.WriteLine("SELECT data from TBL..."); cmd.CommandText = "SELECT * FROM tbl"; IDataReader reader = cmd.ExecuteReader(); int r = 0; - Console.WriteLine( "Read the data..." ); - while ( reader.Read() ) + Console.WriteLine("Read the data..."); + while (reader.Read()) { - Console.WriteLine( " Row: {0}", r ); - int i = reader.GetInt32( reader.GetOrdinal( "ID" ) ); - Console.WriteLine( " ID: {0}", i ); + Console.WriteLine(" Row: {0}", r); + int i = reader.GetInt32(reader.GetOrdinal("ID")); + Console.WriteLine(" ID: {0}", i); - string s = reader.GetString( reader.GetOrdinal( "DATE_TEXT" ) ); - Console.WriteLine( " DATE_TEXT: {0}", s ); + string s = reader.GetString(reader.GetOrdinal("DATE_TEXT")); + Console.WriteLine(" DATE_TEXT: {0}", s); r++; } - Console.WriteLine( "Rows retrieved: {0}", r ); + Console.WriteLine("Rows retrieved: {0}", r); - Console.WriteLine( "Close and cleanup..." ); + Console.WriteLine("Close and cleanup..."); con.Close(); con = null; - Console.WriteLine( "Test3 Done." ); + Console.WriteLine("Test3 Done."); } //nSoftware code for Threading @@ -231,23 +230,23 @@ public void Test3() public void Test4() { string dbFilename = "threading_t4.db"; - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); connstring_T4 = @"Version=3,busy_timeout=100,uri=file:" + dbFilename; Setup_T4(); InsertSameTable_T4(); //concurrent inserts SelectorWrite_T4(); //concurrent selects and inserts - Console.WriteLine( "Testing for Threading done. Press enter to continue" ); + Console.WriteLine("Testing for Threading done. Press enter to continue"); Console.In.Read(); } private void SelectorWrite_T4() { //concurrent reads/writes in the same table, if there were only Selects it would be preferable for the sqlite engine not to lock internally. - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - Console.WriteLine( "SELECT/INSERT ON Thread {0}", i ); - Thread worker = new Thread( () => + Console.WriteLine("SELECT/INSERT ON Thread {0}", i); + Thread worker = new Thread(() => { // Cannot use value of i, since it exceeds the scope of this thread and will be // reused by multiple threads @@ -259,28 +258,28 @@ private void SelectorWrite_T4() con.Open(); IDbCommand cmd = con.CreateCommand(); cmd = con.CreateCommand(); - if ( op == 0 ) + if (op == 0) { - cmd.CommandText = String.Format( "Select * FROM ATABLE" ); + cmd.CommandText = String.Format("Select * FROM ATABLE"); cmd.ExecuteReader(); } else { - cmd.CommandText = String.Format( "INSERT INTO ATABLE ( A, B, C ) VALUES ({0},'threader', '1' )", aValue ); - Console.WriteLine( cmd.CommandText ); + cmd.CommandText = String.Format("INSERT INTO ATABLE ( A, B, C ) VALUES ({0},'threader', '1' )", aValue); + Console.WriteLine(cmd.CommandText); cmd.ExecuteNonQuery(); } - } ); + }); worker.Start(); } } //we need concurrency support on a table level inside of the database file. private void InsertSameTable_T4() { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - Console.WriteLine( "INSERTING ON Thread {0}", i ); - Thread worker = new Thread( () => + Console.WriteLine("INSERTING ON Thread {0}", i); + Thread worker = new Thread(() => { // Cannot use value of i, since it exceeds the scope of this thread and will be // reused by multiple threads @@ -292,8 +291,8 @@ private void InsertSameTable_T4() con.Open(); IDbCommand cmd = con.CreateCommand(); cmd = con.CreateCommand(); - cmd.CommandText = String.Format( "INSERT INTO ATABLE ( A, B, C ) VALUES ({0},'threader', '1' )", aValue ); - Console.WriteLine( cmd.CommandText ); + cmd.CommandText = String.Format("INSERT INTO ATABLE ( A, B, C ) VALUES ({0},'threader', '1' )", aValue); + Console.WriteLine(cmd.CommandText); cmd.ExecuteNonQuery(); } ); @@ -312,7 +311,7 @@ private void Setup_T4() cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE IF NOT EXISTS BTABLE(A integer primary key , B varchar (50), C integer)"; cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )" ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )"); cmd.ExecuteNonQuery(); } @@ -321,22 +320,22 @@ private void Setup_T4() public void Test5() { string dbFilename = "threading_t5.db"; - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); connstring_T5 = @"Version=3,busy_timeout=2500,uri=file:" + dbFilename; Setup_T5(); MultiInsertsSameThread_T5(); //concurrent inserts - Console.WriteLine( "Threads are running..." ); + Console.WriteLine("Threads are running..."); Console.In.Read(); } private void MultiInsertsSameThread_T5() { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { //Console.WriteLine( "SELECT/INSERT ON Thread {0}", i ); - Thread worker = new Thread( () => + Thread worker = new Thread(() => { string commandt = String.Empty; try @@ -351,39 +350,39 @@ private void MultiInsertsSameThread_T5() con.Open(); IDbCommand cmd = con.CreateCommand(); cmd = con.CreateCommand(); - if ( op == 0 ) + if (op == 0) { - for ( int j = 0; j < 1000; j++ ) + for (int j = 0; j < 1000; j++) { int rows; int retry = 0; - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES ({0},'threader', '1' )", ( aValue * 10000 ) + j ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES ({0},'threader', '1' )", (aValue * 10000) + j); commandt = cmd.CommandText; do { rows = cmd.ExecuteNonQuery(); - if ( rows == 0 ) + if (rows == 0) { retry += 1; // Insert Failed - Console.WriteLine( cmd.CommandText ); - Console.WriteLine( "retry {0}", retry ); - Console.WriteLine( ( (SqliteCommand)cmd ).GetLastError() ); + Console.WriteLine(cmd.CommandText); + Console.WriteLine("retry {0}", retry); + Console.WriteLine(((SqliteCommand)cmd).GetLastError()); } - } while ( rows == 0 && retry < 5 ); + } while (rows == 0 && retry < 5); } } else { - cmd.CommandText = String.Format( "Select * FROM ATABLE" ); + cmd.CommandText = String.Format("Select * FROM ATABLE"); commandt = cmd.CommandText; cmd.ExecuteReader(); } } - catch ( Exception ex ) + catch (Exception ex) { - Console.WriteLine( String.Format( "Command {0} threw exception {1}", commandt, ex.Message ) ); + Console.WriteLine(String.Format("Command {0} threw exception {1}", commandt, ex.Message)); } - } ); + }); worker.Start(); } @@ -400,7 +399,7 @@ private void Setup_T5() cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE IF NOT EXISTS BTABLE(A integer primary key , B varchar (50), C integer)"; cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )" ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )"); cmd.ExecuteNonQuery(); } @@ -409,28 +408,28 @@ private void Setup_T5() public void Test6() { string dbFilename = "threading_t6.db"; - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); connstring_T6 = @"Version=3,busy_timeout=2000,uri=file:" + dbFilename; Setup_T6(); MultiInsertsTransactionsSameThread_T6(); //concurrent inserts - Console.WriteLine( "Threads are running..." ); + Console.WriteLine("Threads are running..."); Console.In.Read(); } static Random rnd = new Random(); private void MultiInsertsTransactionsSameThread_T6() { - for ( int i = 0; i < 20; i++ ) + for (int i = 0; i < 20; i++) { - Thread.Sleep( rnd.Next( 100, 1000 ) ); - Console.WriteLine( "Launching Thread {0}", i ); - Thread worker = new Thread( SQLiteClientTestDriver.T6_ThreadStart ); - worker.Start( i ); + Thread.Sleep(rnd.Next(100, 1000)); + Console.WriteLine("Launching Thread {0}", i); + Thread worker = new Thread(SQLiteClientTestDriver.T6_ThreadStart); + worker.Start(i); } } - private static void T6_ThreadStart( object data ) + private static void T6_ThreadStart(object data) { string commandt = String.Empty; int i = (int)data; @@ -444,38 +443,38 @@ private static void T6_ThreadStart( object data ) con.Open(); IDbCommand cmd = con.CreateCommand(); cmd = con.CreateCommand(); - if ( op == 0 ) + if (op == 0) { SqliteTransaction trans = (SqliteTransaction)con.BeginTransaction(); - for ( int j = 0; j < 5000; j++ ) + for (int j = 0; j < 5000; j++) { int rows; int retry = 0; - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES ({0},'threader', '1' )", ( aValue * 10000 ) + j ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES ({0},'threader', '1' )", (aValue * 10000) + j); commandt = cmd.CommandText; do { rows = cmd.ExecuteNonQuery(); - if ( rows == 0 ) + if (rows == 0) { retry += 1; // Insert Failed - Console.WriteLine( "retry {0}:{1}:{2}", retry, ( (SqliteCommand)cmd ).GetLastError(), cmd.CommandText ); - Thread.Sleep( rnd.Next( 50, 1000 ) ); + Console.WriteLine("retry {0}:{1}:{2}", retry, ((SqliteCommand)cmd).GetLastError(), cmd.CommandText); + Thread.Sleep(rnd.Next(50, 1000)); } - } while ( rows == 0 && retry < 10 ); + } while (rows == 0 && retry < 10); } trans.Commit(); } else { - cmd.CommandText = String.Format( "Select * FROM ATABLE" ); + cmd.CommandText = String.Format("Select * FROM ATABLE"); commandt = cmd.CommandText; cmd.ExecuteReader(); } } - catch ( Exception ex ) + catch (Exception ex) { - Console.WriteLine( String.Format( "Command {0} threw exception {1}", commandt, ex.Message ) ); + Console.WriteLine(String.Format("Command {0} threw exception {1}", commandt, ex.Message)); } } private void Setup_T6() @@ -489,7 +488,7 @@ private void Setup_T6() cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE IF NOT EXISTS BTABLE(A integer primary key , B varchar (50), C integer)"; cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )" ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )"); cmd.ExecuteNonQuery(); } //nSoftware code for Threading @@ -497,42 +496,42 @@ private void Setup_T6() public void Test7() { string dbFilename = "threading_t7.db"; - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); connstring_T7 = @"Version=3,busy_timeout=1000,uri=file:" + dbFilename; MultiInsertsSameThread_T7(); //concurrent table creation - Console.WriteLine( "Threads are running..." ); + Console.WriteLine("Threads are running..."); Console.In.Read(); } private void MultiInsertsSameThread_T7() { List lthread = new List(); - for ( int i = 0; i < 70; i++ ) + for (int i = 0; i < 70; i++) { - Thread.Sleep( rnd.Next( 100, 1000 ) ); - Console.WriteLine( "Launching Thread {0}", i ); - Thread worker = new Thread( this.T7_ThreadStart ); - lthread.Add( worker ); - worker.Start( i ); + Thread.Sleep(rnd.Next(100, 1000)); + Console.WriteLine("Launching Thread {0}", i); + Thread worker = new Thread(this.T7_ThreadStart); + lthread.Add(worker); + worker.Start(i); } bool alldone = false; - while ( !alldone ) + while (!alldone) { alldone = true; - for ( int i = 0; i < lthread.Count; i++ ) + for (int i = 0; i < lthread.Count; i++) { - if ( lthread[i].ThreadState == ThreadState.Running ) + if (lthread[i].ThreadState == ThreadState.Running) alldone = false; - Thread.Sleep( 100 ); + Thread.Sleep(100); } } - Console.WriteLine( "finished" ); + Console.WriteLine("finished"); } - private void T7_ThreadStart( object iSequence ) + private void T7_ThreadStart(object iSequence) { int aValue = (int)iSequence * 1000; @@ -541,16 +540,16 @@ private void T7_ThreadStart( object iSequence ) con.Open(); IDbCommand cmd = con.CreateCommand(); cmd = con.CreateCommand(); - string commandt = String.Format( "CREATE TABLE IF NOT EXISTS ATABLE{0}(A integer primary key , B varchar (50), C integer, D varchar (500))", aValue ); + string commandt = String.Format("CREATE TABLE IF NOT EXISTS ATABLE{0}(A integer primary key , B varchar (50), C integer, D varchar (500))", aValue); cmd.CommandText = commandt; try { cmd.ExecuteNonQuery(); - Console.WriteLine( "Created table: ATABLE" + aValue ); + Console.WriteLine("Created table: ATABLE" + aValue); } - catch ( Exception ex ) + catch (Exception ex) { - Console.WriteLine( String.Format( "Command {0} threw exception {1}", commandt, ex.Message ) ); + Console.WriteLine(String.Format("Command {0} threw exception {1}", commandt, ex.Message)); } } @@ -565,7 +564,7 @@ private void Setup_T7() cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE IF NOT EXISTS BTABLE(A integer primary key , B varchar (50), C integer)"; cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format( "INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )" ); + cmd.CommandText = String.Format("INSERT INTO BTABLE ( A, B, C ) VALUES (6,'threader', '1' )"); cmd.ExecuteNonQuery(); } @@ -576,20 +575,20 @@ public void Issue_65() //string datasource = "file://" + TempDirectory.ToString() + "myBigDb.s3db"; string datasource = "file://" + "myBigDb.s3db"; - using ( IDbConnection conn = new SqliteConnection( "uri=" + datasource ) ) + using (IDbConnection conn = new SqliteConnection("uri=" + datasource)) { - long targetFileSize = (long)Math.Pow( 2, 32 ) - 1; + long targetFileSize = (long)Math.Pow(2, 32) - 1; int rowLength = 1024; // 2^10 - long loopCount = (int)( targetFileSize / rowLength ) + 10000; + long loopCount = (int)(targetFileSize / rowLength) + 10000; char[] chars = new char[rowLength]; - for ( int i = 0; i < rowLength; i++ ) + for (int i = 0; i < rowLength; i++) { chars[i] = 'A'; } - string row = new string( chars ); + string row = new string(chars); conn.Open(); IDbCommand cmd = conn.CreateCommand(); @@ -606,14 +605,14 @@ public void Issue_65() cmd.ExecuteNonQuery(); cmd.CommandText = "insert into [MyTable] ([MyField]) VALUES ('" + row + "')"; - for ( int i = 0; i < loopCount; i++ ) + for (int i = 0; i < loopCount; i++) { cmd.ExecuteNonQuery(); } } - catch + catch { - Console.WriteLine( ( (SqliteCommand)cmd ).GetLastError() ); + Console.WriteLine(((SqliteCommand)cmd).GetLastError()); } finally { @@ -628,133 +627,133 @@ public void Issue_65() //Issue 76 Encryption is not implemented in C#SQLite client connection and command objects public void Issue_76() { - Console.WriteLine( "Test for Issue_76 Start." ); + Console.WriteLine("Test for Issue_76 Start."); - Console.WriteLine( "Create connection..." ); + Console.WriteLine("Create connection..."); SqliteConnection con = new SqliteConnection(); string dbFilename = @"SqliteTest3.db"; - string cs = string.Format( "Version=3,uri=file:{0}", dbFilename ); + string cs = string.Format("Version=3,uri=file:{0}", dbFilename); - Console.WriteLine( "Set connection String: {0}", cs ); + Console.WriteLine("Set connection String: {0}", cs); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); con.ConnectionString = cs; - Console.WriteLine( "Open database..." ); + Console.WriteLine("Open database..."); con.Open(); - Console.WriteLine( "create command..." ); + Console.WriteLine("create command..."); IDbCommand cmd = con.CreateCommand(); cmd.CommandText = "pragma hexkey='0x73656372657470617373776F72640f11'"; - Console.WriteLine( cmd.CommandText ); + Console.WriteLine(cmd.CommandText); cmd.ExecuteNonQuery(); cmd.CommandText = "create table a (b); insert into a values ('row 1');select * from a;"; - Console.WriteLine( cmd.CommandText ); - Console.WriteLine( "Result {0}", cmd.ExecuteScalar() ); + Console.WriteLine(cmd.CommandText); + Console.WriteLine("Result {0}", cmd.ExecuteScalar()); - Console.WriteLine( "Close & Reopen Connection" ); + Console.WriteLine("Close & Reopen Connection"); con.Close(); con.Open(); cmd.CommandText = "select * from a;"; - Console.WriteLine( cmd.CommandText ); - Console.WriteLine( "Result {0}", cmd.ExecuteScalar() ); + Console.WriteLine(cmd.CommandText); + Console.WriteLine("Result {0}", cmd.ExecuteScalar()); - Console.WriteLine( "Close & Reopen Connection" ); + Console.WriteLine("Close & Reopen Connection"); con.Close(); con.Open(); cmd.CommandText = "pragma hexkey='0x73656372657470617373776F72640f11'"; - Console.WriteLine( cmd.CommandText ); + Console.WriteLine(cmd.CommandText); cmd.ExecuteNonQuery(); cmd.CommandText = "select * from a;"; - Console.WriteLine( cmd.CommandText ); - Console.WriteLine( "Result {0}", cmd.ExecuteScalar() ); + Console.WriteLine(cmd.CommandText); + Console.WriteLine("Result {0}", cmd.ExecuteScalar()); - Console.WriteLine( "Close & Reopen Connection with password" ); + Console.WriteLine("Close & Reopen Connection with password"); con.Close(); con.ConnectionString = cs + ",Password=0x73656372657470617373776F72640f11"; con.Open(); cmd.CommandText = "select * from a;"; - Console.WriteLine( cmd.CommandText ); - Console.WriteLine( "Result {0}", cmd.ExecuteScalar() ); + Console.WriteLine(cmd.CommandText); + Console.WriteLine("Result {0}", cmd.ExecuteScalar()); con = null; - Console.WriteLine( "Issue_76 Done." ); + Console.WriteLine("Issue_76 Done."); } //Multi thread execution special command or ddl command results in exception.. public void Issue_86() { AppDomain.CurrentDomain.UnhandledException += - ( sender, eventArgs ) => + (sender, eventArgs) => { - Console.WriteLine( eventArgs.ExceptionObject ); + Console.WriteLine(eventArgs.ExceptionObject); }; int flags = Sqlite3.SQLITE_OPEN_NOMUTEX | Sqlite3.SQLITE_OPEN_READWRITE | Sqlite3.SQLITE_OPEN_CREATE; - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - Console.WriteLine( "Running Thread {0}", i ); + Console.WriteLine("Running Thread {0}", i); var t = new Thread( () => { - string dbFilename = string.Format( "db{0}.sqlite", Thread.CurrentThread.ManagedThreadId ); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); - Console.WriteLine( "Using Database {0}", dbFilename ); + string dbFilename = string.Format("db{0}.sqlite", Thread.CurrentThread.ManagedThreadId); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); + Console.WriteLine("Using Database {0}", dbFilename); Sqlite3.sqlite3 db = null; - Sqlite3.sqlite3_open_v2( dbFilename, out db, flags, null ); - var command = string.Format( "create table [t{0}] (id, name, amount)", Thread.CurrentThread.ManagedThreadId ); - ExecuteCommand( db, command ); - Sqlite3.sqlite3_close( db ); - } ); + Sqlite3.sqlite3_open_v2(dbFilename, out db, flags, null); + var command = string.Format("create table [t{0}] (id, name, amount)", Thread.CurrentThread.ManagedThreadId); + ExecuteCommand(db, command); + Sqlite3.sqlite3_close(db); + }); t.Start(); } } - private static void ExecuteCommand( Sqlite3.sqlite3 db, string command ) + private static void ExecuteCommand(Sqlite3.sqlite3 db, string command) { int rc; Sqlite3.Vdbe vm = null; - if ( Sqlite3.sqlite3_prepare_v2( db, command, command.Length, ref vm, 0 ) != Sqlite3.SQLITE_OK ) + if (Sqlite3.sqlite3_prepare_v2(db, command, command.Length, ref vm, 0) != Sqlite3.SQLITE_OK) { - throw new InvalidOperationException( string.Format( "Query failed ({0}), message: {1}.", db.errCode, Sqlite3.sqlite3_errmsg( db ) ) ); + throw new InvalidOperationException(string.Format("Query failed ({0}), message: {1}.", db.errCode, Sqlite3.sqlite3_errmsg(db))); } - rc = Sqlite3.sqlite3_step( vm ); - if ( rc != Sqlite3.SQLITE_DONE && rc != Sqlite3.SQLITE_ROW ) + rc = Sqlite3.sqlite3_step(vm); + if (rc != Sqlite3.SQLITE_DONE && rc != Sqlite3.SQLITE_ROW) { - throw new InvalidOperationException( string.Format( "Query failed ({0}), message: {1}.", db.errCode, Sqlite3.sqlite3_errmsg( db ) ) ); + throw new InvalidOperationException(string.Format("Query failed ({0}), message: {1}.", db.errCode, Sqlite3.sqlite3_errmsg(db))); } - Sqlite3.sqlite3_finalize( vm ); + Sqlite3.sqlite3_finalize(vm); } -//alxwest: DataTable & SqliteDataAdapter currently unavailable for Silverlight -#if !SQLITE_SILVERLIGHT - public void DisplayDataTable( DataTable table, string name ) + //alxwest: DataTable & SqliteDataAdapter currently unavailable for Silverlight +#if !SQLITE_SILVERLIGHT + public void DisplayDataTable(DataTable table, string name) { - Console.WriteLine( "Display DataTable: {0}", name ); + Console.WriteLine("Display DataTable: {0}", name); int r = 0; - foreach ( DataRow row in table.Rows ) + foreach (DataRow row in table.Rows) { - Console.WriteLine( "Row {0}", r ); + Console.WriteLine("Row {0}", r); int c = 0; - foreach ( DataColumn col in table.Columns ) + foreach (DataColumn col in table.Columns) { - Console.WriteLine( " Col {0}: {1} {2}", c, col.ColumnName, col.DataType ); - Console.WriteLine( " Value: {0}", row[col] ); + Console.WriteLine(" Col {0}: {1} {2}", c, col.ColumnName, col.DataType); + Console.WriteLine(" Value: {0}", row[col]); c++; } r++; } - Console.WriteLine( "Rows in data table: {0}", r ); + Console.WriteLine("Rows in data table: {0}", r); } #endif @@ -762,75 +761,75 @@ public void DisplayDataTable( DataTable table, string name ) public void Issue_119() { - Console.WriteLine( "Test Start." ); + Console.WriteLine("Test Start."); - Console.WriteLine( "Create connection..." ); + Console.WriteLine("Create connection..."); SqliteConnection con = new SqliteConnection(); string dbFilename = @"=SqliteTest3=.db"; - string cs = string.Format( "Version=3,uri=file:{0}", dbFilename ); + string cs = string.Format("Version=3,uri=file:{0}", dbFilename); - Console.WriteLine( "Set connection String: {0}", cs ); + Console.WriteLine("Set connection String: {0}", cs); - if ( File.Exists( dbFilename ) ) - File.Delete( dbFilename ); + if (File.Exists(dbFilename)) + File.Delete(dbFilename); con.ConnectionString = cs; - Console.WriteLine( "Open database..." ); + Console.WriteLine("Open database..."); con.Open(); - Console.WriteLine( "create command..." ); + Console.WriteLine("create command..."); IDbCommand cmd = con.CreateCommand(); - Console.WriteLine( "create table TEST_TABLE..." ); + Console.WriteLine("create table TEST_TABLE..."); cmd.CommandText = "CREATE TABLE TEST_TABLE ( COLA INTEGER, COLB TEXT, COLC DATETIME )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 1..." ); + Console.WriteLine("insert row 1..."); cmd.CommandText = "INSERT INTO TEST_TABLE ( COLA, COLB, COLC ) VALUES (123,'ABC','2008-12-31 18:19:20' )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "insert row 2..." ); + Console.WriteLine("insert row 2..."); cmd.CommandText = "INSERT INTO TEST_TABLE ( COLA, COLB, COLC ) VALUES (124,'DEF', '2009-11-16 13:35:36' )"; cmd.ExecuteNonQuery(); - Console.WriteLine( "SELECT data from TEST_TABLE..." ); + Console.WriteLine("SELECT data from TEST_TABLE..."); cmd.CommandText = "SELECT RowID, COLA, COLB, COLC FROM TEST_TABLE"; IDataReader reader = cmd.ExecuteReader(); int r = 0; - Console.WriteLine( "Read the data..." ); - while ( reader.Read() ) + Console.WriteLine("Read the data..."); + while (reader.Read()) { - Console.WriteLine( " Row: {0}", r ); - int rowid = reader.GetInt32( reader.GetOrdinal( "RowID" ) ); - Console.WriteLine( " RowID: {0}", rowid ); + Console.WriteLine(" Row: {0}", r); + int rowid = reader.GetInt32(reader.GetOrdinal("RowID")); + Console.WriteLine(" RowID: {0}", rowid); - int i = reader.GetInt32( reader.GetOrdinal( "COLA" ) ); - Console.WriteLine( " COLA: {0}", i ); + int i = reader.GetInt32(reader.GetOrdinal("COLA")); + Console.WriteLine(" COLA: {0}", i); - string s = reader.GetString( reader.GetOrdinal( "COLB" ) ); - Console.WriteLine( " COLB: {0}", s ); + string s = reader.GetString(reader.GetOrdinal("COLB")); + Console.WriteLine(" COLB: {0}", s); - DateTime dt = reader.GetDateTime( reader.GetOrdinal( "COLC" ) ); - Console.WriteLine( " COLB: {0}", dt.ToString( "MM/dd/yyyy HH:mm:ss" ) ); + DateTime dt = reader.GetDateTime(reader.GetOrdinal("COLC")); + Console.WriteLine(" COLB: {0}", dt.ToString("MM/dd/yyyy HH:mm:ss")); r++; } - Console.WriteLine( "Close and cleanup..." ); + Console.WriteLine("Close and cleanup..."); con.Close(); con = null; - Console.WriteLine( "Test Done." ); + Console.WriteLine("Test Done."); } public void Issue_124() { - Console.WriteLine( "Test Start." ); + Console.WriteLine("Test Start."); Sqlite3.sqlite3 db = null; - Sqlite3.sqlite3_open( ":memory:", out db ); + Sqlite3.sqlite3_open(":memory:", out db); Sqlite3.Vdbe stmt = null; string zero = null; string val; @@ -839,72 +838,72 @@ public void Issue_124() //create table { - Sqlite3.sqlite3_prepare_v2( db, "create table Test (val REAL NOT NULL)", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - Sqlite3.sqlite3_finalize( stmt ); + Sqlite3.sqlite3_prepare_v2(db, "create table Test (val REAL NOT NULL)", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + Sqlite3.sqlite3_finalize(stmt); } //insert 0.1 { - Sqlite3.sqlite3_prepare_v2( db, "insert into Test(val) values ('0.1')", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - Sqlite3.sqlite3_finalize( stmt ); + Sqlite3.sqlite3_prepare_v2(db, "insert into Test(val) values ('0.1')", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + Sqlite3.sqlite3_finalize(stmt); } //insert 0.1 { - Sqlite3.sqlite3_prepare_v2( db, "insert into Test(val) values ('0.2')", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - Sqlite3.sqlite3_finalize( stmt ); + Sqlite3.sqlite3_prepare_v2(db, "insert into Test(val) values ('0.2')", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + Sqlite3.sqlite3_finalize(stmt); } //insert 0.000000001 { - Sqlite3.sqlite3_prepare_v2( db, "insert into Test(val) values ('0.000000001')", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - Sqlite3.sqlite3_finalize( stmt ); + Sqlite3.sqlite3_prepare_v2(db, "insert into Test(val) values ('0.000000001')", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + Sqlite3.sqlite3_finalize(stmt); } //invariant culture { - System.Console.WriteLine( "invariant culture" ); - Sqlite3.sqlite3_prepare_v2( db, "select val from Test", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - val = Sqlite3.sqlite3_column_text( stmt, 0 ); - System.Console.WriteLine( "value: " + val ); - Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture( "ru" ); - Sqlite3.sqlite3_step( stmt ); - val = Sqlite3.sqlite3_column_text( stmt, 0 ); - System.Console.WriteLine( "value: " + val ); - Sqlite3.sqlite3_step( stmt ); - val = Sqlite3.sqlite3_column_text( stmt, 0 ); - System.Console.WriteLine( "value: " + val ); - Sqlite3.sqlite3_finalize( stmt ); + System.Console.WriteLine("invariant culture"); + Sqlite3.sqlite3_prepare_v2(db, "select val from Test", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + val = Sqlite3.sqlite3_column_text(stmt, 0); + System.Console.WriteLine("value: " + val); + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ru"); + Sqlite3.sqlite3_step(stmt); + val = Sqlite3.sqlite3_column_text(stmt, 0); + System.Console.WriteLine("value: " + val); + Sqlite3.sqlite3_step(stmt); + val = Sqlite3.sqlite3_column_text(stmt, 0); + System.Console.WriteLine("value: " + val); + Sqlite3.sqlite3_finalize(stmt); } //ru-ru culture { - System.Console.WriteLine( "ru" ); - Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture( "ru" ); - Sqlite3.sqlite3_prepare_v2( db, "select val from Test", -1, ref stmt, ref zero ); - Sqlite3.sqlite3_step( stmt ); - val = Sqlite3.sqlite3_column_text( stmt, 0 ); - System.Console.WriteLine( "value: " + val ); - Sqlite3.sqlite3_step( stmt ); - val = Sqlite3.sqlite3_column_text( stmt, 0 ); - System.Console.WriteLine( "value: " + val ); - Sqlite3.sqlite3_finalize( stmt ); + System.Console.WriteLine("ru"); + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ru"); + Sqlite3.sqlite3_prepare_v2(db, "select val from Test", -1, ref stmt, ref zero); + Sqlite3.sqlite3_step(stmt); + val = Sqlite3.sqlite3_column_text(stmt, 0); + System.Console.WriteLine("value: " + val); + Sqlite3.sqlite3_step(stmt); + val = Sqlite3.sqlite3_column_text(stmt, 0); + System.Console.WriteLine("value: " + val); + Sqlite3.sqlite3_finalize(stmt); } - Console.WriteLine( "Test Done." ); + Console.WriteLine("Test Done."); } - public static int Main( string[] args ) + public static int Main(string[] args) { SQLiteClientTestDriver tests = new SQLiteClientTestDriver(); - int Test = 124; - switch ( Test ) + int Test = 1; + switch (Test) { case 1: tests.Test1(); @@ -943,7 +942,7 @@ public static int Main( string[] args ) tests.Issue_124(); break; } - Console.WriteLine( "Press Enter to Continue" ); + Console.WriteLine("Press Any Key to Continue"); Console.ReadKey(); tests = null; From 2026abf81d4a86720525a21ce6ba383558efff66 Mon Sep 17 00:00:00 2001 From: stewart Date: Wed, 19 Dec 2012 13:18:57 +0000 Subject: [PATCH 11/19] Consistent namespace used in UnitTest (xUnit) project. --- .../Community.CsharpSQLite.UnitTests.csproj | 13 ++++++++----- .../Properties/AssemblyInfo.cs | 10 +++++----- Community.CsharpSqlite.UnitTests/Stress.cs | 6 +++--- Community.CsharpSqlite.UnitTests/app.config | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.csproj b/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.csproj index a0294bd..4c173ec 100644 --- a/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.csproj +++ b/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -8,14 +8,17 @@ {59E27BF3-3D31-42E5-BA21-FAEE135E699F} Library Properties - Community.Data.SQLite.UnitTests - Community.Data.SQLite.UnitTests + Community.Data.Sqlite.UnitTests + Community.Data.Sqlite.UnitTests v3.5 512 - - + + + + + 3.5 true diff --git a/Community.CsharpSqlite.UnitTests/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.UnitTests/Properties/AssemblyInfo.cs index ada7fe9..e17ff8e 100644 --- a/Community.CsharpSqlite.UnitTests/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.UnitTests/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle( "Community.CsharpSQLite.UnitTests.Properties" )] +[assembly: AssemblyTitle("Community.CsharpSqlite.UnitTests.Properties")] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] -[assembly: AssemblyCompany( "Microsoft" )] -[assembly: AssemblyProduct( "Community.CsharpSQLite.UnitTests.Properties" )] -[assembly: AssemblyCopyright( "Copyright © Microsoft 2010" )] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Community.CsharpSqlite.UnitTests.Properties")] +[assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.7.5.0")] +[assembly: AssemblyVersion("3.7.7.1")] [assembly: AssemblyFileVersion( "1.0.0.0" )] diff --git a/Community.CsharpSqlite.UnitTests/Stress.cs b/Community.CsharpSqlite.UnitTests/Stress.cs index 51b67b2..7496c1e 100644 --- a/Community.CsharpSqlite.UnitTests/Stress.cs +++ b/Community.CsharpSqlite.UnitTests/Stress.cs @@ -1,11 +1,11 @@ using System.Diagnostics; using System.IO; -using Community.CsharpSQLite; -using Xunit; using Community.CsharpSqlite; -namespace Community.CsharpSQLite.UnitTests +using Xunit; + +namespace Community.CsharpSqlite.UnitTests { public class Stress { diff --git a/Community.CsharpSqlite.UnitTests/app.config b/Community.CsharpSqlite.UnitTests/app.config index b7db281..73859b0 100644 --- a/Community.CsharpSqlite.UnitTests/app.config +++ b/Community.CsharpSqlite.UnitTests/app.config @@ -1,3 +1,3 @@ - + - + From 7a88ce08e6b219f485e755a386a848e0334da32b Mon Sep 17 00:00:00 2001 From: stewart Date: Wed, 19 Dec 2012 13:19:53 +0000 Subject: [PATCH 12/19] Add patch for bug 169 http://code.google.com/p/csharp-sqlite/issues/detail?id=169 suggested by Chris Tacke. --- System.Data.Ersatz/src/System.Data/DbType.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/System.Data.Ersatz/src/System.Data/DbType.cs b/System.Data.Ersatz/src/System.Data/DbType.cs index ec0797b..3e70796 100644 --- a/System.Data.Ersatz/src/System.Data/DbType.cs +++ b/System.Data.Ersatz/src/System.Data/DbType.cs @@ -13,6 +13,14 @@ public enum DbType Int64, Byte, Binary, - Decimal + Decimal, + UInt16, + UInt32, + UInt64, + Object, + AnsiString, + AnsiStringFixedLength, + StringFixedLength, + Time } } From 791590dcf72a554eba59342ad24a0260d3df3a89 Mon Sep 17 00:00:00 2001 From: mattleibowmail Date: Sun, 10 Mar 2013 14:25:35 +0200 Subject: [PATCH 13/19] Added the SQLITE_ENABLE_COLUMN_METADATA preprocessor constant and made the sqlite3_table_column_metadata method public as in the official sqlite3 library. --- .../Community.CsharpSqlite.Silverlight.csproj | 4 ++-- Community.CsharpSqlite/src/main_c.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Community.CsharpSqlite.Silverlight/Community.CsharpSqlite.Silverlight.csproj b/Community.CsharpSqlite.Silverlight/Community.CsharpSqlite.Silverlight.csproj index dc4a398..51d0271 100644 --- a/Community.CsharpSqlite.Silverlight/Community.CsharpSqlite.Silverlight.csproj +++ b/Community.CsharpSqlite.Silverlight/Community.CsharpSqlite.Silverlight.csproj @@ -51,7 +51,7 @@ full false Bin\Debug - TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_HAS_CODEC + TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_HAS_CODEC SQLITE_ENABLE_COLUMN_METADATA true true prompt @@ -63,7 +63,7 @@ pdbonly true Bin\Release - SQLITE_SILVERLIGHT TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF + SQLITE_SILVERLIGHT TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_ENABLE_COLUMN_METADATA true true prompt diff --git a/Community.CsharpSqlite/src/main_c.cs b/Community.CsharpSqlite/src/main_c.cs index 7e6773b..164eed0 100644 --- a/Community.CsharpSqlite/src/main_c.cs +++ b/Community.CsharpSqlite/src/main_c.cs @@ -2931,7 +2931,7 @@ void sqlite3_thread_cleanup() */ #if SQLITE_ENABLE_COLUMN_METADATA - static int sqlite3_table_column_metadata( + public static int sqlite3_table_column_metadata( sqlite3 db, /* Connection handle */ string zDbName, /* Database name or NULL */ string zTableName, /* Table name */ From 78298d70b453d0473554adfb99a4de06e35da4b7 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 10 Mar 2013 14:49:27 +0200 Subject: [PATCH 14/19] Added the SQLITE_ENABLE_COLUMN_METADATA preprocessor constant for Windows Phone --- .../Community.CsharpSqlite.WinPhone.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community.CsharpSqlite.WinPhone/Community.CsharpSqlite.WinPhone.csproj b/Community.CsharpSqlite.WinPhone/Community.CsharpSqlite.WinPhone.csproj index 3c55ef4..d7f6acd 100644 --- a/Community.CsharpSqlite.WinPhone/Community.CsharpSqlite.WinPhone.csproj +++ b/Community.CsharpSqlite.WinPhone/Community.CsharpSqlite.WinPhone.csproj @@ -24,7 +24,7 @@ full false Bin\Debug - TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER SQLITE_DEBUG NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF WINDOWS_PHONE + TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER SQLITE_DEBUG NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF WINDOWS_PHONE SQLITE_ENABLE_COLUMN_METADATA true true prompt From 1072d6c349cbe92c222da2503c397d00e3b8e670 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 17 Mar 2013 20:48:04 +0200 Subject: [PATCH 15/19] Fixed the temporary paths for WinRT/SL/WP as they do not have access to the Path.GetTempPath() members: - WinRT = ApplicationData.Current.LocalFolder - SL/WP = sqlite3_temp_directory - others = Path.GetTempPath() --- Community.CsharpSqlite/src/os_win_c.cs | 34 +++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Community.CsharpSqlite/src/os_win_c.cs b/Community.CsharpSqlite/src/os_win_c.cs index 42ea9a6..30e2f59 100644 --- a/Community.CsharpSqlite/src/os_win_c.cs +++ b/Community.CsharpSqlite/src/os_win_c.cs @@ -2524,6 +2524,8 @@ static int getTempname( int nBuf, StringBuilder zBuf ) // zBuf[j] = 0; #if SQLITE_WINRT zBuf.Append( Path.Combine(ApplicationData.Current.LocalFolder.Path, SQLITE_TEMP_FILE_PREFIX + zRandom.ToString()) ); +#elif SQLITE_SILVERLIGHT + zBuf.Append(Path.Combine(sqlite3_temp_directory, SQLITE_TEMP_FILE_PREFIX + zRandom.ToString())); #else zBuf.Append( Path.GetTempPath() + SQLITE_TEMP_FILE_PREFIX + zRandom.ToString() ); #endif @@ -3088,19 +3090,35 @@ static int winAccess( attr = FileAttributes.Normal; } #else -#if WINDOWS_PHONE || WINDOWS_MOBILE || SQLITE_SILVERLIGHT +#if WINDOWS_MOBILE if (new DirectoryInfo(zFilename).Exists) +#elif SQLITE_WINRT + if (HelperMethods.DirectoryExists(zFilename)) +#elif WINDOWS_PHONE || SQLITE_SILVERLIGHT + if (System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().DirectoryExists(zFilename)) #else - attr = File.GetAttributes( zFilename );// GetFileAttributesW( (WCHAR)zConverted ); - if ( attr == FileAttributes.Directory ) + if (Directory.Exists( zFilename )) #endif { try { - string name = Path.Combine( Path.GetTempPath(), Path.GetTempFileName() ); + var tempName = new StringBuilder(); + getTempname(MAX_PATH + 1, tempName); + string name = Path.Combine(zFilename, Path.GetFileNameWithoutExtension(tempName.ToString())); + +#if SQLITE_WINRT + Task fileTask = StorageFolder.GetFolderFromPathAsync(path).AsTask(); + fileTask.Wait(); + attr = fileTask.Attributes; +#elif WINDOWS_PHONE || SQLITE_SILVERLIGHT + var stream = IsolatedStorageFile.GetUserStoreForApplication().CreateFile(name); + stream.Close(); + IsolatedStorageFile.GetUserStoreForApplication().DeleteFile(name); +#else FileStream fs = File.Create( name ); fs.Close(); File.Delete( name ); +#endif attr = FileAttributes.Normal; } catch ( IOException e ) @@ -3130,10 +3148,18 @@ static int winAccess( { case SQLITE_ACCESS_READ: case SQLITE_ACCESS_EXISTS: +#if SQLITE_WINRT + rc = attr == FileAttributes.Normal ? 1 : 0;// != INVALID_FILE_ATTRIBUTES; +#else rc = attr != 0 ? 1 : 0;// != INVALID_FILE_ATTRIBUTES; +#endif break; case SQLITE_ACCESS_READWRITE: +#if SQLITE_WINRT + rc = attr != FileAttributes.Normal ? 0 : (int)( attr & FileAttributes.ReadOnly ) != 0 ? 0 : 1; //FILE_ATTRIBUTE_READONLY ) == 0; +#else rc = attr == 0 ? 0 : (int)( attr & FileAttributes.ReadOnly ) != 0 ? 0 : 1; //FILE_ATTRIBUTE_READONLY ) == 0; +#endif break; default: Debug.Assert( "" == "Invalid flags argument" ); From 1cd6303bffffa3041304b3a12fa9a455382ed71d Mon Sep 17 00:00:00 2001 From: Megax Date: Wed, 10 Jul 2013 14:19:06 +0200 Subject: [PATCH 16/19] =?UTF-8?q?*=20.gitignore=20hozz=C3=A1adva.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ .hgignore | 32 ----------------------------- 2 files changed, 59 insertions(+), 32 deletions(-) create mode 100755 .gitignore delete mode 100644 .hgignore diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..d4421fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +# Autosave files +*~ + +*.pc +*.gmo +*.obj +*.pidb +*.mdb +*/bin/* +Run/ + +# ignore thumbnails created by windows +Thumbs.db +# Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +UpgradeLog.XML +UpgradeLog.htm +*.ReSharper +*.userprefs + +# http://www.gnu.org/software/automake + +Makefile +Makefile.in + +# http://www.gnu.org/software/autoconf + +/autom4te.cache +/aclocal.m4 +/compile +/configure +/depcomp +/install-sh +/missing +/config.status diff --git a/.hgignore b/.hgignore deleted file mode 100644 index faed30a..0000000 --- a/.hgignore +++ /dev/null @@ -1,32 +0,0 @@ -# Ignore file for Visual Studio 2008 - -# use glob syntax -syntax: glob - -# Ignore Visual Studio 2008 files -*~*.* -*_*.* -*_p.c -*.aps -*.bak -*.cache -*.exe -*.ilk -*.log -*.lib -*.ncb -*.obj -*.pch -*.pdb -*.sbr -*.scc -*.suo -*.tlb -*.tlh -*.user -*.vspscc -[Bb]in -[Db]ebug/ -obj/ -[Rr]elease/ -glob:.hgignore From 4324cae9e88c90a8382c2a6181689e5fdf41587f Mon Sep 17 00:00:00 2001 From: Megax Date: Wed, 10 Jul 2013 14:23:47 +0200 Subject: [PATCH 17/19] =?UTF-8?q?*=20A=20nekem=20sz=C3=BCks=C3=A9ges=20r?= =?UTF-8?q?=C3=A9szek=20friss=C3=ADtve.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Community.CsharpSqlite.csproj | 75 +------------------ Community.CsharpSqlite/app.config | 3 - 2 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 Community.CsharpSqlite/app.config diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index 3b83a2e..c6a215c 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -10,30 +10,6 @@ Properties Community.CsharpSqlite Community.CsharpSqlite - - - - - 3.5 - - - v3.5 - Client - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true true @@ -58,31 +34,9 @@ 0168 ; 0169; 0414; 0618; 0649 AllRules.ruleset - - true - bin\x86\Debug\ - DEBUG;SQLITE_DEBUG TRUE WIN32 _MSC_VER NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_W32 SQLITE_THREADSAFE SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF - 0168 ; 0169; 0414; 0618; 0649 - full - x86 - prompt - AllRules.ruleset - - - bin\x86\Release\ - TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_ENABLE_OVERSIZE_CELL_CHECK SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF - true - 0168 ; 0169; 0414; 0618; 0649 - pdbonly - x86 - prompt - AllRules.ruleset - - - 3.5 - + @@ -252,31 +206,6 @@ - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - False - Windows Installer 3.1 - true - - - \ No newline at end of file + diff --git a/Community.CsharpSqlite/app.config b/Community.CsharpSqlite/app.config deleted file mode 100644 index 73859b0..0000000 --- a/Community.CsharpSqlite/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - From a6ff5b064eded5fcfaeb689b6a93a61fdf25baac Mon Sep 17 00:00:00 2001 From: Megax Date: Wed, 10 Jul 2013 15:54:54 +0200 Subject: [PATCH 18/19] =?UTF-8?q?*=20Egy=C3=A9b.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Community.CsharpSqlite/Community.CsharpSqlite.csproj | 11 +++-------- Community.CsharpSqlite/Community.CsharpSqlite.sln | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index c6a215c..9133f92 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -19,27 +19,22 @@ DEBUG;SQLITE_DEBUG TRUE WIN32 _MSC_VER NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_W32 SQLITE_THREADSAFE SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF prompt 4 - 0168 ; 0169; 0414; 0618; 0649 - AnyCPU - AllRules.ruleset + 0168;0169;0414;0618;0649 - pdbonly true bin\Release\ TRUE WIN32 _MSC_VER NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_ENABLE_OVERSIZE_CELL_CHECK SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF prompt 4 - x86 - 0168 ; 0169; 0414; 0618; 0649 - AllRules.ruleset + 0168;0169;0414;0618;0649 - + diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.sln b/Community.CsharpSqlite/Community.CsharpSqlite.sln index 0e7cb6b..785f5cd 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.sln +++ b/Community.CsharpSqlite/Community.CsharpSqlite.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite", "Community.CsharpSqlite.csproj", "{F1653F20-D47D-4F29-8C55-3C835542AF5F}" EndProject Global From 9780544c0f2ad90a27f5cf7e63ae82623bd23fc5 Mon Sep 17 00:00:00 2001 From: Megax Date: Mon, 15 Jul 2013 10:19:48 +0200 Subject: [PATCH 19/19] * Introduce end-of-line normalization. --- .gitattributes | 32 + .../Classes/SQLiteDatabase.cs | 626 +- .../Classes/SQLiteVdbe.cs | 420 +- .../Community.CsharpSqlite.Benchmark.csproj | 780 +- .../Community.CsharpSqlite.Benchmark.sln | 52 +- .../Properties/AssemblyInfo.cs | 66 +- .../src/Benchmark.cs | 706 +- .../src/performance.sql | 268 +- ...munity.CsharpSqlite.SQLiteClient.SL.csproj | 222 +- ...Community.CsharpSqlite.SQLiteClient.SL.sln | 64 +- .../Properties/AssemblyInfo.cs | 70 +- .../SQLiteClientTests/App.xaml | 16 +- .../SQLiteClientTests/App.xaml.cs | 136 +- .../SQLiteClientTests/MainPage.xaml | 24 +- .../SQLiteClientTests/MainPage.xaml.cs | 46 +- .../Properties/AppManifest.xml | 12 +- .../Properties/AssemblyInfo.cs | 70 +- .../SQLiteClientTests.csproj | 248 +- ...munity.CsharpSqlite.SQLiteClient.WM.csproj | 250 +- ...Community.CsharpSqlite.SQLiteClient.WM.sln | 52 +- .../Properties/AssemblyInfo.cs | 70 +- ...munity.CsharpSqlite.SQLiteClient.WP.csproj | 188 +- ...Community.CsharpSqlite.SQLiteClient.WP.sln | 80 +- .../Properties/AssemblyInfo.cs | 70 +- .../SQLiteClientTests/App.xaml | 36 +- .../SQLiteClientTests/App.xaml.cs | 268 +- .../SQLiteClientTests/MainPage.xaml | 90 +- .../SQLiteClientTests/MainPage.xaml.cs | 110 +- .../Properties/AppManifest.xml | 12 +- .../Properties/AssemblyInfo.cs | 70 +- .../Properties/WMAppManifest.xml | 64 +- .../SQLiteClientTests.WinPhone.csproj | 240 +- .../SQLiteClientTests/TestCases.cs | 1642 +- ...ity.CsharpSqlite.SQLiteClient.WinRT.csproj | 330 +- ...munity.CsharpSqlite.SQLiteClient.WinRT.sln | 148 +- .../MetroSQLiteClientTest2/App.xaml | 40 +- .../MetroSQLiteClientTest2/App.xaml.cs | 166 +- .../Common/StandardStyles.xaml | 2014 +- .../MetroSQLiteClientTest2/MainPage.xaml | 68 +- .../MetroSQLiteClientTest2/MainPage.xaml.cs | 1220 +- .../MetroSQLiteClientTest2.csproj | 316 +- .../MetroSQLiteClientTest2.sln | 200 +- .../Package.appxmanifest | 82 +- .../Properties/AssemblyInfo.cs | 56 +- .../Properties/AssemblyInfo.cs | 56 +- ...Community.CsharpSqlite.SQLiteClient.csproj | 318 +- .../Community.CsharpSqlite.SQLiteClient.sln | 98 +- .../Properties/AssemblyInfo.cs | 62 +- .../SQLiteClientTests.csproj | 274 +- .../TestDriver_src/SQLiteClientTestDriver.cs | 1904 +- .../app.config | 6 +- .../src/SqliteClientFactory.cs | 196 +- .../src/SqliteCommand.cs | 1088 +- .../src/SqliteCommandBuilder.cs | 1044 +- .../src/SqliteConnection.cs | 1728 +- .../src/SqliteConnectionStringBuilder.cs | 564 +- .../src/SqliteDataAdapter.cs | 314 +- .../src/SqliteDataReader.cs | 976 +- .../src/SqliteDataSourceEnumerator.cs | 150 +- .../src/SqliteError.cs | 166 +- .../src/SqliteExceptions.cs | 170 +- .../src/SqliteParameter.cs | 348 +- .../src/SqliteRowUpdatedEventArgs.cs | 96 +- .../src/SqliteRowUpdatedEventHandler.cs | 84 +- .../src/SqliteRowUpdatingEventArgs.cs | 96 +- .../src/SqliteRowUpdatingEventHandler.cs | 84 +- .../src/SqliteTransaction.cs | 240 +- .../Community.CsharpSqlite.Silverlight.csproj | 734 +- .../Community.CsharpSqlite.Silverlight.sln | 40 +- .../Properties/AssemblyInfo.cs | 66 +- .../Community.CsharpSQLite.UnitTests.csproj | 160 +- .../Community.CsharpSQLite.UnitTests.sln | 68 +- .../Properties/AssemblyInfo.cs | 66 +- Community.CsharpSqlite.UnitTests/Stress.cs | 186 +- Community.CsharpSqlite.UnitTests/app.config | 6 +- .../Community.CsharpSqlite.WinMobile.csproj | 650 +- .../Community.CsharpSqlite.WinMobile.sln | 40 +- .../Properties/AssemblyInfo.cs | 70 +- .../Community.CsharpSqlite.WinPhone.csproj | 634 +- .../Properties/AssemblyInfo.cs | 70 +- .../Community.CsharpSqlite.WinRT.csproj | 760 +- .../Community.CsharpSqlite.WinRT.sln | 76 +- .../Properties/AssemblyInfo.cs | 56 +- .../Community.CsharpSqlite.shell.csproj | 630 +- .../Community.CsharpSqlite.shell.sln | 40 +- .../Properties/AssemblyInfo.cs | 66 +- Community.CsharpSqlite.shell/src/shell.cs | 7750 +++---- .../Community.CsharpSqlite.csproj | 424 +- .../Community.CsharpSqlite.sln | 40 +- .../Properties/AssemblyInfo.cs | 66 +- Community.CsharpSqlite/src/BtreeInt_h.cs | 1646 +- Community.CsharpSqlite/src/Btree_h.cs | 612 +- Community.CsharpSqlite/src/Delegates.cs | 746 +- Community.CsharpSqlite/src/Hash_h.cs | 282 +- Community.CsharpSqlite/src/VdbeInt_h.cs | 1360 +- Community.CsharpSqlite/src/Vdbe_h.cs | 622 +- Community.CsharpSqlite/src/_Custom.cs | 1342 +- Community.CsharpSqlite/src/alter_c.cs | 1870 +- Community.CsharpSqlite/src/analyze_c.cs | 1732 +- Community.CsharpSqlite/src/attach_c.cs | 1330 +- Community.CsharpSqlite/src/auth_c.cs | 534 +- Community.CsharpSqlite/src/backup_c.cs | 1636 +- Community.CsharpSqlite/src/bitvec_c.cs | 1068 +- Community.CsharpSqlite/src/btmutex_c.cs | 606 +- Community.CsharpSqlite/src/btree_c.cs | 19126 ++++++++-------- Community.CsharpSqlite/src/build_c.cs | 8844 +++---- Community.CsharpSqlite/src/callback_c.cs | 1118 +- Community.CsharpSqlite/src/complete_c.cs | 724 +- Community.CsharpSqlite/src/crypto.cs | 1530 +- Community.CsharpSqlite/src/ctime_c.cs | 840 +- Community.CsharpSqlite/src/date_c.cs | 2820 +-- Community.CsharpSqlite/src/delete_c.cs | 1492 +- Community.CsharpSqlite/src/expr_c.cs | 8884 +++---- Community.CsharpSqlite/src/fault_c.cs | 232 +- Community.CsharpSqlite/src/fkey_c.cs | 2750 +-- Community.CsharpSqlite/src/func_c.cs | 4294 ++-- Community.CsharpSqlite/src/global_c.cs | 492 +- Community.CsharpSqlite/src/hash_c.cs | 726 +- Community.CsharpSqlite/src/hwtime_c.cs | 206 +- Community.CsharpSqlite/src/insert_c.cs | 4346 ++-- Community.CsharpSqlite/src/journal_c.cs | 500 +- Community.CsharpSqlite/src/keywordhash_h.cs | 606 +- Community.CsharpSqlite/src/legacy_c.cs | 470 +- Community.CsharpSqlite/src/loadext_c.cs | 1518 +- Community.CsharpSqlite/src/main_c.cs | 6858 +++--- Community.CsharpSqlite/src/malloc_c.cs | 2230 +- Community.CsharpSqlite/src/mem_Pool.cs | 880 +- Community.CsharpSqlite/src/memjournal_c.cs | 642 +- Community.CsharpSqlite/src/mutex_c.cs | 342 +- Community.CsharpSqlite/src/mutex_h.cs | 298 +- Community.CsharpSqlite/src/mutex_noop_c.cs | 484 +- Community.CsharpSqlite/src/mutex_w32.cs | 850 +- Community.CsharpSqlite/src/notify_c.cs | 692 +- Community.CsharpSqlite/src/opcodes_c.cs | 340 +- Community.CsharpSqlite/src/opcodes_h.cs | 696 +- Community.CsharpSqlite/src/os_c.cs | 838 +- Community.CsharpSqlite/src/os_common_h.cs | 450 +- Community.CsharpSqlite/src/os_h.cs | 608 +- Community.CsharpSqlite/src/os_win_c.cs | 7650 +++--- Community.CsharpSqlite/src/pager_c.cs | 15670 ++++++------- Community.CsharpSqlite/src/pager_h.cs | 416 +- Community.CsharpSqlite/src/parse_c.cs | 8720 +++---- Community.CsharpSqlite/src/parse_h.cs | 660 +- Community.CsharpSqlite/src/pcache1_c.cs | 2344 +- Community.CsharpSqlite/src/pcache_c.cs | 1492 +- Community.CsharpSqlite/src/pcache_h.cs | 426 +- Community.CsharpSqlite/src/pragma_c.cs | 3774 +-- Community.CsharpSqlite/src/prepare_c.cs | 2182 +- Community.CsharpSqlite/src/printf_c.cs | 2896 +-- Community.CsharpSqlite/src/random_c.cs | 406 +- Community.CsharpSqlite/src/resolve_c.cs | 2836 +-- Community.CsharpSqlite/src/rowset_c.cs | 1038 +- Community.CsharpSqlite/src/select_c.cs | 10346 ++++----- Community.CsharpSqlite/src/sqlite3_h.cs | 14970 ++++++------ Community.CsharpSqlite/src/sqliteInt_h.cs | 9282 ++++---- Community.CsharpSqlite/src/sqliteLimit_h.cs | 452 +- Community.CsharpSqlite/src/status_c.cs | 554 +- Community.CsharpSqlite/src/table_c.cs | 442 +- Community.CsharpSqlite/src/tokenize_c.cs | 1426 +- Community.CsharpSqlite/src/trigger_c.cs | 2620 +-- Community.CsharpSqlite/src/update_c.cs | 1562 +- Community.CsharpSqlite/src/utf_c.cs | 1266 +- Community.CsharpSqlite/src/util_c.cs | 3354 +-- Community.CsharpSqlite/src/vacuum_c.cs | 830 +- Community.CsharpSqlite/src/vdbe_c.cs | 14160 ++++++------ Community.CsharpSqlite/src/vdbeapi_c.cs | 3276 +-- Community.CsharpSqlite/src/vdbeaux_c.cs | 8626 +++---- Community.CsharpSqlite/src/vdbeblob_c.cs | 806 +- Community.CsharpSqlite/src/vdbemem_c.cs | 3212 +-- Community.CsharpSqlite/src/vdbetrace_c.cs | 410 +- Community.CsharpSqlite/src/vtab_c.cs | 2482 +- Community.CsharpSqlite/src/wal_c.cs | 5940 ++--- Community.CsharpSqlite/src/wal_h.cs | 458 +- Community.CsharpSqlite/src/walker_c.cs | 380 +- Community.CsharpSqlite/src/where_c.cs | 11686 +++++----- License | 22 +- .../Silverlight/Properties/AssemblyInfo.cs | 62 +- .../System.Data.Ersatz.Silverlight.csproj | 306 +- .../WinPhone/Properties/AssemblyInfo.cs | 62 +- .../System.Data.Ersatz.WinPhone.csproj | 288 +- .../WinRT/Properties/AssemblyInfo.cs | 56 +- .../WinRT/System.Data.Ersatz.WinRT.csproj | 420 +- .../src/System.Data.Common/DbCommand.cs | 370 +- .../src/System.Data.Common/DbConnection.cs | 1578 +- .../src/System.Data.Common/DbParameter.cs | 228 +- .../DbParameterCollection.cs | 292 +- .../src/System.Data.Common/DbTransaction.cs | 168 +- .../src/System.Data.Common/DbTypes.cs | 70 +- .../src/System.Data/CommandType.cs | 16 +- .../src/System.Data/ConnectionState.cs | 28 +- System.Data.Ersatz/src/System.Data/DbType.cs | 52 +- .../src/System.Data/IsolationLevel.cs | 26 +- .../src/System.Data/ParameterDirection.cs | 20 +- .../src/System/ApplicationException.cs | 50 +- System.Data.Ersatz/src/System/DBNull.cs | 34 +- .../src/System/DuplicateNameException.cs | 34 +- System.Data.Ersatz/src/System/ICloneable.cs | 24 +- TCL/Properties/AssemblyInfo.cs | 66 +- TCL/src/SupportClass.cs | 2736 +-- TCL/src/_tcl_Conversions.cs | 1526 +- TCL/src/base/AssocData.cs | 62 +- TCL/src/base/BackSlashResult.cs | 74 +- TCL/src/base/BgErrorMgr.cs | 560 +- TCL/src/base/CObject.cs | 124 +- TCL/src/base/CallFrame.cs | 818 +- TCL/src/base/CharPointer.cs | 134 +- TCL/src/base/Command.cs | 58 +- TCL/src/base/CommandWithDispose.cs | 70 +- TCL/src/base/DebugInfo.cs | 104 +- TCL/src/base/Env.cs | 198 +- TCL/src/base/EventDeleter.cs | 110 +- TCL/src/base/EventuallyFreed.cs | 154 +- TCL/src/base/ExprValue.cs | 136 +- TCL/src/base/Expression.cs | 4544 ++-- TCL/src/base/Extension.cs | 320 +- TCL/src/base/FindElemResult.cs | 104 +- TCL/src/base/IdleHandler.cs | 228 +- TCL/src/base/ImportRef.cs | 80 +- TCL/src/base/ImportedCmdData.cs | 118 +- TCL/src/base/InternalRep.cs | 88 +- TCL/src/base/Interp.cs | 5218 ++--- TCL/src/base/JACL.cs | 86 +- TCL/src/base/Notifier.cs | 1208 +- TCL/src/base/ParseResult.cs | 138 +- TCL/src/base/Parser.cs | 4398 ++-- TCL/src/base/Procedure.cs | 518 +- TCL/src/base/QSort.cs | 1108 +- TCL/src/base/Resolver.cs | 68 +- TCL/src/base/SearchId.cs | 260 +- TCL/src/base/TCL.cs | 250 +- TCL/src/base/TCLObj.cs | 202 +- TCL/src/base/TclBoolean.cs | 300 +- TCL/src/base/TclByteArray.cs | 472 +- TCL/src/base/TclDouble.cs | 266 +- TCL/src/base/TclEvent.cs | 218 +- TCL/src/base/TclException.cs | 226 +- TCL/src/base/TclIndex.cs | 326 +- TCL/src/base/TclInteger.cs | 350 +- TCL/src/base/TclList.cs | 898 +- TCL/src/base/TclLong.cs | 348 +- TCL/src/base/TclNumArgsException.cs | 162 +- TCL/src/base/TclObject.cs | 870 +- TCL/src/base/TclParse.cs | 658 +- TCL/src/base/TclPosixException.cs | 1530 +- TCL/src/base/TclRegexp.cs | 96 +- TCL/src/base/TclRuntimeError.cs | 78 +- TCL/src/base/TclString.cs | 442 +- TCL/src/base/TclToken.cs | 276 +- TCL/src/base/TclVarException.cs | 112 +- TCL/src/base/TimerHandler.cs | 288 +- TCL/src/base/TraceRecord.cs | 80 +- TCL/src/base/Util.cs | 2940 +-- TCL/src/base/Var.cs | 4986 ++-- TCL/src/base/VarTrace.cs | 68 +- TCL/src/base/WrappedCommand.cs | 182 +- TCL/src/commands/AfterCmd.cs | 1062 +- TCL/src/commands/AppendCmd.cs | 122 +- TCL/src/commands/ArrayCmd.cs | 1108 +- TCL/src/commands/BinaryCmd.cs | 2218 +- TCL/src/commands/BreakCmd.cs | 78 +- TCL/src/commands/CaseCmd.cs | 306 +- TCL/src/commands/CatchCmd.cs | 146 +- TCL/src/commands/CdCmd.cs | 112 +- TCL/src/commands/ClockCmd.cs | 3172 +-- TCL/src/commands/CloseCmd.cs | 108 +- TCL/src/commands/ConcatCmd.cs | 62 +- TCL/src/commands/ContinueCmd.cs | 78 +- TCL/src/commands/EncodingCmd.cs | 402 +- TCL/src/commands/EofCmd.cs | 122 +- TCL/src/commands/ErrorCmd.cs | 114 +- TCL/src/commands/EvalCmd.cs | 130 +- TCL/src/commands/ExecCmd.cs | 714 +- TCL/src/commands/ExitCmd.cs | 88 +- TCL/src/commands/ExprCmd.cs | 116 +- TCL/src/commands/FblockedCmd.cs | 108 +- TCL/src/commands/FconfigureCmd.cs | 904 +- TCL/src/commands/FileCmd.cs | 2326 +- TCL/src/commands/FlushCmd.cs | 126 +- TCL/src/commands/ForCmd.cs | 252 +- TCL/src/commands/ForeachCmd.cs | 322 +- TCL/src/commands/FormatCmd.cs | 2440 +- TCL/src/commands/GetsCmd.cs | 188 +- TCL/src/commands/GlobCmd.cs | 1664 +- TCL/src/commands/GlobalCmd.cs | 146 +- TCL/src/commands/IfCmd.cs | 306 +- TCL/src/commands/IncrCmd.cs | 154 +- TCL/src/commands/InfoCmd.cs | 2618 +-- TCL/src/commands/InterpAliasCmd.cs | 490 +- TCL/src/commands/InterpCmd.cs | 870 +- TCL/src/commands/InterpSlaveCmd.cs | 1148 +- TCL/src/commands/JoinCmd.cs | 142 +- TCL/src/commands/LappendCmd.cs | 318 +- TCL/src/commands/LindexCmd.cs | 102 +- TCL/src/commands/LinsertCmd.cs | 130 +- TCL/src/commands/ListCmd.cs | 90 +- TCL/src/commands/LlengthCmd.cs | 76 +- TCL/src/commands/LrangeCmd.cs | 196 +- TCL/src/commands/LreplaceCmd.cs | 190 +- TCL/src/commands/LsearchCmd.cs | 1020 +- TCL/src/commands/LsetCmd.cs | 132 +- TCL/src/commands/LsortCmd.cs | 320 +- TCL/src/commands/NamespaceCmd.cs | 7348 +++--- TCL/src/commands/OpenCmd.cs | 542 +- TCL/src/commands/PackageCmd.cs | 1718 +- TCL/src/commands/ParseAdaptor.cs | 334 +- TCL/src/commands/ProcCmd.cs | 232 +- TCL/src/commands/PutsCmd.cs | 220 +- TCL/src/commands/PwdCmd.cs | 106 +- TCL/src/commands/ReadCmd.cs | 366 +- TCL/src/commands/RegexpCmd.cs | 260 +- TCL/src/commands/RegsubCmd.cs | 274 +- TCL/src/commands/RenameCmd.cs | 118 +- TCL/src/commands/ReturnCmd.cs | 262 +- TCL/src/commands/ScanCmd.cs | 1370 +- TCL/src/commands/SeekCmd.cs | 198 +- TCL/src/commands/SetCmd.cs | 102 +- TCL/src/commands/SocketChannel.cs | 268 +- TCL/src/commands/SourceCmd.cs | 206 +- TCL/src/commands/SplitCmd.cs | 246 +- TCL/src/commands/StdChannel.cs | 390 +- TCL/src/commands/StringCmd.cs | 2536 +- TCL/src/commands/StrtodResult.cs | 114 +- TCL/src/commands/StrtoulResult.cs | 98 +- TCL/src/commands/SubstCmd.cs | 316 +- TCL/src/commands/SwitchCmd.cs | 316 +- TCL/src/commands/TellCmd.cs | 126 +- TCL/src/commands/TimeCmd.cs | 122 +- TCL/src/commands/TraceCmd.cs | 582 +- TCL/src/commands/UnsetCmd.cs | 114 +- TCL/src/commands/UpdateCmd.cs | 148 +- TCL/src/commands/UplevelCmd.cs | 192 +- TCL/src/commands/UpvarCmd.cs | 176 +- TCL/src/commands/VariableCmd.cs | 232 +- TCL/src/commands/VwaitCmd.cs | 150 +- TCL/src/commands/WhileCmd.cs | 172 +- TCL/src/csTCL.cs | 1006 +- TCL/src/io/Channel.cs | 1400 +- TCL/src/io/ChannelBuffer.cs | 132 +- TCL/src/io/FileChannel.cs | 806 +- TCL/src/io/FileUtil.cs | 1936 +- TCL/src/io/TclIO.cs | 588 +- TCL/src/io/TclInputStream.cs | 4324 ++-- TCL/src/io/TclOutputStream.cs | 3074 +-- TCL/src/regexp_brazil/Regexp.cs | 3512 +-- TCL/src/regexp_brazil/Regsub.cs | 428 +- TCL/src/tcl_h.cs | 4752 ++-- TCL/tcl.csproj | 468 +- TCL/tcl.sln | 40 +- test/^testscripts.test | 184 +- test/_C#SQLite.test | 150 +- test/capi3e.test | 244 +- test/e_dropview.test | 384 +- test/e_expr.test | 3736 +-- test/eqp.test | 1156 +- test/fuzzer1.test | 2764 +-- test/tester.tcl | 3038 +-- test/tkt-3fe897352e.test | 6 +- test/triggerD.test | 90 +- test/vacuum2.test | 462 +- test/vtab1.test | 2364 +- testfixture/Properties/AssemblyInfo.cs | 66 +- testfixture/app.config | 6 +- testfixture/src/tclsqlite_c.cs | 8854 +++---- testfixture/src/test1_c.cs | 13686 +++++------ testfixture/src/test2_c.cs | 1460 +- testfixture/src/test3_c.cs | 1604 +- testfixture/src/test8_c.cs | 3158 +-- testfixture/src/test9_c.cs | 486 +- testfixture/src/test_autoext_c.cs | 400 +- testfixture/src/test_backup_c.cs | 414 +- testfixture/src/test_btree_c.cs | 170 +- testfixture/src/test_config_c.cs | 1272 +- testfixture/src/test_func_c.cs | 1392 +- testfixture/src/test_fuzzer_c.cs | 2260 +- testfixture/src/test_hexio_c.cs | 924 +- testfixture/src/test_intarray_c.cs | 902 +- testfixture/src/test_malloc_c.cs | 3274 +-- testfixture/src/test_mutex_c.cs | 1100 +- testfixture/src/test_schema_c.cs | 870 +- testfixture/src/test_stat_c.cs | 1432 +- testfixture/src/test_tclvar_c.cs | 728 +- testfixture/src/test_vfs_c.cs | 3046 +-- testfixture/src/test_vfstrace_c.cs | 1854 +- testfixture/src/test_wholenumber_c.cs | 742 +- testfixture/src/testfixture.cs | 1146 +- testfixture/testfixture.csproj | 4796 ++-- testfixture/testfixture.sln | 64 +- 387 files changed, 231539 insertions(+), 231507 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..37fdc75 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,32 @@ +# NOTE: this file is for git 1.6.6 (and possibly older) +# Post-1.7.2 there is eol and text, and crlf is deprecated +# but we can't depend on an unreleased version... + +# This file mainly controls line ending conversion behaviour, if +# the user has the setting core.autocrlf true. + +# The meaning of the attributes is a little odd +# -crlf means DO NOT convert line endings +# crlf means CONVERT to lf in the repo & Linux/Mac, crlf on Windows + +# First, turn off git line ending handling except on a case-by-case basis +# because our repo isn't normalized, in general. +# There are even files with mixed line endings. +* -crlf + +# Auto detect text files and perform LF normalization +* text=auto + +# sln is always CRLF, even on linux, so don't convert +*.sln -crlf + +# These files can be converted, since they're new +.gitattributes crlf +.gitignore crlf + +# Having proj files as crlf on windows will make VS happier +# MD can deal with (and preserve) either, so it doesn't matter. +# Unfortunately MD creates with LF, so we need to convert these. +*proj crlf + +*.sh eol=lf diff --git a/Community.CsharpSqlite.Benchmark/Classes/SQLiteDatabase.cs b/Community.CsharpSqlite.Benchmark/Classes/SQLiteDatabase.cs index 39c65ab..53a90d2 100644 --- a/Community.CsharpSqlite.Benchmark/Classes/SQLiteDatabase.cs +++ b/Community.CsharpSqlite.Benchmark/Classes/SQLiteDatabase.cs @@ -1,313 +1,313 @@ -// $Header$ -using System; -using System.Collections; -using System.Data; - -namespace Community.CsharpSqlite -{ - - using sqlite = Sqlite3.sqlite3; - using Vdbe = Sqlite3.Vdbe; - /// - /// C#-SQLite wrapper with functions for opening, closing and executing queries. - /// - public class SQLiteDatabase - { - // pointer to database - private sqlite db; - - /// - /// Creates new instance of SQLiteBase class with no database attached. - /// - public SQLiteDatabase() - { - db = null; - } - /// - /// Creates new instance of SQLiteDatabase class and opens database with given name. - /// - /// Name (and path) to SQLite database file - public SQLiteDatabase( String DatabaseName ) - { - OpenDatabase( DatabaseName ); - } - - /// - /// Opens database. - /// - /// Name of database file - public void OpenDatabase( String DatabaseName ) - { - // opens database - if ( -#if NET_35 - Sqlite3.Open -#else -Sqlite3.sqlite3_open -#endif -( DatabaseName, out db ) != Sqlite3.SQLITE_OK ) - { - // if there is some error, database pointer is set to 0 and exception is throws - db = null; - throw new Exception( "Error with opening database " + DatabaseName + "!" ); - } - } - - /// - /// Closes opened database. - /// - public void CloseDatabase() - { - // closes the database if there is one opened - if ( db != null ) - { -#if NET_35 - Sqlite3.Close -#else -Sqlite3.sqlite3_close -#endif -( db ); - } - } - - /// - /// Returns connection - /// - public sqlite Connection() - { - return db; - } - - /// - /// Returns the list of tables in opened database. - /// - /// - public ArrayList GetTables() - { - // executes query that select names of all tables in master table of the database - String query = "SELECT name FROM sqlite_master " + - "WHERE type = 'table'" + - "ORDER BY 1"; - DataTable table = ExecuteQuery( query ); - - // Return all table names in the ArrayList - ArrayList list = new ArrayList(); - foreach ( DataRow row in table.Rows ) - { - list.Add( row.ItemArray[0].ToString() ); - } - return list; - } - - /// - /// Executes query that does not return anything (e.g. UPDATE, INSERT, DELETE). - /// - /// - public void ExecuteNonQuery( String query ) - { - // calles SQLite function that executes non-query - Sqlite3.exec( db, query, 0, 0, 0 ); - // if there is error, excetion is thrown - if ( db.errCode != Sqlite3.SQLITE_OK ) - throw new Exception( "Error with executing non-query: \"" + query + "\"!\n" + -#if NET_35 - Sqlite3.Errmsg -#else -Sqlite3.sqlite3_errmsg -#endif -( db ) ); - } - - /// - /// Executes query that does return something (e.g. SELECT). - /// - /// - /// - public DataTable ExecuteQuery( String query ) - { - // compiled query - SQLiteVdbe statement = new SQLiteVdbe( this, query ); - - // table for result of query - DataTable table = new DataTable(); - - // create new instance of DataTable with name "resultTable" - table = new DataTable( "resultTable" ); - - // reads rows - do { } while ( ReadNextRow( statement.VirtualMachine(), table ) == Sqlite3.SQLITE_ROW ); - // finalize executing this query - statement.Close(); - - // returns table - return table; - } - - // private function for reading rows and creating table and columns - private int ReadNextRow( Vdbe vm, DataTable table ) - { - int columnCount = table.Columns.Count; - if ( columnCount == 0 ) - { - if ( ( columnCount = ReadColumnNames( vm, table ) ) == 0 ) return Sqlite3.SQLITE_ERROR; - } - - int resultType; - if ( ( resultType = -#if NET_35 - Sqlite3.Step -#else -Sqlite3.sqlite3_step -#endif -( vm ) ) == Sqlite3.SQLITE_ROW ) - { - object[] columnValues = new object[columnCount]; - - for ( int i = 0; i < columnCount; i++ ) - { - int columnType = -#if NET_35 - Sqlite3.ColumnType -#else -Sqlite3.sqlite3_column_type -#endif -( vm, i ); - switch ( columnType ) - { - case Sqlite3.SQLITE_INTEGER: - { - table.Columns[i].DataType = typeof( Int64 ); - columnValues[i] = -#if NET_35 - Sqlite3.ColumnInt -#else -Sqlite3.sqlite3_column_int -#endif -( vm, i ); - break; - } - case Sqlite3.SQLITE_FLOAT: - { - table.Columns[i].DataType = typeof( Double ); - columnValues[i] = -#if NET_35 - Sqlite3.ColumnDouble -#else -Sqlite3.sqlite3_column_double -#endif -( vm, i ); - break; - } - case Sqlite3.SQLITE_TEXT: - { - table.Columns[i].DataType = typeof( String ); - columnValues[i] = -#if NET_35 - Sqlite3.ColumnText -#else -Sqlite3.sqlite3_column_text -#endif -( vm, i ); - break; - } - case Sqlite3.SQLITE_BLOB: - { - table.Columns[i].DataType = typeof( Byte[] ); - columnValues[i] = -#if NET_35 - Sqlite3.ColumnBlob -#else -Sqlite3.sqlite3_column_blob -#endif -( vm, i ); - break; - } - default: - { - table.Columns[i].DataType = null; - columnValues[i] = ""; - break; - } - } - } - table.Rows.Add( columnValues ); - } - return resultType; - } - // private function for creating Column Names - // Return number of colums read - private int ReadColumnNames( Vdbe vm, DataTable table ) - { - - String columnName = ""; - int columnType = 0; - // returns number of columns returned by statement - int columnCount = -#if NET_35 - Sqlite3.ColumnCount -#else -Sqlite3.sqlite3_column_count -#endif -( vm ); - object[] columnValues = new object[columnCount]; - - try - { - // reads columns one by one - for ( int i = 0; i < columnCount; i++ ) - { - columnName = -#if NET_35 - Sqlite3.ColumnName -#else -Sqlite3.sqlite3_column_name -#endif -( vm, i ); - columnType = -#if NET_35 - Sqlite3.ColumnType -#else -Sqlite3.sqlite3_column_type -#endif -( vm, i ); - - switch ( columnType ) - { - case Sqlite3.SQLITE_INTEGER: - { - // adds new integer column to table - table.Columns.Add( columnName, Type.GetType( "System.Int64" ) ); - break; - } - case Sqlite3.SQLITE_FLOAT: - { - table.Columns.Add( columnName, Type.GetType( "System.Double" ) ); - break; - } - case Sqlite3.SQLITE_TEXT: - { - table.Columns.Add( columnName, Type.GetType( "System.String" ) ); - break; - } - case Sqlite3.SQLITE_BLOB: - { - table.Columns.Add( columnName, Type.GetType( "System.byte[]" ) ); - break; - } - default: - { - table.Columns.Add( columnName, Type.GetType( "System.String" ) ); - break; - } - } - } - } - catch - { - return 0; - } - return table.Columns.Count; - } - - } -} +// $Header$ +using System; +using System.Collections; +using System.Data; + +namespace Community.CsharpSqlite +{ + + using sqlite = Sqlite3.sqlite3; + using Vdbe = Sqlite3.Vdbe; + /// + /// C#-SQLite wrapper with functions for opening, closing and executing queries. + /// + public class SQLiteDatabase + { + // pointer to database + private sqlite db; + + /// + /// Creates new instance of SQLiteBase class with no database attached. + /// + public SQLiteDatabase() + { + db = null; + } + /// + /// Creates new instance of SQLiteDatabase class and opens database with given name. + /// + /// Name (and path) to SQLite database file + public SQLiteDatabase( String DatabaseName ) + { + OpenDatabase( DatabaseName ); + } + + /// + /// Opens database. + /// + /// Name of database file + public void OpenDatabase( String DatabaseName ) + { + // opens database + if ( +#if NET_35 + Sqlite3.Open +#else +Sqlite3.sqlite3_open +#endif +( DatabaseName, out db ) != Sqlite3.SQLITE_OK ) + { + // if there is some error, database pointer is set to 0 and exception is throws + db = null; + throw new Exception( "Error with opening database " + DatabaseName + "!" ); + } + } + + /// + /// Closes opened database. + /// + public void CloseDatabase() + { + // closes the database if there is one opened + if ( db != null ) + { +#if NET_35 + Sqlite3.Close +#else +Sqlite3.sqlite3_close +#endif +( db ); + } + } + + /// + /// Returns connection + /// + public sqlite Connection() + { + return db; + } + + /// + /// Returns the list of tables in opened database. + /// + /// + public ArrayList GetTables() + { + // executes query that select names of all tables in master table of the database + String query = "SELECT name FROM sqlite_master " + + "WHERE type = 'table'" + + "ORDER BY 1"; + DataTable table = ExecuteQuery( query ); + + // Return all table names in the ArrayList + ArrayList list = new ArrayList(); + foreach ( DataRow row in table.Rows ) + { + list.Add( row.ItemArray[0].ToString() ); + } + return list; + } + + /// + /// Executes query that does not return anything (e.g. UPDATE, INSERT, DELETE). + /// + /// + public void ExecuteNonQuery( String query ) + { + // calles SQLite function that executes non-query + Sqlite3.exec( db, query, 0, 0, 0 ); + // if there is error, excetion is thrown + if ( db.errCode != Sqlite3.SQLITE_OK ) + throw new Exception( "Error with executing non-query: \"" + query + "\"!\n" + +#if NET_35 + Sqlite3.Errmsg +#else +Sqlite3.sqlite3_errmsg +#endif +( db ) ); + } + + /// + /// Executes query that does return something (e.g. SELECT). + /// + /// + /// + public DataTable ExecuteQuery( String query ) + { + // compiled query + SQLiteVdbe statement = new SQLiteVdbe( this, query ); + + // table for result of query + DataTable table = new DataTable(); + + // create new instance of DataTable with name "resultTable" + table = new DataTable( "resultTable" ); + + // reads rows + do { } while ( ReadNextRow( statement.VirtualMachine(), table ) == Sqlite3.SQLITE_ROW ); + // finalize executing this query + statement.Close(); + + // returns table + return table; + } + + // private function for reading rows and creating table and columns + private int ReadNextRow( Vdbe vm, DataTable table ) + { + int columnCount = table.Columns.Count; + if ( columnCount == 0 ) + { + if ( ( columnCount = ReadColumnNames( vm, table ) ) == 0 ) return Sqlite3.SQLITE_ERROR; + } + + int resultType; + if ( ( resultType = +#if NET_35 + Sqlite3.Step +#else +Sqlite3.sqlite3_step +#endif +( vm ) ) == Sqlite3.SQLITE_ROW ) + { + object[] columnValues = new object[columnCount]; + + for ( int i = 0; i < columnCount; i++ ) + { + int columnType = +#if NET_35 + Sqlite3.ColumnType +#else +Sqlite3.sqlite3_column_type +#endif +( vm, i ); + switch ( columnType ) + { + case Sqlite3.SQLITE_INTEGER: + { + table.Columns[i].DataType = typeof( Int64 ); + columnValues[i] = +#if NET_35 + Sqlite3.ColumnInt +#else +Sqlite3.sqlite3_column_int +#endif +( vm, i ); + break; + } + case Sqlite3.SQLITE_FLOAT: + { + table.Columns[i].DataType = typeof( Double ); + columnValues[i] = +#if NET_35 + Sqlite3.ColumnDouble +#else +Sqlite3.sqlite3_column_double +#endif +( vm, i ); + break; + } + case Sqlite3.SQLITE_TEXT: + { + table.Columns[i].DataType = typeof( String ); + columnValues[i] = +#if NET_35 + Sqlite3.ColumnText +#else +Sqlite3.sqlite3_column_text +#endif +( vm, i ); + break; + } + case Sqlite3.SQLITE_BLOB: + { + table.Columns[i].DataType = typeof( Byte[] ); + columnValues[i] = +#if NET_35 + Sqlite3.ColumnBlob +#else +Sqlite3.sqlite3_column_blob +#endif +( vm, i ); + break; + } + default: + { + table.Columns[i].DataType = null; + columnValues[i] = ""; + break; + } + } + } + table.Rows.Add( columnValues ); + } + return resultType; + } + // private function for creating Column Names + // Return number of colums read + private int ReadColumnNames( Vdbe vm, DataTable table ) + { + + String columnName = ""; + int columnType = 0; + // returns number of columns returned by statement + int columnCount = +#if NET_35 + Sqlite3.ColumnCount +#else +Sqlite3.sqlite3_column_count +#endif +( vm ); + object[] columnValues = new object[columnCount]; + + try + { + // reads columns one by one + for ( int i = 0; i < columnCount; i++ ) + { + columnName = +#if NET_35 + Sqlite3.ColumnName +#else +Sqlite3.sqlite3_column_name +#endif +( vm, i ); + columnType = +#if NET_35 + Sqlite3.ColumnType +#else +Sqlite3.sqlite3_column_type +#endif +( vm, i ); + + switch ( columnType ) + { + case Sqlite3.SQLITE_INTEGER: + { + // adds new integer column to table + table.Columns.Add( columnName, Type.GetType( "System.Int64" ) ); + break; + } + case Sqlite3.SQLITE_FLOAT: + { + table.Columns.Add( columnName, Type.GetType( "System.Double" ) ); + break; + } + case Sqlite3.SQLITE_TEXT: + { + table.Columns.Add( columnName, Type.GetType( "System.String" ) ); + break; + } + case Sqlite3.SQLITE_BLOB: + { + table.Columns.Add( columnName, Type.GetType( "System.byte[]" ) ); + break; + } + default: + { + table.Columns.Add( columnName, Type.GetType( "System.String" ) ); + break; + } + } + } + } + catch + { + return 0; + } + return table.Columns.Count; + } + + } +} diff --git a/Community.CsharpSqlite.Benchmark/Classes/SQLiteVdbe.cs b/Community.CsharpSqlite.Benchmark/Classes/SQLiteVdbe.cs index 7b225e6..2972379 100644 --- a/Community.CsharpSqlite.Benchmark/Classes/SQLiteVdbe.cs +++ b/Community.CsharpSqlite.Benchmark/Classes/SQLiteVdbe.cs @@ -1,210 +1,210 @@ -// $Header$ -using System; - -namespace Community.CsharpSqlite -{ - - using Vdbe = Sqlite3.Vdbe; - - /// - /// C#-SQLite wrapper with functions for opening, closing and executing queries. - /// - public class SQLiteVdbe - { - private Vdbe vm = null; - private string LastError = ""; - private int LastResult = 0; - - /// - /// Creates new instance of SQLiteVdbe class by compiling a statement - /// - /// - /// Vdbe - public SQLiteVdbe( SQLiteDatabase db, String query ) - { - vm = null; - - // prepare and compile -#if NET_35 - Sqlite3.PrepareV2NoTail -#else -Sqlite3.sqlite3_prepare_v2 -#endif -( db.Connection(), query, query.Length, ref vm, 0 ); - } - - /// - /// Return Virtual Machine Pointer - /// - /// - /// Vdbe - public Vdbe VirtualMachine() - { - return vm; - } - - /// - /// - /// BindInteger - /// - /// - /// - /// LastResult - public int BindInteger( int index, int bInteger ) - { - if ( ( LastResult = -#if NET_35 - Sqlite3.BindInt -#else -Sqlite3.sqlite3_bind_int -#endif -( vm, index, bInteger ) ) == Sqlite3.SQLITE_OK ) - { LastError = ""; } - else - { - LastError = "Error " + LastError + "binding Integer [" + bInteger + "]"; - } - return LastResult; - } - - /// - /// - /// BindLong - /// - /// - /// - /// LastResult - public int BindLong( int index, long bLong ) - { - if ( ( LastResult = -#if NET_35 - Sqlite3.BindInt64 -#else -Sqlite3.sqlite3_bind_int64 -#endif -( vm, index, bLong ) ) == Sqlite3.SQLITE_OK ) - { LastError = ""; } - else - { - LastError = "Error " + LastError + "binding Long [" + bLong + "]"; - } - return LastResult; - } - - /// - /// BindText - /// - /// - /// - /// LastResult - public int BindText( int index, string bText ) - { - if ( ( LastResult = -#if NET_35 - Sqlite3.BindText -#else -Sqlite3.sqlite3_bind_text -#endif -( vm, index, bText, -1, null ) ) == Sqlite3.SQLITE_OK ) - { LastError = ""; } - else - { - LastError = "Error " + LastError + "binding Text [" + bText + "]"; - } - return LastResult; - } - - /// - /// Execute statement - /// - /// - /// LastResult - public int ExecuteStep() - { - // Execute the statement - int LastResult = -#if NET_35 - Sqlite3.Step -#else -Sqlite3.sqlite3_step -#endif -( vm ); - return LastResult; - } - - /// - /// Returns Result column as Long - /// - /// - /// Result column - public long Result_Long( int index ) - { - return -#if NET_35 - Sqlite3.ColumnInt64 -#else -Sqlite3.sqlite3_column_int64 -#endif -( vm, index ); - } - - /// - /// Returns Result column as Text - /// - /// - /// Result column - public string Result_Text( int index ) - { - return -#if NET_35 - Sqlite3.ColumnText -#else -Sqlite3.sqlite3_column_text -#endif -( vm, index ); - } - - - /// - /// Returns Count of Result Rows - /// - /// - /// Count of Results - public int ResultColumnCount() - { - return vm.pResultSet == null ? 0 : vm.pResultSet.Length; - } - - /// - /// Reset statement - /// - /// - /// - public void Reset() - { - // Reset the statment so it's ready to use again -#if NET_35 - Sqlite3.Reset -#else -Sqlite3.sqlite3_reset -#endif -( vm ); - } - - /// - /// Closes statement - /// - /// - /// LastResult - public void Close() - { -#if NET_35 - Sqlite3.Finalize -#else -Sqlite3.sqlite3_finalize -#endif -( vm ); - } - - } -} +// $Header$ +using System; + +namespace Community.CsharpSqlite +{ + + using Vdbe = Sqlite3.Vdbe; + + /// + /// C#-SQLite wrapper with functions for opening, closing and executing queries. + /// + public class SQLiteVdbe + { + private Vdbe vm = null; + private string LastError = ""; + private int LastResult = 0; + + /// + /// Creates new instance of SQLiteVdbe class by compiling a statement + /// + /// + /// Vdbe + public SQLiteVdbe( SQLiteDatabase db, String query ) + { + vm = null; + + // prepare and compile +#if NET_35 + Sqlite3.PrepareV2NoTail +#else +Sqlite3.sqlite3_prepare_v2 +#endif +( db.Connection(), query, query.Length, ref vm, 0 ); + } + + /// + /// Return Virtual Machine Pointer + /// + /// + /// Vdbe + public Vdbe VirtualMachine() + { + return vm; + } + + /// + /// + /// BindInteger + /// + /// + /// + /// LastResult + public int BindInteger( int index, int bInteger ) + { + if ( ( LastResult = +#if NET_35 + Sqlite3.BindInt +#else +Sqlite3.sqlite3_bind_int +#endif +( vm, index, bInteger ) ) == Sqlite3.SQLITE_OK ) + { LastError = ""; } + else + { + LastError = "Error " + LastError + "binding Integer [" + bInteger + "]"; + } + return LastResult; + } + + /// + /// + /// BindLong + /// + /// + /// + /// LastResult + public int BindLong( int index, long bLong ) + { + if ( ( LastResult = +#if NET_35 + Sqlite3.BindInt64 +#else +Sqlite3.sqlite3_bind_int64 +#endif +( vm, index, bLong ) ) == Sqlite3.SQLITE_OK ) + { LastError = ""; } + else + { + LastError = "Error " + LastError + "binding Long [" + bLong + "]"; + } + return LastResult; + } + + /// + /// BindText + /// + /// + /// + /// LastResult + public int BindText( int index, string bText ) + { + if ( ( LastResult = +#if NET_35 + Sqlite3.BindText +#else +Sqlite3.sqlite3_bind_text +#endif +( vm, index, bText, -1, null ) ) == Sqlite3.SQLITE_OK ) + { LastError = ""; } + else + { + LastError = "Error " + LastError + "binding Text [" + bText + "]"; + } + return LastResult; + } + + /// + /// Execute statement + /// + /// + /// LastResult + public int ExecuteStep() + { + // Execute the statement + int LastResult = +#if NET_35 + Sqlite3.Step +#else +Sqlite3.sqlite3_step +#endif +( vm ); + return LastResult; + } + + /// + /// Returns Result column as Long + /// + /// + /// Result column + public long Result_Long( int index ) + { + return +#if NET_35 + Sqlite3.ColumnInt64 +#else +Sqlite3.sqlite3_column_int64 +#endif +( vm, index ); + } + + /// + /// Returns Result column as Text + /// + /// + /// Result column + public string Result_Text( int index ) + { + return +#if NET_35 + Sqlite3.ColumnText +#else +Sqlite3.sqlite3_column_text +#endif +( vm, index ); + } + + + /// + /// Returns Count of Result Rows + /// + /// + /// Count of Results + public int ResultColumnCount() + { + return vm.pResultSet == null ? 0 : vm.pResultSet.Length; + } + + /// + /// Reset statement + /// + /// + /// + public void Reset() + { + // Reset the statment so it's ready to use again +#if NET_35 + Sqlite3.Reset +#else +Sqlite3.sqlite3_reset +#endif +( vm ); + } + + /// + /// Closes statement + /// + /// + /// LastResult + public void Close() + { +#if NET_35 + Sqlite3.Finalize +#else +Sqlite3.sqlite3_finalize +#endif +( vm ); + } + + } +} diff --git a/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.csproj b/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.csproj index ae0b75b..23ed038 100644 --- a/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.csproj +++ b/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.csproj @@ -1,391 +1,391 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F1653F20-D47D-4F29-8C55-3C835542AF5F} - Exe - Properties - Benchmark - Benchmark - Benchmark - - - 3.5 - - - false - v3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - true - full - false - bin\Debug\ - NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM - prompt - 4 - 0168 ; 0169; 0414; 0618; 0649 - x86 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_TRACE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM - prompt - 4 - AnyCPU - 0168 ; 0169; 0414; 0618; 0649 - AllRules.ruleset - - - true - bin\x86\Debug\ - NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM - 0168 ; 0169; 0414; 0618; 0649 - full - x86 - prompt - AllRules.ruleset - false - - - bin\x86\Release\ - NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_TRACE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM - true - 0168 ; 0169; 0414; 0618; 0649 - pdbonly - x86 - prompt - AllRules.ruleset - - - - - 3.5 - - - - - - - - - Community.CsharpSqlite\alter_c.cs - - - Community.CsharpSqlite\analyze_c.cs - - - Community.CsharpSqlite\attach_c.cs - - - Community.CsharpSqlite\auth_c.cs - - - Community.CsharpSqlite\backup_c.cs - - - Community.CsharpSqlite\bitvec_c.cs - - - Community.CsharpSqlite\btmutex_c.cs - - - Community.CsharpSqlite\BtreeInt_h.cs - - - Community.CsharpSqlite\btree_c.cs - - - Community.CsharpSqlite\Btree_h.cs - - - Community.CsharpSqlite\build_c.cs - - - Community.CsharpSqlite\callback_c.cs - - - Community.CsharpSqlite\complete_c.cs - - - Community.CsharpSqlite\crypto.cs - - - Community.CsharpSqlite\ctime_c.cs - - - Community.CsharpSqlite\date_c.cs - - - Community.CsharpSqlite\Delegates.cs - - - Community.CsharpSqlite\delete_c.cs - - - Community.CsharpSqlite\expr_c.cs - - - Community.CsharpSqlite\fault_c.cs - - - Community.CsharpSqlite\fkey_c.cs - - - Community.CsharpSqlite\func_c.cs - - - Community.CsharpSqlite\global_c.cs - - - Community.CsharpSqlite\hash_c.cs - - - Community.CsharpSqlite\Hash_h.cs - - - Community.CsharpSqlite\hwtime_c.cs - - - Community.CsharpSqlite\insert_c.cs - - - Community.CsharpSqlite\journal_c.cs - - - Community.CsharpSqlite\keywordhash_h.cs - - - Community.CsharpSqlite\legacy_c.cs - - - Community.CsharpSqlite\loadext_c.cs - - - Community.CsharpSqlite\main_c.cs - - - Community.CsharpSqlite\malloc_c.cs - - - Community.CsharpSqlite\memjournal_c.cs - - - Community.CsharpSqlite\mem_Pool.cs - - - Community.CsharpSqlite\mutex_c.cs - - - Community.CsharpSqlite\mutex_h.cs - - - Community.CsharpSqlite\mutex_noop_c.cs - - - Community.CsharpSqlite\mutex_w32.cs - - - Community.CsharpSqlite\notify_c.cs - - - Community.CsharpSqlite\opcodes_c.cs - - - Community.CsharpSqlite\opcodes_h.cs - - - Community.CsharpSqlite\os_c.cs - - - Community.CsharpSqlite\os_common_h.cs - - - Community.CsharpSqlite\os_h.cs - - - Community.CsharpSqlite\os_win_c.cs - - - Community.CsharpSqlite\pager_c.cs - - - Community.CsharpSqlite\pager_h.cs - - - Community.CsharpSqlite\parse_c.cs - - - Community.CsharpSqlite\parse_h.cs - - - Community.CsharpSqlite\pcache1_c.cs - - - Community.CsharpSqlite\pcache_c.cs - - - Community.CsharpSqlite\pcache_h.cs - - - Community.CsharpSqlite\pragma_c.cs - - - Community.CsharpSqlite\prepare_c.cs - - - Community.CsharpSqlite\printf_c.cs - - - Community.CsharpSqlite\random_c.cs - - - Community.CsharpSqlite\resolve_c.cs - - - Community.CsharpSqlite\rowset_c.cs - - - Community.CsharpSqlite\select_c.cs - - - Community.CsharpSqlite\sqlite3_h.cs - - - Community.CsharpSqlite\sqliteInt_h.cs - - - Community.CsharpSqlite\sqliteLimit_h.cs - - - Community.CsharpSqlite\status_c.cs - - - Community.CsharpSqlite\table_c.cs - - - Community.CsharpSqlite\tokenize_c.cs - - - Community.CsharpSqlite\trigger_c.cs - - - Community.CsharpSqlite\update_c.cs - - - Community.CsharpSqlite\utf_c.cs - - - Community.CsharpSqlite\util_c.cs - - - Community.CsharpSqlite\vacuum_c.cs - - - Community.CsharpSqlite\vdbeapi_c.cs - - - Community.CsharpSqlite\vdbeaux_c.cs - - - Community.CsharpSqlite\vdbeblob_c.cs - - - Community.CsharpSqlite\VdbeInt_h.cs - - - Community.CsharpSqlite\vdbemem_c.cs - - - Community.CsharpSqlite\vdbetrace_c.cs - - - Community.CsharpSqlite\vdbe_c.cs - - - Community.CsharpSqlite\Vdbe_h.cs - - - Community.CsharpSqlite\vtab_c.cs - - - Community.CsharpSqlite\walker_c.cs - - - Community.CsharpSqlite\wal_c.cs - - - Community.CsharpSqlite\wal_h.cs - - - Community.CsharpSqlite\where_c.cs - - - Community.CsharpSqlite\_Custom.cs - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {F1653F20-D47D-4F29-8C55-3C835542AF5F} + Exe + Properties + Benchmark + Benchmark + Benchmark + + + 3.5 + + + false + v3.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + bin\Debug\ + NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM + prompt + 4 + 0168 ; 0169; 0414; 0618; 0649 + x86 + AllRules.ruleset + + + pdbonly + true + bin\Release\ + NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_TRACE SQLITE_OMIT_UTF16 SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM + prompt + 4 + AnyCPU + 0168 ; 0169; 0414; 0618; 0649 + AllRules.ruleset + + + true + bin\x86\Debug\ + NET_35 NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM + 0168 ; 0169; 0414; 0618; 0649 + full + x86 + prompt + AllRules.ruleset + false + + + bin\x86\Release\ + NO_TCL NDEBUG TRUE WIN32 _MSC_VER SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_TRACE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF SQLITE_POOL_MEM + true + 0168 ; 0169; 0414; 0618; 0649 + pdbonly + x86 + prompt + AllRules.ruleset + + + + + 3.5 + + + + + + + + + Community.CsharpSqlite\alter_c.cs + + + Community.CsharpSqlite\analyze_c.cs + + + Community.CsharpSqlite\attach_c.cs + + + Community.CsharpSqlite\auth_c.cs + + + Community.CsharpSqlite\backup_c.cs + + + Community.CsharpSqlite\bitvec_c.cs + + + Community.CsharpSqlite\btmutex_c.cs + + + Community.CsharpSqlite\BtreeInt_h.cs + + + Community.CsharpSqlite\btree_c.cs + + + Community.CsharpSqlite\Btree_h.cs + + + Community.CsharpSqlite\build_c.cs + + + Community.CsharpSqlite\callback_c.cs + + + Community.CsharpSqlite\complete_c.cs + + + Community.CsharpSqlite\crypto.cs + + + Community.CsharpSqlite\ctime_c.cs + + + Community.CsharpSqlite\date_c.cs + + + Community.CsharpSqlite\Delegates.cs + + + Community.CsharpSqlite\delete_c.cs + + + Community.CsharpSqlite\expr_c.cs + + + Community.CsharpSqlite\fault_c.cs + + + Community.CsharpSqlite\fkey_c.cs + + + Community.CsharpSqlite\func_c.cs + + + Community.CsharpSqlite\global_c.cs + + + Community.CsharpSqlite\hash_c.cs + + + Community.CsharpSqlite\Hash_h.cs + + + Community.CsharpSqlite\hwtime_c.cs + + + Community.CsharpSqlite\insert_c.cs + + + Community.CsharpSqlite\journal_c.cs + + + Community.CsharpSqlite\keywordhash_h.cs + + + Community.CsharpSqlite\legacy_c.cs + + + Community.CsharpSqlite\loadext_c.cs + + + Community.CsharpSqlite\main_c.cs + + + Community.CsharpSqlite\malloc_c.cs + + + Community.CsharpSqlite\memjournal_c.cs + + + Community.CsharpSqlite\mem_Pool.cs + + + Community.CsharpSqlite\mutex_c.cs + + + Community.CsharpSqlite\mutex_h.cs + + + Community.CsharpSqlite\mutex_noop_c.cs + + + Community.CsharpSqlite\mutex_w32.cs + + + Community.CsharpSqlite\notify_c.cs + + + Community.CsharpSqlite\opcodes_c.cs + + + Community.CsharpSqlite\opcodes_h.cs + + + Community.CsharpSqlite\os_c.cs + + + Community.CsharpSqlite\os_common_h.cs + + + Community.CsharpSqlite\os_h.cs + + + Community.CsharpSqlite\os_win_c.cs + + + Community.CsharpSqlite\pager_c.cs + + + Community.CsharpSqlite\pager_h.cs + + + Community.CsharpSqlite\parse_c.cs + + + Community.CsharpSqlite\parse_h.cs + + + Community.CsharpSqlite\pcache1_c.cs + + + Community.CsharpSqlite\pcache_c.cs + + + Community.CsharpSqlite\pcache_h.cs + + + Community.CsharpSqlite\pragma_c.cs + + + Community.CsharpSqlite\prepare_c.cs + + + Community.CsharpSqlite\printf_c.cs + + + Community.CsharpSqlite\random_c.cs + + + Community.CsharpSqlite\resolve_c.cs + + + Community.CsharpSqlite\rowset_c.cs + + + Community.CsharpSqlite\select_c.cs + + + Community.CsharpSqlite\sqlite3_h.cs + + + Community.CsharpSqlite\sqliteInt_h.cs + + + Community.CsharpSqlite\sqliteLimit_h.cs + + + Community.CsharpSqlite\status_c.cs + + + Community.CsharpSqlite\table_c.cs + + + Community.CsharpSqlite\tokenize_c.cs + + + Community.CsharpSqlite\trigger_c.cs + + + Community.CsharpSqlite\update_c.cs + + + Community.CsharpSqlite\utf_c.cs + + + Community.CsharpSqlite\util_c.cs + + + Community.CsharpSqlite\vacuum_c.cs + + + Community.CsharpSqlite\vdbeapi_c.cs + + + Community.CsharpSqlite\vdbeaux_c.cs + + + Community.CsharpSqlite\vdbeblob_c.cs + + + Community.CsharpSqlite\VdbeInt_h.cs + + + Community.CsharpSqlite\vdbemem_c.cs + + + Community.CsharpSqlite\vdbetrace_c.cs + + + Community.CsharpSqlite\vdbe_c.cs + + + Community.CsharpSqlite\Vdbe_h.cs + + + Community.CsharpSqlite\vtab_c.cs + + + Community.CsharpSqlite\walker_c.cs + + + Community.CsharpSqlite\wal_c.cs + + + Community.CsharpSqlite\wal_h.cs + + + Community.CsharpSqlite\where_c.cs + + + Community.CsharpSqlite\_Custom.cs + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Microsoft Visual Basic PowerPacks 10.0 + true + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.sln b/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.sln index d066368..a90c631 100644 --- a/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.sln +++ b/Community.CsharpSqlite.Benchmark/Community.CsharpSqlite.Benchmark.sln @@ -1,26 +1,26 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.Benchmark", "Community.CsharpSqlite.Benchmark.csproj", "{F1653F20-D47D-4F29-8C55-3C835542AF5F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.ActiveCfg = Debug|x86 - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.Build.0 = Debug|x86 - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.Build.0 = Release|Any CPU - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.ActiveCfg = Release|x86 - {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.Benchmark", "Community.CsharpSqlite.Benchmark.csproj", "{F1653F20-D47D-4F29-8C55-3C835542AF5F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.ActiveCfg = Debug|x86 + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.Build.0 = Debug|x86 + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.Build.0 = Release|Any CPU + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.ActiveCfg = Release|x86 + {F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Community.CsharpSqlite.Benchmark/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.Benchmark/Properties/AssemblyInfo.cs index a27e45f..83ca191 100644 --- a/Community.CsharpSqlite.Benchmark/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.Benchmark/Properties/AssemblyInfo.cs @@ -1,33 +1,33 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Community.CsharpSqlite.Properties")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Community.CsharpSqlite.Properties")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3e153385-e02c-4872-8067-c9e03fa20c18")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion( "3.7.7.1" )] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Community.CsharpSqlite.Properties")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Community.CsharpSqlite.Properties")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3e153385-e02c-4872-8067-c9e03fa20c18")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion( "3.7.7.1" )] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Community.CsharpSqlite.Benchmark/src/Benchmark.cs b/Community.CsharpSqlite.Benchmark/src/Benchmark.cs index d558e9b..38a533a 100644 --- a/Community.CsharpSqlite.Benchmark/src/Benchmark.cs +++ b/Community.CsharpSqlite.Benchmark/src/Benchmark.cs @@ -1,353 +1,353 @@ -// $Header$ - -using System; -using System.Data; -using System.Data.SQLite; -using System.Diagnostics; -using System.IO; -using Community.CsharpSqlite; - -/* -* Benchmark Test for both SQLite and C#-SQLite -*/ - -public class Benchmark -{ - private static int nRecords; - - private static string[] PRAGMA_Commands = { -"PRAGMA synchronous = OFF", -"PRAGMA temp_store = MEMORY", -"PRAGMA journal_mode = OFF" , -"PRAGMA locking_mode=EXCLUSIVE" -}; - - private static string[] CREATE_Commands = { -"CREATE TABLE Root (intIndex INTEGER PRIMARY KEY, strIndex TEXT)", -"CREATE INDEX RootStrIndex ON Root (strIndex)" -}; - - private static string INSERT_Command = "INSERT INTO Root VALUES (?,?)"; - private static string SELECT_Bind_i = "SELECT * FROM Root WHERE intIndex = ?"; - private static string SELECT_Bind_s = "SELECT * FROM Root WHERE strIndex = ?"; - - private static string SELECT_Command_i = "SELECT * FROM Root ORDER BY intIndex"; - private static string SELECT_Command_s = "SELECT * FROM Root ORDER BY strIndex"; - - private static string DELETE_Bind = "DELETE FROM Root WHERE intIndex = ?"; - - private static long[,] timer = new long[2, 4]; - - private static string databaseName; - - public static void Main() - { - for ( nRecords = 10000; nRecords <= 200000; nRecords *= 2 ) - { - databaseName = "Benchmark_cs-SQLite.sqlite"; - TestSQLite(); - // - databaseName = "Benchmark_cs-Sqlite3.sqlite"; - TestCsharpSqlite(); - // - PrintStats( nRecords ); - } - Console.WriteLine( "Enter to Continue: " ); - Console.ReadKey(); - } - - private static void TestCsharpSqlite() - { - SQLiteDatabase db; - SQLiteVdbe stmt; - SQLiteVdbe c1, c2; - - bool found; - int i; - - string databaseName = "Benchmark_cs-SQLite.sqlite"; - if ( File.Exists( databaseName ) ) File.Delete( databaseName ); - - db = new SQLiteDatabase( databaseName ); - for ( i = 0; i < PRAGMA_Commands.Length; i++ ) { db.ExecuteNonQuery( PRAGMA_Commands[i] ); } - - db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); - for ( i = 0; i < CREATE_Commands.Length; i++ ) { db.ExecuteNonQuery( CREATE_Commands[i] ); } - stmt = new SQLiteVdbe( db, INSERT_Command ); - long start = DateTime.Now.Ticks; - long key = 1999; - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - stmt.Reset(); - stmt.BindLong( 1, key ); - stmt.BindText( 2, key.ToString() ); - stmt.ExecuteStep(); - } - stmt.Close(); - db.ExecuteNonQuery( "END" ); - timer[1, 0] = DateTime.Now.Ticks - start; - - db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); - start = DateTime.Now.Ticks; - c1 = new SQLiteVdbe( db, SELECT_Bind_i ); - c2 = new SQLiteVdbe( db, SELECT_Bind_s ); - key = 1999; - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - c1.Reset(); - c1.BindLong( 1, key ); - c1.ExecuteStep(); - - c2.Reset(); - c2.BindText( 1, key.ToString() ); - c2.ExecuteStep(); - - long id = (long)c1.Result_Long( 0 ); - Debug.Assert( id == (long)c2.Result_Long( 0 ) ); - - } - c1.Close(); - c2.Close(); - db.ExecuteNonQuery( "END" ); - timer[1, 1] = DateTime.Now.Ticks - start; - - db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); - start = DateTime.Now.Ticks; - key = Int64.MinValue; - i = 0; - c1 = new SQLiteVdbe( db, SELECT_Command_i ); - while ( c1.ExecuteStep() != Sqlite3.SQLITE_DONE ) - { - long intKey = (long)c1.Result_Long( 0 ); - Debug.Assert( intKey >= key ); - key = intKey; - i += 1; - } - c1.Close(); - Debug.Assert( i == nRecords ); - - String strKey = ""; - i = 0; - c2 = new SQLiteVdbe( db, SELECT_Command_s ); - while ( c2.ExecuteStep() != Sqlite3.SQLITE_DONE ) - { - string recStrKey = (string)c2.Result_Text( 1 ); - Debug.Assert( recStrKey.CompareTo( strKey ) >= 0 ); - strKey = recStrKey; - i += 1; - } - c2.Close(); - Debug.Assert( i == nRecords ); - timer[1, 2] = DateTime.Now.Ticks - start; - db.ExecuteNonQuery( "END" ); - - db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); - start = DateTime.Now.Ticks; - key = 1999; - stmt = new SQLiteVdbe( db, DELETE_Bind ); - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - stmt.Reset(); - stmt.BindLong( 1, key ); - stmt.ExecuteStep(); - } - stmt.Close(); - db.ExecuteNonQuery( "END" ); - timer[1, 3] = DateTime.Now.Ticks - start; - db.CloseDatabase(); -#if NET_35 - Sqlite3.Shutdown(); -#else -Sqlite3.sqlite3_shutdown(); -#endif - } - private static void TestSQLite() - { - int i; - string databaseName = "Benchmark_SQLite.sqlite"; - if ( File.Exists( databaseName ) ) File.Delete( databaseName ); - - SQLiteConnectionStringBuilder constring = new SQLiteConnectionStringBuilder(); - constring.PageSize = 1024; - constring.SyncMode = SynchronizationModes.Off; - constring.DataSource = databaseName; - - SQLiteConnection con = new SQLiteConnection( constring.ToString() ); - con.Open(); - SQLiteCommand com = con.CreateCommand(); - for ( i = 0; i < PRAGMA_Commands.Length; i++ ) - { - com.CommandText = PRAGMA_Commands[i]; - com.ExecuteNonQuery(); - } - for ( i = 0; i < CREATE_Commands.Length; i++ ) - { - com.CommandText = CREATE_Commands[i]; - com.ExecuteNonQuery(); - } - - com.CommandText = "BEGIN EXCLUSIVE"; - com.ExecuteNonQuery(); - - com.CommandText = "INSERT INTO Root VALUES (?,?)"; - SQLiteParameter p1 = com.CreateParameter(); - p1.DbType = DbType.Int64; - com.Parameters.Add( p1 ); - SQLiteParameter p2 = com.CreateParameter(); - p2.DbType = DbType.String; - com.Parameters.Add( p2 ); - - long start = DateTime.Now.Ticks; - long key = 1999; - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - p1.Value = key; - p2.Value = key.ToString(); - com.ExecuteNonQuery(); - } - com.CommandText = "END"; - com.Parameters.Clear(); - com.ExecuteNonQuery(); - timer[0, 0] = DateTime.Now.Ticks - start; - - com.CommandText = "BEGIN EXCLUSIVE"; - com.ExecuteNonQuery(); - - using ( SQLiteCommand com2 = con.CreateCommand() ) - { - com.CommandText = SELECT_Bind_i; - com.Parameters.Clear(); - com.Parameters.Add( p1 ); - - com2.CommandText = SELECT_Bind_s; - com2.Parameters.Clear(); - com2.Parameters.Add( p2 ); - - start = DateTime.Now.Ticks; - key = 1999; - object[] resValues = new object[2]; - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - p1.Value = key; - p2.Value = key.ToString(); - using ( SQLiteDataReader res = com.ExecuteReader() ) - { - res.Read(); - res.GetValues( resValues ); - } - long id = (long)resValues[0]; - using ( SQLiteDataReader res = com2.ExecuteReader() ) - { - res.Read(); - res.GetValues( resValues ); - } - Debug.Assert( id == ( (long)resValues[0] ) ); - } - } - - timer[0, 1] = DateTime.Now.Ticks - start; - com.CommandText = "END"; - com.Parameters.Clear(); - com.ExecuteNonQuery(); - - com.CommandText = "BEGIN EXCLUSIVE"; - com.ExecuteNonQuery(); - - start = DateTime.Now.Ticks; - com.CommandText = SELECT_Command_i; - com.Parameters.Clear(); - key = Int64.MinValue; - i = 0; - using ( SQLiteDataReader reader = com.ExecuteReader() ) - { - object[] resValues = new object[2]; - while ( reader.Read() ) - { - reader.GetValues( resValues ); - long intKey = (long)resValues[0]; - Debug.Assert( intKey >= key ); - key = intKey; - i += 1; - } - Debug.Assert( i == nRecords ); - } - com.CommandText = SELECT_Command_s; - using ( SQLiteDataReader reader = com.ExecuteReader() ) - { - i = 0; - String strKey = ""; - object[] resValues = new object[2]; - while ( reader.Read() ) - { - reader.GetValues( resValues ); - string recStrKey = (string)resValues[1]; - Debug.Assert( recStrKey.CompareTo( strKey ) >= 0 ); - strKey = recStrKey; - i += 1; - } - Debug.Assert( i == nRecords ); - } - timer[0, 2] = DateTime.Now.Ticks - start; - - com.CommandText = "END"; - com.Parameters.Clear(); - com.ExecuteNonQuery(); - - com.CommandText = "BEGIN EXCLUSIVE"; - com.ExecuteNonQuery(); - - com.CommandText = DELETE_Bind; - com.Parameters.Clear(); - com.Parameters.Add( p1 ); - - start = DateTime.Now.Ticks; - key = 1999; - for ( i = 0; i < nRecords; i++ ) - { - key = ( 3141592621L * key + 2718281829L ) % 1000000007L; - p1.Value = key; - com.ExecuteNonQuery(); - } - com.CommandText = "END"; - com.Parameters.Clear(); - com.ExecuteNonQuery(); - - timer[0, 3] = DateTime.Now.Ticks - start; - con.Close(); - } - - static void PrintStats( int nRecords ) - { - - Console.WriteLine( " # Records Inserting Searching Iterating Deleting" ); - Console.WriteLine( - String.Format( " SQLite{0,10:####,###}{1,10:#####.0s}{2,10:#####.0s}{3,10:#####.0s}{4,10:#####.0s}" - , nRecords - , ( timer[0, 0] ) * 10e-8 + .05 - , ( timer[0, 1] ) * 10e-8 + .05 - , ( timer[0, 2] ) * 10e-8 + .05 - , ( timer[0, 3] ) * 10e-8 + .05 - ) ); - Console.WriteLine( - String.Format( "C#-SQLite{0,10:####,###}{1,10:#####.0s}{2,10:#####.0s}{3,10:#####.0s}{4,10:#####.0s}" - , nRecords - , ( timer[1, 0] ) * 10e-8 + .05 - , ( timer[1, 1] ) * 10e-8 + .05 - , ( timer[1, 2] ) * 10e-8 + .05 - , ( timer[1, 3] ) * 10e-8 + .05 - ) ); - Console.WriteLine( - String.Format( "C#/SQLite{0,10:####,###}{1,10:#####.0x}{2,10:#####.0x}{3,10:#####.0x}{4,10:#####.0x}" - , nRecords - , ( (double)timer[1, 0] / timer[0, 0] ) - , ( (double)timer[1, 1] / timer[0, 1] ) - , ( (double)timer[1, 2] / timer[0, 2] ) - , ( (double)timer[1, 3] / timer[0, 3] ) - ) ); - } -} +// $Header$ + +using System; +using System.Data; +using System.Data.SQLite; +using System.Diagnostics; +using System.IO; +using Community.CsharpSqlite; + +/* +* Benchmark Test for both SQLite and C#-SQLite +*/ + +public class Benchmark +{ + private static int nRecords; + + private static string[] PRAGMA_Commands = { +"PRAGMA synchronous = OFF", +"PRAGMA temp_store = MEMORY", +"PRAGMA journal_mode = OFF" , +"PRAGMA locking_mode=EXCLUSIVE" +}; + + private static string[] CREATE_Commands = { +"CREATE TABLE Root (intIndex INTEGER PRIMARY KEY, strIndex TEXT)", +"CREATE INDEX RootStrIndex ON Root (strIndex)" +}; + + private static string INSERT_Command = "INSERT INTO Root VALUES (?,?)"; + private static string SELECT_Bind_i = "SELECT * FROM Root WHERE intIndex = ?"; + private static string SELECT_Bind_s = "SELECT * FROM Root WHERE strIndex = ?"; + + private static string SELECT_Command_i = "SELECT * FROM Root ORDER BY intIndex"; + private static string SELECT_Command_s = "SELECT * FROM Root ORDER BY strIndex"; + + private static string DELETE_Bind = "DELETE FROM Root WHERE intIndex = ?"; + + private static long[,] timer = new long[2, 4]; + + private static string databaseName; + + public static void Main() + { + for ( nRecords = 10000; nRecords <= 200000; nRecords *= 2 ) + { + databaseName = "Benchmark_cs-SQLite.sqlite"; + TestSQLite(); + // + databaseName = "Benchmark_cs-Sqlite3.sqlite"; + TestCsharpSqlite(); + // + PrintStats( nRecords ); + } + Console.WriteLine( "Enter to Continue: " ); + Console.ReadKey(); + } + + private static void TestCsharpSqlite() + { + SQLiteDatabase db; + SQLiteVdbe stmt; + SQLiteVdbe c1, c2; + + bool found; + int i; + + string databaseName = "Benchmark_cs-SQLite.sqlite"; + if ( File.Exists( databaseName ) ) File.Delete( databaseName ); + + db = new SQLiteDatabase( databaseName ); + for ( i = 0; i < PRAGMA_Commands.Length; i++ ) { db.ExecuteNonQuery( PRAGMA_Commands[i] ); } + + db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); + for ( i = 0; i < CREATE_Commands.Length; i++ ) { db.ExecuteNonQuery( CREATE_Commands[i] ); } + stmt = new SQLiteVdbe( db, INSERT_Command ); + long start = DateTime.Now.Ticks; + long key = 1999; + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + stmt.Reset(); + stmt.BindLong( 1, key ); + stmt.BindText( 2, key.ToString() ); + stmt.ExecuteStep(); + } + stmt.Close(); + db.ExecuteNonQuery( "END" ); + timer[1, 0] = DateTime.Now.Ticks - start; + + db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); + start = DateTime.Now.Ticks; + c1 = new SQLiteVdbe( db, SELECT_Bind_i ); + c2 = new SQLiteVdbe( db, SELECT_Bind_s ); + key = 1999; + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + c1.Reset(); + c1.BindLong( 1, key ); + c1.ExecuteStep(); + + c2.Reset(); + c2.BindText( 1, key.ToString() ); + c2.ExecuteStep(); + + long id = (long)c1.Result_Long( 0 ); + Debug.Assert( id == (long)c2.Result_Long( 0 ) ); + + } + c1.Close(); + c2.Close(); + db.ExecuteNonQuery( "END" ); + timer[1, 1] = DateTime.Now.Ticks - start; + + db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); + start = DateTime.Now.Ticks; + key = Int64.MinValue; + i = 0; + c1 = new SQLiteVdbe( db, SELECT_Command_i ); + while ( c1.ExecuteStep() != Sqlite3.SQLITE_DONE ) + { + long intKey = (long)c1.Result_Long( 0 ); + Debug.Assert( intKey >= key ); + key = intKey; + i += 1; + } + c1.Close(); + Debug.Assert( i == nRecords ); + + String strKey = ""; + i = 0; + c2 = new SQLiteVdbe( db, SELECT_Command_s ); + while ( c2.ExecuteStep() != Sqlite3.SQLITE_DONE ) + { + string recStrKey = (string)c2.Result_Text( 1 ); + Debug.Assert( recStrKey.CompareTo( strKey ) >= 0 ); + strKey = recStrKey; + i += 1; + } + c2.Close(); + Debug.Assert( i == nRecords ); + timer[1, 2] = DateTime.Now.Ticks - start; + db.ExecuteNonQuery( "END" ); + + db.ExecuteNonQuery( "BEGIN EXCLUSIVE" ); + start = DateTime.Now.Ticks; + key = 1999; + stmt = new SQLiteVdbe( db, DELETE_Bind ); + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + stmt.Reset(); + stmt.BindLong( 1, key ); + stmt.ExecuteStep(); + } + stmt.Close(); + db.ExecuteNonQuery( "END" ); + timer[1, 3] = DateTime.Now.Ticks - start; + db.CloseDatabase(); +#if NET_35 + Sqlite3.Shutdown(); +#else +Sqlite3.sqlite3_shutdown(); +#endif + } + private static void TestSQLite() + { + int i; + string databaseName = "Benchmark_SQLite.sqlite"; + if ( File.Exists( databaseName ) ) File.Delete( databaseName ); + + SQLiteConnectionStringBuilder constring = new SQLiteConnectionStringBuilder(); + constring.PageSize = 1024; + constring.SyncMode = SynchronizationModes.Off; + constring.DataSource = databaseName; + + SQLiteConnection con = new SQLiteConnection( constring.ToString() ); + con.Open(); + SQLiteCommand com = con.CreateCommand(); + for ( i = 0; i < PRAGMA_Commands.Length; i++ ) + { + com.CommandText = PRAGMA_Commands[i]; + com.ExecuteNonQuery(); + } + for ( i = 0; i < CREATE_Commands.Length; i++ ) + { + com.CommandText = CREATE_Commands[i]; + com.ExecuteNonQuery(); + } + + com.CommandText = "BEGIN EXCLUSIVE"; + com.ExecuteNonQuery(); + + com.CommandText = "INSERT INTO Root VALUES (?,?)"; + SQLiteParameter p1 = com.CreateParameter(); + p1.DbType = DbType.Int64; + com.Parameters.Add( p1 ); + SQLiteParameter p2 = com.CreateParameter(); + p2.DbType = DbType.String; + com.Parameters.Add( p2 ); + + long start = DateTime.Now.Ticks; + long key = 1999; + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + p1.Value = key; + p2.Value = key.ToString(); + com.ExecuteNonQuery(); + } + com.CommandText = "END"; + com.Parameters.Clear(); + com.ExecuteNonQuery(); + timer[0, 0] = DateTime.Now.Ticks - start; + + com.CommandText = "BEGIN EXCLUSIVE"; + com.ExecuteNonQuery(); + + using ( SQLiteCommand com2 = con.CreateCommand() ) + { + com.CommandText = SELECT_Bind_i; + com.Parameters.Clear(); + com.Parameters.Add( p1 ); + + com2.CommandText = SELECT_Bind_s; + com2.Parameters.Clear(); + com2.Parameters.Add( p2 ); + + start = DateTime.Now.Ticks; + key = 1999; + object[] resValues = new object[2]; + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + p1.Value = key; + p2.Value = key.ToString(); + using ( SQLiteDataReader res = com.ExecuteReader() ) + { + res.Read(); + res.GetValues( resValues ); + } + long id = (long)resValues[0]; + using ( SQLiteDataReader res = com2.ExecuteReader() ) + { + res.Read(); + res.GetValues( resValues ); + } + Debug.Assert( id == ( (long)resValues[0] ) ); + } + } + + timer[0, 1] = DateTime.Now.Ticks - start; + com.CommandText = "END"; + com.Parameters.Clear(); + com.ExecuteNonQuery(); + + com.CommandText = "BEGIN EXCLUSIVE"; + com.ExecuteNonQuery(); + + start = DateTime.Now.Ticks; + com.CommandText = SELECT_Command_i; + com.Parameters.Clear(); + key = Int64.MinValue; + i = 0; + using ( SQLiteDataReader reader = com.ExecuteReader() ) + { + object[] resValues = new object[2]; + while ( reader.Read() ) + { + reader.GetValues( resValues ); + long intKey = (long)resValues[0]; + Debug.Assert( intKey >= key ); + key = intKey; + i += 1; + } + Debug.Assert( i == nRecords ); + } + com.CommandText = SELECT_Command_s; + using ( SQLiteDataReader reader = com.ExecuteReader() ) + { + i = 0; + String strKey = ""; + object[] resValues = new object[2]; + while ( reader.Read() ) + { + reader.GetValues( resValues ); + string recStrKey = (string)resValues[1]; + Debug.Assert( recStrKey.CompareTo( strKey ) >= 0 ); + strKey = recStrKey; + i += 1; + } + Debug.Assert( i == nRecords ); + } + timer[0, 2] = DateTime.Now.Ticks - start; + + com.CommandText = "END"; + com.Parameters.Clear(); + com.ExecuteNonQuery(); + + com.CommandText = "BEGIN EXCLUSIVE"; + com.ExecuteNonQuery(); + + com.CommandText = DELETE_Bind; + com.Parameters.Clear(); + com.Parameters.Add( p1 ); + + start = DateTime.Now.Ticks; + key = 1999; + for ( i = 0; i < nRecords; i++ ) + { + key = ( 3141592621L * key + 2718281829L ) % 1000000007L; + p1.Value = key; + com.ExecuteNonQuery(); + } + com.CommandText = "END"; + com.Parameters.Clear(); + com.ExecuteNonQuery(); + + timer[0, 3] = DateTime.Now.Ticks - start; + con.Close(); + } + + static void PrintStats( int nRecords ) + { + + Console.WriteLine( " # Records Inserting Searching Iterating Deleting" ); + Console.WriteLine( + String.Format( " SQLite{0,10:####,###}{1,10:#####.0s}{2,10:#####.0s}{3,10:#####.0s}{4,10:#####.0s}" + , nRecords + , ( timer[0, 0] ) * 10e-8 + .05 + , ( timer[0, 1] ) * 10e-8 + .05 + , ( timer[0, 2] ) * 10e-8 + .05 + , ( timer[0, 3] ) * 10e-8 + .05 + ) ); + Console.WriteLine( + String.Format( "C#-SQLite{0,10:####,###}{1,10:#####.0s}{2,10:#####.0s}{3,10:#####.0s}{4,10:#####.0s}" + , nRecords + , ( timer[1, 0] ) * 10e-8 + .05 + , ( timer[1, 1] ) * 10e-8 + .05 + , ( timer[1, 2] ) * 10e-8 + .05 + , ( timer[1, 3] ) * 10e-8 + .05 + ) ); + Console.WriteLine( + String.Format( "C#/SQLite{0,10:####,###}{1,10:#####.0x}{2,10:#####.0x}{3,10:#####.0x}{4,10:#####.0x}" + , nRecords + , ( (double)timer[1, 0] / timer[0, 0] ) + , ( (double)timer[1, 1] / timer[0, 1] ) + , ( (double)timer[1, 2] / timer[0, 2] ) + , ( (double)timer[1, 3] / timer[0, 3] ) + ) ); + } +} diff --git a/Community.CsharpSqlite.Benchmark/src/performance.sql b/Community.CsharpSqlite.Benchmark/src/performance.sql index f1d5ef2..1b153b3 100644 --- a/Community.CsharpSqlite.Benchmark/src/performance.sql +++ b/Community.CsharpSqlite.Benchmark/src/performance.sql @@ -1,134 +1,134 @@ --- --- The author disclaims copyright to this source code. In place of --- a legal notice, here is a blessing: --- --- May you do good and not evil. --- May you find forgiveness for yourself and forgive others. --- May you share freely, never taking more than you give. --- ------------------------------------------------------------------------------------------ --- This file contains code used to implement the performance scripts --- --- Repository path: $HeadURL: https://sqlitecs.googlecode.com/svn/trunk/test/performance.sql $ --- Last Revised : $Revision: 62 $ --- Last Changed By : $LastChangedBy: noah.hart $ --- Last Changed Date : $LastChangedDate: 2009-08-03 09:19:48 -0700 (Mon, 03 Aug 2009) $ ------------------------------------------------------------------------------------------ ---------------------------------------------------------------------- --- --- NOTES: --- ---------------------------------------------------------------------- - ------------------------------------------- --- LEVEL THE PLAYING FIELD WITH PRAGMAs ------------------------------------------- - -PRAGMA auto_vacuum = NONE; -PRAGMA cache_size = 20000; -PRAGMA count_changes = 1; -PRAGMA encoding = "UTF-8"; -PRAGMA fullfsync = 0; -PRAGMA journal_mode = NONE; -PRAGMA locking_mode = EXCLUSIVE; -PRAGMA page_size = 1024; -PRAGMA synchronous = OFF; -PRAGMA temp_store = MEMORY; ------------------------------------------- --- A LITTLE SETUP BEFORE WE BEGIN ------------------------------------------- - -ATTACH ':memory:' as tDB; -CREATE TABLE tDB.TIMER(TestNumber INTEGER, Description TEXT, StartTime REAL, EndTime REAL DEFAULT NULL, Rows INTEGER DEFAULT NULL); -INSERT INTO TIMER VALUES(0, 'performance.txt,v 1.3', 0, 1, 0); -CREATE TABLE tDB.TEST1 (I INTEGER, T TEXT); -CREATE TABLE N_1(i INTEGER, t TEXT); -INSERT INTO N_1 VALUES(1, 't1_'); -INSERT INTO N_1 VALUES(2, 't_22_'); -INSERT INTO N_1 VALUES(3, 'tx_3_3_3_'); -INSERT INTO N_1 VALUES(4, 'txt_4_4_4_4_'); -CREATE TABLE N_2(i INTEGER, t TEXT); -INSERT INTO N_2 SELECT N1.I+N2.I*7, N1.T||N2.T FROM N_1 N1 CROSS JOIN N_1 N2 CROSS JOIN N_1 N3; - --------------------------------------------------------- --- TEST 1 --- TRIVIAL INSERTS -- KEEP THE NUMBER AND TEXT SMALL --------------------------------------------------------- -BEGIN; -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Inserts', (julianday('now') - 2440587.5)*86400 FROM TIMER; -INSERT INTO TEST1 SELECT 1,'T' FROM N_2 N1 CROSS JOIN N_2 N2 CROSS JOIN N_2 N3; -COMMIT; - - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - --------------------------------------------------------- --- TEST 2 --- TRIVIAL SELECTS --------------------------------------------------------- -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Selects', (julianday('now') - 2440587.5)*86400 FROM TIMER; - UPDATE TIMER SET Rows = (SELECT COUNT(*) FROM TEST1 where rowid > 0) - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0 - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - --------------------------------------------------------- --- TEST 3 --- TRIVIAL UPDATES -- THE NUMBERS AND ROW SIZE ARE SMALL --------------------------------------------------------- -BEGIN; -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Updates', (julianday('now') - 2440587.5)*86400 FROM TIMER; -UPDATE TEST1 SET I=I; -COMMIT; - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - --------------------------------------------------------- --- TEST 4 --- TRIVIAL DELETES --------------------------------------------------------- -BEGIN; -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Deletes', (julianday('now') - 2440587.5)*86400 FROM TIMER; -DELETE FROM TEST1 WHERE I >0; -COMMIT; - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - ------------------------------------------- --- A LITTLE CLEANUP BEFORE WE CONTINUE ------------------------------------------- - -DROP TABLE TEST1; -CREATE TABLE tDB.TEST1 (I INTEGER, T TEXT); -PRAGMA page_count; -VACUUM; -PRAGMA page_count; - --------------------------------------------------------- --- TEST 5 --- INSERTS WITH CALCULATIONS -- SHOULD BE SLOWER THAN 1 --------------------------------------------------------- -BEGIN; -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Insert with calculations', (julianday('now') - 2440587.5)*86400 FROM TIMER; -INSERT INTO TEST1 SELECT N1.I*N2.I+N3.I, N1.T||N2.T||N3.T FROM N_2 N1 CROSS JOIN N_2 N2 CROSS JOIN N_2 N3; -COMMIT; - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - --------------------------------------------------------- --- TEST 6 --- UPDATES WITH CALCULATIONS -- SHOULD BE SLOWER THAN 2 --------------------------------------------------------- -BEGIN; -INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Updates with calculations and longer rows', (julianday('now') - 2440587.5)*86400 FROM TIMER; -UPDATE TEST1 SET I=I*1+2-3; -COMMIT; - UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() - WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); - ------------------------------------------------ --- REPORT THE RESULTS --------------------------------------------------------- - Select TestNumber, Description, ROUND(EndTime- StartTime,2), Rows, Round(Rows/(EndTime-StartTime)/1000)||'K Rows/Second' from TIMER; - - +-- +-- The author disclaims copyright to this source code. In place of +-- a legal notice, here is a blessing: +-- +-- May you do good and not evil. +-- May you find forgiveness for yourself and forgive others. +-- May you share freely, never taking more than you give. +-- +----------------------------------------------------------------------------------------- +-- This file contains code used to implement the performance scripts +-- +-- Repository path: $HeadURL: https://sqlitecs.googlecode.com/svn/trunk/test/performance.sql $ +-- Last Revised : $Revision: 62 $ +-- Last Changed By : $LastChangedBy: noah.hart $ +-- Last Changed Date : $LastChangedDate: 2009-08-03 09:19:48 -0700 (Mon, 03 Aug 2009) $ +----------------------------------------------------------------------------------------- +--------------------------------------------------------------------- +-- +-- NOTES: +-- +--------------------------------------------------------------------- + +------------------------------------------ +-- LEVEL THE PLAYING FIELD WITH PRAGMAs +------------------------------------------ + +PRAGMA auto_vacuum = NONE; +PRAGMA cache_size = 20000; +PRAGMA count_changes = 1; +PRAGMA encoding = "UTF-8"; +PRAGMA fullfsync = 0; +PRAGMA journal_mode = NONE; +PRAGMA locking_mode = EXCLUSIVE; +PRAGMA page_size = 1024; +PRAGMA synchronous = OFF; +PRAGMA temp_store = MEMORY; +------------------------------------------ +-- A LITTLE SETUP BEFORE WE BEGIN +------------------------------------------ + +ATTACH ':memory:' as tDB; +CREATE TABLE tDB.TIMER(TestNumber INTEGER, Description TEXT, StartTime REAL, EndTime REAL DEFAULT NULL, Rows INTEGER DEFAULT NULL); +INSERT INTO TIMER VALUES(0, 'performance.txt,v 1.3', 0, 1, 0); +CREATE TABLE tDB.TEST1 (I INTEGER, T TEXT); +CREATE TABLE N_1(i INTEGER, t TEXT); +INSERT INTO N_1 VALUES(1, 't1_'); +INSERT INTO N_1 VALUES(2, 't_22_'); +INSERT INTO N_1 VALUES(3, 'tx_3_3_3_'); +INSERT INTO N_1 VALUES(4, 'txt_4_4_4_4_'); +CREATE TABLE N_2(i INTEGER, t TEXT); +INSERT INTO N_2 SELECT N1.I+N2.I*7, N1.T||N2.T FROM N_1 N1 CROSS JOIN N_1 N2 CROSS JOIN N_1 N3; + +-------------------------------------------------------- +-- TEST 1 +-- TRIVIAL INSERTS -- KEEP THE NUMBER AND TEXT SMALL +-------------------------------------------------------- +BEGIN; +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Inserts', (julianday('now') - 2440587.5)*86400 FROM TIMER; +INSERT INTO TEST1 SELECT 1,'T' FROM N_2 N1 CROSS JOIN N_2 N2 CROSS JOIN N_2 N3; +COMMIT; + + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +-------------------------------------------------------- +-- TEST 2 +-- TRIVIAL SELECTS +-------------------------------------------------------- +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Selects', (julianday('now') - 2440587.5)*86400 FROM TIMER; + UPDATE TIMER SET Rows = (SELECT COUNT(*) FROM TEST1 where rowid > 0) + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0 + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +-------------------------------------------------------- +-- TEST 3 +-- TRIVIAL UPDATES -- THE NUMBERS AND ROW SIZE ARE SMALL +-------------------------------------------------------- +BEGIN; +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Updates', (julianday('now') - 2440587.5)*86400 FROM TIMER; +UPDATE TEST1 SET I=I; +COMMIT; + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +-------------------------------------------------------- +-- TEST 4 +-- TRIVIAL DELETES +-------------------------------------------------------- +BEGIN; +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Trivial Deletes', (julianday('now') - 2440587.5)*86400 FROM TIMER; +DELETE FROM TEST1 WHERE I >0; +COMMIT; + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +------------------------------------------ +-- A LITTLE CLEANUP BEFORE WE CONTINUE +------------------------------------------ + +DROP TABLE TEST1; +CREATE TABLE tDB.TEST1 (I INTEGER, T TEXT); +PRAGMA page_count; +VACUUM; +PRAGMA page_count; + +-------------------------------------------------------- +-- TEST 5 +-- INSERTS WITH CALCULATIONS -- SHOULD BE SLOWER THAN 1 +-------------------------------------------------------- +BEGIN; +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Insert with calculations', (julianday('now') - 2440587.5)*86400 FROM TIMER; +INSERT INTO TEST1 SELECT N1.I*N2.I+N3.I, N1.T||N2.T||N3.T FROM N_2 N1 CROSS JOIN N_2 N2 CROSS JOIN N_2 N3; +COMMIT; + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +-------------------------------------------------------- +-- TEST 6 +-- UPDATES WITH CALCULATIONS -- SHOULD BE SLOWER THAN 2 +-------------------------------------------------------- +BEGIN; +INSERT INTO TIMER (TestNumber, Description, StartTime) SELECT 1+MAX(TESTNUMBER), 'Updates with calculations and longer rows', (julianday('now') - 2440587.5)*86400 FROM TIMER; +UPDATE TEST1 SET I=I*1+2-3; +COMMIT; + UPDATE TIMER SET EndTime = (julianday('now') - 2440587.5)*86400.0, Rows = changes() + WHERE TestNumber = (SELECT MAX(TESTNUMBER) FROM TIMER); + +----------------------------------------------- +-- REPORT THE RESULTS +-------------------------------------------------------- + Select TestNumber, Description, ROUND(EndTime- StartTime,2), Rows, Round(Rows/(EndTime-StartTime)/1000)||'K Rows/Second' from TIMER; + + diff --git a/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.csproj b/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.csproj index 1ecd3c0..30eca23 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.csproj +++ b/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.csproj @@ -1,112 +1,112 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {238EAD8B-B811-4FA6-8581-4CA4B816066D} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Community.CsharpSqlite.SQLiteClient.SL - Community.CsharpSqlite.SQLiteClient.SL - Silverlight - v4.0 - $(TargetFrameworkVersion) - false - true - true - - - - v3.5 - - - true - full - false - Bin\Debug - TRACE;DEBUG;SQLITE_SILVERLIGHT SQLITE_HAS_CODEC NET_2_0 - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SQLITE_SILVERLIGHT - true - true - prompt - 4 - - - - - - - - src\SqliteCommand.cs - Code - - - src\SqliteConnection.cs - Code - - - src\SqliteDataReader.cs - Code - - - src\SqliteError.cs - Code - - - src\SqliteExceptions.cs - Code - - - src\SqliteParameter.cs - Code - - - src\SqliteParameterCollection.cs - Code - - - src\SqliteTransaction.cs - Code - - - - - - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779} - Community.CsharpSqlite.Silverlight - - - {D7194231-DBAD-422B-819E-911037934F45} - System.Data.Ersatz.Silverlight - - - - - - - - - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {238EAD8B-B811-4FA6-8581-4CA4B816066D} + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Community.CsharpSqlite.SQLiteClient.SL + Community.CsharpSqlite.SQLiteClient.SL + Silverlight + v4.0 + $(TargetFrameworkVersion) + false + true + true + + + + v3.5 + + + true + full + false + Bin\Debug + TRACE;DEBUG;SQLITE_SILVERLIGHT SQLITE_HAS_CODEC NET_2_0 + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SQLITE_SILVERLIGHT + true + true + prompt + 4 + + + + + + + + src\SqliteCommand.cs + Code + + + src\SqliteConnection.cs + Code + + + src\SqliteDataReader.cs + Code + + + src\SqliteError.cs + Code + + + src\SqliteExceptions.cs + Code + + + src\SqliteParameter.cs + Code + + + src\SqliteParameterCollection.cs + Code + + + src\SqliteTransaction.cs + Code + + + + + + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779} + Community.CsharpSqlite.Silverlight + + + {D7194231-DBAD-422B-819E-911037934F45} + System.Data.Ersatz.Silverlight + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.sln b/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.sln index 738561d..69a94f8 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.sln +++ b/Community.CsharpSqlite.SQLiteClient.SL/Community.CsharpSqlite.SQLiteClient.SL.sln @@ -1,32 +1,32 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.SL", "Community.CsharpSqlite.SQLiteClient.SL.csproj", "{238EAD8B-B811-4FA6-8581-4CA4B816066D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.Silverlight", "..\Community.CsharpSqlite.Silverlight\Community.CsharpSqlite.Silverlight.csproj", "{A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.Silverlight", "..\System.Data.Ersatz\Silverlight\System.Data.Ersatz.Silverlight.csproj", "{D7194231-DBAD-422B-819E-911037934F45}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Release|Any CPU.Build.0 = Release|Any CPU - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Release|Any CPU.Build.0 = Release|Any CPU - {D7194231-DBAD-422B-819E-911037934F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7194231-DBAD-422B-819E-911037934F45}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7194231-DBAD-422B-819E-911037934F45}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7194231-DBAD-422B-819E-911037934F45}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.SL", "Community.CsharpSqlite.SQLiteClient.SL.csproj", "{238EAD8B-B811-4FA6-8581-4CA4B816066D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.Silverlight", "..\Community.CsharpSqlite.Silverlight\Community.CsharpSqlite.Silverlight.csproj", "{A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.Silverlight", "..\System.Data.Ersatz\Silverlight\System.Data.Ersatz.Silverlight.csproj", "{D7194231-DBAD-422B-819E-911037934F45}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {238EAD8B-B811-4FA6-8581-4CA4B816066D}.Release|Any CPU.Build.0 = Release|Any CPU + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779}.Release|Any CPU.Build.0 = Release|Any CPU + {D7194231-DBAD-422B-819E-911037934F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7194231-DBAD-422B-819E-911037934F45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7194231-DBAD-422B-819E-911037934F45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7194231-DBAD-422B-819E-911037934F45}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Community.CsharpSqlite.SQLiteClient.SL/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.SQLiteClient.SL/Properties/AssemblyInfo.cs index b8d6d38..739e801 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.SQLiteClient.SL/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.SL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.SL")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5cf66686-bc8e-4d47-98ce-8ea30fb91a30")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.SL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.SL")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5cf66686-bc8e-4d47-98ce-8ea30fb91a30")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml index de812cb..1344421 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml.cs b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml.cs index fff6ab8..969df56 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml.cs +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/App.xaml.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace SQLiteClientTests -{ - public partial class App : Application - { - - public App() - { - this.Startup += this.Application_Startup; - this.Exit += this.Application_Exit; - this.UnhandledException += this.Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = new MainPage(); - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) - { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace SQLiteClientTests +{ + public partial class App : Application + { + + public App() + { + this.Startup += this.Application_Startup; + this.Exit += this.Application_Exit; + this.UnhandledException += this.Application_UnhandledException; + + InitializeComponent(); + } + + private void Application_Startup(object sender, StartupEventArgs e) + { + this.RootVisual = new MainPage(); + } + + private void Application_Exit(object sender, EventArgs e) + { + + } + + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + // If the app is running outside of the debugger then report the exception using + // the browser's exception mechanism. On IE this will display it a yellow alert + // icon in the status bar and Firefox will display a script error. + if (!System.Diagnostics.Debugger.IsAttached) + { + + // NOTE: This will allow the application to continue running after an exception has been thrown + // but not handled. + // For production applications this error handling should be replaced with something that will + // report the error to the website and stop the application. + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); + } + } + + private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml index f0f94fc..faca1a4 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml @@ -1,12 +1,12 @@ - - - - - - + + + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml.cs b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml.cs index 5c4cb61..81a6249 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml.cs +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/MainPage.xaml.cs @@ -1,23 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace SQLiteClientTests -{ - public partial class MainPage : UserControl - { - public MainPage() - { - InitializeComponent(); - SQLiteClientTestDriver.Main(null); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace SQLiteClientTests +{ + public partial class MainPage : UserControl + { + public MainPage() + { + InitializeComponent(); + SQLiteClientTestDriver.Main(null); + } + } +} diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AppManifest.xml b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AppManifest.xml index a955232..6712a11 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AppManifest.xml +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AppManifest.xml @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AssemblyInfo.cs index c3cd1ce..7ee9e68 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SQLiteClientTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SQLiteClientTests")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2ad31cc4-7853-4cbb-b185-239b97d991d8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SQLiteClientTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SQLiteClientTests")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2ad31cc4-7853-4cbb-b185-239b97d991d8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/SQLiteClientTests.csproj b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/SQLiteClientTests.csproj index 2ef1e6e..41fa76e 100644 --- a/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/SQLiteClientTests.csproj +++ b/Community.CsharpSqlite.SQLiteClient.SL/SQLiteClientTests/SQLiteClientTests.csproj @@ -1,125 +1,125 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {071198E0-F451-475D-83D2-302C74A3862D} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SQLiteClientTests - SQLiteClientTests - Silverlight - v4.0 - $(TargetFrameworkVersion) - true - - - true - true - SQLiteClientTests.xap - Properties\AppManifest.xml - SQLiteClientTests.App - SQLiteClientTestsTestPage.html - true - true - false - Properties\OutOfBrowserSettings.xml - false - true - - - - - - v3.5 - - - true - full - false - Bin\Debug - TRACE;DEBUG;SQLITE_SILVERLIGHT - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SQLITE_SILVERLIGHT - true - true - prompt - 4 - - - - - - - - - - - - - TestDriver_src\SQLiteClientTestDriver.cs - - - App.xaml - - - MainPage.xaml - - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - - - {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779} - Community.CsharpSqlite.Silverlight - - - {D7194231-DBAD-422B-819E-911037934F45} - System.Data.Ersatz - - - {238EAD8B-B811-4FA6-8581-4CA4B816066D} - Community.CsharpSqlite.SQLiteClient.SL - - - - - - - - - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {071198E0-F451-475D-83D2-302C74A3862D} + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + SQLiteClientTests + SQLiteClientTests + Silverlight + v4.0 + $(TargetFrameworkVersion) + true + + + true + true + SQLiteClientTests.xap + Properties\AppManifest.xml + SQLiteClientTests.App + SQLiteClientTestsTestPage.html + true + true + false + Properties\OutOfBrowserSettings.xml + false + true + + + + + + v3.5 + + + true + full + false + Bin\Debug + TRACE;DEBUG;SQLITE_SILVERLIGHT + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SQLITE_SILVERLIGHT + true + true + prompt + 4 + + + + + + + + + + + + + TestDriver_src\SQLiteClientTestDriver.cs + + + App.xaml + + + MainPage.xaml + + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + + + {A3AE849B-B668-4BC9-A75F-6E9B0A8F6779} + Community.CsharpSqlite.Silverlight + + + {D7194231-DBAD-422B-819E-911037934F45} + System.Data.Ersatz + + + {238EAD8B-B811-4FA6-8581-4CA4B816066D} + Community.CsharpSqlite.SQLiteClient.SL + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.csproj b/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.csproj index 24492a1..7e49080 100644 --- a/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.csproj +++ b/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.csproj @@ -1,126 +1,126 @@ - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07} - Library - Properties - Community.CsharpSqlite.SQLiteClient.WM - Community.CsharpSqlite.SQLiteClient.WM - {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - PocketPC - 4118C335-430C-497f-BE48-11C3316B135E - 5.1 - Community.CsharpSqlite.SQLiteClient.WM - v3.5 - Windows Mobile 5.0 Pocket PC SDK - - - - - true - full - false - bin\Debug\ - TRACE;DEBUG;WINDOWS_MOBILE - true - true - prompt - 512 - 4 - Off - - - pdbonly - true - bin\Release\ - TRACE;$(PlatformFamilyName) - true - true - prompt - 512 - 4 - Off - - - - - - - - - - - - - src\SqliteCommand.cs - Component - - - src\SqliteCommandBuilder.cs - Component - - - src\SqliteConnection.cs - Component - - - src\SqliteDataAdapter.cs - Component - - - src\SqliteDataReader.cs - - - src\SqliteError.cs - - - src\SqliteExceptions.cs - - - src\SqliteParameter.cs - - - src\SqliteParameterCollection.cs - - - src\SqliteRowUpdatedEventArgs.cs - - - src\SqliteRowUpdatedEventHandler.cs - - - src\SqliteRowUpdatingEventArgs.cs - - - src\SqliteRowUpdatingEventHandler.cs - - - src\SqliteTransaction.cs - - - - - - {3A036D50-E70A-4581-8891-352CCD69617A} - Community.CsharpSqlite.WinMobile - - - - - - - - - - - + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07} + Library + Properties + Community.CsharpSqlite.SQLiteClient.WM + Community.CsharpSqlite.SQLiteClient.WM + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + 4118C335-430C-497f-BE48-11C3316B135E + 5.1 + Community.CsharpSqlite.SQLiteClient.WM + v3.5 + Windows Mobile 5.0 Pocket PC SDK + + + + + true + full + false + bin\Debug\ + TRACE;DEBUG;WINDOWS_MOBILE + true + true + prompt + 512 + 4 + Off + + + pdbonly + true + bin\Release\ + TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + + + + + + + + + + + src\SqliteCommand.cs + Component + + + src\SqliteCommandBuilder.cs + Component + + + src\SqliteConnection.cs + Component + + + src\SqliteDataAdapter.cs + Component + + + src\SqliteDataReader.cs + + + src\SqliteError.cs + + + src\SqliteExceptions.cs + + + src\SqliteParameter.cs + + + src\SqliteParameterCollection.cs + + + src\SqliteRowUpdatedEventArgs.cs + + + src\SqliteRowUpdatedEventHandler.cs + + + src\SqliteRowUpdatingEventArgs.cs + + + src\SqliteRowUpdatingEventHandler.cs + + + src\SqliteTransaction.cs + + + + + + {3A036D50-E70A-4581-8891-352CCD69617A} + Community.CsharpSqlite.WinMobile + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.sln b/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.sln index e3463ce..0cee0f6 100644 --- a/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.sln +++ b/Community.CsharpSqlite.SQLiteClient.WM/Community.CsharpSqlite.SQLiteClient.WM.sln @@ -1,26 +1,26 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WM", "Community.CsharpSqlite.SQLiteClient.WM.csproj", "{3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinMobile", "..\Community.CsharpSqlite.WinMobile\Community.CsharpSqlite.WinMobile.csproj", "{3A036D50-E70A-4581-8891-352CCD69617A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Release|Any CPU.Build.0 = Release|Any CPU - {3A036D50-E70A-4581-8891-352CCD69617A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A036D50-E70A-4581-8891-352CCD69617A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A036D50-E70A-4581-8891-352CCD69617A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A036D50-E70A-4581-8891-352CCD69617A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WM", "Community.CsharpSqlite.SQLiteClient.WM.csproj", "{3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinMobile", "..\Community.CsharpSqlite.WinMobile\Community.CsharpSqlite.WinMobile.csproj", "{3A036D50-E70A-4581-8891-352CCD69617A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3628A9EF-CCDB-4474-A0CD-4D0CFC0FAC07}.Release|Any CPU.Build.0 = Release|Any CPU + {3A036D50-E70A-4581-8891-352CCD69617A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A036D50-E70A-4581-8891-352CCD69617A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A036D50-E70A-4581-8891-352CCD69617A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A036D50-E70A-4581-8891-352CCD69617A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Community.CsharpSqlite.SQLiteClient.WM/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.SQLiteClient.WM/Properties/AssemblyInfo.cs index 033809c..3794827 100644 --- a/Community.CsharpSqlite.SQLiteClient.WM/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.SQLiteClient.WM/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.WM")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.WM")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("875f82cd-952d-44b3-a090-90aee33d30fe")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.WM")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.WM")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("875f82cd-952d-44b3-a090-90aee33d30fe")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] + diff --git a/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.csproj b/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.csproj index cb6f418..f4cc209 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.csproj +++ b/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.csproj @@ -1,95 +1,95 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Community.CsharpSqlite.SQLiteClient.WP - Community.CsharpSqlite.SQLiteClient.WP - v4.0 - $(TargetFrameworkVersion) - WindowsPhone - Silverlight - false - true - true - - - true - full - false - Bin\Debug - TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER SQLITE_DEBUG NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SQLITE_SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - - - - - src\SqliteCommand.cs - - - src\SqliteConnection.cs - - - src\SqliteDataReader.cs - - - src\SqliteError.cs - - - src\SqliteExceptions.cs - - - src\SqliteParameter.cs - - - src\SqliteParameterCollection.cs - - - src\SqliteTransaction.cs - - - - - - - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9} - Community.CsharpSqlite.WinPhone - - - {60396C62-02C2-45FE-98BD-4A16E076722B} - System.Data.Ersatz.WinPhone - - - - - - + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Community.CsharpSqlite.SQLiteClient.WP + Community.CsharpSqlite.SQLiteClient.WP + v4.0 + $(TargetFrameworkVersion) + WindowsPhone + Silverlight + false + true + true + + + true + full + false + Bin\Debug + TRACE;DEBUG;SQLITE_SILVERLIGHT NET_40 TRUE WIN32 _MSC_VER SQLITE_DEBUG NDEBUG NO_TCL SQLITE_ASCII SQLITE_DISABLE_LFS SQLITE_HAS_CODEC SQLITE_MEM_POOL SQLITE_MUTEX_OMIT SQLITE_OMIT_AUTHORIZATION SQLITE_OMIT_DEPRECATED SQLITE_OMIT_GET_TABLE SQLITE_OMIT_INCRBLOB SQLITE_OMIT_LOOKASIDE SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_UTF16 SQLITE_OMIT_VIRTUALTABLE SQLITE_OMIT_WAL SQLITE_OS_WIN SQLITE_SYSTEM_MALLOC VDBE_PROFILE_OFF WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SQLITE_SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + + + + + src\SqliteCommand.cs + + + src\SqliteConnection.cs + + + src\SqliteDataReader.cs + + + src\SqliteError.cs + + + src\SqliteExceptions.cs + + + src\SqliteParameter.cs + + + src\SqliteParameterCollection.cs + + + src\SqliteTransaction.cs + + + + + + + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9} + Community.CsharpSqlite.WinPhone + + + {60396C62-02C2-45FE-98BD-4A16E076722B} + System.Data.Ersatz.WinPhone + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.sln b/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.sln index 0274476..c825cae 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.sln +++ b/Community.CsharpSqlite.SQLiteClient.WP/Community.CsharpSqlite.SQLiteClient.WP.sln @@ -1,40 +1,40 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WP", "Community.CsharpSqlite.SQLiteClient.WP.csproj", "{22E602F9-ADB6-4B94-B980-40EB1E83BE8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinPhone", "..\Community.CsharpSqlite.WinPhone\Community.CsharpSqlite.WinPhone.csproj", "{A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.WinPhone", "..\System.Data.Ersatz\WinPhone\System.Data.Ersatz.WinPhone.csproj", "{60396C62-02C2-45FE-98BD-4A16E076722B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteClientTests.WinPhone", "SQLiteClientTests\SQLiteClientTests.WinPhone.csproj", "{C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Release|Any CPU.Build.0 = Release|Any CPU - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Release|Any CPU.Build.0 = Release|Any CPU - {60396C62-02C2-45FE-98BD-4A16E076722B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60396C62-02C2-45FE-98BD-4A16E076722B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60396C62-02C2-45FE-98BD-4A16E076722B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60396C62-02C2-45FE-98BD-4A16E076722B}.Release|Any CPU.Build.0 = Release|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.Build.0 = Release|Any CPU - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.Deploy.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WP", "Community.CsharpSqlite.SQLiteClient.WP.csproj", "{22E602F9-ADB6-4B94-B980-40EB1E83BE8B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinPhone", "..\Community.CsharpSqlite.WinPhone\Community.CsharpSqlite.WinPhone.csproj", "{A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.WinPhone", "..\System.Data.Ersatz\WinPhone\System.Data.Ersatz.WinPhone.csproj", "{60396C62-02C2-45FE-98BD-4A16E076722B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteClientTests.WinPhone", "SQLiteClientTests\SQLiteClientTests.WinPhone.csproj", "{C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B}.Release|Any CPU.Build.0 = Release|Any CPU + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9}.Release|Any CPU.Build.0 = Release|Any CPU + {60396C62-02C2-45FE-98BD-4A16E076722B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60396C62-02C2-45FE-98BD-4A16E076722B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60396C62-02C2-45FE-98BD-4A16E076722B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60396C62-02C2-45FE-98BD-4A16E076722B}.Release|Any CPU.Build.0 = Release|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.Build.0 = Release|Any CPU + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Community.CsharpSqlite.SQLiteClient.WP/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.SQLiteClient.WP/Properties/AssemblyInfo.cs index f6e25ce..8cc6db8 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.SQLiteClient.WP/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.WP")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.WP")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("881c47fa-c32a-40df-8c40-6410189eeedd")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Community.CsharpSqlite.SQLiteClient.WP")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Community.CsharpSqlite.SQLiteClient.WP")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("881c47fa-c32a-40df-8c40-6410189eeedd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml index 83c77ea..3d21607 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml @@ -1,19 +1,19 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml.cs b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml.cs index 8f7233c..a094e0b 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml.cs +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/App.xaml.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; - -namespace Test.WP -{ - public partial class App : Application - { - /// - /// Provides easy access to the root frame of the Phone Application. - /// - /// The root frame of the Phone Application. - public PhoneApplicationFrame RootFrame { get; private set; } - - /// - /// Constructor for the Application object. - /// - public App() - { - // Global handler for uncaught exceptions. - UnhandledException += Application_UnhandledException; - - // Show graphics profiling information while debugging. - if (System.Diagnostics.Debugger.IsAttached) - { - // Display the current frame rate counters. - Application.Current.Host.Settings.EnableFrameRateCounter = true; - - // Show the areas of the app that are being redrawn in each frame. - //Application.Current.Host.Settings.EnableRedrawRegions = true; - - // Enable non-production analysis visualization mode, - // which shows areas of a page that are being GPU accelerated with a colored overlay. - //Application.Current.Host.Settings.EnableCacheVisualization = true; - } - - // Standard Silverlight initialization - InitializeComponent(); - - // Phone-specific initialization - InitializePhoneApplication(); - } - - // Code to execute when the application is launching (eg, from Start) - // This code will not execute when the application is reactivated - private void Application_Launching(object sender, LaunchingEventArgs e) - { - } - - // Code to execute when the application is activated (brought to foreground) - // This code will not execute when the application is first launched - private void Application_Activated(object sender, ActivatedEventArgs e) - { - } - - // Code to execute when the application is deactivated (sent to background) - // This code will not execute when the application is closing - private void Application_Deactivated(object sender, DeactivatedEventArgs e) - { - } - - // Code to execute when the application is closing (eg, user hit Back) - // This code will not execute when the application is deactivated - private void Application_Closing(object sender, ClosingEventArgs e) - { - } - - // Code to execute if a navigation fails - private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) - { - if (System.Diagnostics.Debugger.IsAttached) - { - // A navigation has failed; break into the debugger - System.Diagnostics.Debugger.Break(); - } - } - - // Code to execute on Unhandled Exceptions - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - if (System.Diagnostics.Debugger.IsAttached) - { - // An unhandled exception has occurred; break into the debugger - System.Diagnostics.Debugger.Break(); - } - } - - #region Phone application initialization - - // Avoid double-initialization - private bool phoneApplicationInitialized = false; - - // Do not add any additional code to this method - private void InitializePhoneApplication() - { - if (phoneApplicationInitialized) - return; - - // Create the frame but don't set it as RootVisual yet; this allows the splash - // screen to remain active until the application is ready to render. - RootFrame = new PhoneApplicationFrame(); - RootFrame.Navigated += CompleteInitializePhoneApplication; - - // Handle navigation failures - RootFrame.NavigationFailed += RootFrame_NavigationFailed; - - // Ensure we don't initialize again - phoneApplicationInitialized = true; - } - - // Do not add any additional code to this method - private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) - { - // Set the root visual to allow the application to render - if (RootVisual != RootFrame) - RootVisual = RootFrame; - - // Remove this handler since it is no longer needed - RootFrame.Navigated -= CompleteInitializePhoneApplication; - } - - #endregion - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; + +namespace Test.WP +{ + public partial class App : Application + { + /// + /// Provides easy access to the root frame of the Phone Application. + /// + /// The root frame of the Phone Application. + public PhoneApplicationFrame RootFrame { get; private set; } + + /// + /// Constructor for the Application object. + /// + public App() + { + // Global handler for uncaught exceptions. + UnhandledException += Application_UnhandledException; + + // Show graphics profiling information while debugging. + if (System.Diagnostics.Debugger.IsAttached) + { + // Display the current frame rate counters. + Application.Current.Host.Settings.EnableFrameRateCounter = true; + + // Show the areas of the app that are being redrawn in each frame. + //Application.Current.Host.Settings.EnableRedrawRegions = true; + + // Enable non-production analysis visualization mode, + // which shows areas of a page that are being GPU accelerated with a colored overlay. + //Application.Current.Host.Settings.EnableCacheVisualization = true; + } + + // Standard Silverlight initialization + InitializeComponent(); + + // Phone-specific initialization + InitializePhoneApplication(); + } + + // Code to execute when the application is launching (eg, from Start) + // This code will not execute when the application is reactivated + private void Application_Launching(object sender, LaunchingEventArgs e) + { + } + + // Code to execute when the application is activated (brought to foreground) + // This code will not execute when the application is first launched + private void Application_Activated(object sender, ActivatedEventArgs e) + { + } + + // Code to execute when the application is deactivated (sent to background) + // This code will not execute when the application is closing + private void Application_Deactivated(object sender, DeactivatedEventArgs e) + { + } + + // Code to execute when the application is closing (eg, user hit Back) + // This code will not execute when the application is deactivated + private void Application_Closing(object sender, ClosingEventArgs e) + { + } + + // Code to execute if a navigation fails + private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) + { + if (System.Diagnostics.Debugger.IsAttached) + { + // A navigation has failed; break into the debugger + System.Diagnostics.Debugger.Break(); + } + } + + // Code to execute on Unhandled Exceptions + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + if (System.Diagnostics.Debugger.IsAttached) + { + // An unhandled exception has occurred; break into the debugger + System.Diagnostics.Debugger.Break(); + } + } + + #region Phone application initialization + + // Avoid double-initialization + private bool phoneApplicationInitialized = false; + + // Do not add any additional code to this method + private void InitializePhoneApplication() + { + if (phoneApplicationInitialized) + return; + + // Create the frame but don't set it as RootVisual yet; this allows the splash + // screen to remain active until the application is ready to render. + RootFrame = new PhoneApplicationFrame(); + RootFrame.Navigated += CompleteInitializePhoneApplication; + + // Handle navigation failures + RootFrame.NavigationFailed += RootFrame_NavigationFailed; + + // Ensure we don't initialize again + phoneApplicationInitialized = true; + } + + // Do not add any additional code to this method + private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) + { + // Set the root visual to allow the application to render + if (RootVisual != RootFrame) + RootVisual = RootFrame; + + // Remove this handler since it is no longer needed + RootFrame.Navigated -= CompleteInitializePhoneApplication; + } + + #endregion + } } \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml index 58916e8..6d628ac 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml.cs b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml.cs index 94bea2b..941114f 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml.cs +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/MainPage.xaml.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -using Microsoft.Phone.Controls; -using System.Data; -using Community.CsharpSqlite.SQLiteClient; -using test; - -namespace Test.WP -{ - public partial class MainPage : PhoneApplicationPage - { - // Constructor - public MainPage() - { - InitializeComponent(); - this.Loaded += new RoutedEventHandler(MainPage_Loaded); - } - - public void WriteLine(String value) - { - this.listBox1.Items.Add(value);// + Environment.NewLine; - } - - protected void MainPage_Loaded(object sender, EventArgs e) - { - - //SQLiteClientTests.SQLiteClientTestDriver.Main(null); - IDbConnection cnn; - - try - { - System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().DeleteFile("test.db3"); - } - catch { } - - - using (cnn = new SqliteConnection()) - { - TestCases tests = new TestCases(); - - cnn.ConnectionString = "data source=test.db3,password=0x01010101010101010101010101010101"; - cnn.Open(); - tests.Run(cnn, this); - } - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Microsoft.Phone.Controls; +using System.Data; +using Community.CsharpSqlite.SQLiteClient; +using test; + +namespace Test.WP +{ + public partial class MainPage : PhoneApplicationPage + { + // Constructor + public MainPage() + { + InitializeComponent(); + this.Loaded += new RoutedEventHandler(MainPage_Loaded); + } + + public void WriteLine(String value) + { + this.listBox1.Items.Add(value);// + Environment.NewLine; + } + + protected void MainPage_Loaded(object sender, EventArgs e) + { + + //SQLiteClientTests.SQLiteClientTestDriver.Main(null); + IDbConnection cnn; + + try + { + System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().DeleteFile("test.db3"); + } + catch { } + + + using (cnn = new SqliteConnection()) + { + TestCases tests = new TestCases(); + + cnn.ConnectionString = "data source=test.db3,password=0x01010101010101010101010101010101"; + cnn.Open(); + tests.Run(cnn, this); + } + } + } } \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AppManifest.xml b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AppManifest.xml index a955232..6712a11 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AppManifest.xml +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AppManifest.xml @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AssemblyInfo.cs b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AssemblyInfo.cs index 041e832..137b9fc 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AssemblyInfo.cs +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Test.WP")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Test.WP")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("eae25b4d-6f80-4c3c-8dad-41fba9f64f70")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Test.WP")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Test.WP")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("eae25b4d-6f80-4c3c-8dad-41fba9f64f70")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/WMAppManifest.xml b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/WMAppManifest.xml index 6efb016..36bc8f8 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/WMAppManifest.xml +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/Properties/WMAppManifest.xml @@ -1,32 +1,32 @@ - - - - - ApplicationIcon.png - - - - - - - - - - - - - - - - - - - - Background.png - 0 - Test.WP - - - - - + + + + + ApplicationIcon.png + + + + + + + + + + + + + + + + + + + + Background.png + 0 + Test.WP + + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/SQLiteClientTests.WinPhone.csproj b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/SQLiteClientTests.WinPhone.csproj index 827efea..f54a44b 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/SQLiteClientTests.WinPhone.csproj +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/SQLiteClientTests.WinPhone.csproj @@ -1,121 +1,121 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Test.WP - Test.WP - v4.0 - $(TargetFrameworkVersion) - WindowsPhone - Silverlight - true - - - true - true - Test.WP.xap - Properties\AppManifest.xml - Test.WP.App - true - true - - - true - full - false - Bin\Debug - TRACE;DEBUG;SQLITE_DEBUG SQLITE_SILVERLIGHT WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SQLITE_SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - - - - - - - - - - src\SQLiteClientTestDriver.cs - - - App.xaml - - - MainPage.xaml - - - - Code - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - - - - PreserveNewest - - - PreserveNewest - - - - - - {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9} - Community.CsharpSqlite.WinPhone - - - {60396C62-02C2-45FE-98BD-4A16E076722B} - System.Data.Ersatz.WinPhone - - - {22E602F9-ADB6-4B94-B980-40EB1E83BE8B} - Community.CsharpSqlite.SQLiteClient.WP - - - - - - + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {C1A7EA2C-8FAE-46F3-BBE1-AFD6DDB81A3E} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Test.WP + Test.WP + v4.0 + $(TargetFrameworkVersion) + WindowsPhone + Silverlight + true + + + true + true + Test.WP.xap + Properties\AppManifest.xml + Test.WP.App + true + true + + + true + full + false + Bin\Debug + TRACE;DEBUG;SQLITE_DEBUG SQLITE_SILVERLIGHT WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SQLITE_SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + + + + + + + + + + src\SQLiteClientTestDriver.cs + + + App.xaml + + + MainPage.xaml + + + + Code + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + {A1CF8CB2-DB66-4036-AB1F-9D205D5C93E9} + Community.CsharpSqlite.WinPhone + + + {60396C62-02C2-45FE-98BD-4A16E076722B} + System.Data.Ersatz.WinPhone + + + {22E602F9-ADB6-4B94-B980-40EB1E83BE8B} + Community.CsharpSqlite.SQLiteClient.WP + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/TestCases.cs b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/TestCases.cs index 4f7780f..25325a4 100644 --- a/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/TestCases.cs +++ b/Community.CsharpSqlite.SQLiteClient.WP/SQLiteClientTests/TestCases.cs @@ -1,821 +1,821 @@ -using System; -using System.Data.Common; -using System.Data; -using Community.CsharpSqlite.SQLiteClient; - -namespace test -{ - - /// - /// Scalar user-defined function. In this example, the same class is declared twice with - /// different function names to demonstrate how to use alias names for user-defined functions. - /// - //[SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)] - //[SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)] - class TestFunc// : SQLiteFunction - { - public object Invoke(object[] args) - { - if (args[0].GetType() != typeof(int)) return args[0]; - - int Param1 = Convert.ToInt32(args[0]); // First parameter - int Param2 = Convert.ToInt32(args[1]); // Second parameter - - return Param1 + Param2; - } - } - - /// - /// Aggregate user-defined function. Arguments = -1 means any number of arguments is acceptable - /// - // [SQLiteFunction(Name = "MyCount", Arguments = -1, FuncType = FunctionType.Aggregate)] - class MyCount //: SQLiteFunction - { - public void Step(object[] args, int nStep, ref object contextData) - { - if (contextData == null) - { - contextData = 1; - } - else - contextData = (int)contextData + 1; - } - - public object Final(object contextData) - { - return contextData; - } - } - - /// - /// User-defined collating sequence. - /// - //[SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)] - class MySequence // : SQLiteFunction - { - public int Compare(string param1, string param2) - { - // Make sure the string "Field3" is sorted out of order - if (param1 == "Field3") return 1; - if (param2 == "Field3") return -1; - return String.Compare(param1, param2); - } - } - - internal class TestCases - { - internal Test.WP.MainPage frm; - - internal void Run(IDbConnection cnn, Test.WP.MainPage frm2) - { - - frm = frm2; - // frm.Show(); - - frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString()); - try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); } - catch (Exception) { frm.WriteLine("FAIL - CreateTable"); } - - try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); } - catch (Exception) { frm.WriteLine("FAIL - DataType Test"); } - - //not enabled yet - //try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); } - //catch (Exception) { frm.WriteLine("FAIL - Full Text Search"); } - - //Not possible without datatable to reade the schema - //try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); } - //catch (Exception) { frm.WriteLine("FAIL - KeyInfo Fetch"); } - - try { InsertTable(cnn); frm.WriteLine("SUCCESS - InsertTable"); } - catch (Exception) { frm.WriteLine("FAIL - InsertTable"); } - - try { VerifyInsert(cnn); frm.WriteLine("SUCCESS - VerifyInsert"); } - catch (Exception) { frm.WriteLine("FAIL - VerifyInsert"); } - - try { CoersionTest(cnn); frm.WriteLine("FAIL - CoersionTest"); } - catch (Exception) { frm.WriteLine("SUCCESS - CoersionTest"); } - - try { ParameterizedInsert(cnn); frm.WriteLine("SUCCESS - ParameterizedInsert"); } - catch (Exception) { frm.WriteLine("FAIL - ParameterizedInsert"); } - - try { BinaryInsert(cnn); frm.WriteLine("SUCCESS - BinaryInsert"); } - catch (Exception) { frm.WriteLine("FAIL - BinaryInsert"); } - - try { VerifyBinaryData(cnn); frm.WriteLine("SUCCESS - VerifyBinaryData"); } - catch (Exception) { frm.WriteLine("FAIL - VerifyBinaryData"); } - - try { LockTest(cnn); frm.WriteLine("SUCCESS - LockTest"); } - catch (Exception) { frm.WriteLine("FAIL - LockTest"); } - - try { ParameterizedInsertMissingParams(cnn); frm.WriteLine("FAIL - ParameterizedInsertMissingParams"); } - catch (Exception) { frm.WriteLine("SUCCESS - ParameterizedInsertMissingParams"); } - - //try { InsertMany(cnn, false); frm.WriteLine("SUCCESS - InsertMany"); } - //catch (Exception) { frm.WriteLine("FAIL - InsertMany"); } - - //try { InsertMany(cnn, true); frm.WriteLine("SUCCESS - InsertManyWithIdentityFetch"); } - //catch (Exception) { frm.WriteLine("FAIL - InsertManyWithIdentityFetch"); } - - try { FastInsertMany(cnn); frm.WriteLine("SUCCESS - FastInsertMany"); } - catch (Exception) { frm.WriteLine("FAIL - FastInsertMany"); } - - //try { IterationTest(cnn); frm.WriteLine("SUCCESS - Iteration Test"); } - //catch (Exception) { frm.WriteLine("FAIL - Iteration Test"); } - - //try { UserFunction(cnn); frm.WriteLine("SUCCESS - UserFunction"); } - //catch (Exception) { frm.WriteLine("FAIL - UserFunction"); } - - //try { UserAggregate(cnn); frm.WriteLine("SUCCESS - UserAggregate"); } - //catch (Exception) { frm.WriteLine("FAIL - UserAggregate"); } - - //try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); } - //catch (Exception) { frm.WriteLine("FAIL - UserCollation"); } - - try { DropTable(cnn); frm.WriteLine("SUCCESS - DropTable"); } - catch (Exception) { frm.WriteLine("FAIL - DropTable"); } - - frm.WriteLine("\r\nTests Finished."); - } - - internal static void KeyInfoTest(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - // First test against integer primary key (optimized) keyinfo fetch - cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "Select * from keyinfotest"; - using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - if (reader.FieldCount != 3) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); - } - - cmd.CommandText = "SELECT MyValue FROM keyinfotest"; - using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - if (reader.FieldCount != 2) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); - } - - cmd.CommandText = "DROP TABLE keyinfotest"; - cmd.ExecuteNonQuery(); - - // Now test against non-integer primary key (unoptimized) subquery keyinfo fetch - cmd.CommandText = "Create table keyinfotest (id char primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "SELECT MyValue FROM keyinfotest"; - using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - if (reader.FieldCount != 2) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); - } - - cmd.CommandText = "Select * from keyinfotest"; - using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - if (reader.FieldCount != 3) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); - } - - //// Make sure commandbuilder can generate an update command with the correct parameter count - //using (DbDataAdapter adp = new SQLiteDataAdapter()) - //using (DbCommandBuilder builder = new SQLiteCommandBuilder()) - //{ - // adp.SelectCommand = cmd; - // builder.DataAdapter = adp; - // builder.ConflictOption = ConflictOption.OverwriteChanges; - - // using (IDbCommand updatecmd = builder.GetUpdateCommand()) - // { - // if (updatecmd.Parameters.Count != 4) - // throw new ArgumentOutOfRangeException("Wrong number of parameters in update command!"); - // } - //} - } - } - - internal static void DataTypeTest(IDbConnection cnn) - { - DateTime now = DateTime.Now; - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "create table datatypetest(id integer primary key, myvalue, datetimevalue datetime, decimalvalue decimal)"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(?,?,?)"; - IDbDataParameter p1 = cmd.CreateParameter(); - IDbDataParameter p2 = cmd.CreateParameter(); - IDbDataParameter p3 = cmd.CreateParameter(); - - cmd.Parameters.Add(p1); - cmd.Parameters.Add(p2); - cmd.Parameters.Add(p3); - - p1.Value = 1; - p2.Value = DateTime.MinValue; - p3.Value = (Decimal)1.05; - cmd.ExecuteNonQuery(); - - //p1.ResetDbType(); - //p2.ResetDbType(); - //p3.ResetDbType(); - - p1.Value = "One"; - p2.Value = "2001-01-01"; - p3.Value = (float)1.123; - cmd.ExecuteNonQuery(); - - //p1.ResetDbType(); - //p2.ResetDbType(); - //p3.ResetDbType(); - - p1.Value = 1.01; - DateTime nw = now; - p2.Value = nw; - p3.Value = (Double )9.91; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest"; - using (IDataReader reader = cmd.ExecuteReader()) - { - for (int n = 0; n < 3; n++) - { - reader.Read(); - if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(2).GetType() != reader.GetDouble(2).GetType()) throw new ArgumentOutOfRangeException(); - - switch (n) - { - case 0: - if (reader.GetValue(0).GetType() != typeof(long)) throw new ArgumentOutOfRangeException(); - - if (reader.GetValue(0).Equals((long)1) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(1).Equals(DateTime.MinValue) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetDecimal(2).Equals((Decimal)1.05) == false) throw new ArgumentOutOfRangeException(); - - if (reader.GetInt64(0) != (long)1) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); - break; - case 1: - if (reader.GetValue(0).GetType() != typeof(string)) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(0).Equals("One") == false) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetFloat(2).Equals((float)1.123) == false) throw new ArgumentOutOfRangeException(); - - if (reader.GetString(0) != "One") throw new ArgumentOutOfRangeException(); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); - break; - case 2: - if (reader.GetValue(0).GetType() != typeof(double)) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(0).Equals(1.01) == false) throw new ArgumentOutOfRangeException(); - //Something weird comparing datetime values... - if (((DateTime)reader.GetValue(1)).ToString("s").Equals(nw.ToString("s")) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetDouble(2).Equals((Double)9.91) == false) throw new ArgumentOutOfRangeException(); - - if (reader.GetDouble(0) != 1.01) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); - if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); - break; - } - } - } - } - } - - internal static void FullTextTest(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS3(name, ingredients);"; - cmd.ExecuteNonQuery(); - - string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" }; - string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" }; - int n; - - cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);"; - IDbDataParameter name = cmd.CreateParameter(); - IDbDataParameter ingredient = cmd.CreateParameter(); - - name.ParameterName = "@name"; - ingredient.ParameterName = "@ingredient"; - - cmd.Parameters.Add(name); - cmd.Parameters.Add(ingredient); - - for (n = 0; n < names.Length; n++) - { - name.Value = names[n]; - ingredient.Value = ingredients[n]; - - cmd.ExecuteNonQuery(); - } - - cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';"; - - int[] rowids = { 3, 4 }; - n = 0; - - using (IDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { - if (reader.GetInt64(0) != rowids[n++]) - throw new ArgumentException("Unexpected rowid returned"); - - if (n > rowids.Length) throw new ArgumentException("Too many rows returned"); - } - } - } - } - - internal void CreateTable(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)"; - //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)"; - cmd.ExecuteNonQuery(); - } - } - - internal void DropTable(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "DROP TABLE TestCase"; - cmd.ExecuteNonQuery(); - } - } - - internal void InsertTable(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(1, 3.14159, 'Field3', 'Field4', '2005-01-01 13:49:00')"; - cmd.ExecuteNonQuery(); - } - } - - internal void VerifyInsert(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5 FROM TestCase"; - cmd.Prepare(); - using (IDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read()) - { - long Field1 = rd.GetInt64(0); - double Field2 = rd.GetDouble(1); - string Field3 = rd.GetString(2); - string Field4 = rd.GetString(3).TrimEnd(); - DateTime Field5 = rd.GetDateTime(4); - - if (Field1 != 1) throw new ArgumentOutOfRangeException("Non-Match on Field1"); - if (Field2 != 3.14159) throw new ArgumentOutOfRangeException("Non-Match on Field2"); - if (Field3 != "Field3") throw new ArgumentOutOfRangeException("Non-Match on Field3"); - if (Field4 != "Field4") throw new ArgumentOutOfRangeException("Non-Match on Field4"); - if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new ArgumentOutOfRangeException("Non-Match on Field5"); - } - else throw new ArgumentOutOfRangeException("No data in table"); - } - } - } - - internal void CoersionTest(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase"; - using (IDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read()) - { - object Field1 = rd.GetInt32(0); - object Field2 = rd.GetDouble(1); - object Field3 = rd.GetString(2); - object Field4 = rd.GetString(3).TrimEnd(); - object Field5 = rd.GetDateTime(4); - - // The next statement should cause an exception - Field1 = rd.GetString(0); - Field2 = rd.GetString(1); - Field3 = rd.GetString(2); - Field4 = rd.GetString(3); - Field5 = rd.GetString(4); - - Field1 = rd.GetInt32(0); - Field2 = rd.GetInt32(1); - Field3 = rd.GetInt32(2); - Field4 = rd.GetInt32(3); - Field5 = rd.GetInt32(4); - - Field1 = rd.GetDecimal(0); - Field2 = rd.GetDecimal(1); - Field3 = rd.GetDecimal(2); - Field4 = rd.GetDecimal(3); - Field5 = rd.GetDecimal(4); - } - else throw new ArgumentOutOfRangeException("No data in table"); - } - } - } - - internal void ParameterizedInsert(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)"; - IDbDataParameter Field1 = cmd.CreateParameter(); - IDbDataParameter Field2 = cmd.CreateParameter(); - IDbDataParameter Field3 = cmd.CreateParameter(); - IDbDataParameter Field4 = cmd.CreateParameter(); - IDbDataParameter Field5 = cmd.CreateParameter(); - - Field1.Value = 2; - Field2.Value = 3.14159; - Field3.Value = "Param Field3"; - Field4.Value = "Field4 Par"; - Field5.Value = DateTime.Now; - - cmd.Parameters.Add(Field1); - cmd.Parameters.Add(Field2); - cmd.Parameters.Add(Field3); - cmd.Parameters.Add(Field4); - cmd.Parameters.Add(Field5); - - cmd.ExecuteNonQuery(); - } - } - - internal void BinaryInsert(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field6) VALUES(?)"; - IDbDataParameter Field6 = cmd.CreateParameter(); - - byte[] b = new byte[4000]; - b[0] = 1; - b[100] = 2; - b[1000] = 3; - b[2000] = 4; - b[3000] = 5; - - Field6.Value = b; - - cmd.Parameters.Add(Field6); - - cmd.ExecuteNonQuery(); - } - } - - internal void VerifyBinaryData(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; - byte[] b = new byte[4000]; - - using (IDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read() == false) throw new ArgumentOutOfRangeException(); - - rd.GetBytes(0, 0, b, 0, 4000); - - if (b[0] != 1) throw new ArgumentException(); - if (b[100] != 2) throw new ArgumentException(); - if (b[1000] != 3) throw new ArgumentException(); - if (b[2000] != 4) throw new ArgumentException(); - if (b[3000] != 5) throw new ArgumentException(); - } - } - } - - internal static void LockTest(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; - byte[] b = new byte[4000]; - - using (IDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read() == false) throw new ArgumentOutOfRangeException(); - - rd.GetBytes(0, 0, b, 0, 4000); - - if (b[0] != 1) throw new ArgumentException(); - if (b[100] != 2) throw new ArgumentException(); - if (b[1000] != 3) throw new ArgumentException(); - if (b[2000] != 4) throw new ArgumentException(); - if (b[3000] != 5) throw new ArgumentException(); - - using (IDbConnection clone = (IDbConnection)((ICloneable)cnn).Clone()) - { - using (IDbCommand newcmd = clone.CreateCommand()) - { - newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL"; - newcmd.CommandTimeout = 2; - int cmdStart = Environment.TickCount; - int cmdEnd; - - try - { - newcmd.ExecuteNonQuery(); // should fail because there's a reader on the database - throw new ArgumentException(); // If we got here, the test failed - } - catch - { - cmdEnd = Environment.TickCount; - //TODO: commandtimeout and retry on lock. - //if (cmdEnd - cmdStart < 2000 || cmdEnd - cmdStart > 3000) - //throw new ArgumentException(); // Didn't wait the right amount of time - } - } - } - } - } - } - - internal void ParameterizedInsertMissingParams(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)"; - IDbDataParameter Field1 = cmd.CreateParameter(); - IDbDataParameter Field2 = cmd.CreateParameter(); - IDbDataParameter Field3 = cmd.CreateParameter(); - IDbDataParameter Field4 = cmd.CreateParameter(); - IDbDataParameter Field5 = cmd.CreateParameter(); - - Field1.DbType = System.Data.DbType.Int32; - - Field1.Value = 2; - Field2.Value = 3.14159; - Field3.Value = "Field3 Param"; - Field4.Value = "Field4 Par"; - Field5.Value = DateTime.Now; - - cmd.Parameters.Add(Field1); - cmd.Parameters.Add(Field2); - cmd.Parameters.Add(Field3); - cmd.Parameters.Add(Field4); - - // Assertion here, not enough parameters - cmd.ExecuteNonQuery(); - } - } - - // Utilizes the SQLiteCommandBuilder, which in turn utilizes SQLiteDataReader's GetSchemaTable() functionality - //internal void InsertMany(IDbConnection cnn, bool bWithIdentity) - //{ - // int nmax = 1000; - - // using (IDbTransaction dbTrans = cnn.BeginTransaction()) - // { - // using (DbDataAdapter adp = new SQLiteDataAdapter()) - // { - // using (IDbCommand cmd = cnn.CreateCommand()) - // { - // cmd.Transaction = dbTrans; - // cmd.CommandText = "SELECT * FROM TestCase WHERE 1=2"; - // adp.SelectCommand = cmd; - - // using (DbCommandBuilder bld = new SQLiteCommandBuilder()) - // { - // bld.DataAdapter = adp; - // using (adp.InsertCommand = (SQLiteCommand)((ICloneable)bld.GetInsertCommand()).Clone()) - // { - // bld.DataAdapter = null; - // if (bWithIdentity) - // { - // adp.InsertCommand.CommandText += ";SELECT last_insert_rowid() AS [ID]"; - // adp.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; - // } - - // using (DataTable tbl = new DataTable()) - // { - // adp.Fill(tbl); - // for (int n = 0; n < nmax; n++) - // { - // DataRow row = tbl.NewRow(); - // row[1] = n + nmax; - // tbl.Rows.Add(row); - // } - - // frm.Write(String.Format(" InsertMany{0} ({1} rows) Begins ... ", (bWithIdentity == true) ? "WithIdentityFetch" : " ", nmax)); - // int dtStart = Environment.TickCount; - // adp.Update(tbl); - // int dtEnd = Environment.TickCount; - // dtEnd -= dtStart; - // frm.Write(String.Format("Ends in {0} ms ... ", (dtEnd))); - - // dtStart = Environment.TickCount; - // dbTrans.Commit(); - // dtEnd = Environment.TickCount; - // dtEnd -= dtStart; - // frm.WriteLine(String.Format("Commits in {0} ms", (dtEnd))); - // } - // } - // } - // } - // } - // } - //} - - internal void FastInsertMany(IDbConnection cnn) - { - using (IDbTransaction dbTrans = cnn.BeginTransaction()) - { - int dtStart; - int dtEnd; - - using (IDbCommand cmd = cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1) VALUES(?)"; - IDbDataParameter Field1 = cmd.CreateParameter(); - - cmd.Parameters.Add(Field1); - - frm.WriteLine("Fast insert using parameters and prepared "); - frm.WriteLine("statement-> (10,000 rows) Begins ... "); - dtStart = Environment.TickCount; - for (int n = 0; n < 10000; n++) - { - Field1.Value = n + 100000; - cmd.ExecuteNonQuery(); - } - - dtEnd = Environment.TickCount; - dtEnd -= dtStart; - frm.WriteLine(" -> Ends in "+dtEnd+" ms ... "); - } - - dtStart = Environment.TickCount; - dbTrans.Rollback(); - dtEnd = Environment.TickCount; - dtEnd -= dtStart; - frm.WriteLine("Rolled back in " + dtEnd + " ms"); - } - } - - // Causes the user-defined function to be called - internal void UserFunction(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT Foo('ee','foo')"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - frm.WriteLine(String.Format(" User (text) command executed {0} times in 1 second.", nTimes)); - - nTimes = 0; - cmd.CommandText = "SELECT Foo(10,11)"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - frm.WriteLine(String.Format(" UserFunction command executed {0} times in 1 second.", nTimes)); - - nTimes = 0; - cmd.CommandText = "SELECT ABS(1)"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - frm.WriteLine(String.Format(" Intrinsic command executed {0} times in 1 second.", nTimes)); - - nTimes = 0; - cmd.CommandText = "SELECT lower('FOO')"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - frm.WriteLine(String.Format(" Intrin (txt) command executed {0} times in 1 second.", nTimes)); - - nTimes = 0; - cmd.CommandText = "SELECT 1"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - frm.WriteLine(String.Format(" Raw Value command executed {0} times in 1 second.", nTimes)); - } - } - - internal void IterationTest(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - int dtStart; - int dtEnd; - int nCount; - long n; - - cmd.CommandText = "SELECT Foo(ID, ID) FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (IDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - frm.WriteLine(String.Format(" User Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); - - cmd.CommandText = "SELECT ID FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (IDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - frm.WriteLine(String.Format(" Raw iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); - - cmd.CommandText = "SELECT ABS(ID) FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (IDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - frm.WriteLine(String.Format(" Intrinsic Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); - - } - } - - // Causes the user-defined aggregate to be iterated through - internal void UserAggregate(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - int dtStart; - int n = 0; - int nCount; - - cmd.CommandText = "SELECT MyCount(*) FROM TestCase"; - - nCount = 0; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - n = Convert.ToInt32(cmd.ExecuteScalar()); - nCount++; - } - if (n != 2003) throw new ArgumentOutOfRangeException("Unexpected count"); - frm.WriteLine(String.Format(" UserAggregate executed {0} times in 1 second.", nCount)); - } - } - - // Causes the user-defined collation sequence to be iterated through - internal void UserCollation(IDbConnection cnn) - { - using (IDbCommand cmd = cnn.CreateCommand()) - { - // Using a default collating sequence in descending order, "Param Field3" will appear at the top - // and "Field3" will be next, followed by a NULL. Our user-defined collating sequence will - // deliberately place them out of order so Field3 is first. - cmd.CommandText = "SELECT Field3 FROM TestCase ORDER BY Field3 COLLATE MYSEQUENCE DESC"; - string s = (string)cmd.ExecuteScalar(); - if (s != "Field3") throw new ArgumentOutOfRangeException("MySequence didn't sort properly"); - } - } - } -} +using System; +using System.Data.Common; +using System.Data; +using Community.CsharpSqlite.SQLiteClient; + +namespace test +{ + + /// + /// Scalar user-defined function. In this example, the same class is declared twice with + /// different function names to demonstrate how to use alias names for user-defined functions. + /// + //[SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)] + //[SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)] + class TestFunc// : SQLiteFunction + { + public object Invoke(object[] args) + { + if (args[0].GetType() != typeof(int)) return args[0]; + + int Param1 = Convert.ToInt32(args[0]); // First parameter + int Param2 = Convert.ToInt32(args[1]); // Second parameter + + return Param1 + Param2; + } + } + + /// + /// Aggregate user-defined function. Arguments = -1 means any number of arguments is acceptable + /// + // [SQLiteFunction(Name = "MyCount", Arguments = -1, FuncType = FunctionType.Aggregate)] + class MyCount //: SQLiteFunction + { + public void Step(object[] args, int nStep, ref object contextData) + { + if (contextData == null) + { + contextData = 1; + } + else + contextData = (int)contextData + 1; + } + + public object Final(object contextData) + { + return contextData; + } + } + + /// + /// User-defined collating sequence. + /// + //[SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)] + class MySequence // : SQLiteFunction + { + public int Compare(string param1, string param2) + { + // Make sure the string "Field3" is sorted out of order + if (param1 == "Field3") return 1; + if (param2 == "Field3") return -1; + return String.Compare(param1, param2); + } + } + + internal class TestCases + { + internal Test.WP.MainPage frm; + + internal void Run(IDbConnection cnn, Test.WP.MainPage frm2) + { + + frm = frm2; + // frm.Show(); + + frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString()); + try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); } + catch (Exception) { frm.WriteLine("FAIL - CreateTable"); } + + try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); } + catch (Exception) { frm.WriteLine("FAIL - DataType Test"); } + + //not enabled yet + //try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); } + //catch (Exception) { frm.WriteLine("FAIL - Full Text Search"); } + + //Not possible without datatable to reade the schema + //try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); } + //catch (Exception) { frm.WriteLine("FAIL - KeyInfo Fetch"); } + + try { InsertTable(cnn); frm.WriteLine("SUCCESS - InsertTable"); } + catch (Exception) { frm.WriteLine("FAIL - InsertTable"); } + + try { VerifyInsert(cnn); frm.WriteLine("SUCCESS - VerifyInsert"); } + catch (Exception) { frm.WriteLine("FAIL - VerifyInsert"); } + + try { CoersionTest(cnn); frm.WriteLine("FAIL - CoersionTest"); } + catch (Exception) { frm.WriteLine("SUCCESS - CoersionTest"); } + + try { ParameterizedInsert(cnn); frm.WriteLine("SUCCESS - ParameterizedInsert"); } + catch (Exception) { frm.WriteLine("FAIL - ParameterizedInsert"); } + + try { BinaryInsert(cnn); frm.WriteLine("SUCCESS - BinaryInsert"); } + catch (Exception) { frm.WriteLine("FAIL - BinaryInsert"); } + + try { VerifyBinaryData(cnn); frm.WriteLine("SUCCESS - VerifyBinaryData"); } + catch (Exception) { frm.WriteLine("FAIL - VerifyBinaryData"); } + + try { LockTest(cnn); frm.WriteLine("SUCCESS - LockTest"); } + catch (Exception) { frm.WriteLine("FAIL - LockTest"); } + + try { ParameterizedInsertMissingParams(cnn); frm.WriteLine("FAIL - ParameterizedInsertMissingParams"); } + catch (Exception) { frm.WriteLine("SUCCESS - ParameterizedInsertMissingParams"); } + + //try { InsertMany(cnn, false); frm.WriteLine("SUCCESS - InsertMany"); } + //catch (Exception) { frm.WriteLine("FAIL - InsertMany"); } + + //try { InsertMany(cnn, true); frm.WriteLine("SUCCESS - InsertManyWithIdentityFetch"); } + //catch (Exception) { frm.WriteLine("FAIL - InsertManyWithIdentityFetch"); } + + try { FastInsertMany(cnn); frm.WriteLine("SUCCESS - FastInsertMany"); } + catch (Exception) { frm.WriteLine("FAIL - FastInsertMany"); } + + //try { IterationTest(cnn); frm.WriteLine("SUCCESS - Iteration Test"); } + //catch (Exception) { frm.WriteLine("FAIL - Iteration Test"); } + + //try { UserFunction(cnn); frm.WriteLine("SUCCESS - UserFunction"); } + //catch (Exception) { frm.WriteLine("FAIL - UserFunction"); } + + //try { UserAggregate(cnn); frm.WriteLine("SUCCESS - UserAggregate"); } + //catch (Exception) { frm.WriteLine("FAIL - UserAggregate"); } + + //try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); } + //catch (Exception) { frm.WriteLine("FAIL - UserCollation"); } + + try { DropTable(cnn); frm.WriteLine("SUCCESS - DropTable"); } + catch (Exception) { frm.WriteLine("FAIL - DropTable"); } + + frm.WriteLine("\r\nTests Finished."); + } + + internal static void KeyInfoTest(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + // First test against integer primary key (optimized) keyinfo fetch + cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "Select * from keyinfotest"; + using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + if (reader.FieldCount != 3) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); + } + + cmd.CommandText = "SELECT MyValue FROM keyinfotest"; + using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + if (reader.FieldCount != 2) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); + } + + cmd.CommandText = "DROP TABLE keyinfotest"; + cmd.ExecuteNonQuery(); + + // Now test against non-integer primary key (unoptimized) subquery keyinfo fetch + cmd.CommandText = "Create table keyinfotest (id char primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "SELECT MyValue FROM keyinfotest"; + using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + if (reader.FieldCount != 2) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); + } + + cmd.CommandText = "Select * from keyinfotest"; + using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + if (reader.FieldCount != 3) throw new ArgumentOutOfRangeException("Wrong number of columns returned"); + } + + //// Make sure commandbuilder can generate an update command with the correct parameter count + //using (DbDataAdapter adp = new SQLiteDataAdapter()) + //using (DbCommandBuilder builder = new SQLiteCommandBuilder()) + //{ + // adp.SelectCommand = cmd; + // builder.DataAdapter = adp; + // builder.ConflictOption = ConflictOption.OverwriteChanges; + + // using (IDbCommand updatecmd = builder.GetUpdateCommand()) + // { + // if (updatecmd.Parameters.Count != 4) + // throw new ArgumentOutOfRangeException("Wrong number of parameters in update command!"); + // } + //} + } + } + + internal static void DataTypeTest(IDbConnection cnn) + { + DateTime now = DateTime.Now; + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "create table datatypetest(id integer primary key, myvalue, datetimevalue datetime, decimalvalue decimal)"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(?,?,?)"; + IDbDataParameter p1 = cmd.CreateParameter(); + IDbDataParameter p2 = cmd.CreateParameter(); + IDbDataParameter p3 = cmd.CreateParameter(); + + cmd.Parameters.Add(p1); + cmd.Parameters.Add(p2); + cmd.Parameters.Add(p3); + + p1.Value = 1; + p2.Value = DateTime.MinValue; + p3.Value = (Decimal)1.05; + cmd.ExecuteNonQuery(); + + //p1.ResetDbType(); + //p2.ResetDbType(); + //p3.ResetDbType(); + + p1.Value = "One"; + p2.Value = "2001-01-01"; + p3.Value = (float)1.123; + cmd.ExecuteNonQuery(); + + //p1.ResetDbType(); + //p2.ResetDbType(); + //p3.ResetDbType(); + + p1.Value = 1.01; + DateTime nw = now; + p2.Value = nw; + p3.Value = (Double )9.91; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest"; + using (IDataReader reader = cmd.ExecuteReader()) + { + for (int n = 0; n < 3; n++) + { + reader.Read(); + if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(2).GetType() != reader.GetDouble(2).GetType()) throw new ArgumentOutOfRangeException(); + + switch (n) + { + case 0: + if (reader.GetValue(0).GetType() != typeof(long)) throw new ArgumentOutOfRangeException(); + + if (reader.GetValue(0).Equals((long)1) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(1).Equals(DateTime.MinValue) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetDecimal(2).Equals((Decimal)1.05) == false) throw new ArgumentOutOfRangeException(); + + if (reader.GetInt64(0) != (long)1) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); + break; + case 1: + if (reader.GetValue(0).GetType() != typeof(string)) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(0).Equals("One") == false) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetFloat(2).Equals((float)1.123) == false) throw new ArgumentOutOfRangeException(); + + if (reader.GetString(0) != "One") throw new ArgumentOutOfRangeException(); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); + break; + case 2: + if (reader.GetValue(0).GetType() != typeof(double)) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(0).Equals(1.01) == false) throw new ArgumentOutOfRangeException(); + //Something weird comparing datetime values... + if (((DateTime)reader.GetValue(1)).ToString("s").Equals(nw.ToString("s")) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetDouble(2).Equals((Double)9.91) == false) throw new ArgumentOutOfRangeException(); + + if (reader.GetDouble(0) != 1.01) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException(); + if (reader.GetValue(2).Equals(reader.GetDouble(2)) == false) throw new ArgumentOutOfRangeException(); + break; + } + } + } + } + } + + internal static void FullTextTest(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS3(name, ingredients);"; + cmd.ExecuteNonQuery(); + + string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" }; + string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" }; + int n; + + cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);"; + IDbDataParameter name = cmd.CreateParameter(); + IDbDataParameter ingredient = cmd.CreateParameter(); + + name.ParameterName = "@name"; + ingredient.ParameterName = "@ingredient"; + + cmd.Parameters.Add(name); + cmd.Parameters.Add(ingredient); + + for (n = 0; n < names.Length; n++) + { + name.Value = names[n]; + ingredient.Value = ingredients[n]; + + cmd.ExecuteNonQuery(); + } + + cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';"; + + int[] rowids = { 3, 4 }; + n = 0; + + using (IDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + if (reader.GetInt64(0) != rowids[n++]) + throw new ArgumentException("Unexpected rowid returned"); + + if (n > rowids.Length) throw new ArgumentException("Too many rows returned"); + } + } + } + } + + internal void CreateTable(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)"; + //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)"; + cmd.ExecuteNonQuery(); + } + } + + internal void DropTable(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "DROP TABLE TestCase"; + cmd.ExecuteNonQuery(); + } + } + + internal void InsertTable(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(1, 3.14159, 'Field3', 'Field4', '2005-01-01 13:49:00')"; + cmd.ExecuteNonQuery(); + } + } + + internal void VerifyInsert(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5 FROM TestCase"; + cmd.Prepare(); + using (IDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read()) + { + long Field1 = rd.GetInt64(0); + double Field2 = rd.GetDouble(1); + string Field3 = rd.GetString(2); + string Field4 = rd.GetString(3).TrimEnd(); + DateTime Field5 = rd.GetDateTime(4); + + if (Field1 != 1) throw new ArgumentOutOfRangeException("Non-Match on Field1"); + if (Field2 != 3.14159) throw new ArgumentOutOfRangeException("Non-Match on Field2"); + if (Field3 != "Field3") throw new ArgumentOutOfRangeException("Non-Match on Field3"); + if (Field4 != "Field4") throw new ArgumentOutOfRangeException("Non-Match on Field4"); + if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new ArgumentOutOfRangeException("Non-Match on Field5"); + } + else throw new ArgumentOutOfRangeException("No data in table"); + } + } + } + + internal void CoersionTest(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase"; + using (IDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read()) + { + object Field1 = rd.GetInt32(0); + object Field2 = rd.GetDouble(1); + object Field3 = rd.GetString(2); + object Field4 = rd.GetString(3).TrimEnd(); + object Field5 = rd.GetDateTime(4); + + // The next statement should cause an exception + Field1 = rd.GetString(0); + Field2 = rd.GetString(1); + Field3 = rd.GetString(2); + Field4 = rd.GetString(3); + Field5 = rd.GetString(4); + + Field1 = rd.GetInt32(0); + Field2 = rd.GetInt32(1); + Field3 = rd.GetInt32(2); + Field4 = rd.GetInt32(3); + Field5 = rd.GetInt32(4); + + Field1 = rd.GetDecimal(0); + Field2 = rd.GetDecimal(1); + Field3 = rd.GetDecimal(2); + Field4 = rd.GetDecimal(3); + Field5 = rd.GetDecimal(4); + } + else throw new ArgumentOutOfRangeException("No data in table"); + } + } + } + + internal void ParameterizedInsert(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)"; + IDbDataParameter Field1 = cmd.CreateParameter(); + IDbDataParameter Field2 = cmd.CreateParameter(); + IDbDataParameter Field3 = cmd.CreateParameter(); + IDbDataParameter Field4 = cmd.CreateParameter(); + IDbDataParameter Field5 = cmd.CreateParameter(); + + Field1.Value = 2; + Field2.Value = 3.14159; + Field3.Value = "Param Field3"; + Field4.Value = "Field4 Par"; + Field5.Value = DateTime.Now; + + cmd.Parameters.Add(Field1); + cmd.Parameters.Add(Field2); + cmd.Parameters.Add(Field3); + cmd.Parameters.Add(Field4); + cmd.Parameters.Add(Field5); + + cmd.ExecuteNonQuery(); + } + } + + internal void BinaryInsert(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field6) VALUES(?)"; + IDbDataParameter Field6 = cmd.CreateParameter(); + + byte[] b = new byte[4000]; + b[0] = 1; + b[100] = 2; + b[1000] = 3; + b[2000] = 4; + b[3000] = 5; + + Field6.Value = b; + + cmd.Parameters.Add(Field6); + + cmd.ExecuteNonQuery(); + } + } + + internal void VerifyBinaryData(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; + byte[] b = new byte[4000]; + + using (IDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read() == false) throw new ArgumentOutOfRangeException(); + + rd.GetBytes(0, 0, b, 0, 4000); + + if (b[0] != 1) throw new ArgumentException(); + if (b[100] != 2) throw new ArgumentException(); + if (b[1000] != 3) throw new ArgumentException(); + if (b[2000] != 4) throw new ArgumentException(); + if (b[3000] != 5) throw new ArgumentException(); + } + } + } + + internal static void LockTest(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; + byte[] b = new byte[4000]; + + using (IDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read() == false) throw new ArgumentOutOfRangeException(); + + rd.GetBytes(0, 0, b, 0, 4000); + + if (b[0] != 1) throw new ArgumentException(); + if (b[100] != 2) throw new ArgumentException(); + if (b[1000] != 3) throw new ArgumentException(); + if (b[2000] != 4) throw new ArgumentException(); + if (b[3000] != 5) throw new ArgumentException(); + + using (IDbConnection clone = (IDbConnection)((ICloneable)cnn).Clone()) + { + using (IDbCommand newcmd = clone.CreateCommand()) + { + newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL"; + newcmd.CommandTimeout = 2; + int cmdStart = Environment.TickCount; + int cmdEnd; + + try + { + newcmd.ExecuteNonQuery(); // should fail because there's a reader on the database + throw new ArgumentException(); // If we got here, the test failed + } + catch + { + cmdEnd = Environment.TickCount; + //TODO: commandtimeout and retry on lock. + //if (cmdEnd - cmdStart < 2000 || cmdEnd - cmdStart > 3000) + //throw new ArgumentException(); // Didn't wait the right amount of time + } + } + } + } + } + } + + internal void ParameterizedInsertMissingParams(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)"; + IDbDataParameter Field1 = cmd.CreateParameter(); + IDbDataParameter Field2 = cmd.CreateParameter(); + IDbDataParameter Field3 = cmd.CreateParameter(); + IDbDataParameter Field4 = cmd.CreateParameter(); + IDbDataParameter Field5 = cmd.CreateParameter(); + + Field1.DbType = System.Data.DbType.Int32; + + Field1.Value = 2; + Field2.Value = 3.14159; + Field3.Value = "Field3 Param"; + Field4.Value = "Field4 Par"; + Field5.Value = DateTime.Now; + + cmd.Parameters.Add(Field1); + cmd.Parameters.Add(Field2); + cmd.Parameters.Add(Field3); + cmd.Parameters.Add(Field4); + + // Assertion here, not enough parameters + cmd.ExecuteNonQuery(); + } + } + + // Utilizes the SQLiteCommandBuilder, which in turn utilizes SQLiteDataReader's GetSchemaTable() functionality + //internal void InsertMany(IDbConnection cnn, bool bWithIdentity) + //{ + // int nmax = 1000; + + // using (IDbTransaction dbTrans = cnn.BeginTransaction()) + // { + // using (DbDataAdapter adp = new SQLiteDataAdapter()) + // { + // using (IDbCommand cmd = cnn.CreateCommand()) + // { + // cmd.Transaction = dbTrans; + // cmd.CommandText = "SELECT * FROM TestCase WHERE 1=2"; + // adp.SelectCommand = cmd; + + // using (DbCommandBuilder bld = new SQLiteCommandBuilder()) + // { + // bld.DataAdapter = adp; + // using (adp.InsertCommand = (SQLiteCommand)((ICloneable)bld.GetInsertCommand()).Clone()) + // { + // bld.DataAdapter = null; + // if (bWithIdentity) + // { + // adp.InsertCommand.CommandText += ";SELECT last_insert_rowid() AS [ID]"; + // adp.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; + // } + + // using (DataTable tbl = new DataTable()) + // { + // adp.Fill(tbl); + // for (int n = 0; n < nmax; n++) + // { + // DataRow row = tbl.NewRow(); + // row[1] = n + nmax; + // tbl.Rows.Add(row); + // } + + // frm.Write(String.Format(" InsertMany{0} ({1} rows) Begins ... ", (bWithIdentity == true) ? "WithIdentityFetch" : " ", nmax)); + // int dtStart = Environment.TickCount; + // adp.Update(tbl); + // int dtEnd = Environment.TickCount; + // dtEnd -= dtStart; + // frm.Write(String.Format("Ends in {0} ms ... ", (dtEnd))); + + // dtStart = Environment.TickCount; + // dbTrans.Commit(); + // dtEnd = Environment.TickCount; + // dtEnd -= dtStart; + // frm.WriteLine(String.Format("Commits in {0} ms", (dtEnd))); + // } + // } + // } + // } + // } + // } + //} + + internal void FastInsertMany(IDbConnection cnn) + { + using (IDbTransaction dbTrans = cnn.BeginTransaction()) + { + int dtStart; + int dtEnd; + + using (IDbCommand cmd = cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1) VALUES(?)"; + IDbDataParameter Field1 = cmd.CreateParameter(); + + cmd.Parameters.Add(Field1); + + frm.WriteLine("Fast insert using parameters and prepared "); + frm.WriteLine("statement-> (10,000 rows) Begins ... "); + dtStart = Environment.TickCount; + for (int n = 0; n < 10000; n++) + { + Field1.Value = n + 100000; + cmd.ExecuteNonQuery(); + } + + dtEnd = Environment.TickCount; + dtEnd -= dtStart; + frm.WriteLine(" -> Ends in "+dtEnd+" ms ... "); + } + + dtStart = Environment.TickCount; + dbTrans.Rollback(); + dtEnd = Environment.TickCount; + dtEnd -= dtStart; + frm.WriteLine("Rolled back in " + dtEnd + " ms"); + } + } + + // Causes the user-defined function to be called + internal void UserFunction(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT Foo('ee','foo')"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + frm.WriteLine(String.Format(" User (text) command executed {0} times in 1 second.", nTimes)); + + nTimes = 0; + cmd.CommandText = "SELECT Foo(10,11)"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + frm.WriteLine(String.Format(" UserFunction command executed {0} times in 1 second.", nTimes)); + + nTimes = 0; + cmd.CommandText = "SELECT ABS(1)"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + frm.WriteLine(String.Format(" Intrinsic command executed {0} times in 1 second.", nTimes)); + + nTimes = 0; + cmd.CommandText = "SELECT lower('FOO')"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + frm.WriteLine(String.Format(" Intrin (txt) command executed {0} times in 1 second.", nTimes)); + + nTimes = 0; + cmd.CommandText = "SELECT 1"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + frm.WriteLine(String.Format(" Raw Value command executed {0} times in 1 second.", nTimes)); + } + } + + internal void IterationTest(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + int dtStart; + int dtEnd; + int nCount; + long n; + + cmd.CommandText = "SELECT Foo(ID, ID) FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (IDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + frm.WriteLine(String.Format(" User Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); + + cmd.CommandText = "SELECT ID FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (IDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + frm.WriteLine(String.Format(" Raw iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); + + cmd.CommandText = "SELECT ABS(ID) FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (IDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + frm.WriteLine(String.Format(" Intrinsic Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart))); + + } + } + + // Causes the user-defined aggregate to be iterated through + internal void UserAggregate(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + int dtStart; + int n = 0; + int nCount; + + cmd.CommandText = "SELECT MyCount(*) FROM TestCase"; + + nCount = 0; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + n = Convert.ToInt32(cmd.ExecuteScalar()); + nCount++; + } + if (n != 2003) throw new ArgumentOutOfRangeException("Unexpected count"); + frm.WriteLine(String.Format(" UserAggregate executed {0} times in 1 second.", nCount)); + } + } + + // Causes the user-defined collation sequence to be iterated through + internal void UserCollation(IDbConnection cnn) + { + using (IDbCommand cmd = cnn.CreateCommand()) + { + // Using a default collating sequence in descending order, "Param Field3" will appear at the top + // and "Field3" will be next, followed by a NULL. Our user-defined collating sequence will + // deliberately place them out of order so Field3 is first. + cmd.CommandText = "SELECT Field3 FROM TestCase ORDER BY Field3 COLLATE MYSEQUENCE DESC"; + string s = (string)cmd.ExecuteScalar(); + if (s != "Field3") throw new ArgumentOutOfRangeException("MySequence didn't sort properly"); + } + } + } +} diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.csproj b/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.csproj index 2d39362..2490666 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.csproj +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.csproj @@ -1,166 +1,166 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603} - Library - Properties - Community.CsharpSqlite.SQLiteClient.WinRT - Community.CsharpSqlite.SQLiteClient.WinRT - en-US - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NETFX_CORE;SQLITE_WINRT - prompt - 4 - 0168;0169;0414;0618;0649 - - - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE;SQLITE_WINRT - prompt - 4 - 0168;0169;0414;0618;0649 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - ExpressRules.ruleset - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - ExpressRules.ruleset - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - ExpressRules.ruleset - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - ExpressRules.ruleset - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - ExpressRules.ruleset - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - ExpressRules.ruleset - true - - - - - {5fe98adc-4a6f-4a74-8a6b-7f33ea020058} - Community.CsharpSqlite.WinRT - - - {6191a053-0255-4509-b7c0-11c6c3d4e66b} - System.Data.Ersatz.WinRT - - - - - src\SqliteCommand.cs - Code - - - src\SqliteConnection.cs - Code - - - src\SqliteDataReader.cs - Code - - - src\SqliteError.cs - Code - - - src\SqliteExceptions.cs - Code - - - src\SqliteParameter.cs - Code - - - src\SqliteParameterCollection.cs - Code - - - src\SqliteTransaction.cs - Code - - - - - 11.0 - - - + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603} + Library + Properties + Community.CsharpSqlite.SQLiteClient.WinRT + Community.CsharpSqlite.SQLiteClient.WinRT + en-US + 512 + {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + TRACE;DEBUG;NETFX_CORE;SQLITE_WINRT + prompt + 4 + 0168;0169;0414;0618;0649 + + + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE;SQLITE_WINRT + prompt + 4 + 0168;0169;0414;0618;0649 + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + ARM + false + prompt + ExpressRules.ruleset + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + ARM + false + prompt + ExpressRules.ruleset + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x64 + false + prompt + ExpressRules.ruleset + true + + + bin\x64\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x64 + false + prompt + ExpressRules.ruleset + true + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x86 + false + prompt + ExpressRules.ruleset + true + + + bin\x86\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x86 + false + prompt + ExpressRules.ruleset + true + + + + + {5fe98adc-4a6f-4a74-8a6b-7f33ea020058} + Community.CsharpSqlite.WinRT + + + {6191a053-0255-4509-b7c0-11c6c3d4e66b} + System.Data.Ersatz.WinRT + + + + + src\SqliteCommand.cs + Code + + + src\SqliteConnection.cs + Code + + + src\SqliteDataReader.cs + Code + + + src\SqliteError.cs + Code + + + src\SqliteExceptions.cs + Code + + + src\SqliteParameter.cs + Code + + + src\SqliteParameterCollection.cs + Code + + + src\SqliteTransaction.cs + Code + + + + + 11.0 + + + \ No newline at end of file diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.sln b/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.sln index 017f563..c263e33 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.sln +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/Community.CsharpSqlite.SQLiteClient.WinRT.sln @@ -1,74 +1,74 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 11 Express for Windows 8 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WinRT", "Community.CsharpSqlite.SQLiteClient.WinRT.csproj", "{7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinRT", "..\Community.CsharpSqlite.WinRT\Community.CsharpSqlite.WinRT.csproj", "{5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.WinRT", "..\System.Data.Ersatz\WinRT\System.Data.Ersatz.WinRT.csproj", "{6191A053-0255-4509-B7C0-11C6C3D4E66B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|ARM.ActiveCfg = Debug|ARM - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|ARM.Build.0 = Debug|ARM - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x64.ActiveCfg = Debug|x64 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x64.Build.0 = Debug|x64 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x86.ActiveCfg = Debug|x86 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x86.Build.0 = Debug|x86 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|ARM.ActiveCfg = Release|ARM - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|ARM.Build.0 = Release|ARM - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|Any CPU.Build.0 = Release|Any CPU - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x64.ActiveCfg = Release|x64 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x64.Build.0 = Release|x64 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x86.ActiveCfg = Release|x86 - {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x86.Build.0 = Release|x86 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|ARM.ActiveCfg = Debug|ARM - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|ARM.Build.0 = Debug|ARM - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x64.ActiveCfg = Debug|x64 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x64.Build.0 = Debug|x64 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x86.ActiveCfg = Debug|x86 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x86.Build.0 = Debug|x86 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|ARM.ActiveCfg = Release|ARM - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|ARM.Build.0 = Release|ARM - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|Any CPU.Build.0 = Release|Any CPU - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x64.ActiveCfg = Release|x64 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x64.Build.0 = Release|x64 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x86.ActiveCfg = Release|x86 - {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x86.Build.0 = Release|x86 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|ARM.ActiveCfg = Debug|ARM - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|ARM.Build.0 = Debug|ARM - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x64.ActiveCfg = Debug|x64 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x64.Build.0 = Debug|x64 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x86.ActiveCfg = Debug|x86 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x86.Build.0 = Debug|x86 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|ARM.ActiveCfg = Release|ARM - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|ARM.Build.0 = Release|ARM - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|Any CPU.Build.0 = Release|Any CPU - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x64.ActiveCfg = Release|x64 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x64.Build.0 = Release|x64 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x86.ActiveCfg = Release|x86 - {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 11 Express for Windows 8 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.SQLiteClient.WinRT", "Community.CsharpSqlite.SQLiteClient.WinRT.csproj", "{7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite.WinRT", "..\Community.CsharpSqlite.WinRT\Community.CsharpSqlite.WinRT.csproj", "{5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Ersatz.WinRT", "..\System.Data.Ersatz\WinRT\System.Data.Ersatz.WinRT.csproj", "{6191A053-0255-4509-B7C0-11C6C3D4E66B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|ARM.ActiveCfg = Debug|ARM + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|ARM.Build.0 = Debug|ARM + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x64.ActiveCfg = Debug|x64 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x64.Build.0 = Debug|x64 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x86.ActiveCfg = Debug|x86 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Debug|x86.Build.0 = Debug|x86 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|ARM.ActiveCfg = Release|ARM + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|ARM.Build.0 = Release|ARM + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|Any CPU.Build.0 = Release|Any CPU + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x64.ActiveCfg = Release|x64 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x64.Build.0 = Release|x64 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x86.ActiveCfg = Release|x86 + {5FE98ADC-4A6F-4A74-8A6B-7F33EA020058}.Release|x86.Build.0 = Release|x86 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|ARM.ActiveCfg = Debug|ARM + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|ARM.Build.0 = Debug|ARM + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x64.ActiveCfg = Debug|x64 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x64.Build.0 = Debug|x64 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x86.ActiveCfg = Debug|x86 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Debug|x86.Build.0 = Debug|x86 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|ARM.ActiveCfg = Release|ARM + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|ARM.Build.0 = Release|ARM + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|Any CPU.Build.0 = Release|Any CPU + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x64.ActiveCfg = Release|x64 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x64.Build.0 = Release|x64 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x86.ActiveCfg = Release|x86 + {6191A053-0255-4509-B7C0-11C6C3D4E66B}.Release|x86.Build.0 = Release|x86 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|ARM.ActiveCfg = Debug|ARM + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|ARM.Build.0 = Debug|ARM + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x64.ActiveCfg = Debug|x64 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x64.Build.0 = Debug|x64 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x86.ActiveCfg = Debug|x86 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Debug|x86.Build.0 = Debug|x86 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|ARM.ActiveCfg = Release|ARM + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|ARM.Build.0 = Release|ARM + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|Any CPU.Build.0 = Release|Any CPU + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x64.ActiveCfg = Release|x64 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x64.Build.0 = Release|x64 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x86.ActiveCfg = Release|x86 + {7FD8D34E-59D8-4BE4-B2FF-2A9F053A6603}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml index df3935f..39201c0 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml.cs b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml.cs index dd82384..c983988 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml.cs +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/App.xaml.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 - -namespace MetroSQLiteClientTest2 -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - sealed partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - this.Suspending += OnSuspending; - } - - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used when the application is launched to open a specific file, to display - /// search results, and so forth. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs args) - { - // Do not repeat app initialization when already running, just ensure that - // the window is active - if (args.PreviousExecutionState == ApplicationExecutionState.Running) - { - Window.Current.Activate(); - return; - } - - if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: Load state from previously suspended application - } - - // Create a Frame to act navigation context and navigate to the first page - var rootFrame = new Frame(); - if (!rootFrame.Navigate(typeof(MainPage))) - { - throw new Exception("Failed to create initial page"); - } - - // Place the frame in the current Window and ensure that it is active - Window.Current.Content = rootFrame; - Window.Current.Activate(); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - deferral.Complete(); - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +namespace MetroSQLiteClientTest2 +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used when the application is launched to open a specific file, to display + /// search results, and so forth. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + // Do not repeat app initialization when already running, just ensure that + // the window is active + if (args.PreviousExecutionState == ApplicationExecutionState.Running) + { + Window.Current.Activate(); + return; + } + + if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Create a Frame to act navigation context and navigate to the first page + var rootFrame = new Frame(); + if (!rootFrame.Navigate(typeof(MainPage))) + { + throw new Exception("Failed to create initial page"); + } + + // Place the frame in the current Window and ensure that it is active + Window.Current.Content = rootFrame; + Window.Current.Activate(); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/Common/StandardStyles.xaml b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/Common/StandardStyles.xaml index 1937eb7..81fb398 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/Common/StandardStyles.xaml +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/Common/StandardStyles.xaml @@ -1,1007 +1,1007 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mouse - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/MainPage.xaml b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/MainPage.xaml index 9db6ff8..84d234f 100644 --- a/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/MainPage.xaml +++ b/Community.CsharpSqlite.SQLiteClient.WinRT/MetroSQLiteClientTest2/MainPage.xaml @@ -1,34 +1,34 @@ - - - - - - - - - - - - - - - - - -