MySqlCommand cmd2 = conn.CreateCommand(); cmd2.CommandText = "call Insert_Manacost_Bridge_Entry('halp',2,2)";
cmd2.CommandType = System.Data.CommandType.Text;
//cmd2.Parameters.Add("pColor", MySqlDbType.VarChar).Value = "RED"; //cmd2.Parameters.Add("pCost", MySqlDbType.Int32).Value = 1111;
//cmd2.Parameters.Add("pCard_ID", MySqlDbType.Int32).Value = 14;
//cmd2.ExecuteNonQuery();
CREATE DEFINER=`root`@`localhost` PROCEDURE `Insert_Manacost_Bridge_Entry`(pColor VARCHAR(4), pCost INT, pCard_ID INT)
BEGIN
DECLARE card_mana_ID INT DEFAULT 0;
DECLARE manacost_ID INT DEFAULT 0;
SET manacost_ID = ((SELECT COUNT(*) FROM manacost_entry) + 1);
SET card_mana_ID = ((SELECT COUNT(*) FROM bridge_card_manacost) + 1);
INSERT INTO manacost_entry (manacost_ID, Color, Cost)VALUES (manacost_ID, pColor, pCost);
INSERT INTO bridge_card_manacost (card_mana_ID, card_ID, manacost_ID) VALUES (card_mana_ID, pCard_ID, manacost_ID);
END
|