Download presentation
Presentation is loading. Please wait.
Published byMatilda Sherman Modified over 8 years ago
1
Standalone Databases In the name of Allah Iman M.Gowhari imanmgowhari@fastmail.fm
2
2 Introduction Mylittlebase SQLite Other Solutions
3
3 Introduction Embedded database. The size of the database. The database performance. No end-user configuration required.
4
4 Mylittlebase It is a little database component. Function-call API for data access and management. No need to link to any external server, DLLs. Delphi / C++ / PHP http://www.mylittlebase.org
5
5 Mylittlebase #include ; #include "mlb2.h"; int main() { TMlb2* mlb; mlb = mlb->Create(); printf("%d\n", mlb->GetVersionNumber()); mlb->Destroy(); }
6
6 Mylittlebase Initialization: Create, Destroy, Init, … Fields: AddField, SetFieldType, SetFieldName, … Rows: AddRow, GetCurrentRow, … Navigation: GoFirst, GoNext, SeekData, … Data management: GetData, SetData, … File management: SaveToFile, LoadFromFile, … Utils: MakeDistinct, SortByData, …
7
7 Mylittlebase #include #include "mlb2.h" void main() { TMlb2* mlb; mlb = mlb->Create(); mlb->LoadFromFile("data.csv"); mlb->GoFirst(); mlb->BeginSeek(MLB_FORWARD); while(mlb->SeekData("city", "LIKE", "Lond*")) { // insert here your action } mlb->EndSeek(); mlb->Destroy(); }
8
8 SQLite It is a C library that implements an embeddable SQL database engine. Implements most of SQL92. Very simple C/C++ interface requires the use of only three functions and one opaque structure. Two times faster than PostgreSQL and MySQL for many common operations. http://www.sqlite.org
9
9 SQLite int main() { sqlite *db; char *zErrMsg=0; int rc; db=sqlite_open("test.db", 0, &zErrMsg); if( db==0 ) { printf("Can't open database: %s\n", zErrMsg); return 1; } rc=sqlite_exec(db, "select * from tbl1", callback, 0, &zErrMsg); if( rc!=SQLITE_OK ){ printf("SQL error: %s\n", zErrMsg); } sqlite_close(db); return 0; }
10
10 SQLite static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; for(i=0; i<argc; i++) { printf("%s=%s\t", azColName[i], argv[i] ? argv[i] : "NULL"); } printf("\n"); return 0; }
11
11 SQLite Accessing Data Without Using A Callback Function. SQLite is typeless. Python, Ruby, Perl, PHP, …
12
12 Other Solutions Berkeley DB (http://www.sleepycat.com)(http://www.sleepycat.com) Ebase (http://ebase.sourceforge.net)(http://ebase.sourceforge.net) Gadfly (http://gadfly.sourceforge.net)(http://gadfly.sourceforge.net)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.