DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Defining and using an external query manager

In the section “getting data from queries” we have seen how queries could be used with the “sav_jpgraph” extension by means of a <query> ... </query> tag in which the SELECT, FROM, WHERE, ... clauses were defined. In this section we will deal with queries defined by means of another extension which will be called a query manager. For example, we will consider the extension “wfqbe” which provides a good solution to manage general queries.

In “sav_jpgraph” a special hook was introduced in the class “typo3” (see “class.typo3.php”) to process the query and deal with errors, if any. The hook is defined by means of the global variable TYPO3_CONF_VARS (see http://typo3.org/documentation/document- library/core-documentation/doc_core_api/4.2.0/view/3/4/#id4198557 ). The sub_key “queryManagerClass” is used received the query manager class in which the two methods “executeQuery” and “getErrorMessage” must be defined.

Developing a connector for the external query manager

You have to develop a connector if it does not already exist. A connector with “wfqbe” is taken as an example of the implementation. This connector is called “wfqbe_savjpgraph” and was developed with Mauro Lorenzutti who maintains the “wfqbe” extension. It is available from the TER.

  1. Download the extension “wfqbe_savjpgraph” from the TER.
  2. The connector must contain a class with two methods “executeQuery” and “getErrorMessage”. For example, in the “wfqbe_savjpgraph” connector, the following class was added in a file “hook/class.tx_wfqbe_savjpgraph_hook.php”.
  3. The hook must be added in “ext_localconf.php”. For example, the following line was added in the “wfqbe_savjpgraph” extension.
// Adds a hook for sav_jpgraph
$TYPO3_CONF_VARS['EXTCONF']['sav_jpgraph']['queryManagerClass']['wfqbe'] = 'EXT:wfqbe_savjpgraph/hook/class.tx_wfqbe_savjpgraph_hook.php:tx_wfqbe_savjpgraph_hook';

Using the query manager

  1. Define a query with the query manager. For example, with “wfqbe” you need to create a sysfolder in which you will define your query. Assume that your new “wfqbe” query has the id “15”.
  2. In “sav_jpgraph” create a query tag in which you will call the previous query as follows:
<query id="1">
  <setQueryManager type="wfqbe" uid="15" />
</query>

It will call the query whose uid=15 defined with the query manager whose key is “wfqbe”.