summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2011-08-08 22:15:45 +0200
committercos <cos>2011-08-08 22:15:45 +0200
commitf0783ca2f72ff9f178c59d85aa33f17cecd13158 (patch)
treee577d70cae70a3cb8de6a48fc51c4ba1d6df1e28
parentb98492e8f5c2259c3664b84be011c7ff5fafb5cf (diff)
downloadmat-f0783ca2f72ff9f178c59d85aa33f17cecd13158.zip
Make addrecipe command add ingredients.
-rwxr-xr-xmat7
1 files changed, 6 insertions, 1 deletions
diff --git a/mat b/mat
index f5bcaa4..22b7cf5 100755
--- a/mat
+++ b/mat
@@ -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 ################################################################