diff options
author | cos <cos> | 2011-08-08 22:15:45 +0200 |
---|---|---|
committer | cos <cos> | 2011-08-08 22:15:45 +0200 |
commit | f0783ca2f72ff9f178c59d85aa33f17cecd13158 (patch) | |
tree | e577d70cae70a3cb8de6a48fc51c4ba1d6df1e28 | |
parent | b98492e8f5c2259c3664b84be011c7ff5fafb5cf (diff) | |
download | mat-f0783ca2f72ff9f178c59d85aa33f17cecd13158.zip |
Make addrecipe command add ingredients.
-rwxr-xr-x | mat | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -295,13 +295,18 @@ sub cmd_addrecipe { $uri = <STDIN>; chomp $uri; - $sql = "INSERT INTO recipes (name, uri) VALUES ('$recipe_name', '$uri');"; + $sql = "INSERT INTO recipes (name, uri) VALUES (".$db->quote($recipe_name). + ", ".$db->quote($uri).");"; print "$sql\n\n"; print "Add to database? (y/n): "; $answer = <STDIN>; if ($answer eq "y\n") { $db->do($sql); } + + $sql = "SELECT id FROM recipes WHERE name='$recipe_name' AND uri='$uri';"; + my @recipe_id = $db->selectrow_array($sql); + return interactive_edit_recipe_ingredients($recipe_id[0]); } # MAIN PROGRAM ################################################################ |