Search This Blog

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

Sunday, February 5, 2012

SQLite with VC++

In case you are looking for sqlite3.lib , you can create it via the next command .


create lib file from def file
lib /def:sqlite3.def /OUT:sqlite3.lib
more details could be found in this post create-lib-file-from-dll.


check out the wrapper class i found , very easy to use and to implement CppSQLite - C++ Wrapper for SQLite.


Check out example1 in this article  Loading and Saving In-Memory Databases  we loading and saving the contents of an in-memory database to a file on disk , very common in the real world.


i extend the cppSQLite , to enable to read DB from disk into memory


void CppSQLite3DB::open(const char* szFile,BOOL inMem)
{
if(inMem)
{
open(":memory:");
loadOrSaveDb(mpDB,szFile,false);
}
else
open(szFile);
}

Yaniv Tzanany


Wednesday, February 1, 2012

SQLite - starter kick

SQlite , its very popular Database , easy to use , i used it as InMemory db.

download software from Sqlite home page.

know your limits -> Frequently Asked Questions .

Know your Datatypes In SQLite Version 3.

Command Line Shell For SQLite.

in case you need ODBC for sqlite , you can find it here SQLite ODBC Driver.
nice tool for sqlite its the sqlite browser.
check out Sqlite wrappers you might find something for your needs.

(i used the 3.7.10 version)
command line usage example to open db

sqlite3.exe yaniv.db
sqlite> .mode column
sqlite> .headers  on
sqlite> select * from t1;


Create a new db (open cmd window)
sqlite3.exe myTest.db
sqlite> CREATE TABLE t2(t  TEXT,nu NUMERIC,i  INTEGER,r  REAL,no BLOB ,EFFEC_DATE DATE );
sqlite> INSERT INTO t2 (t,nu,i,r,no,EFFEC_DATE) VALUES('500.0', '500.0', '500.0', '500.0', '500.0','2010-10-23');
sqlite>.quit


.read excute sql file
import value into db

sqlite>.separator ,
sqlite>.import  dd.txt t2

// will show you all master objects
sqlite> SELECT * FROM sqlite_master;


enjoy 
yaniv Tzanany