本文整理汇总了PHP中sql::esc方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::esc方法的具体用法?PHP sql::esc怎么用?PHP sql::esc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::esc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: result
function result()
{
if (!isset($this->exprs)) {
$this->error = loc_get_val('sql_list', 'unset', 'Expression is not set!');
return NULL;
}
$res = ' ';
if (is_array($this->exprs)) {
$exprs =& $this->exprs;
} else {
$exprs[] =& $this->exprs;
}
if (count($exprs) == 0) {
return '';
}
foreach ($exprs as $e) {
if ($res != ' ') {
$res .= $this->delimiter . ' ';
}
if (!is_object($e)) {
$this->error = loc_get_val('sql_list', 'not_an_object', '$exprs array contains weird data.');
return NULL;
}
if (is_a($e, 'sql_immed') || is_a($e, 'sql_var') || is_a($e, 'sql_column') || is_a($e, 'sql_list') || $this->nopar) {
//no parenthesis required
$res .= $e->result() . ' ';
} else {
$res .= '(' . $e->result() . ') ';
}
}
if (isset($this->func) && $this->func != '') {
$res = $this->func . '(' . $res . ')';
}
//check for dupplicate alias/ambigous column
if ($this->alias != '') {
$res .= ' AS `' . sql::esc($this->alias) . '`';
}
if ($this->variable != '') {
$res = ' @`' . sql::esc($this->variable) . '` :=' . $res;
}
return $res;
}
示例2: caddkey
function caddkey($n, $key)
{
if (is_array($this->keys) && is_array($this->keys[$n]) && is_array($this->cols)) {
foreach ($this->keys[$n] as $k) {
foreach ($this->cols as $co) {
if ($co->name == $k->col && $co->sequence == 1) {
$this->auto_inc = (object) array('name' => $co->name, 'type' => $co->type->raw, 'null' => $co->null, 'default' => $co->default, 'sequence' => $co->sequence, 'comment' => $co->comment, 'prev_col' => $co->prev_col);
}
}
}
}
$q = "ALTER TABLE `" . sql::esc($this->ctbl) . "` ADD ";
if ($n == 'PRIMARY') {
$q .= 'PRIMARY KEY';
} else {
$q .= " KEY ";
}
$cols = '';
foreach ($key as $col) {
if ($cols != '') {
$cols .= ', ';
}
$cols .= "`" . sql::esc($col->col) . "`";
if ($col->sub) {
$cols .= "(" . $col->sub . ")";
}
}
$q .= " ({$cols})";
$sz = is_array($this->querys) ? sizeof($this->querys) : 0;
$this->querys[$sz] = $q;
}
示例3: bootstrap
function bootstrap()
{
$this->long_name = editor_generic::long_name();
//if(!isset($this->settings))$this->settings_io->load($this);
//if($this->settings->ed_db!='')$this->context[$this->long_name]['dbname']=$this->settings->ed_db;
//$this->context[$this->long_name]['tblname']=$this->edittbl;
if ($this->settings->ed_db != '') {
$dbe = '`' . sql::esc($this->settings->ed_db) . '`.';
}
$this->context[$this->long_name . '.col']['rawquery'] = 'show columns from ' . $dbe . '`' . sql::esc($this->settings->ed_table) . '`';
$this->context[$this->long_name]['retid'] = $this->id_gen();
$this->context[$this->long_name]['io_class'] = get_class($this->settings_io);
if (is_array($this->editors)) {
foreach ($this->editors as $k => $e) {
$this->context[$this->long_name . '.' . $k]['var'] = $k;
$e->keys =& $this->keys;
$e->args =& $this->args;
$e->context =& $this->context;
if (isset($e->validator_class)) {
$this->context[$this->long_name . '.' . $k]['validator_class'] = $e->validator_class;
}
$e->bootstrap();
}
}
}
示例4: set_query
function set_query($oid, $setting, $uid, $preset, $val)
{
return "INSERT INTO `" . TABLE_META_SETTINGS . "` SET `oid` = '" . sql::esc($oid) . "', `setting` = '" . sql::esc($setting) . "', `uid` = '" . sql::esc($uid) . "', `preset` = '" . sql::esc($preset) . "', `val` = '" . sql::esc($val) . "' ON DUPLICATE KEY UPDATE `val` = '" . sql::esc($val) . "'";
}