//get the new results id for this instance of session form
 //a method for getting the new results id for the current form
 public static int getResultsID(DBConnect DBCon)
 {
     string resultsIDQuery = "SELECT (1+max(resultsID)) from result_;"; //set the query
     queryRunner queryR = new queryRunner(resultsIDQuery); //initialize a new query runner object for running queries
     string resultID = queryR.runQuery(DBCon.getConnection()); //sets the new result id equal to a new strin object
     try
     {
         return Int32.Parse(resultID); //returns the int32 value parsed from the string object.
     }
     catch (FormatException) //if something goes wrong...
     {
         return 0; //return 0... if this happens then a sql exception may be thrown that is unaccounted for *TODO*
     }
 }
 //a method for obtaining all of the new tireID's for the given session.
 public static List<string> getNewTireIDs(DBConnect DBCon)
 {
     string tireQuery = "SELECT (1+max(LF_LFTireID)), (1+max(RF_RFTireID)), (1+max(LR_LRTireID)), (1+max(RR_RRTireID)) FROM result_;"; //define the tire query string
     queryRunner queryR = new queryRunner(tireQuery); //make the query runner object for the tire query
     queryR.runQuery(DBCon.getConnection()); //run the query
     return queryR.getLastQueryResultsList(); //return the generic list object with the new tireIds
 }
        // a method to check if an event with the specified name and date exists.
        public bool eventTest(string eventName)
        {
            sqlQuery = ""; //set the sql query equal to an empty string.
            if (testingDB.getConState())
            {
                sqlQuery = "Select Distinct DATE_FORMAT(eventDate, '%Y-%m-%d') from `event`;"; //set the sql query equal to a query that returns all the dates in event.
                queryR = new queryRunner(sqlQuery); //tell the query runner object to initialize itself with the query defined above
                queryR.runQuery(connection); //tell the query runner object to run the query

                //Not using a sql query that checks date and name since it would return pairs of values that would make it difficult to
                //quickly find matches.
                //we have to check to make sure today's date even exists

                if (queryR.getLastQueryResultsList().BinarySearch(todaysDate) >= 0) //check if the results list has today's date using a quick binary search.
                {
                    queryR.setQueryArgs("select eventname from `event` where `EventDate` = '" + todaysDate + "';"); //set the query args to search for events with today's today when it is verified that entries with today's date exist
                    queryR.runQuery(connection); //run the query
                    if (queryR.getLastQueryResultsList().BinarySearch(eventName) >= 0) //if today's date is an entry then we need to see if an event matches that day
                    {
                        return false; //if this is reached it means that an event with todays date and name exists; don't create a new event entry
                    }

                    else
                        return true; //today's date exists, but no entry exists with today's name
                }
                else
                    return true; //reached if none of the dates match today's date
            }
            else
                throw new Exception("The database connection passed to this sqlTesting object failed"); //happens if the connection doesn't work
        }
 //a method for making sure that the sessionID is unique
 public bool sessionTest(string sessionID)
 {
     if (testingDB.getConState())
     {
         sqlQuery = "SELECT SessionID from Session_ where sessionID = " + sessionID + ";"; //set the query to the sessionID object
         queryR = new queryRunner(sqlQuery); //re initialize the query runner object with the new query
         string results = queryR.runQuery(connection); //set the results equal to the results from running the query
         if (results == sessionID) //only going to get one response for any given string so this works
         {
             return false; //if this is reached it means that a session with the given session ID exists, don't create a new entry
         }
         else
             return true; //reached if no sessionID's match the given session ID, make a new entry
     }
     else
         throw new Exception("The database connection passed to this object failed"); //happens if the connection doesn't work
 }
        string todaysDate; //stores the date of today.

        #endregion Fields

        #region Constructors

        public sqlTesting(DBConnect DBCon)
        {
            testingDB = DBCon; //initialize the testingDB instance varriable to the dbcon object passed in with the constructor
            sqlQuery = ""; //set the sql query to an empty string.
            todaysDate = DateTime.Now.ToString("yyyy-MM-dd"); //set todaysDate to todays date with the appropriate format
            testingStrings = new List<string>(); //make a new generic list object that stores string typed varriables
            queryR = new queryRunner(""); //initialize query runner with an empty string.
            connection = testingDB.getConnection(); //set the inherited connection attribute to the connection provided to us in the DB object
        }