Project

General

Profile

Actions

Bug #17552

closed

IFNULL operator cannot be parsed

Added by Marcel Alburg over 16 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2007-08-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello,

i wanna use IrFAQ with DBAL and PostgreSQL. PostGresql dont use IFNULL and because of that, i changed that to COALESCE.

But now, i've a error (the same error like with IFNULL).

SQL engine parse ERROR: No field name found as expected in parseWhereClause(): near "COALESCE = 1) AND"

i've the version von svn.

Marcel

(issue imported from #M6196)


Files

6196_core.diff (2.31 KB) 6196_core.diff Administrator Admin, 2010-02-13 13:00
6196_dbal.diff (5.38 KB) 6196_dbal.diff Administrator Admin, 2010-02-13 13:15
6196_dbal_v2.diff (7.51 KB) 6196_dbal_v2.diff Administrator Admin, 2010-02-13 14:14

Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #22116: IFNULL operator cannot be parsedClosed2010-02-13

Actions
Actions #1

Updated by Martin Kutschker over 16 years ago

DBAL supports only a limited set of SQL-functions.

But for your case it should IMHO provide a utility method to creates a) the IFNULL-equivalent for the DB (I think ADOdb has such a function) and b) support of course this function when parsing the query.

Actions #2

Updated by Xavier Perseguers about 14 years ago

Taking information from duplicated bug:

When using tt_news and choosing to restrict the list of news with a set of news categories, FE rendering crashes with:

Could not parse where clause in /path/to/dbal/class.ux_t3lib_db.php : 1072

This is due by tt_news which issues this kind of query:

1=1 AND (IFNULL IN (21,22)) AND tt_news.sys_language_uid IN (0,-1) AND tt_news.pid > 0 AND tt_news.pid IN (61) AND tt_news.deleted=0 AND tt_news.t3ver_state<=0 AND tt_news.hidden=0 AND tt_news.starttime<=1266057900 AND (tt_news.endtime=0 OR tt_news.endtime>1266057900) AND (tt_news.fe_group='' OR tt_news.fe_group IS NULL OR tt_news.fe_group='0' OR (tt_news.fe_group LIKE '%,0,%' OR tt_news.fe_group LIKE '0,%' OR tt_news.fe_group LIKE '%,0' OR tt_news.fe_group='0') OR (tt_news.fe_group LIKE '%,-1,%' OR tt_news.fe_group LIKE '-1,%' OR tt_news.fe_group LIKE '%,-1' OR tt_news.fe_group='-1'))

Problem is the IFNULL which cannot be parsed ATM.

Actions #3

Updated by Xavier Perseguers about 14 years ago

- Oracle equivalent is NVL : http://www.techonthenet.com/oracle/functions/nvl.php [^]
- MSSQL is ISNULL : http://msdn.microsoft.com/fr-fr/library/ms184325.aspx
- PostgreSQL would use COALESCE or a user-defined function mapping IFNULL to COALESCE as we usually do with PostgreSQL

Actions #4

Updated by Xavier Perseguers about 14 years ago

Core trunk (rev. 6899) and DBAL trunk (rev. 29977)

Actions

Also available in: Atom PDF