本文整理汇总了PHP中Sqlite::getRowsGeneric方法的典型用法代码示例。如果您正苦于以下问题:PHP Sqlite::getRowsGeneric方法的具体用法?PHP Sqlite::getRowsGeneric怎么用?PHP Sqlite::getRowsGeneric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sqlite
的用法示例。
在下文中一共展示了Sqlite::getRowsGeneric方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFromList
final function getFromList($class, $name)
{
if (cse($class, "_a")) {
return $this->{$class}[$name];
}
// A small hack.. If asked for the same object, return ourselves. This is the best way to do it.. I think this does not really break teh conceptual integrity. Every object must have itself as a virtual entity. Even if it is not there in the list, it should be gettable.... The only question is the uniqueness. BUt our model of unique nname makes sure of that too...
if ($class === lget_class($this) && $name === $this->nname) {
return $this;
}
// A virtual list concept only implemented and need in ffile. This allows us to get an object without initializing the whole list.
$this->__list_list = array_push_unique($this->__list_list, $class);
$ret = $this->getFromVirtualList($class, $name);
if ($ret) {
$ret->__parent_o = $this;
return $ret;
}
$name = str_replace("'", "", $name);
$list = "{$class}_l";
if (!isset($this->{$list})) {
$this->{$list} = null;
//throw new lxexception ("The " . get_class($this) . ":$list is NULL ");
}
// Very important. If it is already set, then don't ever load it from the database.
if (isset($this->{$list}[$name])) {
$object = $this->{$list}[$name];
return $object;
}
if (exec_class_method($class, 'canGetSingle')) {
if (isset($this->{$list}[$name])) {
return $this->{$list}[$name];
}
$rule = exec_class_method($class, 'initThisListRule', $this, $class);
if ($rule) {
$query = $this->getDefaultQuery($class, $rule);
if ($query) {
$query .= " AND nname = '{$name}'";
} else {
$query .= "where nname = '{$name}'";
}
$db = new Sqlite($this->__masterserver, $this->getTheTable($class));
$res = $db->getRowsGeneric($query);
if (!$res) {
throw new lxexception("The Element {$name} Doesnt Exist in. {$this->getClass()}:{$this->nname} {$list}");
}
$obj = new $class($this->__masterserver, $this->__readserver, $name);
$obj->setFromArray($res[0]);
$this->{$list}[$name] = $obj;
} else {
$this->{$list}[$name] = exec_class_method($class, 'initThisObject', $this, $class, $name);
}
} else {
$this->initListIfUndef($class);
if (!$this->{$list}) {
$this->{$list} = null;
//throw new lxexception ("The " . get_class($this) . ":$list is NULL ");
}
}
if (isset($this->{$list}[$name])) {
// The virtual objects already has a __parent_o, and so we shouldn't add our own __parent_o
if (!$this->isVirtual($class)) {
$this->{$list}[$name]->__parent_o = $this;
}
$this->{$list}[$name]->postRead();
return $this->{$list}[$name];
} else {
throw new lxexception("The Element {$name} Doesnt Exist in. {$this->getClass()}:{$this->nname} {$list}");
}
}