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

2011/10/12

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/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

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

SQLite 3.7.5 이상의 버전에서는 ICU Unicode 모듈이 추가되어 이 모듈을 추가하거나 기능을 비활성화 하여야 한다.

Visual C++ 의 경우 ICU 모듈을 사용할 수 있어서 ICU4C 소스를 받아서 라이브러리에 포함 시켜준다. ICU4C 전체 소스는 필요없고 소스 파일 패키지(icu4c-4_6_1-src.zip)에서 source/common/unicode 폴더가 필요하며 부가적으로 source/i18n/unicode/uregex.h 파일이 필요하다.

진행에 사용한 버전은 SQLite 3.7.6.1 버전과 Visual C++ 2005, 2010 버전이다.

아래는 Visual C++ 에서 SQLite Static Library 를 만들기 위한 프로젝트 구조이다.   SQLiteStatic      - icu         - unicode      - sqlite      - SQLiteStatic2005      - SQLiteStatic2010
 unicode 폴더에는 icu4c 소스의 source/common/unicode 폴더에 포함 된 파일들과 source/i18n/unicode/uregex.h 을 넣어 두었다.

sqlite 폴더에는  sqlite-preprocessed-3070601.zip 의 파일들과 sqlite-src-3070601.zip 의 sqlite-src-3070601/ext/rtree 폴더에 포함되어 있는 sqlite3rtree.h 파일을 복사해 두었다.

위와 같이 파일들을 준비하고 메인프로젝트 하위에 Visual C++ 2005 와 Visual C++ 2010 버전을 위한 프로젝트를 만들었다. 두 버전의 프로젝트 설정은 동일하다.

Visual C++로 "Win32 Consol Application" 을 생성한다. 생성할 때 응용프로그램 설정(Application Settings)에서 정적 라이브러리(Static Library) 를 선택하고 미리 컴파일된 헤러(Precompiled header)를 사용하지 않도록 만든다.



만들어진 프로젝트에 sqlite 경로에 있는 파일들(fts1*, fts2* 파일들과 tclsqlite.c 제외)을 추가한다.

마지막으로 아래와 같은 프로젝트 설정을 한다.
General/Additional Include Directories :
..\icu
Preprocessor/Preprocessor Definitions :
NO_TCL _CRT_SECURE_NO_WARNINGS (optional) SQLITE_ENABLE_BROKEN_FTS1=1 SQLITE_ENABLE_BROKEN_FTS2=1
Code Generation/Runtime Library :
Multi-threaded (Release) Multi-threaded Debug (Debug)
Advanced/Disable Specific Warnings
4267;4244;4018;4311;4996;4312 (optional) 


설정을 마치고 컴파일을 하면 SQLite 정적 라이브러리를 얻을 수 있다.

64비트가 필요할 경우 64비트 Platform 을 추가하고 
Preprocessor/Preprocessor Definitions 항목의 WIN32를 WIN64로 변경하고 컴파일 하면 된다.

만들어진 라이브러리를 테스트 해 보았는데 
Visual C++ 2005 버전 프로젝트에 사용하려면 Visual C++ 2005 버전으로 만든 정적 라이브러리를 사용하여야 완벽한 동작을 보장 받을 수 있을 것 같았다. (Visual C++ 2010 버전도 동일함.)



2011/02/08 - [Dev Story] - SQLite 3.7.5.0 Library (정적/동적) for C++ Builder and Visual C++
2008/12/07 - [Dev Story/Tips] - Visual C++ 용 SQLite 정적 라이브러리 만들기 


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

2010/12/09

SQLite Release 3.7.4.0 (정적/동적 라이브러리 포함)

SQLite 가 버전업이 되었다. 3.7.2 버전 미만을 사용하고 있을경우 업그레이드를 권장하고 있다.




SQLite Release 3.7.4 On 2010 December 08 (3.7.4)


  • Added the sqlite3_blob_reopen() interface to allow an existing sqlite3_blob object to be rebound to a new row.

  • Use the new sqlite3_blob_reopen() interface to improve the performance of FTS.

  • VFSes that do not support shared memory are allowed to access WAL databases if PRAGMA locking_mode is set to EXCLUSIVE.

  • Enhancements to EXPLAIN QUERY PLAN.

  • Added the sqlite3_stmt_readonly() interface.

  • Added PRAGMA checkpoint_fullfsync.

  • Added the SQLITE_FCNTL_FILE_POINTER option to sqlite3_file_control().

  • Added support for FTS4 and enhancements to the FTS matchinfo() function.

  • Added the test_superlock.c module which provides example code for obtaining an exclusive lock to a rollback or WAL database.

  • Added the test_multiplex.c module which provides an example VFS that provides multiplexing (sharding) of a DB, splitting it over multiple files of fixed size.

  • A very obscure bug associated with the or optimization was fixed.





이번 버전 역시 정적 라이브러리 컴파일 시도 할 때 sqlite3rtree.h 파일이 없어 sqlite-src-3070400.zip\sqlite-src-3070400\ext\rtree\ 에 포함되어 있던 파일을 이용하였다.




SQLite Homepage




2010/10/28

SQLite Release 3.7.3.0 (정적/동적 라이브러리 포함)





