1 / 12

Standalone Databases

Standalone Databases. In the name of Allah. Iman M.Gowhari imanmgowhari@fastmail.fm. Introduction Mylittlebase SQLite Other Solutions. Introduction. Embedded database. The size of the database. The database performance. No end-user configuration required. Mylittlebase.

aadi
Download Presentation

Standalone Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Standalone Databases In the name of Allah Iman M.Gowhari imanmgowhari@fastmail.fm

  2. Introduction • Mylittlebase • SQLite • Other Solutions

  3. Introduction • Embedded database. • The size of the database. • The database performance. • No end-user configuration required.

  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. Mylittlebase #include <stdio.h>;#include "mlb2.h";int main() {    TMlb2* mlb; mlb = mlb->Create();    printf("%d\n", mlb->GetVersionNumber());    mlb->Destroy();}

  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. Mylittlebase #include <stdio.h> #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. 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. 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. 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. SQLite • Accessing Data Without Using A Callback Function. • SQLite is typeless. • Python, Ruby, Perl, PHP, …

  12. Other Solutions • Berkeley DB(http://www.sleepycat.com) • Ebase(http://ebase.sourceforge.net) • Gadfly(http://gadfly.sourceforge.net)

More Related