lib/db/cortex.php
public function sql_prependTableToFields($cond, $table) {
		$out = preg_replace_callback('/'.
			'(\w+\((?:[^)(]+|\((?:[^)(]+|(?R))*\))*\))|'.
			'(?:(\s)|^|(?<=[(]))'.
			'([a-zA-Z_](?:[\w\-_]+))'.
			'(?=[\s<>=!)]|$)/i',
			function($match) use($table) {
				if (!isset($match[3]))
					return $match[1];
				if (preg_match('/\b(AND|OR|IN|LIKE|NOT)\b/i',$match[3]))
					return $match[0];
				return $match[2].$table.'.'.$match[3];
			}, $cond);
		return $out ?: $cond;
	}
public function sql_prependTableToFields($cond, $table) {
		$out = preg_replace_callback('/'.
			'(\w+\((?:[^)(]+|\((?:[^)(]+|(?R))*\))*\))|'.
			'(?:(\s)|^|(?<=[(]))'.
			'([a-zA-Z_](?:[\w\-_]+))'.
			'(?=[\s<>=!)]|$)/i',
			function($match) use($table) {
				if (!isset($match[3]))
					return $match[1];
				if (preg_match('/\b(AND|OR|IN|LIKE|NOT)\b/i',$match[3]))
					return $match[0];
				return $match[2].$table.'.'.$match[3];
			}, $cond);
		return $out ?: $cond;
	}
public function sql_prependTableToFields ( $ cond , $ table ) { $ out = preg_replace_callback ( '/' . '(\w+\((?:[^)(]+|\((?:[^)(]+|(?R))*\))*\))|' . '(?:(\s)|^|(?<=[(]))' . '([a-zA-Z_](?:[\w\-_]+))' . '(?=[\s<>=!)]|$)/i' , function ( $ match ) use ( $ table ) { if ( ! isset ( $ match [ 3 ] ) ) return $ match [ 1 ] ; if ( preg_match ( '/\b(AND|OR|IN|LIKE|NOT)\b/i' , $ match [ 3 ] ) ) return $ match [ 0 ] ; return $ match [ 2 ] . $ table . '.' . $ match [ 3 ] ; } , $ cond ) ; return $ out ? : $ cond ; }
add table prefix to identifiers which do not have a table prefix yet
@param string $cond
@param string $table
@return string
add table prefix to identifiers which do not have a table prefix yet