WIP: schedulers..
This commit is contained in:
@@ -182,10 +182,6 @@ class MssqlManager extends DBManager
|
||||
}
|
||||
}
|
||||
|
||||
if($this->checkError('Could Not Connect:', $dieOnError))
|
||||
$GLOBALS['log']->info("connected to db");
|
||||
|
||||
$GLOBALS['log']->info("Connect:".$this->database);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +214,6 @@ class MssqlManager extends DBManager
|
||||
if (empty($app_strings) or !isset($app_strings['ERR_MSSQL_DB_CONTEXT'])) {
|
||||
//ignore the message from sql-server if $app_strings array is empty. This will happen
|
||||
//only if connection if made before languge is set.
|
||||
$GLOBALS['log']->debug("Ignoring this database message: " . $sqlmsg);
|
||||
$sqlmsg = '';
|
||||
}
|
||||
else {
|
||||
@@ -229,7 +224,6 @@ class MssqlManager extends DBManager
|
||||
}
|
||||
|
||||
if ( strlen($sqlmsg) > 2 ) {
|
||||
$GLOBALS['log']->fatal("SQL Server error: " . $sqlmsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -246,12 +240,8 @@ class MssqlManager extends DBManager
|
||||
$suppress = false
|
||||
)
|
||||
{
|
||||
// Flag if there are odd number of single quotes
|
||||
if ((substr_count($sql, "'") & 1))
|
||||
$GLOBALS['log']->error("SQL statement[" . $sql . "] has odd number of single quotes.");
|
||||
|
||||
$this->countQuery($sql);
|
||||
$GLOBALS['log']->info('Query:' . $sql);
|
||||
$this->checkConnection();
|
||||
$this->query_time = microtime(true);
|
||||
|
||||
@@ -268,7 +258,6 @@ class MssqlManager extends DBManager
|
||||
$this->lastmysqlrow = -1;
|
||||
|
||||
$this->query_time = microtime(true) - $this->query_time;
|
||||
$GLOBALS['log']->info('Query Execution Time:'.$this->query_time);
|
||||
|
||||
|
||||
$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError);
|
||||
@@ -295,8 +284,6 @@ class MssqlManager extends DBManager
|
||||
if ($start < 0)
|
||||
$start=0;
|
||||
|
||||
$GLOBALS['log']->debug(print_r(func_get_args(),true));
|
||||
|
||||
$this->lastsql = $sql;
|
||||
|
||||
//change the casing to lower for easier string comparison, and trim whitespaces
|
||||
@@ -392,7 +379,6 @@ class MssqlManager extends DBManager
|
||||
else {
|
||||
if ($start < 0)
|
||||
$start = 0;
|
||||
$GLOBALS['log']->debug(print_r(func_get_args(),true));
|
||||
$this->lastsql = $sql;
|
||||
$matches = array();
|
||||
preg_match('/^(.*SELECT )(.*?FROM.*WHERE)(.*)$/isU',$sql, $matches);
|
||||
@@ -547,8 +533,6 @@ class MssqlManager extends DBManager
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug('Limit Query: ' . $newSQL);
|
||||
$result = $this->query($newSQL, $dieOnError, $msg);
|
||||
$this->dump_slow_queries($newSQL);
|
||||
return $result;
|
||||
@@ -779,13 +763,11 @@ class MssqlManager extends DBManager
|
||||
return $col_name;
|
||||
}
|
||||
//break out of here, log this
|
||||
$GLOBALS['log']->debug("No match was found for order by, pass string back untouched as: $orig_order_match");
|
||||
return $orig_order_match;
|
||||
}
|
||||
else {
|
||||
//if found, then parse and return
|
||||
//grab string up to the aliased column
|
||||
$GLOBALS['log']->debug("order by found, process sql string");
|
||||
|
||||
$psql = (trim($this->getAliasFromSQL($sql, $orderMatch )));
|
||||
if (empty($psql))
|
||||
@@ -810,7 +792,6 @@ class MssqlManager extends DBManager
|
||||
$col_name = $col_name. " ". $asc_desc;
|
||||
|
||||
//pass in new order by
|
||||
$GLOBALS['log']->debug("order by being returned is " . $col_name);
|
||||
return $col_name;
|
||||
}
|
||||
}
|
||||
@@ -829,7 +810,6 @@ class MssqlManager extends DBManager
|
||||
{
|
||||
|
||||
global $beanList, $beanFiles;
|
||||
$GLOBALS['log']->debug("Module being processed is " . $module_str);
|
||||
//get the right module files
|
||||
//the module string exists in bean list, then process bean for correct table name
|
||||
//note that we exempt the reports module from this, as queries from reporting module should be parsed for
|
||||
@@ -847,14 +827,12 @@ class MssqlManager extends DBManager
|
||||
$tbl_name = trim($tbl_name);
|
||||
|
||||
if(empty($tbl_name)){
|
||||
$GLOBALS['log']->debug("Could not find table name for module $module_str. ");
|
||||
$tbl_name = $module_str;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//since the module does NOT exist in beanlist, then we have to parse the string
|
||||
//and grab the table name from the passed in sql
|
||||
$GLOBALS['log']->debug("Could not find table name from module in request, retrieve from passed in sql");
|
||||
$tbl_name = $module_str;
|
||||
$sql = strtolower($sql);
|
||||
|
||||
@@ -873,7 +851,6 @@ class MssqlManager extends DBManager
|
||||
if ($next_space > 0) {
|
||||
$tbl_name= substr($tableEnd,0, $next_space);
|
||||
if(empty($tbl_name)){
|
||||
$GLOBALS['log']->debug("Could not find table name sql either, return $module_str. ");
|
||||
$tbl_name = $module_str;
|
||||
}
|
||||
}
|
||||
@@ -911,7 +888,6 @@ class MssqlManager extends DBManager
|
||||
}
|
||||
}
|
||||
//return table name
|
||||
$GLOBALS['log']->debug("Table name for module $module_str is: ".$tbl_name);
|
||||
return $tbl_name;
|
||||
}
|
||||
|
||||
@@ -1066,7 +1042,6 @@ class MssqlManager extends DBManager
|
||||
$tableName
|
||||
)
|
||||
{
|
||||
$GLOBALS['log']->info("tableExists: $tableName");
|
||||
|
||||
$this->checkConnection();
|
||||
$result = $this->query(
|
||||
@@ -1135,7 +1110,6 @@ class MssqlManager extends DBManager
|
||||
*/
|
||||
public function getTablesArray()
|
||||
{
|
||||
$GLOBALS['log']->debug('MSSQL fetching table list');
|
||||
|
||||
if($this->getDatabase()) {
|
||||
$tables = array();
|
||||
@@ -1159,7 +1133,6 @@ class MssqlManager extends DBManager
|
||||
*/
|
||||
public function wakeupFTS()
|
||||
{
|
||||
$GLOBALS['log']->debug('MSSQL about to wakeup FTS');
|
||||
|
||||
if($this->getDatabase()) {
|
||||
//create wakup catalog
|
||||
|
||||
@@ -120,13 +120,10 @@ class MysqlManager extends DBManager
|
||||
|
||||
if (mysql_errno($this->getDatabase())) {
|
||||
if ($this->dieOnError || $dieOnError){
|
||||
$GLOBALS['log']->fatal("MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database));
|
||||
sugar_die ($msg."MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database));
|
||||
}
|
||||
else {
|
||||
$this->last_error = $msg."MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database);
|
||||
$GLOBALS['log']->error("MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database));
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -152,7 +149,6 @@ class MysqlManager extends DBManager
|
||||
)
|
||||
{
|
||||
parent::countQuery($sql);
|
||||
$GLOBALS['log']->info('Query:' . $sql);
|
||||
$this->checkConnection();
|
||||
//$this->freeResult();
|
||||
$this->query_time = microtime(true);
|
||||
@@ -165,8 +161,6 @@ class MysqlManager extends DBManager
|
||||
|
||||
$this->lastmysqlrow = -1;
|
||||
$this->query_time = microtime(true) - $this->query_time;
|
||||
$GLOBALS['log']->info('Query Execution Time:'.$this->query_time);
|
||||
|
||||
|
||||
$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError);
|
||||
if($autofree)
|
||||
@@ -187,7 +181,6 @@ class MysqlManager extends DBManager
|
||||
{
|
||||
if ($start < 0)
|
||||
$start = 0;
|
||||
$GLOBALS['log']->debug('Limit Query:' . $sql. ' Start: ' .$start . ' count: ' . $count);
|
||||
|
||||
$sql = "$sql LIMIT $start,$count";
|
||||
$this->lastsql = $sql;
|
||||
@@ -225,20 +218,7 @@ class MysqlManager extends DBManager
|
||||
|
||||
if ( empty($badQuery) )
|
||||
return true;
|
||||
|
||||
foreach($badQuery as $table=>$data ){
|
||||
if(!empty($data)){
|
||||
$warning = ' Table:' . $table . ' Data:' . $data;
|
||||
if(!empty($GLOBALS['sugar_config']['check_query_log'])){
|
||||
$GLOBALS['log']->fatal($sql);
|
||||
$GLOBALS['log']->fatal('CHECK QUERY:' .$warning);
|
||||
}
|
||||
else{
|
||||
$GLOBALS['log']->warn('CHECK QUERY:' .$warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -331,7 +311,6 @@ class MysqlManager extends DBManager
|
||||
public function getTablesArray()
|
||||
{
|
||||
global $sugar_config;
|
||||
$GLOBALS['log']->debug('Fetching table list');
|
||||
|
||||
if ($this->getDatabase()) {
|
||||
$tables = array();
|
||||
@@ -363,7 +342,6 @@ class MysqlManager extends DBManager
|
||||
$tableName
|
||||
)
|
||||
{
|
||||
$GLOBALS['log']->info("tableExists: $tableName");
|
||||
|
||||
if ($this->getDatabase()) {
|
||||
$result = $this->query("SHOW TABLES LIKE '".$tableName."'");
|
||||
@@ -441,10 +419,6 @@ class MysqlManager extends DBManager
|
||||
mysql_query($charset, $this->database); // no quotes around "[charset]"
|
||||
mysql_query("SET NAMES 'utf8'", $this->database);
|
||||
|
||||
if($this->checkError('Could Not Connect:', $dieOnError))
|
||||
$GLOBALS['log']->info("connected to db");
|
||||
|
||||
$GLOBALS['log']->info("Connect:".$this->database);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,13 +123,10 @@ class MysqliManager extends MysqlManager
|
||||
|
||||
if (mysqli_errno($this->getDatabase())){
|
||||
if($this->dieOnError || $dieOnError){
|
||||
$GLOBALS['log']->fatal("MySQL error ".mysqli_errno($this->database).": ".mysqli_error($this->database));
|
||||
sugar_die ($msg."MySQL error ".mysqli_errno($this->database).": ".mysqli_error($this->database));
|
||||
}
|
||||
else{
|
||||
$this->last_error = $msg."MySQL error ".mysqli_errno($this->database).": ".mysqli_error($this->database);
|
||||
$GLOBALS['log']->error("MySQL error ".mysqli_errno($this->database).": ".mysqli_error($this->database));
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -149,7 +146,6 @@ class MysqliManager extends MysqlManager
|
||||
{
|
||||
static $queryMD5 = array();
|
||||
parent::countQuery($sql);
|
||||
$GLOBALS['log']->info('Query:' . $sql);
|
||||
$this->checkConnection();
|
||||
//$this->freeResult();
|
||||
$this->query_time = microtime(true);
|
||||
@@ -166,8 +162,6 @@ class MysqliManager extends MysqlManager
|
||||
|
||||
$this->lastmysqlrow = -1;
|
||||
$this->query_time = microtime(true) - $this->query_time;
|
||||
$GLOBALS['log']->info('Query Execution Time:'.$this->query_time);
|
||||
|
||||
|
||||
$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError);
|
||||
if($autofree)
|
||||
@@ -318,9 +312,5 @@ class MysqliManager extends MysqlManager
|
||||
mysqli_query($this->database,"SET CHARACTER SET utf8"); // no quotes around "[charset]"
|
||||
mysqli_query($this->database,"SET NAMES 'utf8'");
|
||||
|
||||
if($this->checkError('Could Not Connect:', $dieOnError))
|
||||
$GLOBALS['log']->info("connected to db");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user