本文整理汇总了PHP中DB::IsError方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::IsError方法的具体用法?PHP DB::IsError怎么用?PHP DB::IsError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::IsError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install()
{
$sql = "CREATE TABLE IF NOT EXISTS miscapps (miscapps_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, ext VARCHAR( 50 ) , description VARCHAR( 50 ) , dest VARCHAR( 255 ))";
$q = $this->db->prepare($sql);
$q = $q->execute();
unset($sql);
unset($q);
//Migration... Is this still needed
global $db;
$results = array();
$sql = "SELECT miscapps_id, dest FROM miscapps";
$results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (!\DB::IsError($results)) {
// error - table must not be there
foreach ($results as $result) {
$old_dest = $result['dest'];
$this->id = $result['miscapps_id'];
$new_dest = merge_ext_followme(trim($old_dest));
if ($new_dest != $old_dest) {
$sql = "UPDATE miscapps SET dest = '{$new_dest}' WHERE miscapps_id = {$miscapps_id} AND dest = '{$old_dest}'";
$results = $db->query($sql);
if (DB::IsError($results)) {
die_freepbx($results->getMessage());
}
}
}
}
}
示例2: parking_save
/** parking_save
* Short insert or update parking settings
* Long takes array of settings to update, missing settings will
* get default values, if id not present it will insert a new row.
* Returns the id of the current or newly inserted record or
* boolean false upon a failure.
*
* @author Philippe Lindheimer
* @param array $parms
* @return mixed
*/
function parking_save($parms = array())
{
global $db, $amp_conf;
if (!empty($parms['id'])) {
$var['id'] = $db->escapeSimple($parms['id']);
}
if (!function_exists('parkpro_get')) {
$var['id'] = 1;
}
$var['name'] = "Parking Lot";
$var['type'] = 'public';
$var['parkext'] = '';
$var['parkpos'] = '';
$var['numslots'] = 4;
$var['parkingtime'] = 45;
$var['parkedmusicclass'] = 'default';
$var['generatehints'] = 'yes';
$var['generatefc'] = 'yes';
$var['findslot'] = 'first';
$var['parkedplay'] = 'both';
$var['parkedcalltransfers'] = 'caller';
$var['parkedcallreparking'] = 'caller';
$var['alertinfo'] = '';
$var['cidpp'] = '';
$var['autocidpp'] = 'none';
$var['announcement_id'] = null;
$var['comebacktoorigin'] = 'yes';
$var['dest'] = '';
foreach ($var as $k => $v) {
if (isset($parms[$k])) {
$var[$k] = $db->escapeSimple($parms[$k]);
}
}
$var['defaultlot'] = isset($var['id']) && $var['id'] == 1 ? 'yes' : 'no';
$fields = "name, type, parkext, parkpos, numslots, parkingtime, parkedmusicclass, generatehints, generatefc, findslot, parkedplay,\n\t\tparkedcalltransfers, parkedcallreparking, alertinfo, cidpp, autocidpp, announcement_id, comebacktoorigin, dest, defaultlot";
$holders = "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?";
if (empty($var['id'])) {
$sql = "INSERT INTO parkplus ({$fields}) VALUES ({$holders})";
} else {
$sql = "REPLACE INTO parkplus (id, {$fields}) VALUES (?,{$holders})";
}
$res = $db->query($sql, array_values($var));
if (DB::IsError($res)) {
$id = false;
// TODO log error
} elseif (empty($var['id'])) {
if (method_exists($db, 'insert_id')) {
$id = $db->insert_id();
} else {
$id = $amp_conf["AMPDBENGINE"] == "sqlite3" ? sqlite_last_insert_rowid($db->connection) : mysql_insert_id($db->connection);
}
needreload();
} else {
$id = $var['id'];
needreload();
}
return $id;
}
示例3: setcid_edit
function setcid_edit($cid_id, $description, $cid_name, $cid_num, $dest)
{
global $db;
$sql = "UPDATE setcid SET " . "description = '" . $db->escapeSimple($description) . "', " . "cid_name = '" . $db->escapeSimple($cid_name) . "', " . "cid_num = '" . $db->escapeSimple($cid_num) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE cid_id = " . $db->escapeSimple($cid_id);
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getMessage() . $sql);
}
}
示例4: contactdir_get_all_server_types
function contactdir_get_all_server_types()
{
global $db;
$sql = "select * from contactdir_server_types";
$results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($results)) {
die_freepbx($result->getDebugInfo());
}
return $results;
}
示例5: legacy_extensions_del
function legacy_extensions_del($context, $exten)
{
global $db;
$sql = "DELETE FROM extensions WHERE context = '" . $db->escapeSimple($context) . "' AND `extension` = '" . $db->escapeSimple($exten) . "'";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($sql . "<br>\n" . $result->getMessage());
}
return $result;
}
示例6: ttsengines_get_all_engines
function ttsengines_get_all_engines()
{
global $db;
$sql = "select * from ttsengines";
$results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($results)) {
die_freepbx($result->getDebugInfo());
}
return $results;
}
示例7: restart_get_devices
function restart_get_devices($grp)
{
global $db;
$sql = "SELECT * FROM devices";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
$results = null;
}
foreach ($results as $val) {
$tmparray[] = $val[0];
}
return $tmparray;
}
示例8: _timeconditions_timegroups_get_times
function _timeconditions_timegroups_get_times($timegroup)
{
global $db;
$sql = "select id, time from timegroups_details where timegroupid = {$timegroup}";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
$results = null;
}
foreach ($results as $val) {
$tmparray[] = array($val[0], $val[1]);
}
return $tmparray;
}
示例9: getZap_sib
function getZap_sib($searchext)
{
global $db;
zapexists();
$sql = "SELECT id,data FROM zap WHERE keyword = 'callerid' AND data LIKE '%" . $searchext . "%' ORDER BY id";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
$results = null;
}
foreach ($results as $result) {
$result[] = 'zap';
$zap[] = $result;
}
return $zap;
}
示例10: execSQL
function execSQL($file)
{
global $db;
$data = null;
// run sql script
$fd = fopen($file, "r");
while (!feof($fd)) {
$data .= fread($fd, 1024);
}
fclose($fd);
preg_match_all("/((SELECT|INSERT|UPDATE|DELETE|CREATE|DROP).*);\\s*\n/Us", $data, $matches);
foreach ($matches[1] as $sql) {
$result = $db->query($sql);
if (DB::IsError($result)) {
return false;
}
}
return true;
}
示例11: get_dial_string
function get_dial_string($extnum)
{
global $db;
$ds = '';
$sql = "SELECT value FROM globals WHERE variable = 'E{$extnum}'";
$result = $db->getAll($sql);
if (DB::IsError($result)) {
die($result->getMessage());
}
if (count($result) > 0) {
$exttech = $result[0][0];
switch ($exttech) {
case "SIP":
$ds = "SIP/" . $extnum;
break;
case "IAX2":
$ds = "IAX2/" . $extnum;
break;
case "ZAP":
$sql = "SELECT value FROM globals WHERE variable = 'ZAPCHAN_{$extnum}'";
$zapres = $db->getAll($sql);
if (DB::IsError($zapres)) {
die($zapres->getMessage());
}
if (count($zapres) > 0) {
$zapchannel = $result[0][0];
}
$ds = "Zap/" . $zapchannel;
break;
default:
outn($exttech . "...");
break;
}
}
return $ds;
}
示例12: die
if (DB::IsError($results)) {
die($results->getMessage());
}
// get all call groups
$sql = "select extension, args from extensions where args LIKE 'GROUP=%';";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
die($results->getMessage());
}
out(count($results) . " to check...");
if (count($results) > 0) {
// yes, there are ring groups defined
foreach ($results as $key => $value) {
// replace * that are not at the beginning of an extension
$new_extensions = preg_replace("/([0-9*#]+)\\*([0-9#]+)/", "\$1\$2#", $value[1]);
// only replace if changed
if ($new_extensions != $value[1]) {
out("Changing " . $value[1] . " to " . $new_extensions);
$sql = sprintf("update extensions set args = '%s' WHERE extension = '%s' ", $new_extensions, $value['0']) . "AND args LIKE 'GROUP=%'";
// debug("sql = ". $sql);
$update_results = $db->query($sql);
if (DB::IsError($update_results)) {
die($update_results->getMessage());
}
}
}
}
out("OK");
?>
示例13: callrecording_edit
function callrecording_edit($callrecording_id, $description, $callrecording_mode, $dest)
{
global $db;
$sql = "UPDATE callrecording SET " . "description = '" . $db->escapeSimple($description) . "', " . "callrecording_mode = '" . $db->escapeSimple($callrecording_mode) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE callrecording_id = " . $db->escapeSimple($callrecording_id);
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getMessage() . $sql);
}
}
示例14: array
$rule_match = array('status'=>false,'number'=>false);
}
if((!$rule_match['status']) || (!$rule_match['number'])){
if($debug)
{
print "Searching Superfecta Cache ... ";
}
//clear old cache
$sql = "DELETE FROM superfectacache WHERE dateentered < DATE_SUB(NOW(),INTERVAL ".(isset($run_param['Cache_Timeout'])?$run_param['Cache_Timeout']:$source_param['Cache_Timeout']['default'])." DAY)";
$db->query($sql);
//query cache
$sql = "SELECT callerid FROM superfectacache WHERE number = '$thenumber'";
$sres = $db->getOne($sql);
if (DB::IsError($sres))
{
die_freepbx( "Error: " . $sres->getMessage() . "<br>");
}
//check to see if there is a valid return and that it's not numeric
if(($sres != '') && !is_numeric($sres))
{
$caller_id = $sres;
$cache_found = true;
}
else if($debug)
{
print "not found<br>\n";
}
}elseif($debug){
示例15: __core_routing_getroutetrunks
function __core_routing_getroutetrunks($route)
{
global $db;
$sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-" . $route . "' AND (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' OR args LIKE 'dialout-dundi,%') ORDER BY CAST(priority as UNSIGNED) ";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
die_freepbx($results->getMessage());
}
$trunks = array();
foreach ($results as $row) {
if (preg_match('/^dialout-trunk,(\\d+)/', $row[0], $matches)) {
// check in_array -- even though we did distinct
// we still might get ${EXTEN} and ${EXTEN:1} if they used | to split a pattern
if (!in_array("OUT_" . $matches[1], $trunks)) {
$trunks[] = "OUT_" . $matches[1];
}
} else {
if (preg_match('/^dialout-enum,(\\d+)/', $row[0], $matches)) {
if (!in_array("OUT_" . $matches[1], $trunks)) {
$trunks[] = "OUT_" . $matches[1];
}
} else {
if (preg_match('/^dialout-dundi,(\\d+)/', $row[0], $matches)) {
if (!in_array("OUT_" . $matches[1], $trunks)) {
$trunks[] = "OUT_" . $matches[1];
}
}
}
}
}
return $trunks;
}