BulliM
06-11-2019, 03:10 PM
I've created a new table in database. In cron script I try to delete some rows from it. Problem is, that new table isn't defined in /core/vb/db/mysql/querydefs.php. If I define the new table there, cron job runs without errors. But I won't define my table there, because on updates, this file is overwritten.
So I've created an addon instead and defined new table in /core/packages/addonname/db/mysql/querydefs.php. But that won't work.
vB::getDbAssertor()->delete('newtable',array('columnname' => 'columnvalue'));
This code runs fine, if new table is defined in /core/vb/db/mysql/querydefs.php. Runs not, if new table defined in /core/packages/addonname/db/mysql/querydefs.php. Addon is installed without errors.
Can anyone tell me why? This is my querydefs.php:
<?php if (!defined('VB_ENTRY')) die('Access denied.');
class addonname_dB_MYSQL_QueryDefs extends vB_dB_QueryDefs
{
private $db_type = 'MYSQL';
private $table_data = array(
'newtable' => array(
'key' => 'id',
'structure' => array('id', 'userid', 'columnname')
)
);
}
--------------- Added 1560349493 at 1560349493 ---------------
Solution: This cron job...
vB::getDbAssertor()->delete('newtable',array('columname' => 'columnvalue'));
...works, if tablename is defined in /core/vb/db/mysql/querydefs.php.
Following code works, if I use an addon to define my table in /core/packages/addonname/db/mysql/querydefs.php.
vB::getDbAssertor()->delete('addonname:newtable',array('columname' => 'columnvalue'));
So I've created an addon instead and defined new table in /core/packages/addonname/db/mysql/querydefs.php. But that won't work.
vB::getDbAssertor()->delete('newtable',array('columnname' => 'columnvalue'));
This code runs fine, if new table is defined in /core/vb/db/mysql/querydefs.php. Runs not, if new table defined in /core/packages/addonname/db/mysql/querydefs.php. Addon is installed without errors.
Can anyone tell me why? This is my querydefs.php:
<?php if (!defined('VB_ENTRY')) die('Access denied.');
class addonname_dB_MYSQL_QueryDefs extends vB_dB_QueryDefs
{
private $db_type = 'MYSQL';
private $table_data = array(
'newtable' => array(
'key' => 'id',
'structure' => array('id', 'userid', 'columnname')
)
);
}
--------------- Added 1560349493 at 1560349493 ---------------
Solution: This cron job...
vB::getDbAssertor()->delete('newtable',array('columname' => 'columnvalue'));
...works, if tablename is defined in /core/vb/db/mysql/querydefs.php.
Following code works, if I use an addon to define my table in /core/packages/addonname/db/mysql/querydefs.php.
vB::getDbAssertor()->delete('addonname:newtable',array('columname' => 'columnvalue'));