Showing posts with label SQLite. Show all posts
Showing posts with label SQLite. Show all posts

2013/05/20

SQLite Release 3.7.17

SQLite 버전이 업데이트 되었다.


SQLite Release 3.7.17 On 2013-05-20 (3.7.17)


  • Add support for memory-mapped I/O.

  • Add the sqlite3_strglob() convenience interface.

  • Assigned the integer at offset 68 in the database header as the
    Application ID for when SQLite is used as an application file-format.
    Added the PRAGMA application_id command to query and set the Application ID.

  • Report rollback recovery in the error log as SQLITE_NOTICE_RECOVER_ROLLBACK.
    Change the error log code for WAL recover from
    SQLITE_OK to SQLITE_NOTICE_RECOVER_WAL.

  • Report the risky uses of unlinked database files and
    database filename aliasing as SQLITE_WARNING messages in the error log.

  • Added the SQLITE_TRACE_SIZE_LIMIT compile-time option.

  • Increase the default value of SQLITE_MAX_SCHEMA_RETRY to 50 and make sure
    that it is honored in every place that a schema change might force a statement
    retry.

  • Add a new test harness called "mptester" used to verify correct operation
    when multiple processes are using the same database file at the same time.

  • Enhance the extension loading mechanism to be more flexible (while
    still maintaining backwards compatibility) in two ways:

    1. If the default entry point "sqlite3_extension_init" is not present in
      the loadable extension, also try an entry point "sqlite3_X_init" where
      "X" is based on the shared library filename. This allows every extension
      to have a different entry point, which allows them to be statically linked
      with no code changes.

    2. The shared library filename passed to sqlite3_load_extension() may
      omit the filename suffix, and an appropriate architecture-dependent
      suffix (".so", ".dylib", or ".dll") will be added automatically.



  • Added many new loadable extensions to the source tree, including
    amatch, closure, fuzzer, ieee754, nextchar, regexp, spellfix,
    and wholenumber. See header comments on each extension source file
    for further information about what that extension does.

  • Enhance FTS3 to avoid using excess stack space when there are a huge
    number of terms on the right-hand side of the MATCH operator. A side-effect
    of this change is that the MATCH operator can only accommodate 12 NEAR
    operators at a time.

  • Enhance the fts4aux virtual table so that it can be a TEMP table.

  • Added the fts3tokenize virtual table to the full-text search logic.

  • Query planner enhancement: Use the transitive property of constraints
    to move constraints into the outer loops of a join whenever possible,
    thereby reducing the amount of work that needs to occur in inner loops.

  • Discontinue the use of posix_fallocate() on unix, as it does not work on all
    filesystems.

  • Improved tracing and debugging facilities in the Windows VFS.

  • Bug fix: Fix a potential database corruption bug
    in shared cache mode when one
    database connection is closed while another is in the middle of a write
    transaction.
    Ticket e636a050b7

  • Bug fix:
    Only consider AS names from the result set as candidates for resolving
    identifiers in the WHERE clause if there are no other matches. In the
    ORDER BY clause, AS names take priority over any column names.
    Ticket 2500cdb9be05

  • Bug fix: Do not allow a virtual table to cancel the ORDER BY clause unless
    all outer loops are guaranteed to return no more than one row result.
    Ticket ba82a4a41eac1.

  • Bug fix: Do not suppress the ORDER BY clause on a virtual table query if
    an IN constraint is used.
    Ticket f69b96e3076e.

  • Bug fix: The command-line shell gives an exit code of 0 when terminated
    using the ".quit" command.

  • Bug fix: Make sure PRAGMA statements appear in sqlite3_trace() output.

  • Bug fix: When a compound query that uses an ORDER BY clause
    with a COLLATE operator, make sure that the sorting occurs
    according to the specified collation and that the comparisons associate with
    the compound query use the native collation. Ticket
    6709574d2a8d8.

  • Bug fix: Makes sure the authorizer callback gets
    a valid pointer to the string "ROWID" for the column-name parameter when
    doing an UPDATE that changes the rowid. Ticket
    0eb70d77cb05bb2272

  • Bug fix: Do not move WHERE clause terms inside OR expressions that are
    contained within an ON clause of a LEFT JOIN. Ticket
    f2369304e4

  • Bug fix: Make sure an error is always reported when attempting to preform
    an operation that requires a collating sequence that is missing.
    Ticket 0fc59f908b


  • SQLITE_SOURCE_ID:
    "2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668"

  • SHA1 for sqlite3.c: 246987605d0503c700a08b9ee99a6b5d67454aab


    Original Post : http://neodreamer-dev.tistory.com/710
  • 2013/01/30

    SQLite Memory DB 속도 테스트

    SQLite 를 이용하여 데이터를 저장하는데 속도 문제가 고민이 되어 Memory DB를 테스트 해 보았다.



    SQLite 를 이용하여 10만개 레코드를 Insert하고 Update 해 보았다.



    테스트를 한 시스템은 Intel Core2Quad CPU Q9550 2.83GHz 이다.



    결과는 Update는 차이가 없었지만 Memory DB가 SSD에 비해 15배, HDD에 비해 19배 빠른 결과가 나왔다. 
     

    MemoryDB 

    MemoryDB Insert: 276.685ms

    MemoryDB Update: 4.503ms




    SSD

    SDD 100000 Insert: 4268.289ms

    SDD 100000 Update: 4.685ms




    HDD

    HDD 100000 Insert: 5302.730ms

    HDD 100000 Update: 5.745ms



    Memory DB를  활용하면 좀 더 빠르게 데이터를 저장할 수 있을 것 같다.



    Memory DB에 올려진 데이터는 백업 함수를 이용하면 쉽고 빠르게 파일로 저장할 수 있다.



    Memory DB와 File DB를 연 상태에서 아래 코드를 수행하면 된다. 

    sqlite3_backup* pBackup = NULL;
    watch.Begin();
    pBackup = sqlite3_backup_init( pFileDB, "main", pMemDB, "main" );
    if ( pBackup )
    {
    sqlite3_backup_step( pBackup, -1 );
    sqlite3_backup_finish( pBackup );
    }


    <

    Original Post : http://neodreamer-dev.tistory.com/695

    2012/09/05

    SQLite Release 3.7.14

    SQLite Release 3.7.14 On 2012-09-03 (3.7.14)

    • Drop built-in support for OS/2. If you need to upgrade an OS/2 application to use this or a later version of SQLite, then add an application-defined VFS using the sqlite3_vfs_register() interface. The code removed in this release can serve as a baseline for the application-defined VFS.

    • Ensure that floating point values are preserved exactly when reconstructing a database from the output of the ".dump" command of the command-line shell.

    • Added the sqlite3_close_v2() interface.

    • Updated the command-line shell so that it can be built using SQLITE_OMIT_FLOATING_POINT and SQLITE_OMIT_AUTOINIT.

    • Improvements to the windows makefiles and build processes.

    • Enhancements to PRAGMA integrity_check and PRAGMA quick_check so that they can optionally check just a single attached database instead of all attached databases.

    • Enhancements to WAL mode processing that ensure that at least one valid read-mark is available at all times, so that read-only processes can always read the database.

    • Performance enhancements in the sorter used by ORDER BY and CREATE INDEX.

    • Added the SQLITE_DISABLE_FTS4_DEFERRED compile-time option.

    • Better handling of aggregate queries where the aggregate functions are contained within subqueries.

    • Enhance the query planner so that it will try to use a covering index on queries that make use of or optimization.

    • SQLITE_SOURCE_ID: "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a"

    • SHA1 for sqlite3.c: 5fdf596b29bb426001f28b488ff356ae14d5a5a6


    SQLite 3.7.14 Release Note<

    Original Post : http://neodreamer-dev.tistory.com/679

    2012/06/15

    SQLite Release 3.7.13

    SQLite 가 버전업을 하였다.

    이번 배포판부터는 Metro style 응용프로그램을 위한 WinRT API 를 사용한 Dll 파일을 배포하고 있다.




    SQLite Release 3.7.13 On 2012-06-11 (3.7.13)


    • In-memory databases that are specified using URI filenames are allowed to use shared cache, so that the same in-memory database can be accessed from multiple database connections.

    • Recognize and use the mode=memory query parameter in URI filenames.

    • Avoid resetting the schema of shared cache connections when any one connection closes. Instead, wait for the last connection to close before reseting the schema.

    • In the RTREE extension, when rounding 64-bit floating point numbers to 32-bit for storage, always round in a direction that causes the bounding box to get larger.

    • Adjust the unix driver to avoid unnecessary calls to fchown().

    • Add interfaces sqlite3_quota_ferror() and sqlite3_quota_file_available() to the test_quota.c module.

    • The sqlite3_create_module() and sqlite3_create_module_v2() interfaces return SQLITE_MISUSE on any attempt to overload or replace a virtual table module. The destructor is always called in this case, in accordance with historical and current documentation.

    • SQLITE_SOURCE_ID: "2012-06-11 02:05:22 f5b5a13f7394dc143aa136f1d4faba6839eaa6dc"

    • SHA1 for sqlite3.c: ff0a771d6252545740ba9685e312b0e3bb6a641b



    SQLite Homepage&

    Original Post : http://neodreamer-dev.tistory.com/661

    2012/05/24

    SQLite Release 3.7.12.1

    SQLite 가 3.7.12 버전을 공개한지 얼마 되지 않아 다시 3.7.12.1 버전을 공개하였다.



    SQLite Release 3.7.12.1 On 2012 May 22 (3.7.12.1)

    • Fix a bug (ticket c2ad16f997) in the 3.7.12 release that can cause a segfault for certain obscure nested aggregate queries.

    • Fix various other minor test script problems.

    • SQLITE_SOURCE_ID: "2012-05-22 02:45:53 6d326d44fd1d626aae0e8456e5fa2049f1ce0789"

    • SHA1 for sqlite3.c: d494e8d81607f0515d4f386156fb0fd86d5ba7df

    SQLite Homepage

    SQLite Download pag

    Original Post :
    http://neodreamer-dev.tistory.com/656

    2012/05/16

    SQLite Release 3.7.12

    Release 3.7.12 On 2012 May 14



    • Add the SQLITE_DBSTATUS_CACHE_WRITE option for sqlite3_db_status().

    • Optimize the typeof() and length() SQL functions so that they avoid unnecessary reading of database content from disk.

    • Add the FTS4 "merge" command, the FTS4 "automerge" command, and the FTS4 "integrity-check" command.

    • Report the name of specific CHECK constraints that fail.

    • In the command-line shell, use popen() instead of fopen() if the first character of the argument to the ".output" command is "|".

    • Make use of OVERLAPPED in the windows VFS to avoid some system calls and thereby obtain a performance improvement.

    • More aggressive optimization of the AND operator when one side or the other is always false.

    • Improved performance of queries with many OR-connected terms in the WHERE clause that can all be indexed.

    • Add the SQLITE_RTREE_INT_ONLY compile-time option to force the R*Tree Extension Module to use integer instead of floating point values for both storage and computation.

    • Enhance the PRAGMA integrity_check command to use much less memory when processing multi-gigabyte databases.

    • New interfaces added to the test_quota.c add-on module.

    • Added the ".trace" dot-command to the command-line shell.

    • Allow virtual table constructors to be invoked recursively.

    • Improved optimization of ORDER BY clauses on compound queries.

    • Improved optimization of aggregate subqueries contained within an aggregate query.

    • Bug fix: Fix the RELEASE command so that it does not cancel pending queries. This repairs a problem introduced in 3.7.11.

    • Bug fix: Do not discard the DISTINCT as superfluous unless a subset of the result set is subject to a UNIQUE constraint and it none of the columns in that subset can be NULL. Ticket 385a5b56b9.

    • Bug fix: Do not optimize away an ORDER BY clause that has the same terms as a UNIQUE index unless those terms are also NOT NULL. Ticket 2a5629202f.

    • SQLITE_SOURCE_ID: "2012-05-14 01:41:23 8654aa9540fe9fd210899d83d17f3f407096c004"

    • SHA1 for sqlite3.c: 57e2104a0f7b3f528e7f6b7a8e553e2357ccd2e1





    SQLite 3 Homepage

    SQLite 3 Download Page&

    Original Post : http://neodreamer-dev.tistory.com/652

    2012/02/06

    Visual C++ 2005 와 SQLite 3.7.10

    SQLite 가 공개가 되면 프로젝트에 사용적용하기 위해 64비트용 dll과 static 라이브러리를 만들었다.

    그런데 이번 3.7.10 버전은 Visual C++ 2005 버전에서 컴파일은 문제 없으나 데이터베이스 생성시 런타임 에러가 발생하였다. Visual C++ 2010 버전에서는 문제가 발생하지 않았다.

    amalgamation 을 이용하여 SQLite를 프로젝트에 포함을 시켜도 증상은 동일하였다.



    관련 정보를 찾아보다가 그 원인과 해결책을 찾았다.

    참고가 된 정보는 
    http://www.sqlite.org/src/info/1ce4d21d52  이다. 

    Visual C++ 2005 버전에서는 _WIN32_WINNT 가 기본적으로 정의가 되지 않아 sqlite3.c 컴파일 때 Window로 인식하하지 않아 런타임 에러가 발생하는 것이였다.



    해결책은 sqlite3.c 파일을 수정하면 된다.

    수정해야할 내용은 문제의 정보가 있는
    http://www.sqlite.org/src/info/1ce4d21d52 있는 방법대로


    #if defined(_WIN32_WINNT)


    # define SQLITE_OS_WINNT 1


    #else


    # define SQLITE_OS_WINNT 0

    #endif



    부분을 아래 내용을 바꾸면 된다. 


    #if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)


    # define SQLITE_OS_WINNT 1

    #endif 



    더 간단한 방법은 sqlite3.c 가장 윗줄에 _WIN32_WINNT 을 define 해주면 된다.

    #define _WIN32_WINNT 0x0500 &

    Original Post : http://neodreamer-dev.tistory.com/637

    2012/02/05

    Visual C++ 프로젝트에 SQLite 포함시키기

    SQLite 는 32비트 Dll 형태로 기본 배포가 되고 있다.

    하지만 프로젝트를 진행함에 있어 다양한 환경에 접하게 된다. 요즘은 64비트 프로젝트로 일반화 되어 있어 32비트 Dll 만드로는 부족한 것이 많다.



    이전에는 64비트 프로젝트에서 사용하기 위해 별도의 Dll 이나 Static Library 만들어 사용 하였다.

    하지만 굳이 그렇게 별도의 라이브러리를 만들지 않아도 쉽게 프로젝트에 SQLite 를 포함 시킬 수 있다.



    SQLite 사이트에서 배포하는 amalgamation 소스를 이용하면 된다.

    프로젝트에 원하는 SQLite 버전의 amalgamation 소스를 추가 한다. 추가되는 파일은 아래 4개 파일 이다.


    shell.c


    sqlite3.c


    sqlite3.h


    sqlite3ext.h



    이 파일들 중에서 sqlite3.c 와 sqlite3.h 파일을 이용하게 된다.

    프로젝트를 컴파일 하면 아래와 같은 에러 메시지를 만나게 된다.

    Error 1 error C1853: 'x64\Debug\xxx.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)


    sqlite3.c 파일이 C로 작성이 되어 Precompiled Header 를 지원하지 않는다. 따라서 Precompiled Header를 사용하지 않도록 해야 하는데 프로젝트 전반적으로 설정할 경우 컴파일 속도에 많은 문제가 되므로 sqlite3.c 파일만 Precompiled Header를 사용하지 않도록 설정한다.

    방법은 Solution Explorer 에서 sqlite3.c 파일을 선택하고 속성창을 실행해서 Precompiled Header를 사용하지 않음으로 설정하고 컴파일 하면 된다.

     &

    Original Post : http://neodreamer-dev.tistory.com/636

    2011/11/02

    SQLite 3.7.9 Release (include Library)

    SQLite Release 3.7.9 On 2011 November 1 (3.7.9)

    • If a search token (on the right-hand side of the MATCH operator) in FTS4 begins with "^" then that token must be the first in its field of the document. ** Potentially Incompatible Change **

    • Added options SQLITE_DBSTATUS_CACHE_HIT and SQLITE_DBSTATUS_CACHE_MISS to the sqlite3_db_status() interface.

    • Removed support for SQLITE_ENABLE_STAT2, replacing it with the much more capable SQLITE_ENABLE_STAT3 option.

    • Enhancements to the sqlite3_analyzer utility program, including the --pageinfo and --stats options and support for multiplexed databases.

    • Enhance the sqlite3_data_count() interface so that it can be used to determine if SQLITE_DONE has been seen on the prepared statement.

    • Added the SQLITE_FCNTL_OVERWRITE file-control by which the SQLite core indicates to the VFS that the current transaction will overwrite the entire database file.

    • Increase the default lookaside memory allocator allocation size from 100 to 128 bytes.

    • Enhanced the query planner so that it can factor terms in and out of OR expressions in the WHERE clause in an effort to find better indices.

    • Added the SQLITE_DIRECT_OVERFLOW_READ compile-time option, causing overflow pages to be read directly from the database file, bypassing the page cache.

    • Remove limits on the magnitude of precision and width value in the format specifiers of the sqlite3_mprintf() family of string rendering routines.

    • Fix a bug that prevent ALTER TABLE ... RENAME from working on some virtual tables in a database with a UTF16 encoding.

    • Fix a bug in ASCII-to-float conversion that causes slow performance and incorrect results when converting numbers with ridiculously large exponents.

    • Fix a bug that causes incorrect results in aggregate queries that use multiple aggregate functions whose arguments contain complicated expressions that differ only in the case of string literals contained within those expressions.

    • Fix a bug that prevented the page_count and quick_check pragmas from working correctly if their names were capitalized.

    • Fix a bug that caused VACUUM to fail if the count_changes pragma was engaged.

    • Fix a bug in virtual table implementation that causes a crash if an FTS4 table is dropped inside a transaction and a SAVEPOINT occurs afterwards.


    SQLITE_SOURCE_ID: "2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e"


    SHA1 for sqlite3.c: becd16877f4f9b281b91c97e106089497d71bb47




    SQLite website




    <

    Original Post : http://neodreamer-dev.tistory.com/610

    2011/10/14

    C#에서 SQLite 사용하기

    C#에 대해서 잘 알지는 못하고 요즘 조금 관심을 두고 있는데 C#의 데이터베이스 관련하여 모르는 상태에서 SQLite 의 예제와 관련 정보를 찾아 SQLite를 연결하여 테스트 해 보았다.



    우선 C#에서 SQLite를 사용하려면 아래 사이트를 통해 개발 환경에 맞는 파일을 다운 받아야 한다.

    System.Data.SQLite Download Page 



    내려받은 파일들 중 System.Data.SQLite.dll 와 System.Data.SQLite.Linq.dll 을 Add Reference... 를 통해 추가한다. 테스트에 사용한 코드는 아래와 같다.

    string strQuery;

    textResult.Text = "Begin...\n";

    SQLiteConnectionStringBuilder SQLiteConString
    = new SQLiteConnectionStringBuilder();
    SQLiteConString.DataSource = "test.db";

    SQLiteConnection SQLite3Con
    = new SQLiteConnection(SQLiteConString.ToString());
    SQLite3Con.Open();

    bool bPrevStepSuccess = false;

    textResult.AppendText(" Try to connect with test.db ...");
    if (SQLite3Con.State == ConnectionState.Open)
    {
    textResult.AppendText("OK\n");

    // 테이블 생성
    strQuery = "CREATE TABLE IF NOT EXISTS TestTable ("
    + " name VARCHAR(20)"
    + " ,age int"
    + " ,country VARCHAR(20)"
    + ")";

    SQLiteCommand SQLite3Cmd = SQLite3Con.CreateCommand();
    SQLite3Cmd.CommandText = strQuery;
    try
    {
    SQLite3Cmd.ExecuteNonQuery();
    textResult.AppendText(" Test Table Create ... OK\n");

    bPrevStepSuccess = true;
    }
    catch (System.Data.SQLite.SQLiteException ex)
    {
    int nResult = SQLite3Con.ResultCode();
    textResult.AppendText(" Test Table Create ... FAIL, Error Msg : "
    + ex.Message + "\n");

    bPrevStepSuccess = false;
    }

    if (bPrevStepSuccess)
    {
    // Insert
    textResult.AppendText(" Inserting ...\n");
    strQuery = "INSERT INTO TestTable (name, age, country) VALUES (?,?,?);";

    SQLite3Cmd.CommandText = strQuery;
    SQLiteParameter paramName = SQLite3Cmd.CreateParameter();
    SQLite3Cmd.Parameters.Add(paramName);
    SQLiteParameter paramAge = SQLite3Cmd.CreateParameter();
    SQLite3Cmd.Parameters.Add(paramAge);
    SQLiteParameter paramCountry = SQLite3Cmd.CreateParameter();
    SQLite3Cmd.Parameters.Add(paramCountry);

    for (int i = 0; i < 10; ++i)
    {
    paramName.Value = "Name " + i.ToString();
    paramAge.Value = 20 + i;
    paramCountry.Value = "None";

    int InsertRow = SQLite3Cmd.ExecuteNonQuery();

    if (InsertRow == 1)
    {
    textResult.AppendText(" Insert ... OK\n");
    }
    else
    {
    textResult.AppendText(" Insert ... FAIL\n");
    }
    }

    strQuery = "SELECT COUNT(*) FROM TestTable;";

    SQLite3Cmd.Parameters.Clear();
    SQLite3Cmd.CommandText = strQuery;

    using (SQLiteDataReader SQLite3Reader = SQLite3Cmd.ExecuteReader())
    {
    if (SQLite3Reader.Read())
    {
    string strRow = " Row Count ... "
    + SQLite3Reader.GetValue(0).ToString() + "\n";

    textResult.AppendText(strRow);
    }
    }

    // Selecting
    textResult.AppendText(" Selecting ...\n");
    strQuery = "SELECT * FROM TestTable;";

    SQLite3Cmd.Parameters.Clear();
    SQLite3Cmd.CommandText = strQuery;

    using (SQLiteDataReader SQLite3Reader = SQLite3Cmd.ExecuteReader())
    {
    while (SQLite3Reader.Read())
    {
    string strRow = " "
    + SQLite3Reader.GetValue(0).ToString() + " "
    + SQLite3Reader.GetValue(1).ToString() + " "
    + SQLite3Reader.GetValue(2).ToString()
    + "\n";

    textResult.AppendText(strRow);
    }
    }

    // Updating...
    textResult.AppendText(" Updating ...\n");
    strQuery = "UPDATE TestTable SET country=@country WHERE age<@age;";
    SQLite3Cmd.CommandText = strQuery;

    paramCountry.ParameterName = "@country";
    paramCountry.Value = "KOREA";
    SQLite3Cmd.Parameters.Add(paramCountry);

    paramAge.ParameterName = "@age";
    paramAge.Value = 25;
    SQLite3Cmd.Parameters.Add(paramAge);

    int nUpdated = SQLite3Cmd.ExecuteNonQuery();

    string strMsg = " Updated Row(s) Count ... "
    + nUpdated.ToString() + "\n";
    textResult.AppendText(strMsg);

    // Deleting...
    textResult.AppendText(" Deleting ...\n");
    strQuery = "DELETE FROM TestTable WHERE age < @age;";

    SQLite3Cmd.Parameters.Clear();
    SQLite3Cmd.CommandText = strQuery;

    paramAge.ParameterName = "@age";
    paramAge.Value = 25;
    SQLite3Cmd.Parameters.Add(paramAge);

    int nDeleted = SQLite3Cmd.ExecuteNonQuery();

    strMsg = " Deleted Row(s) Count ... "
    + nDeleted.ToString() + "\n";
    textResult.AppendText(strMsg);

    // Drop Table
    strQuery = "DROP TABLE IF EXISTS TestTable;";

    SQLite3Cmd.Parameters.Clear();
    SQLite3Cmd.CommandText = strQuery;

    SQLite3Cmd.ExecuteNonQuery();
    textResult.AppendText(" Test Table dropped ... OK\n");
    }
    }
    else
    {
    textResult.AppendText("FAIL\n");
    }

    SQLite3Con.Close();
    textResult.AppendText("Finish.");





    C#은 C++ 에서의 방법과 많이 다른 것 같다. 효과적으로 사용하기 위해서는 C#의 데이터베이스에 대한 공부가 필요할 것 같다.&

    Original Post : http://neodreamer-dev.tistory.com/595

    2011/10/12

    SQLite3 3.7.8 Libraries for Visual C++ & C++ Builder

    amalgamation 소스를 이용한 의 라이브러리를 만드는 방법으로 라이브러리를 만들었다. 기존의 전체 소스를 이용하여 만드는 것 보다 많이 쉬웠다.

    2011/10/12 - [Dev Story] - SQLite3 dll 과 정적 라이브러리(Static Library) 만들기

    2011/10/12 - [Dev Story/Tips] - C++ Builder 를 위한 SQLite3 라이브러리 만들기



    각각의 라이브러리는 오래전 올린 테스트 코드를 이용하는데 문제가 없었다.

    2009/03/23 - [Dev Story/Mess] - SQLite 테스트...

    2009/03/23 - [Dev Story/Mess] - SQLite 64비트에서 테스트...





    <

    Original Post : http://neodreamer-dev.tistory.com/593

    C++ Builder 를 위한 SQLite3 라이브러리 만들기

    C++ Builder를 위한 SQLite3 라이브러리 생성은 그리 어렵지 않다. 이전에 올린 글에서도 언급을 하였는데 amalgamation 소스를 이용하면 작업이 쉽다.

    2011/10/12 - [Dev Story] - SQLite3 dll 과 정적 라이브러리(Static Library) 만들기


    동적 라이브러리는 SQLite 사이트에서 배포하는 DLL을 사용하면 되며 필요한 .lib 파일은 아래 명령을 통해서 만들 수 있다.

    implib -a sqlite3.lib sqlite3.dll



    정적 라이브러리의 경우 amalgamation 소스를 이용하여 만든다. 

    먼저 Static Library 프로젝트를 만든다.



    적당한 이름으로 프로젝트를 정리하고 프로젝트에 amalgamation 소스파일 3개(sqlite3.c, sqlite3.h, sqlite3ext.h)을 추가 한다.


    그리고 프로젝트의 Conditional defines의 Base에 아래와 같이 3개의 Conditional을 추가한다.

    SQLITE_ENABLE_FTS3

    SQLITE_ENABLE_RTREE

    SQLITE_ENABLE_COLUMN_METADATA



    이제 빌드만 하면 정적 라이브러리를 얻을 수 있다.

    기존의 전체 소스로 컴파일 하는 것에 비하면 상당히 단순화 된 작업이다.

    이렇게 만들어진 라이브러리에 대해서는 이전에 올린 테스트 코드에서 이상없이 동작을 하였다. <

    Original Post : http://neodreamer-dev.tistory.com/592

    SQLite3 dll 과 정적 라이브러리(Static Library) 만들기

    예전 글에서는 Dll 은 amalgamation 소스를 이용하고 정적 라이브러리는 전체 소스를 가지고 만드는 방법을 기록하였는데 이번에는 두가지 모두 amalgamation 소스를 이용하는 방법으로 하여 보았다. 이 방법을 이용할 경우 작업이 무척 간단하고 ICU 모듈 없이도 라이브러리를 만들 수 있다.



    일단 Dll 을 만드는 방법은 예전 글(2009/12/09 - [Dev Story/Tips] - SQLite3.dll 만들기 (Win32 & x64 with VC++ 2005))에도 설명을 하였지만 다시금 간단하게 요약을 하면 Win32 Application 을 "SQLite3"란 이름으로 만들고 Wizard 화면에서 아래와 같이 Type을 DLL, Additional options에서 Empty project를 체크하고 프로젝트를 만든다.

    SQLite3.dll 프로젝트 속성

    SQLite3.dll 프로젝트 속성



    프로젝트에 sqlite-amalgamation-xxxxxxxx.zip 파일에 있는 sqlite3.c, sqlite3.h, sqlite3ext.h 파일을 프로젝트에 포함시켜 준다. 그리고 Preprocessor Definitions에 아래 세가지를 입력한다.

    SQLITE_ENABLE_FTS3

    SQLITE_ENABLE_RTREE

    SQLITE_ENABLE_COLUMN_METADATA





    마지막으로 sqlite-dll-win32-x86-
    xxxxxxxx.zip 파일에 포함되어 있는 sqlite3.def 파일을 프로젝트에 속성에 추가 시켜준다.

    sqlite3.def 지정 화면

    sqlite3.def 지정 화면



    이제 빌드만 해 주면 .dll 파일과 .lib 파일을 얻을 수 있다. 필요에 따라 x64 platform 을 추가 구성하면 64비트용 파일들을 얻을 수 있다.



    다음으로 정적 라이브러리를 만드는 방법이다. 기존 방법과는 다르고 DLL 파일을 만드는 것과 유사하다.

    우선 Win32 Application을 SQLite3Static 이란 이름으로 type을 Static library, Additional options에서 Precompiled header를 선택 해제하고 프로젝트를 생성한다.



    DLL 만드는 경우와 같이 프로젝트에 sqlite-amalgamation-xxxxxxxx.zip 파일에 있는 sqlite3.c, sqlite3.h, sqlite3ext.h 파일을 프로젝트에 포함시켜 준다. 그리고 Preprocessor Definitions에 아래 세가지를 입력한다.

    SQLITE_ENABLE_FTS3

    SQLITE_ENABLE_RTREE

    SQLITE_ENABLE_COLUMN_METADATA



    이제 빌드만 하면 정적 라이브러리를 만들 수 있다. 역시 x64 platform 을 추가 구성하면 64비트용 파일들을 얻을 수 있다. 그리고 각각의 
    x64 platform 과 Configuration에 맞게 정적 라이브러리 이름을 지정하면 쉽게 구분할 수 있다.

    본인의 경우 아래와 같이 이름을 지정하였다.


    x86용

    Debug: SQLite3Static32D.lib 

    Release: SQLite3Static32.lib 

    x64용

    Debug: SQLite3Static64D.lib 

    Release: SQLite3Static64.lib 



    위의 작업은 Visual Studio 2005에서 작업을 하였으며 정적 라이브러리의 경우 Visual Studio 2010 버전으로 테스트해

    Original Post : http://neodreamer-dev.tistory.com/591

    2011/10/11

    .Net 을 위한 SQLite 라이브러리

    언제부터 인지는 모르겠지만 오래전 부터 SQLite 사이트에서 .Net을 위한 코드와 바이너리를 제공하고 있었다. 그런데 이번 3.7.8버전 공개로 다시 찾은 사이트에서는 보다 다양한 버전을 제공하고 있다.

    다양한 버전을 제공하고 있어 특별한 경우가 아니고서는 컴파일을 할 필요 없이 일반적으로 제공하는 것을 다운받아 사용하면 될 것 같다.


    아래 항목은 System.Data.SQLite 페이지에서 제공하는 것 들이다.

    Source Code

    Setups for 32-bit Windows (.NET Framework 3.5 SP1)

    Setups for 64-bit Windows (.NET Framework 3.5 SP1)

    Setups for 32-bit Windows (.NET Framework 4.0)

    Setups for 64-bit Windows (.NET Framework 4.0)

    Precompiled Binaries for 32-bit Windows (.NET Framework 3.5 SP1)

    Precompiled Binaries for 64-bit Windows (.NET Framework 3.5 SP1)

    Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)

    Precompiled Binaries for 64-bit Windows (.NET Framework 4.0)

    Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 3.5 SP1)

    Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 3.5 SP1)

    Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)

    Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0)

    Precompiled Binaries for Windows CE (.NET Compact Framework 3.5)


    System.Data.SQLit

    Original Post :
    http://neodreamer-dev.tistory.com/590

    SQLite Release 3.7.8

    SQLite 3.7.8 (2011/09/19)


    • Orders of magnitude performance improvement for CREATE INDEX on very large tables.

    • Improved the windows VFS to better defend against interference from anti-virus software.

    • Improved query plan optimization when the DISTINCT keyword is present.

    • Allow more system calls to be overridden in the unix VFS - to provide better support for chromium sandboxes.

    • Increase the default size of a lookahead cache line from 100 to 128 bytes.

    • Enhancements to the test_quota.c module so that it can track preexisting files.

    • Bug fix: Virtual tables now handle IS NOT NULL constraints correctly.

    • Bug fixes: Correctly handle nested correlated subqueries used with indices in a WHERE clause.

    • SQLITE_SOURCE_ID: "2011-09-19 14:49:19 3e0da808d2f5b4d12046e05980ca04578f581177"

    • SHA1 for sqlite3.c: bfcd74a655636b592c5dba6d0d5729c0f8e3b4de




    SQLite homepage&

    Original Post : http://neodreamer-dev.tistory.com/589

    2011/05/20

    SQLite 3 Library (Static & Dynamic)

    SQLite 3.7.6.3 Library for C++ Builder





    SQLite 3.7.6.3 Library for Visual C++

    &

    Original Post : http://neodreamer-dev.tistory.com/543

    SQLite Release 3.7.6.3

    SQLite 3.7.6.3  (2011/05/19)

    • Fix a problem with WAL mode which could cause transactions to silently rollback if the cache_size is set very small (less than 10) and SQLite comes under memory pressure.



    공식 홈페이지에서는 모든 이전 버전 사용자들에게 업그레이드를 권장하고 있다.


    SQLite Homepage

    SQLite Download page

    &

    Original Post : http://neodreamer-dev.tistory.com/542

    2011/04/25

    2011/04/14

    SQLite 정적라이브러리(Static Library) 만들기 (C++ Builder)

    2008/12/07 - [Dev Story/Tips] - C++ Builder 용 SQLite 정적 라이브러리 만들기


    SQLite 3.7.5 버전 후로는 ICU 모듈이 추가되어 이를 포함해 주가나 기능을 비 활성화 해야하는데 C++ Builder 의 경우 포함하는데 어렵다. ICU 사이트에서도 테스트된 컴파일러가 Visual C++ 이라고 명시되어 있기도 하다.


    그래서 이 기능을 비활성화 하는 것으로 방향을 설정 하였다.


    우선 C++ Builder 에서 Static Library 프로젝트를 생성한다. 

    프로젝트 폴더에 sqlite-preprocessed-3070601.zip 의 파일들과 sqlite-src-3070601.zip 의 sqlite-src-3070601/ext/rtree 폴더에 포함되어 있는 sqlite3rtree.h 파일을 복사 한 후 fts1*, fts2* 그리고 tclsqlite.c 파일을 제외하고 프로젝트에 포함 시킨다.


    Project 속성의 C++ Compiler / Directories and Conditional 에서 Conditional Defines 에 아래 내용을 추가한다.

    NO_TCL

    SQLITE_ENABLE_BROKEN_FTS1=1

    SQLITE_ENABLE_BROKEN_FTS2=1


    그리고  C++ Compiler / Pre-compiled headers 에서 Pre-compiled header 를 사용하지 않음으로 설정한다.


    마지막으로 SQLITE_ENABLE_ICU 을 사용하는 파일들을 찾아서 파일 첫줄에 #undef SQLITE_ENABLE_ICU 입력하여 ICU 를 비활성화 한다.


    이제 빌드만 하

    Original Post : http://neodreamer-dev.tistory.com/538