Esempio n. 1
0
        public ExecutionResult SelectData(DatabaseModel select, DatabaseModel condition, List <DatabaseQuery.Condition> conditioners, List <DatabaseQuery> conditionExts = null)
        {
            DatabaseQuery   query  = DatabaseQuery.ConstructSelectStatement(select, condition, conditioners, conditionExts);
            ExecutionResult result = new ExecutionResult()
            {
                Stat = ExecutionResult.Status.Success, Data = query.Results
            };

            List <Dictionary <string, string> > execData = null; string execQuery = query.GetSQLRepresentation();
            DatabaseConnection dbConn = DBController.RetrieveDBConnection();

            try
            {
                execData = dbConn.ExecuteQuery(execQuery);
            }
            catch (DBQExecutionFailException exception)
            {
                result.Stat     = ExecutionResult.Status.Fail;
                result.FailInfo = exception.InnerExceptMess;
            }
            DBController.ReleaseDBConnection(dbConn);
            for (int i = 0; i < execData.Count; i++)
            {
                query.FeedSQLResult(execData.ElementAt(i));
            }
            return(result);
        }