SQLite Release 3.7.3 On 2010 October 08 (3.7.3)

  • Added the sqlite3_create_function_v2() interface that includes a destructor callback.

  • Added support for custom r-tree queries using application-supplied callback routines to define the boundary of the query region.

  • The default page cache strives more diligently to avoid using memory beyond what is allocated to it by SQLITE_CONFIG_PAGECACHE. Or if using page cache is allocating from the heap, it strives to avoid going over the sqlite3_soft_heap_limit64(), even if SQLITE_ENABLE_MEMORY_MANAGEMENT is not set.

  • Added the sqlite3_soft_heap_limit64() interface as a replacement for sqlite3_soft_heap_limit().

  • The ANALYZE command now gathers statistics on tables even if they have no indices.

  • Tweaks to the query planner to help it do a better job of finding the most efficient query plan for each query.

  • Enhanced the internal text-to-numeric conversion routines so that they work with UTF8 or UTF16, thereby avoiding some UTF16-to-UTF8 text conversions.

  • Fix a problem that was causing excess memory usage with large WAL transactions in win32 systems.

  • The interface between the VDBE and B-Tree layer is enhanced such that the VDBE provides hints to the B-Tree layer letting the B-Tree layer know when it is safe to use hashing instead of B-Trees for transient tables.

  • Miscellaneous documentation enhancements.




이번 버전에서는 정적 라이브러리를 만들기 위해 컴파일을 시도 하면 sqlite3rtree.h 파일을 찾을 수 없다는 에러 메세지가 발생하였다. 이 문제에 대한 자료를 찾기가 어려워 우선 sqlite3rtree.h 파일을 sqlite-3.7.3.tar.gz 파일에서 찾아(sqlite-3.7.3.tar.gz\sqlite-3.7.3.tar\sqlite-3.7.3\ext\rtree\) 넣어 컴파일을 하였다





2010/08/30

SQLite Release 3.7.2.0 (정적/동적 라이브러리 포함)




SQLite 가 3.7.2 버전을 공개하였고 이하의 버전을 사용하는 경우 업그레이드를 권고하고 있다.



2010 August 24 (3.7.2)


  • Fix an old and very obscure bug that can lead to corruption of the database free-page list when incremental_vacuum is used.





2010 August 23 (3.7.1)


  • Added new commands SQLITE_DBSTATUS_SCHEMA_USED and SQLITE_DBSTATUS_STMT_USED to the sqlite3_db_status() interface, in order to report out the amount of memory used to hold the schema and prepared statements of a connection.

  • Increase the maximum size of a database pages from 32KiB to 64KiB.

  • Use the LIKE optimization even if the right-hand side string contains no wildcards.

  • Added the SQLITE_FCNTL_CHUNK_SIZE verb to the sqlite3_file_control() interface for both unix and windows, to cause database files to grow in large chunks in order to reduce disk fragmentation.

  • Fixed a bug in the query planner that caused performance regresssions relative to 3.6.23.1 on some complex joins.

  • Fixed a typo in the OS/2 backend.

  • Refactored the pager module.

  • The SQLITE_MAX_PAGE_SIZE compile-time option is now silently ignored. The maximum page size is hard-coded at 65536 bytes.






<

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

2010/07/22

2010/03/10

SQLite 3.6.23 Released & Library (Static, Dynamic, VC, CB)

SQLite Release 3.6.23 On 2010 March 09 (3.6.23)



Changes associated with this release include the following:


  • Added the secure_delete pragma.

  • Added the sqlite3_compileoption_used() and sqlite3_compileoption_get() interfaces as well as the compile_options pragma and the sqlite_compileoption_used() and sqlite_compileoption_get() SQL functions.

  • Added the sqlite3_log() interface together with the SQLITE_CONFIG_LOG verb to sqlite3_config(). The ".log" command is added to the Command Line Interface.

  • Improvements to FTS3.

  • Improvements and bug-fixes in support for SQLITE_OMIT_FLOATING_POINT.

  • The integrity_check pragma is enhanced to detect out-of-order rowids.

  • The ".genfkey" operator has been removed from the Command Line Interface.

  • Updates to the co-hosted Lemon LALR(1) parser generator. (These updates did not effect SQLite.)

  • Various minor bug fixes and performance enhancements.










SQLite Library for C++ Builder (DLL 및 정적라이브러리)


SQLite Library for Visual C++ ( DLL 및 정적라이브러리 32/64bit)

2010/01/06

SQLite 3.6.22 Released & Library (Static, Dynamic)

3.6.22 ( 2010/01/06 ) 에서 변경된 사항

  • Fix bugs that can (rarely) lead to incorrect query results when the CAST or OR operators are used in the WHERE clause of a query.

  • Continuing enhancements and improvements to FTS3.

  • Other miscellanous bug fixes.



SQLite homepage




SQLite Library for C++ Builder (DLL 및 정적라이브러리)




SQLite Library for Visual C++ ( DLL 및 정적라이브러리 32/64bit)

<

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

2009/12/14

SQLite 3.6.21 Library ( VC x86, VC x64, BCC )

SQLite 3.6.21 버전의 라이브러리 파일이다.



VC 의 동적라이브러리는 새롭게 알게된 방법으로 만들었으며 테스트도 해 보았다.










+ 2009/12/16

이상하게도 Windows 7 에서 만들어진 Library가 XP 에서 정상동작을 하지 않는 것 같다. Visual C++ 을 최신 업데이트를 하면 동작을 하는 것 같은데 아직 확실치 않아서 Visual C++ 용 라이브러리를 XP 에서 다시 만들었다.



SQLite homepage<

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

2009/11/26

SQLite 3.6.20 Released (with Library)

이번 버전에서 수정된 사항




  • Optimizer enhancement: prepared statements are automatically
    re-compiled when a binding on the RHS of a LIKE operator changes or
    when any range constraint changes under SQLITE_ENABLE_STAT2.

  • Various minor bug fixes and documentation enhancements.




SQLite homepage

SQLite download



Visual C++ (32/64bit) 과 C++ Builder 용 동적라이브러리와 정적라이브러리



<

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

2009/10/24

2009/04/14

2009/04/02