Example #1
0
 public void CreateWithConnectionThenQuery()
 {
     DBObject obj = new DBObject(Utility.connMy);
     obj.FillFromSelect("SELECT id, first_name, last_name, email FROM users WHERE id = @0", 1313);
     Assert.AreEqual("Chris", obj.Rows[0]["first_name"]);
 }
Example #2
0
 public void ThrowNoConnectionStringError()
 {
     DBObject obj = new DBObject();
     Assert.Throws<NoConnectionStringException>(delegate { obj.FillFromSelect("SELECT id, first_name, last_name, email FROM users WHERE id = @0", 1313); });
 }
Example #3
0
 /// <summary>
 /// Filles the DBObject from the select query provided.
 /// </summary>
 /// <param name="select_query">Example: "SELECT * FROM user WHERE id=@0" </param>
 /// <param name="query_parameters">Numbered parameters for the select query. Example: "1"</param>
 /// <param name="connection_string">Connection string to use</param>
 /// <returns></returns>
 public static DBObject BySelect(string connection_string, string select_query, params object[] query_parameters)
 {
     DBObject obj = new DBObject(connection_string);
     obj.FillFromSelect(select_query, query_parameters);
     return obj;
 }