issue #0001590 : Modification du code pour connexion sur une seule base de données

This commit is contained in:
Michael RICOIS 2013-03-19 08:42:10 +00:00
parent 44e9dd0278
commit 42865deac9
6 changed files with 35 additions and 62 deletions

View File

@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "/home/vhosts/data"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=ciblage
profil.db.ciblage.params.password=z7jq8AhvrwqQJ4Yb
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.3.30
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.metier.adapter=mysqli
profil.db.metier.params.host=192.168.3.30
profil.db.metier.params.username=ciblage
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.metier.params.dbname=jo
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=127.0.0.1
profil.sphinx.port=3312

View File

@ -23,27 +23,22 @@ autoloaderNamespaces[] = "Form_"
; Scores configuration
profil.server.name = development
profil.webservice.location = sdsrvdev01
profil.webservice.location = local
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=root
profil.db.ciblage.params.password=bj10sx
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.path.data = "your/data/path
profil.db.metier.adapter=mysqli
profil.db.metier.params.host=192.168.78.230
profil.db.metier.params.username=ciblage
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.metier.params.dbname=jo
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312

View File

@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=root
profil.db.ciblage.params.password=bj10sx
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.metier.adapter=mysqli
profil.db.metier.params.host=192.168.78.230
profil.db.metier.params.username=ciblage
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.metier.params.dbname=jo
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312

View File

@ -43,9 +43,9 @@ if(isset($opts->help))
}
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->ciblage);
$db = Zend_Db::factory($c->profil->db->metier);
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select()
->where('idProfil != ?', 0)

View File

@ -56,13 +56,7 @@ Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
//Définition bdd
try {
$db = Zend_Db::factory($config->profil->db->ciblage);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
$db = Zend_Db::factory($config->profil->db->metier);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
@ -72,12 +66,12 @@ $liste = array();
if ($opts->id)
{
//Read SIRETs
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$commande = $commandesM->find(intval($opts->id))->current();
$identifiants = json_decode($commande->identifiants, true);
//Read profil for data extract
$profilM = new Application_Model_EnrichissementProfils($db);
$profilM = new Application_Model_CiblageEnrichissementProfils();
$profil = $profilM->find(intval($commande->idProfil))->current();
$dataProfil = json_decode($profil->criteres, true);
}

View File

@ -45,13 +45,7 @@ if(isset($opts->help))
$config = new Zend_Config($application->getOptions());
try {
$db = Zend_Db::factory($config->profil->db->ciblage);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
$db = Zend_Db::factory($config->profil->db->metier);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
@ -85,7 +79,7 @@ $keys = array(
'bilYP',
);
$sql = 'TRUNCATE TABLE fields_minmax';
$sql = 'TRUNCATE TABLE ciblage.fields_minmax';
if ( !$db->query($sql) ) {
die ('Impossible de vider la table fields_minmax');
}
@ -93,7 +87,7 @@ if ( !$db->query($sql) ) {
foreach($keys as $key) {
//Lecture
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act';
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM jo.etablissements_act';
$stmt = $dbMetier->query($sql);
$result = $stmt->fetchObject();
@ -103,7 +97,7 @@ foreach($keys as $key) {
'min' => $result->min,
'max' => $result->max,
);
$db->insert('fields_minmax', $data);
$db->insert('ciblage.fields_minmax', $data);
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
}
if ($opts->manuel) print("Terminé\n");