Database

Mon, 2010-01-25 17:35

Singleton pattern for connect to databases.

Submitted by chatsiri on Mon, 2010-01-25 17:35.

Posted in | | | | chatsiri's blog | add new comment | quote | 849 reads »

Singleton concept for implemented configuration of code.C++ can
created instance of object after new driven class.

//main idea for create only one instace for config
//create instance
ConnectionDb &ConnectionDb::instance(){
if( !instance_ ){
instance_ = new ConnectByControlOne;
return *instance_;
}
}

Test source code after compiled Mongodb package for Linux.See below,It's show debug run by localhost.

From chatsiri.com

After write example code by Singleton concept.Code example [main],[connectiondb.cpp],[connectiondb.h]

From chatsiri.com

No one expect after play football with old friend( CPESRC'47 ).My
finger have symptom of broken bone.Doctor suggested splint of my
finger.Start time for splint my finger at January( New Year - -") to
February.It's not easy for touch-type for write code.This is end of time splint finger.

From chatsiri.com

Thu, 2007-11-15 02:33

Scenario for Storedbd.

Submitted by chatsiri on Thu, 2007-11-15 02:33.

Posted in | | | | chatsiri's blog | 2 comments | quote | 601 reads »

I just write scenario a Storebdb[link].Once strategy before implementation applications does is software engineering.I didn't think in long time for software engineering[link].I last class lecture write requirement with stockholder(lecturer suppose a stockholder).Lecturer talk when me get requirement with stockholder.Not effort talk is technique term.Stockholders doesn't like technique,but they are want programs help them support work.Beside,Use case is importance can help you designed software in software engineering way.
Scenario of Storebdb.I write GUI same SQLite Database Browser[link].SQLite Database Browser is idea me for implementation a Storebdb(Open project)application on Linux Operation System.See picture below following GUI screen of SQLite Database Browser(If you use it,you might build SQLite and Tcl library Script for SQLite Database Browser)

From chatsiri.com

Aha,This ideal me for implement application.I determine using a Qt Framework as for who interesting a open project me.You can join project too.

Sat, 2007-11-10 20:56

Open database in Berkeley DB.

Submitted by chatsiri on Sat, 2007-11-10 20:56.

Posted in | | | | chatsiri's blog | add new comment | quote | 985 reads »

Last Article talk about install a Berkeley Database XML and Berkeley Database[link].Today,I test open database use an "open" is member function in a APIs name is "Db" class.Berkeley Database is not the RDBMS.In fact,A Berkeley DB use algorithms for store a data to database.Algorithms(refer document) for store have Btree(very hard implementation for me),Hash,Queue and Ranco.If you create database,you are specified an algorithm for member function name is "open" in Class Db(Programmatic APIs).see following below

#include< db_cxx.h >
int Db::open(DbTxn *txnid, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode);

change to real world.

#include< db_cxx.h >
#include< iostream >
#include< string >
class dbMe{... dbMe(std::string &path,std::string &name);}
....
//obverse cFlags set DB_CREATE.if not database on berkeley
//database
dbMe::dbMe(std::string &patch,std::string
&dbName):db_(NULL,0),dbFileName_(patch+dbName),cFlags_(DB_CREATE){
try{
db_.set_eror_stream(&std::cerr);
//set type open database.this use btree.
db_.open(NULL,dbFileName_.c_str(),NULL,DB_BTREE,cFlags_,0);
...
//"DbException" for exception error in Berkeley Database
catch(DbException &e){...}
}

Reference:
Programmatic APIs [link]
Documentation [link]

Syndicate content