[TYPO3-dev] DBAL problems with pages.fe_group
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Tue Jun 27 15:28:09 CEST 2006
Hi!
The FE group access control is defined as such:
TCA:
'fe_group' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.fe_group',
'config' => Array (
'type' => 'select',
'size' => 5,
'maxitems' => 20,
'items' => Array (
Array('LLL:EXT:lang/locallang_general.php:LGL.hide_at_login', -1),
Array('LLL:EXT:lang/locallang_general.php:LGL.any_login', -2),
Array('LLL:EXT:lang/locallang_general.php:LGL.usergroups', '--div--')
),
'exclusiveKeys' => '-1,-2',
'foreign_table' => 'fe_groups',
)
),
SQL:
fe_group varchar(100) DEFAULT '0' NOT NULL
The odd thing is that the default value is the illegal id 0. Does TYPO3
rely on this '0', instead of using '' meaning an empty list?
Because this is is a problem for Oracle. When tyring to change a page
TYPO3/DBAL will use this statement:
UPDATE "pages" SET "storage_pid"='0', "fe_group"='', "tstamp"='1151413939'
WHERE "uid" = 33
But '' is NULL for Oracle, so we get a ORA-01407 error.
I can do this (modifying didn't work?):
ALTER TABLE "pages" DROP COLUMN "fe_group"
ALTER TABLE "pages" ADD ("fe_group" VARCHAR(100) DEFAULT '0'
But now an UPDATE with "fe_group"='' will result in ''. I think that Myslq
still would try to enter '0' but that doesn't help.
So what is best option?
a) Simply to remove the NOT NULL and the then useless DEFAULT '0'?
b) Adding TCA options that enforce the SQL default in situations like this?
c) Add DB triggers that turn '' into '0' for such fields?
I'm for a) If the field is a list then '' is an empty list not '0'. But is
the Core ready for this?
Masi
More information about the TYPO3-dev
mailing list