Project

General

Profile

Actions

Bug #58973

closed

quoteStr is not using the table

Added by Martin Tepper almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2014-05-20
Due date:
% Done:

0%

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

Description

Currently i'm trying to find a way to crawl EXT:news records with the crawler extension by using the single_pid of the category.
For this case i have a statement with three tables. (news,mm,category)

In this case the crawler is using the quoteStr method in TYPO3\CMS\Core\Database. But here the tablename will not use so that it is not possible to get a valid query in my case.

I think it should not be a problem to set the tablename all the time.


Files

quoteStr.patch (714 Bytes) quoteStr.patch Martin Tepper, 2014-05-20 22:54
Actions #1

Updated by Markus Klein almost 10 years ago

What is wrong with your patch? 140 KB?

Actions #3

Updated by Markus Klein almost 10 years ago

  • File deleted (0001-BUGFIX-quoteStr-use-not-the-table.patch)
Actions #4

Updated by Markus Klein almost 10 years ago

  • Status changed from New to Needs Feedback

Ok I had a look at the patch but I've still no clue what your actual problem is.
Can you please provide demo queries with what is wrong?

quoteStr only quotes a string according to the needs of mysql. This is independent of the actual table afaik.
(The table is only used when DBAL comes into the game. Not a topic here.)

Actions #5

Updated by Martin Tepper almost 10 years ago

I builded a crawler configuration for news records where each category has an own detail page.

my config:
&L=[0|1]&tx_news_pi1[news]=[_TABLE:tx_news_domain_model_news;_PID:9;_FIELD:tx_news_domain_model_news.uid;_ENABLELANG:1;_ADDTABLE:,tx_news_domain_model_news_category_mm,tx_news_domain_model_category;_WHERE: AND tx_news_domain_model_news.uid = tx_news_domain_model_news_category_mm.uid_local AND tx_news_domain_model_news_category_mm.uid_foreign = tx_news_domain_model_category.uid AND tx_news_domain_model_category.single_pid = 20]

in this case the crawler build an query with quoteStr. As example here for the pid of the news records.

$GLOBALS['TYPO3_DB']->quoteStr('pid', 'tx_news_domain_model_news');

with the current code an query will generate which fails because pid has no relation to a table. example: (have a look to the pid field)

SELECT tx_news_domain_model_news.uid FROM tx_news_domain_model_news,tx_news_domain_model_news_category_mm,tx_news_domain_model_category WHERE tx_news_domain_model_news.uid = tx_news_domain_model_news_category_mm.uid_local AND tx_news_domain_model_news_category_mm.uid_foreign = tx_news_domain_model_category.uid AND tx_news_domain_model_category.single_pid = 20 and pid = 9

when the table would be use there would not be a problem. or maybe the crawler should use another method?

Actions #6

Updated by Markus Klein almost 10 years ago

This seems to be a bug of the crawler. I'm citing the description of the quoteStr() function:

Unless you have to apply the single quotes yourself you should rather use ->fullQuoteStr()!

@return string Output string; Quotes (" / ') and \ will be backslashed

It is intended to be used for values not for columns. So for columns the user has to take care on its own to have a unique naming.

Typical usage of fullQuoteStr() is:

$GLOBALS['TYPO3_DB']->exec_SELECTquery(
  '*',
  'tx_ext_table',
  'myname = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('My\'Name/with special chars in "it"', 'tx_ext_table')
);
Actions #7

Updated by Martin Tepper almost 10 years ago

Thanks for your interest to this problem

I will create a patch for the crawler extension.

Actions #8

Updated by Markus Klein almost 10 years ago

  • Status changed from Needs Feedback to Closed

Closing this issue then.

Actions

Also available in: Atom PDF