本文整理匯總了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}");
}
}