// Open the database
CDatabase db(mDbPath);
if(!db.IsAvaliable()) //check is avaliable
return false;
// There is a form check
// Query
CDatabaseRequest *req = db.Query("select count(*) from Terminal;");
if(req.IsAvaliable() && req.Read()) // check and read
{
int val = req.GetInteger("count(*)",-1);//with value -1 for an error
if(val == 0) //execute
db.Execute("insert into Terminal (Id) values('aaaa');");
}
The request and database will be automatically closed at the following location Destructor
// Execute
db.Execute(sql);//完整的sql
CDatabaseSentece *s = db.BeginExecute("insert int xxx values(?,?,?);");//模式赋值,个人觉得没什么用
s.Bind(1);
s.Bind(2);
s.Bind("abc");
s.Execute();
事务
db.BeginTransaction();
db.Rollback();
db.Commit();
// CDatabaseTable supports migration
class csampletable:CDatabaseTable
{
.......
}
csampletable :: csampletable (void){
Table = "Strategy";
ArrayResize(SqlCreateTable,2);
ArrayResize(SqlMoveRecord,2);
//0 for initial ddl then for every update, fill sqlcreatetable and moverecord like following, the adding field cannot be uniqe!!!
SqlCreateTable[0] = "CREATE TABLE Strategy(Id INTEGER PRIMARY KEY ON CONFLICT IGNORE );";
SqlCreateTable[1] = "CREATE TABLE Strategy(Id INTEGER PRIMARY KEY ON CONFLICT IGNORE, Ticket INTEGER);";
SqlMoveRecord[1] = "INSERT INTO Strategy (Id, Ticket) SELECT Id FROM sqlitestudio_temp_table;";
OnMiggrate();
}
I find the lot calculation tedious so I just use this script and tell it the dollar amount to use. It then does the rest. This works for any currency.
I find the lot calculation tedious so I just use this script and tell it the dollar amount to use. It then does the rest. This works for any currency.
This EA collects information about the spreads and Shows the number of spreads in the specified range based on the ticks that occur each year.
The breakout strength meter is a trading tool that is used to identify which currencies are the strongest to breakout, and which currencies are the weakest to breakout