From: Thomas Mudrunka Date: Sun, 29 Jul 2012 19:03:06 +0000 (+0200) Subject: Lepsi escapovani v migratoru X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=836c989eca83383fcaefa1e73a8015379e9dc570;p=mirrors%2FSokoMan.git Lepsi escapovani v migratoru --- diff --git a/assistants/migrations.inc.php b/assistants/migrations.inc.php index c00b8e3..dd7b436 100644 --- a/assistants/migrations.inc.php +++ b/assistants/migrations.inc.php @@ -1,13 +1,13 @@
 

-- populate barcode table

db->safe_query_fetch('SELECT model_id as id, model_barcode as bar FROM model;'); +$data = $this->db->safe_query_fetch('SELECT model_id as id, model_barcode as bar FROM model;', false); //print_r($data); echo("UPDATE item SET barcode_id=model_id;\n"); echo("INSERT INTO barcode (barcode_id,model_id,barcode_name) VALUES\n"); -foreach($data as $line) echo("('".$line['id']."','".$line['id']."','".$line['bar']."'),\n"); +foreach($data as $line) echo("('".$line['id']."','".$line['id']."',".$this->db->quote($line['bar'])."),\n"); ?>

-- populate columns item_date_bought and item_date_sold

db->safe_query_fetch('SELECT item_id,MIN(item_valid_from) AS min,MAX(item_valid_from) AS max FROM item GROUP BY item_id;'); +$data = $this->db->safe_query_fetch('SELECT item_id,MIN(item_valid_from) AS min,MAX(item_valid_from) AS max FROM item GROUP BY item_id;', false); //print_r($data); echo("START TRANSACTION;\n"); foreach($data as $line) echo("UPDATE item SET item_date_bought='".$line['min']."',item_date_sold='".$line['max']."' WHERE item_id=".$line['item_id'].";\n");