
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
This code works:
string getSTRField(string query)
{
string result;
string row;
int length=StringLen(query);
int res2 = mysql_real_query(mysql,query,length);
int res = mysql_store_result(mysql);
if(res==0)
{
Print("result of query stored = 0!!");
Print("GetLastError MySQL: " + DoubleToStr(GetLastError(),0));
return("");
}
int numOfRows = mysql_num_rows(res);
row = mysql_fetch_row(res); //Only pick up first occurrence.
row = StringSubstr(row,8);
row = StringTrimLeft(StringTrimRight(row));
mysql_free_result(res);
return(row);
}
I am picking up the result from mysql_fetch_row() in a "normal" string. The result is actually given back in something called a MY_SQLROW.
According to the MySQL Manual: "This is a type-safe representation of one row of data...."
Looking into the string I can see that the row data is prefixed with "something" of length 8 so I just scrap that. It works but I wonder if there is a better formal way to handle this??