Edit me
Exécuter un dataquery
Interêt
Cette méthode permet l’exécution d’un dataquery selon les variables d’environnements passées en paramètre et de connaître le temps d’exécution de celle-ci.
Elle est éxécutée en ligne de commande.
Usage
Cette méthode a besoin du nom d’un projet et de l’id ou le nom d’une ressource de type dataquery ou export :
On lance ensuite la méthode execDataquery()
grâce au Voo4CliApi.php :
php voo4_cli . php mtd = execDataquery project = rythmo dataquery = 68 print_result = true
mtd* = le nom de la méthode
project* = le nom du projet
dataquery* = l’id ou le nom d’une ressource de type dataquery ou export
(print_result) = permet d’afficher le résultat de la requête
Le résultat s’affichera dans l’entrée standard.
Il est possible de passer des paramètres au dataquery sélectionné. Si le dataquery contient une ou des variable(s), il suffit de lui donner en paramètre comme ceci afin de récupérer les résultats voulus :
php voo4_cli . php mtd = execDataquery project = rythmo dataquery = 68 print_result = true prenom = kevin
Exemple de résultat :
<dataquery id= "listing" table_name= "{pj}_person_data" varset_name= "person" table_alias= "alias_5b191bdd94bf3" begin= "0" range= "3" >
<column sql= "{id_data}" alias= "person-id_data" default_short_label= "id_data" type= "integer" >
<field table_name= "alias_5b191bdd94bf3" field_name= "id_data" alias= "id_data" />
</column>
<column sql= "{agge}" alias= "person-agge" default_short_label= "agge" >
<field table_name= "alias_5b191bdd94bf3" field_name= "agge" alias= "agge" />
</column>
<column sql= "{id_data}" alias= "autoGeneratedKey-id_data-01" default_short_label= "autoGeneratedKey-id_data" >
<field table_name= "alias_5b191bdd94bf3" field_name= "id_data" alias= "id_data" />
</column>
</dataquery>
SELECT alias_5b191bdd94bf3.id_data AS `person-id_data`, alias_5b191bdd94bf3.agge AS `person-agge`, alias_5b191bdd94bf3.id_data AS `autoGeneratedKey-id_data-01` FROM `eaz6_person_data` AS `alias_5b191bdd94bf3` LIMIT 3
Array
(
[0] => Array
(
[person-id_data] => 1
[person-agge] => 23
[autoGeneratedKey-id_data-01] => 1
)
[1] => Array
(
[person-id_data] => 3
[person-agge] => 23
[autoGeneratedKey-id_data-01] => 3
)
[2] => Array
(
[person-id_data] => 5
[person-agge] => 99
[autoGeneratedKey-id_data-01] => 5
)
)
Temps de reponse 0.0049 seconde(s)
En cas d’erreur, une erreur SQL est retournée :
<?xml version="1.0" encoding="UTF-8"?>
<dataquery id= "listing" table_name= "{pj}_person_data" varset_name= "person" table_alias= "alias_5b191bdd94bf3" begin= "0" range= "3" >
<column sql= "{id_data}" alias= "person-id_data" default_short_label= "id_data" type= "integer" >
<field table_name= "alias_5b191bdd94bf3" field_name= "id_data" alias= "id_data" />
</column>
<column sql= "{aggge}" alias= "person-agge" default_short_label= "agge" >
<field table_name= "alias_5b191bdd94bf3" field_name= "agge" alias= "agge" />
</column>
<column sql= "{id_data}" alias= "autoGeneratedKey-id_data-01" default_short_label= "autoGeneratedKey-id_data" >
<field table_name= "alias_5b191bdd94bf3" field_name= "id_data" alias= "id_data" />
</column>
</dataquery>
SELECT alias_5b191bdd94bf3.id_data AS `person-id_data`, {aggge} AS `person-agge`, alias_5b191bdd94bf3.id_data AS `autoGeneratedKey-id_data-01` FROM `eaz6_person_data` AS `alias_5b191bdd94bf3` LIMIT 3
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '} AS `person-agge`, alias_5b191bdd94bf3.id_data AS `autoGeneratedKey-id_data-01`' at line 1, query was: SELECT alias_5b191bdd94bf3.id_data AS `person-id_data`, {aggge} AS `person-agge`, alias_5b191bdd94bf3.id_data AS `autoGeneratedKey-id_data-01` FROM `eaz6_person_data` AS `alias_5b191bdd94bf3` LIMIT 3