找不到记录... Agiletoolkit和Oracle.网格/CRUD元素 [英] No records found ...Agiletoolkit and Oracle. Grid/CRUD elements
问题描述
在建立模型并尝试显示显示未找到记录"的网格之后,我正在尝试使用oracle在Agile Toolkit上进行测试.
I am trying to test around Agile Toolkit with oracle, after seting up a model and trying to show a grid it says "No records found"...
让我告诉你我做了什么,因为我一直在猜测所有配置中的大多数,因为我没有找到有关oracle的指南.
Let me tell you what I did, since i've been guessing most of all configuration as I found no guides for oracle.
-
agiletoolkit config-default.php文件中的Oracle连接字符串如下:
My Oracle connection string in agiletoolkit config-default.php file looks like this:
$ config ['dsn'] = array('oci:dbname = localhost/MYDATABASE','MYUSER','MYPASSWORD');
$config['dsn']= array( 'oci:dbname=localhost/MYDATABASE', 'MYUSER', 'MYPASSWORD' );
要解决找不到驱动程序的错误,我在apache安装中的php.ini文件中启用了extension=php_pdo_oci8.dll
.
To fix the driver not found error, I enabled extension=php_pdo_oci8.dll
in the php.ini file from my apache installation.
然后出现一个有关缺少"oci.php"的错误,以解决我必须这样创建自己的文件:
Then there was an error about a missing "oci.php", to solve that I had to create my own file like this:
class DB_dsql_oci extends DB_dsql {
function limit($cnt,$shift=0){
$cnt+=$shift;
$this->where('NUM_ROWS>=',$shift);
$this->where('NUM_ROWS<',$cnt);
return $this;
}
function render_limit(){
return '';
}
}
并将其放置在...atk4\lib\DB\dsql
- 要修复来自oracle的特殊字符错误,我将/atk4/lib/DB/dsql.php上的第59行设置为空字符串,如下所示:
public $bt='';
我设法运行数据库测试,并显示已成功连接到数据库."
I manage to run the database test, and it says "Successfully connected to database."
然后,我像这样创建一个模型"lib \ Model \ Mytable.php":
Then I created a model "lib\Model\Mytable.php" like this:
<?php
class Model_Mytable extends Model_Table {
public $table = "MYTABLE";
function init(){
parent::init();
$this->addField('ID');
$this->addField('NAME');
$this->addField('INIDATE');
$this->addField('ENDDATE');
}
?>
之后,我创建了一个新页面并尝试使用如下模型:
After that, I made a new page and tried to use the model like this:
<?php
class page_test extends Page {
function init(){
parent::init();
$form = $this->add('Grid');
$form->setModel('Mytable');
}
}
?>
刷新浏览器后,它将显示网格,显示未找到记录"
After refreshing the browser, it will show the grid saying " No Records found"
我想知道发生了什么事,该表毫无疑问地记录了所有数据,并且我确信oracle正在解析查询,因为如果我错过一个列名,则会引发oracle错误.
I wonder whats happening, that table has records no doubt, all data is committed, and im sure oracle is parsing queries because if I miss a column name an oracle error will raise.
有任何线索吗?
推荐答案
这是您可以简单地将DSQL设置为View(例如,Grid)数据源的方法:
This is how you can simply set DSQL as your View (Grid for example) data source:
class page_test extends Page_Basic
{
function init()
{
parent::init();
// DSQL
$q = $this->api->db->dsql();
$q->table('MYTABLE')
->field('DNAME')
->field('INIDATE');
// Create grid and set DSQL as its data source
$g = $this->add('Grid');
$g->addColumn('DNAME');
$g->addColumn('INIDATE');
$g->setSource($q);
// better add paginator too or your grid can become huge :)
$g->addPaginator();
}
}
这篇关于找不到记录... Agiletoolkit和Oracle.网格/CRUD元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!