Code Duplication    Length = 9-9 lines in 3 locations

ecrire/req/sqlite_generique.php 3 locations

@@ 1475-1483 (lines=9) @@
1472
		and is_array($desc['field'])
1473
	) {
1474
		foreach ($desc['field'] as $c => $d) {
1475
			if (preg_match(",^(tinytext|mediumtext|text|longtext|varchar|char),i", $d)
1476
				and stripos($d, "NOT NULL") !== false
1477
				and stripos($d, "DEFAULT") === false
1478
				/* pas touche aux cles primaires */
1479
				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1480
			) {
1481
				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1482
				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1483
			}
1484
			if (preg_match(",^(INTEGER),i", $d)
1485
				and stripos($d, "NOT NULL") !== false
1486
				and stripos($d, "DEFAULT") === false
@@ 1484-1492 (lines=9) @@
1481
				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1482
				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1483
			}
1484
			if (preg_match(",^(INTEGER),i", $d)
1485
				and stripos($d, "NOT NULL") !== false
1486
				and stripos($d, "DEFAULT") === false
1487
				/* pas touche aux cles primaires */
1488
				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1489
			) {
1490
				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1491
				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1492
			}
1493
			if (preg_match(",^(datetime),i", $d)
1494
				and stripos($d, "NOT NULL") !== false
1495
				and stripos($d, "DEFAULT") === false
@@ 1493-1501 (lines=9) @@
1490
				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1491
				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1492
			}
1493
			if (preg_match(",^(datetime),i", $d)
1494
				and stripos($d, "NOT NULL") !== false
1495
				and stripos($d, "DEFAULT") === false
1496
				/* pas touche aux cles primaires */
1497
				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1498
			) {
1499
				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur);
1500
				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1501
			}
1502
		}
1503
1504
		return array(" OK ");