/// <summary> /// TODO: the data struction ! HtmlNodeCollection should be Collection of UserDataRow s /// Inserts to database. /// </summary> /// <param name="job">JobData which is needed to be stored in database</param> /// <param name="nodes">html nodes which contains user contributions </param> /// <param name="jobnum">Jobnum.</param> void insertToDatabase(JobData job, HtmlNodeCollection nodes, int jobnum) { if (!job.hasReward ()) { return; } //SQL preparation MySqlConnection con = null; string conCmd = "server=" + SERVER + ";" + "database=" + DATABASE + ";" + "userid=" + USERID + ";" + "port=" + PORT + ";" + "password="******"insert into " + "crowdworks" + " values (" + "2"+ ", \""+ "shoshotest" + "\" , "+ "19910722" + ");"; string selCmd = new UserDataRow (n, jobnum).getSQLString (TASKTABLE); Debug.Log (selCmd); MySqlCommand cmd = new MySqlCommand (selCmd, con); cmd.ExecuteNonQuery (); } catch (NullReferenceException e) { Debug.Log (e.ToString ()); } } if (job.list.ToArray ().Length >= 1) { try { foreach(var n in job.list){ string selCmd = n.getSQLString (EXTRATABLE,jobnum); MySqlCommand cmd = new MySqlCommand (selCmd, con); cmd.ExecuteNonQuery (); } } catch (NullReferenceException e) { Debug.Log (e.ToString ()); } } //SQL end con.Close (); con.Dispose (); }