<li>''ElTp cfg( string nm )'' — gets the value of the configuration field ''nm'' of the object.</li>
<li>''ElTp cfg( string nm )'' — gets the value of the configuration field ''nm'' of the object.</li>
<li>''bool cfgSet( string nm, ElTp val )'' — sets the configuration field ''nm'' of the object to the value ''val''.</li>
<li>''bool cfgSet( string nm, ElTp val )'' — sets the configuration field ''nm'' of the object to the value ''val''.</li>
−
<li>''Array SQLReq( string req, bool tr = EVAL );'' — forms of the SQL-request to the DB, inside (''tr''=true), outside (''tr''=false) or no matter (''tr''=EVAL) to the transaction. At an error the result property "err" sets to the error value.
+
<li>''Array SQLReq( string req, bool tr = EVAL );'' — performs the SQL-request ''req'' to the DB, inside (''tr''=true), outside (''tr''=false) or no matter (''tr''=EVAL) to the transaction. Returns an array of rows of the result table with the fields both per indexes and column names. At an error the result property "err" sets to the error value.
<pre style="white-space: pre-wrap;">
<pre style="white-space: pre-wrap;">
DBTbl = SYS.BD.MySQL.GenDB.SQLReq("SELECT * from DB;");
DBTbl = SYS.BD.MySQL.GenDB.SQLReq("SELECT * from DB;");
Revision as of 11:37, 19 March 2018
Subsystem "DB" (SYS.BD)
Functions of the database object (SYS.BD["TypeDB"]["DB"]):
ElTp cfg( string nm ) — gets the value of the configuration field nm of the object.
bool cfgSet( string nm, ElTp val ) — sets the configuration field nm of the object to the value val.
Array SQLReq( string req, bool tr = EVAL ); — performs the SQL-request req to the DB, inside (tr=true), outside (tr=false) or no matter (tr=EVAL) to the transaction. Returns an array of rows of the result table with the fields both per indexes and column names. At an error the result property "err" sets to the error value.
DBTbl = SYS.BD.MySQL.GenDB.SQLReq("SELECT * from DB;");
if(DBTbl.err.length) SYS.messInfo("TEST DB","Error: "+DBTbl.err);
else for(var iRw = 0; iRw < DBTbl.length; iRw++) {
var rec = "";
for(var iFld = 0; iFld < DBTbl[iRw].length; iFld++) rec += DBTbl[iRw][iFld] + "\t";
SYS.messInfo("TEST DB", "Row "+iRw+": "+rec);
//Get column value by the name
if(iRw) SYS.messInfo("TEST DB", "Row "+iRw+": 'NAME'"+DBTbl[iRw]["NAME"]);
}