For accessing the database the class JobDB can be used. This class allows you to query the JobRouter database or an external database using various SQL statements.
The JobDB class provides the method quote($value) that enables processing data to use them within SQL commands. As parameter, this method expects the value to be processed. For example, text values are enclosed by quotation marks, as the corresponding database system expects it.
Example:
$jobDB = $this->getJobDB();
// $username = 'admin';
// $minimalLogins = '100';
$username = $this->getTableValue('USERNAME');
$minimalLogins = $this->getTableValue('MINIMAL_LOGINS');
$quotedUsername = $jobDB->quote($username);
$quotedDecimal = $jobDB->quote($minimalLogins);
// ==> SELECT * FROM JRUSERS WHERE username = 'admin' AND login_count > 100;
$sql = 'SELECT * FROM JRUSERS WHERE username = ' . $quotedUsername . ' AND login_count > ' . $quotedDecimal;