The previous time in the development of Oraytalk (proud Rui Tong Enterprise instant Messaging System) of the chat recording module used by SQLite, this is my first contact and use of SQLite, the overall feeling is very good. Here's my experience with SQLite to share with you.
I. About SQLite
SQLite is an open-source, lightweight database for use in clients and embedded devices , and supports standard SQL.
Unlike the engine of SQL Server or Oracle, which is a standalone process that communicates with a program through TCP or named pipes, SQLite is a part of the program, a constituent part, and using SQLite is the way to make API calls directly in the program.
The original SQLite is not a visual operator to SQL Server Enterprise Manager, but there is a third-party development of the application Sqlitestudio very good, the basic building, building tables, editing data, export data and other functions are well supported. The Sqlitestudio runs as follows:
SQLite Resource Links:
(1) SQLite website: You can download the source code from the official website, or download the compiled binary version. Supported systems include: Linux, MacOS, Windows,. NET.
(2) Sqlitestudio: Easy to use SQLite visual manager.
two. Using SQLite in. NET
Download from official website. NET version of SQLite, which mainly includes two Dll:SQLite.Interop.dll, System.Data.SQLite.dll.
(1) System.Data.SQLite.dll is a standard managed DLL that we can reference and use directly in a. NET project, just as you would with individual objects in a. Net System.Data namespace.
(2) SQLite.Interop.dll is an unmanaged DLL, is the SQLite engine core, we need to copy it to the running directory, at run time, it will be called by System.Data.SQLite.dll.
three. Let SQLite out of VC + + runtime
In the course of testing after the completion of the project, we found that the client program using SQLite will error when running on some machines, as follows:
The DLL "SQLite.Interop.DLL" could not be loaded and the application could not be started due to an incorrect application configuration. Reinstalling the application may correct the problem. (Exception from HRESULT:0X800736B1)
After a toss-up, it is found that these machines are not installed on the VC + + runtime (Visual C + + 2005 SP1 runtime), and SQLite.Interop.dll run is required by VC + + Runtime support. This is too unfriendly. Our project was developed based on. NET 2.0, and the Windows XP SP1 and above all come with this framework, and these machines do not necessarily have VC + + runtime installed. So my first reaction was to try to get SQLite to run properly on a machine that didn't have VC + + running.
1. Programme I
I Baidu, there is a plausible solution is this: the Msvcm80.dll, Msvcp80.dll, msvcr80.dll These dynamic libraries are also placed in the running directory. I didn't like the plan very much, so I tried to solve the problem by myself.
2. Programme II
By virtue of a point I have not completely forgotten the basis of VC + +, I know that VC + + program at compile time can choose to dynamically link to the dependent library or static link, if it is a static connection, compiled generated binary program is equivalent to include a copy of the dependent library. So, my idea is to recompile the SQLite.Interop.dll so that it is statically linked to the VC + + runtime. I downloaded the source of SQLite, opened with VS2010, as follows:
SQLITE.INTEROP.2010 This project is the core, we need to make some changes to some of its settings, these small changes I spent some time groping to succeed, here to omit the specific groping process, directly give the results of groping:
(1) Open the SQLITE.INTEROP.2010 Project properties page, configuration properties, c/C + +, code generation, run-time library, which is set to multithreaded debugging (/MTD).
(2) Continue Configuration Properties, List tool, input and output, embedded list, the item was "Yes" and changed to "no".
(3) Show all project files, then locate the Sqlite.interop.2010.props file and open it. Remove the <INTEROP_MIXED_NAME> configuration node.
(4) Remove the "Resource Files" folder from the project.
(5) Recompile the project, the generated SQLite.Interop.dll is what we need.
four. Download the results
Unless the special needs, otherwise there is no need to repeat this process, I will generate the SQLite binary version directly available to everyone download use.
Can be divorced from VC + + runtime running SQLite (v1.0.93.0)