Correction de `lightdb:delete` et `lightdb:deleteAll` + Correction des `break` en `continue` dans `input/phone`
This commit is contained in:
parent
336e8e84a8
commit
f2da5085f7
|
@ -1,5 +1,5 @@
|
|||
.ftpconfig
|
||||
sftp-config.json
|
||||
phpunit/coverage/
|
||||
*/tmp/*
|
||||
#/public_html/tmp/*
|
||||
#/build/lightdb/storage/*/data
|
||||
|
|
|
@ -99,7 +99,8 @@
|
|||
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$ficheData['contact']]) )
|
||||
break;
|
||||
continue;
|
||||
|
||||
|
||||
$contact = $contacts[ $ficheData['contact'] ];
|
||||
|
||||
|
@ -115,7 +116,7 @@
|
|||
|
||||
// S'il a déja une fiche ou qu'on a déja fait une fiche, on quitte
|
||||
if( is_array($existingData) && isset($existingData['studies2']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
break;
|
||||
continue;
|
||||
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
|
@ -127,7 +128,7 @@
|
|||
|
||||
// S'il a déja été saisi, on quitte
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
|
@ -183,7 +184,7 @@
|
|||
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$miniData['contact']]) )
|
||||
break;
|
||||
continue;
|
||||
|
||||
$contact = $contacts[ $miniData['contact'] ];
|
||||
|
||||
|
@ -199,7 +200,7 @@
|
|||
|
||||
// S'il a déja une fiche ou qu'on a déja fait une fiche (ou mini), on quitte
|
||||
if( is_array($existingData) && isset($existingData['studies2']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
break;
|
||||
continue;
|
||||
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
|
@ -211,7 +212,7 @@
|
|||
|
||||
// S'il a déja été saisi, on quitte
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
|
@ -254,7 +255,7 @@
|
|||
|
||||
/* [6] On enregistre les relations de la MATRICE
|
||||
=========================================================*/
|
||||
var_dump($finalid);
|
||||
var_dump('finalid\'s', $finalid);
|
||||
$clen = count($finalid);
|
||||
|
||||
/* (1) On récupére les ids des contacts */
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
class lightdb{
|
||||
|
||||
// REPERTOIRE RACINE DE TOUTES LES BDD
|
||||
public static function default_root(){ return __BUILD__.'/lightdb/storage/'; }
|
||||
public static function default_root(){ return __BUILD__.'/lightdb/storage'; }
|
||||
|
||||
// ATTRIBUTS
|
||||
private $root;
|
||||
private $dbname;
|
||||
private $dir;
|
||||
private $index;
|
||||
private $date;
|
||||
private $driver;
|
||||
private $line;
|
||||
|
||||
|
@ -59,11 +60,12 @@
|
|||
/* [3] Initialisation du gestionnaire d'acces (SplFileObject)
|
||||
=========================================================*/
|
||||
/* (1) Si le fichier n'existe pas, on le crée */
|
||||
if( !file_exists($this->dir.'data') )
|
||||
file_put_contents($this->dir.'data', '' );
|
||||
$this->data = $this->dir.'data';
|
||||
if( !file_exists($this->data) )
|
||||
file_put_contents($this->data, '' );
|
||||
|
||||
/* (2) On place un 'driver' sur le fichier */
|
||||
$this->driver = new \SplFileObject($this->dir.'data', 'r+');
|
||||
$this->driver = new \SplFileObject($this->data, 'r+');
|
||||
// $this->driver->setFlags( \SplFileObject::SKIP_EMPTY );
|
||||
|
||||
/* (3) On récupère le nombre de lignes */
|
||||
|
@ -75,9 +77,30 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function close(){ $this->driver = null; }
|
||||
|
||||
|
||||
|
||||
/* FLUSH LA BDD (erase all)
|
||||
*
|
||||
*/
|
||||
public function flush(){
|
||||
/* (1) On flush les index */
|
||||
$fIndex = new \SplFileObject($this->dir.'index', 'w');
|
||||
$fIndex->fwrite('[]');
|
||||
$fIndex = null;
|
||||
$this->line = 0;
|
||||
$this->index = [];
|
||||
|
||||
/* (2) On flush les data */
|
||||
file_put_contents($this->dir.'data', '' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN INDEX
|
||||
*
|
||||
* @i<String> [OPT] Index pour lequel on veut la ligne et le hash
|
||||
|
@ -117,8 +140,8 @@
|
|||
|
||||
/* (3) On enregistre l'index */
|
||||
$this->index[$key] = [
|
||||
'line' => $this->line - 1,
|
||||
'hash' => sha1($json_data)
|
||||
'line' => $this->line - 1//,
|
||||
//'hash' => sha1($json_data)
|
||||
];
|
||||
|
||||
/* (4) On enregistre le fichier index */
|
||||
|
@ -155,8 +178,8 @@
|
|||
|
||||
/* (3) On enregistre les index */
|
||||
$this->index[$key] = [
|
||||
'line' => $this->line - 1,
|
||||
'hash' => sha1($json_data)
|
||||
'line' => $this->line - 1//,
|
||||
//'hash' => sha1($json_data)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -253,12 +276,14 @@
|
|||
$this->driver->seek(0);
|
||||
|
||||
// On recopie toutes les lignes sauf celle à supprimer dans un fichier temporaire
|
||||
while( $this->driver->key() < $this->line ){
|
||||
foreach($this->driver as $key=>$content){
|
||||
// Only valuable lines (not the last linebreak)
|
||||
if( $key >= $this->line ) break;
|
||||
|
||||
if( $this->driver->key() != $line )
|
||||
$tmpfile->fwrite( $this->driver->current() );
|
||||
// On n'écrit pas la ligne à supprimer
|
||||
if( $key != $line )
|
||||
$tmpfile->fwrite( $content );
|
||||
|
||||
$this->driver->next();
|
||||
}
|
||||
|
||||
// On décrémente le nb de lignes
|
||||
|
@ -312,6 +337,9 @@
|
|||
$keyLines[$key] = $this->index[$key]['line'];
|
||||
}
|
||||
|
||||
if( count($keyLines) == 0 )
|
||||
return true;
|
||||
|
||||
/* [2] On trie les clés en fonction de leur ligne
|
||||
=========================================================*/
|
||||
$sorted = [];
|
||||
|
@ -342,13 +370,14 @@
|
|||
$this->driver->seek(0);
|
||||
|
||||
/* (2) On recopie toutes les lignes sauf celles à supprimer dans un fichier temporaire */
|
||||
while( $this->driver->key() < $this->line ){
|
||||
foreach($this->driver as $key=>$content){
|
||||
// Only valuable lines (not the last linebreak)
|
||||
if( $key >= $this->line ) break;
|
||||
|
||||
// Si la ligne en cours n'est pas dans la liste des lignes à supprimer
|
||||
if( !in_array($this->driver->key(), $sorted) )
|
||||
$tmpfile->fwrite( $this->driver->current() ); // On l'écrit dans le nouveau fichier
|
||||
// On n'écrit pas la ligne à supprimer
|
||||
if( !in_array($key, $sorted) )
|
||||
$tmpfile->fwrite( $content );
|
||||
|
||||
$this->driver->next();
|
||||
}
|
||||
|
||||
$tmpfile = null;
|
||||
|
@ -387,46 +416,4 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* RENVOIE LES DONNEES ASSOCIEES A UN CHAMP DE RECHERCHE
|
||||
*
|
||||
* @nomParam<typeParam> Description du param
|
||||
*
|
||||
* @return nomRetour<typeRetour> Description du retour
|
||||
*
|
||||
*/
|
||||
public function filter($data){
|
||||
/* (1) Si @data est un tableau associatif */
|
||||
if( is_array($data) ){
|
||||
|
||||
$filtered = [];
|
||||
foreach($this->index as $i=>$indexData){
|
||||
$this->driver->seek( $indexData['line'] );
|
||||
$dbData = json_decode( $this->driver->fgets(), true );
|
||||
|
||||
foreach($data as $key=>$value)
|
||||
if( isset($dbData[$key]) && preg_match("#$value#", $dbData[$key]) ){
|
||||
$filtered[$i] = $dbData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
|
||||
|
||||
/* (2) Sinon on compare @data en tant que valeur simple */
|
||||
}else{
|
||||
|
||||
$this->tmp = sha1( json_encode($data) );
|
||||
return array_filter($this->index, [$this, 'simpleFilter']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function simpleFilter($e){ return $e['hash'] == $this->tmp; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{"id":1,"name":"contact-x","sexe":"1","age":"6","studies2":"01","reltype":"7","dist":"1","job":"82","famsit":"0","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":2,"name":"contact-1","sexe":"0","age":"6","studies2":"06","reltype":"6","dist":"2","job":"36","famsit":"0","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":3,"name":"contact-2","sexe":"1","age":"7","studies2":"07","reltype":"7","dist":"3","job":"41","famsit":"0","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
|
@ -19,23 +18,26 @@
|
|||
{"id":18,"name":"contact-17","sexe":"1","age":"3","studies2":"10","reltype":"4","dist":"2","job":"75","famsit":"0","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":19,"name":"contact-18","sexe":"2","age":"4","studies2":"11","reltype":"5","dist":"3","job":"76","famsit":"0","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":20,"name":"contact-19","sexe":"0","age":"5","studies2":"","reltype":"6","dist":"0","job":"81","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":21,"name":"contact-x","sexe":"1","age":"6","studies2":"01","reltype":"7","dist":"1","job":"82","famsit":"0","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":22,"name":"contact-1","sexe":"0","age":"6","studies2":"06","reltype":"6","dist":"2","job":"36","famsit":"0","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":23,"name":"contact-2","sexe":"1","age":"7","studies2":"07","reltype":"7","dist":"3","job":"41","famsit":"0","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":24,"name":"contact-3","sexe":"2","age":"8","studies2":"08","reltype":"autre","dist":"0","job":"46","famsit":"0","city":"18","cp":"10008","quartier":"8","duration":["8","18"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":25,"name":"contact-4","sexe":"0","age":"9","studies2":"09","reltype":"0","dist":"1","job":"47","famsit":"0","city":"19","cp":"10009","quartier":"9","duration":["9","19"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":26,"name":"contact-5","sexe":"1","age":"10","studies2":"10","reltype":"1","dist":"2","job":"48","famsit":"0","city":"20","cp":"10010","quartier":"10","duration":["10","110"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":27,"name":"contact-6","sexe":"2","age":"11","studies2":"11","reltype":"2","dist":"3","job":"51","famsit":"0","city":"21","cp":"10011","quartier":"11","duration":["11","111"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":28,"name":"contact-7","sexe":"0","age":"12","studies2":"","reltype":"3","dist":"0","job":"54","famsit":"0","city":"22","cp":"10012","quartier":"12","duration":["12","112"],"context":"12","contextExtra":["","association",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":29,"name":"contact-8","sexe":"1","age":"13","studies2":"01","reltype":"4","dist":"1","job":"55","famsit":"0","city":"23","cp":"10013","quartier":"13","duration":["13","113"],"context":"13","contextExtra":["","","autre"],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":30,"name":"contact-9","sexe":"2","age":"14","studies2":"02","reltype":"5","dist":"2","job":"56","famsit":"0","city":"24","cp":"10014","quartier":"14","duration":["14","114"],"context":"0","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":31,"name":"contact-10","sexe":"0","age":"15","studies2":"03","reltype":"6","dist":"3","job":"61","famsit":"0","city":"25","cp":"10015","quartier":"15","duration":["15","115"],"context":"1","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":32,"name":"contact-11","sexe":"1","age":"16","studies2":"04","reltype":"7","dist":"0","job":"66","famsit":"0","city":"26","cp":"10016","quartier":"16","duration":["16","116"],"context":"2","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":33,"name":"contact-12","sexe":"2","age":"17","studies2":"05","reltype":"autre","dist":"1","job":"69","famsit":"0","city":"27","cp":"10017","quartier":"17","duration":["17","117"],"context":"3","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":34,"name":"contact-13","sexe":"0","age":"18","studies2":"06","reltype":"0","dist":"2","job":"71","famsit":"0","city":"28","cp":"10018","quartier":"18","duration":["18","118"],"context":"4","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":35,"name":"contact-14","sexe":"1","age":"0","studies2":"07","reltype":"1","dist":"3","job":"72","famsit":"0","city":"29","cp":"10019","quartier":"19","duration":["19","119"],"context":"5","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":36,"name":"contact-15","sexe":"2","age":"1","studies2":"08","reltype":"2","dist":"0","job":"73","famsit":"0","city":"30","cp":"10020","quartier":"20","duration":["20","120"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":37,"name":"contact-16","sexe":"0","age":"2","studies2":"09","reltype":"3","dist":"1","job":"74","famsit":"0","city":"31","cp":"10021","quartier":"21","duration":["21","121"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":38,"name":"contact-17","sexe":"1","age":"3","studies2":"10","reltype":"4","dist":"2","job":"75","famsit":"0","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":39,"name":"contact-18","sexe":"2","age":"4","studies2":"11","reltype":"5","dist":"3","job":"76","famsit":"0","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":40,"name":"contact-19","sexe":"0","age":"5","studies2":"","reltype":"6","dist":"0","job":"81","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":22,"name":"contact-21","sexe":"2","age":"7","studies2":"02","reltype":"autre","dist":"2","job":"10","famsit":"0","city":"36","cp":"10026","quartier":"26","duration":["26","126"],"context":"12","contextExtra":["","association",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":23,"name":"contact-22","sexe":"0","age":"8","studies2":"03","reltype":"0","dist":"3","job":"21","famsit":"0","city":"37","cp":"10027","quartier":"27","duration":["27","127"],"context":"13","contextExtra":["","","autre"],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":24,"name":"contact-23","sexe":"1","age":"9","studies2":"04","reltype":"1","dist":"0","job":"22","famsit":"0","city":"38","cp":"10028","quartier":"28","duration":["28","128"],"context":"0","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":25,"name":"contact-24","sexe":"2","age":"10","studies2":"05","reltype":"2","dist":"1","job":"23","famsit":"0","city":"39","cp":"10029","quartier":"29","duration":["29","129"],"context":"1","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":26,"name":"contact-25","sexe":"0","age":"11","studies2":"06","reltype":"3","dist":"2","job":"31","famsit":"0","city":"40","cp":"10030","quartier":"30","duration":["30","130"],"context":"2","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":27,"name":"contact-26","sexe":"1","age":"12","studies2":"07","reltype":"4","dist":"3","job":"32","famsit":"0","city":"41","cp":"10031","quartier":"31","duration":["31","131"],"context":"3","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":28,"name":"contact-27","sexe":"2","age":"13","studies2":"08","reltype":"5","dist":"0","job":"36","famsit":"0","city":"42","cp":"10032","quartier":"32","duration":["32","132"],"context":"4","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":29,"name":"contact-28","sexe":"0","age":"14","studies2":"09","reltype":"6","dist":"1","job":"41","famsit":"0","city":"43","cp":"10033","quartier":"33","duration":["33","133"],"context":"5","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":30,"name":"contact-29","sexe":"1","age":"15","studies2":"10","reltype":"7","dist":"2","job":"46","famsit":"0","city":"44","cp":"10034","quartier":"34","duration":["34","134"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":31,"name":"contact-30","sexe":"2","age":"16","studies2":"11","reltype":"autre","dist":"3","job":"47","famsit":"0","city":"45","cp":"10035","quartier":"35","duration":["35","135"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":32,"name":"contact-31","sexe":"0","age":"17","studies2":"","reltype":"0","dist":"0","job":"48","famsit":"0","city":"46","cp":"10036","quartier":"36","duration":["36","136"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":33,"name":"contact-32","sexe":"1","age":"18","studies2":"01","reltype":"1","dist":"1","job":"51","famsit":"0","city":"47","cp":"10037","quartier":"37","duration":["37","137"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":34,"name":"contact-33","sexe":"2","age":"0","studies2":"02","reltype":"2","dist":"2","job":"54","famsit":"0","city":"48","cp":"10038","quartier":"38","duration":["38","138"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":35,"name":"contact-34","sexe":"0","age":"1","studies2":"03","reltype":"3","dist":"3","job":"55","famsit":"0","city":"49","cp":"10039","quartier":"39","duration":["39","139"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":36,"name":"contact-35","sexe":"1","age":"2","studies2":"04","reltype":"4","dist":"0","job":"56","famsit":"0","city":"50","cp":"10040","quartier":"40","duration":["40","140"],"context":"12","contextExtra":["","association",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":37,"name":"contact-36","sexe":"2","age":"3","studies2":"05","reltype":"5","dist":"1","job":"61","famsit":"0","city":"51","cp":"10041","quartier":"41","duration":["41","141"],"context":"13","contextExtra":["","","autre"],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":38,"name":"contact-37","sexe":"0","age":"4","studies2":"06","reltype":"6","dist":"2","job":"66","famsit":"0","city":"52","cp":"10042","quartier":"42","duration":["42","142"],"context":"0","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":39,"name":"contact-38","sexe":"1","age":"5","studies2":"07","reltype":"7","dist":"3","job":"69","famsit":"0","city":"53","cp":"10043","quartier":"43","duration":["43","143"],"context":"1","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":40,"name":"contact-39","sexe":"2","age":"6","studies2":"08","reltype":"autre","dist":"0","job":"71","famsit":"0","city":"54","cp":"10044","quartier":"44","duration":["44","144"],"context":"2","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||
{"id":42,"name":"contact-41","sexe":"1","age":"","studies1":"2","reltype":"1","dist":"."}
|
||||
{"id":43,"name":"contact-42","sexe":"0","age":"2","studies1":"3","reltype":"2","dist":"."}
|
||||
{"id":44,"name":"contact-43","sexe":"1","age":"3","studies1":"4","reltype":"3","dist":"."}
|
||||
{"id":45,"name":"contact-44","sexe":"0","age":"4","studies1":"5","reltype":"4","dist":"."}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"1":{"line":1,"hash":"53329f79873048ac547733758e8a9748244f19d6"},"2":{"line":2,"hash":"0bd101882347c2d0611fcd650bcfd65d11889d16"},"3":{"line":3,"hash":"2c4296696863e3767381128c9c8e2f2cb6b021f5"},"4":{"line":4,"hash":"6d5ebe34615316f06f6dd3acb242d6c45fd0a4f3"},"5":{"line":5,"hash":"695fb73dd643a997d8de407c3f4833a44a7a453c"},"6":{"line":6,"hash":"986635a51581ca941ebbfc1f507c11601641f74b"},"7":{"line":7,"hash":"9b68019f94e0b453dbe036662deec231136c8ce4"},"8":{"line":8,"hash":"f7d8d23d90bcd939315cc745b96d53172d1e2be9"},"9":{"line":9,"hash":"47ea43ceb3ffac48354347e2e47f0bd90e102981"},"10":{"line":10,"hash":"1016d1c8a6aa59c58fb12d23efb44dba2e0480ae"},"11":{"line":11,"hash":"d32cf2a74a509c2d9196de6e43c8a780f9f505d0"},"12":{"line":12,"hash":"a69bf3702a807c9599b11f66fc85a4b1429d95ab"},"13":{"line":13,"hash":"60b7f129371a0e685d2a9c94cd9c1479007b5c91"},"14":{"line":14,"hash":"92f0e743b79e14dbd0a6087fd42f5a1ddbf93b26"},"15":{"line":15,"hash":"7f95b020b8958b23f759afbd54d9344f4669a535"},"16":{"line":16,"hash":"9db524430354104254d67db4051434bdc68f2d14"},"17":{"line":17,"hash":"3d7e96865f76ef6476c76b67ff49fdc2d21bce4f"},"18":{"line":18,"hash":"44bb7d8cfd73e64c74e22f8bed0d6a5667193531"},"19":{"line":19,"hash":"bff1fe0220fb48033239de52e4176c2e05393932"},"20":{"line":20,"hash":"c662345489073304966f607be98f82b58972ab67"},"21":{"line":21,"hash":"3268a838e132fb080b7dbf7a36df8071facda9e5"},"22":{"line":22,"hash":"ec674f1b5aeead8ddaad30f5b92ef844b19832ee"},"23":{"line":23,"hash":"3d5f103923637361c47a8287b67ae057eae76100"},"24":{"line":24,"hash":"e6abe915b19deb553689fb135eec736fed0cdfe6"},"25":{"line":25,"hash":"5a8a0a4d316cc94c30baff9517f17d7346667e8a"},"26":{"line":26,"hash":"d8f5dcff760645c789b443476a88bcd23328c385"},"27":{"line":27,"hash":"d118b82db5d471969cb743202827c6671795a992"},"28":{"line":28,"hash":"885766f872616d4d81895d97ed60f2b6072a1657"},"29":{"line":29,"hash":"a3e4fe59e1fdbfbfd01cf42cb5a5b1a4dce2a85a"},"30":{"line":30,"hash":"3c51638a6bff5cd6effca6d0013c623c94361bf1"},"31":{"line":31,"hash":"6f520b50be61131e3d78ea1a596a277a9af04165"},"32":{"line":32,"hash":"d85ae569d345a39a6921c62b09f5b55b0543c723"},"33":{"line":33,"hash":"1ee9df42a435ec8cfa0b3ea4a4839ecaa37b31e6"},"34":{"line":34,"hash":"60ff867709af5b4fb530ad68d17fad053e2117aa"},"35":{"line":35,"hash":"910df61f211d5d08ac07bec49f24e65b0e15df5d"},"36":{"line":36,"hash":"5874b4ea65f206fa9052d5679cbc8614c015dd02"},"37":{"line":37,"hash":"bc3fb457c6e97008d7d7ffedfd2f5c2be95ab070"},"38":{"line":38,"hash":"68fb7dc97739414cad3cd4e8f58799cf3059c09e"},"39":{"line":39,"hash":"74c17fdb061b75b87a6b561f8df7025e3dc6aa13"},"40":{"line":40,"hash":"41762132a3e4576443fc798733843450f3a55013"}}
|
||||
{"1":{"line":0},"2":{"line":1},"3":{"line":2},"4":{"line":3},"5":{"line":4},"6":{"line":5},"7":{"line":6},"8":{"line":7},"9":{"line":8},"10":{"line":9},"11":{"line":10},"12":{"line":11},"13":{"line":12},"14":{"line":13},"15":{"line":14},"16":{"line":15},"17":{"line":16},"18":{"line":17},"19":{"line":18},"20":{"line":19},"22":{"line":20},"23":{"line":21},"24":{"line":22},"25":{"line":23},"26":{"line":24},"27":{"line":25},"28":{"line":26},"29":{"line":27},"30":{"line":28},"31":{"line":29},"32":{"line":30},"33":{"line":31},"34":{"line":32},"35":{"line":33},"36":{"line":34},"37":{"line":35},"38":{"line":36},"39":{"line":37},"40":{"line":38},"42":{"line":39},"43":{"line":40},"44":{"line":41},"45":{"line":42}}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
{"2":{"line":0,"hash":"a7b9d5cf6cfb41c0b100d91d053032bdad3a80da"},"3":{"line":1,"hash":"ef73002b8217c3c3b87a62b8ae4c69b3994c114f"},"4":{"line":2,"hash":"5cf77d4e920f1b418bf78484bc1766fb84baabb9"},"5":{"line":3,"hash":"356e841ad04cb0f553fe47eab88bf550d6853c60"},"6":{"line":4,"hash":"7d070210aed5df40ee7e2ca4b54f29c672d32a89"},"7":{"line":5,"hash":"9e4936de2cf03d46135bbac3589a1e3ce68fb406"},"1":{"line":6,"hash":"3220079028ee4e722040157bd2e8248cb4c7d637"}}
|
||||
{"1":{"line":0}}
|
|
@ -1 +1 @@
|
|||
40
|
||||
45
|
|
@ -2,27 +2,36 @@
|
|||
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
|
||||
debug();
|
||||
|
||||
use \lightdb\core\lightdb;
|
||||
|
||||
$sl = new lightdb('subject');
|
||||
$cl = new lightdb('contact');
|
||||
|
||||
|
||||
/* [1] Remove contacts
|
||||
=========================================================*/
|
||||
$sub = $sl->fetch(1);
|
||||
if( true ){
|
||||
|
||||
$contactIds = $sub['contacts'];
|
||||
$cl->deleteAll($contactsIds);
|
||||
/* [1] Remove contacts
|
||||
=========================================================*/
|
||||
$sub = $sl->fetch(1);
|
||||
|
||||
/* [2] Reset subject
|
||||
=========================================================*/
|
||||
unset( $sub['contacts'] );
|
||||
unset( $sub['relations'] );
|
||||
$sub['subject']['surveys'] = [];
|
||||
$cl->deleteAll( $sub['contacts'] );
|
||||
|
||||
$sl->delete(1);
|
||||
$sl->insert(1, $sub);
|
||||
/* [2] Reset subject
|
||||
=========================================================*/
|
||||
|
||||
unset( $sub['contacts'] );
|
||||
unset( $sub['relations'] );
|
||||
$sub['subject']['surveys'] = [];
|
||||
|
||||
$sl->delete(1);
|
||||
$sl->insert(1, $sub);
|
||||
|
||||
}
|
||||
|
||||
$sl->close();
|
||||
$cl->close();
|
||||
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue