Correction et test des requêtes
This commit is contained in:
parent
7cfe6dde1d
commit
475a297afa
@ -23,6 +23,7 @@ defined('APPLICATION_ENV')
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
require_once APPLICATION_PATH.'/configs/config.php';
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
@ -105,12 +106,12 @@ $sourcesList = array(
|
||||
// Ajout Insee
|
||||
'inseeadd' => array(
|
||||
'declencheur' => 'ajout',
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateInsert AS dateEven FROM insee.insee_even WHERE insSIREN>1000 AND insSIEGE=1 AND insVMAJ='C' AND insEVE='CS' AND dateInsert BETWEEN '{DATEBEGIN}' AND '{DATEEND}'",
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateInsert AS dateEven FROM insee.insee_even WHERE insSIREN>1000 AND insSIEGE=1 AND insVMAJ='C' AND insEVE='CS' AND idFlux BETWEEN SUBSTR('{DATEBEGIN}',0,8) AND SUBSTR('{DATEEND}',0,8)",
|
||||
),
|
||||
// Nouveau score
|
||||
// Scores ajouté manuellement
|
||||
'manualadd' => array(
|
||||
'declencheur' => 'ajout',
|
||||
'sql' => "SELECT LPAD(siren,9,0) AS siren, dateUpdate AS dateEven FROM jo.scores_surveillance WHERE siren>1000 AND ( DATEDIFF(NOW(),indiScoreDate) IS NULL AND dateUpdate BETWEEN '{DATEBEGIN}' AND '{DATEEND}' OR indiScoreDate=0 )",
|
||||
'sql' => "SELECT LPAD(siren,9,0) AS siren, dateUpdate AS dateEven FROM jo.scores_surveillance WHERE siren>1000 AND dateUpdate BETWEEN '{DATEBEGIN}' AND '{DATEEND}' AND indiScoreDate=0",
|
||||
),
|
||||
// Bilan Association
|
||||
'bilanasso' => array(
|
||||
@ -135,22 +136,22 @@ $sourcesList = array(
|
||||
// Insee
|
||||
'insee' => array(
|
||||
'declencheur' => 'insee',
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateInsert AS dateEven FROM insee.insee_even WHERE insSIREN>1000 AND insSIEGE=1 AND dateInsert BETWEEN '{DATEBEGIN}' AND '{DATEEND}'",
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateInsert AS dateEven FROM insee.insee_even WHERE insSIREN>1000 AND insSIEGE=1 AND idFlux BETWEEN SUBSTR('{DATEBEGIN}',0,8) AND SUBSTR('{DATEEND}',0,8)",
|
||||
),
|
||||
// Bodacc
|
||||
'bodacc' => array(
|
||||
'declencheur' => 'bodacc',
|
||||
'sql' => "SELECT LPAD(siren,9,0) AS siren, IF(dateUpdate=0,dateInsert,dateUpdate) AS dateEven FROM jo.bodacc_detail WHERE siren>1000 AND Rubrique NOT IN('creations','comptes') AND (dateInsert BETWEEN '{DATEBEGIN}' AND '{DATEEND}' OR dateUpdate BETWEEN '{DATEBEGIN}' AND '{DATEEND}')",
|
||||
),
|
||||
// Collecte - Index :
|
||||
// Collecte
|
||||
'collecte' => array(
|
||||
'declencheur' => 'collecte',
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateInsert AS dateEven FROM jo.annonces WHERE siren>1000 AND dateInsert BETWEEN '{DATEBEGIN}' AND '{DATEEND}'",
|
||||
'sql' => "SELECT LPAD(siren,9,0) AS siren, dateInsert AS dateEven FROM jo.annonces WHERE siren>1000 AND dateInsert BETWEEN '{DATEBEGIN}' AND '{DATEEND}'",
|
||||
),
|
||||
// Ancien
|
||||
'ancien' => array(
|
||||
'declencheur' => 'ancien',
|
||||
'sql' => "SELECT LPAD(insSIREN,9,0) AS siren, dateUpdate AS dateEven FROM jo.scores_surveillance WHERE siren>1000 AND (DATEDIFF(NOW(), indiScoreDate) > 365) AND procol NOT IN('P') AND dateUpdate < '{DATEBEGIN}'",
|
||||
'sql' => "SELECT LPAD(siren,9,0) AS siren, dateUpdate AS dateEven FROM jo.scores_surveillance WHERE siren>1000 AND (DATEDIFF(NOW(), indiScoreDate) > 365) AND procol NOT IN('P') AND dateUpdate < '{DATEBEGIN}'",
|
||||
),
|
||||
);
|
||||
|
||||
@ -215,12 +216,12 @@ foreach($sourcesList as $source => $item) {
|
||||
}
|
||||
else {
|
||||
$survResult = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
if (empty($itemResult->dateEven)) {
|
||||
if (empty($item->dateEven)) {
|
||||
echo " : dateEven = NULL\n";
|
||||
continue;
|
||||
}
|
||||
$calculDate = DateTime::createFromFormat('YmdHis', $survResult->dateUpdate);
|
||||
$evenDate = DateTime::createFromFormat('YmdHis', $itemResult->dateEven);
|
||||
$evenDate = DateTime::createFromFormat('YmdHis', $item->dateEven);
|
||||
if ($evenDate > $calculDate) {
|
||||
$toCalculate = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user