Hardly.SqlController.Select C# (CSharp) Method

Select() static private method

static private Select ( string tableName, string join, string what, string whereClause, object vars, string orderBy, uint limit ) : List
tableName string
join string
what string
whereClause string
vars object
orderBy string
limit uint
return List
        internal static List<object[]> Select(string tableName, string join, string what, string whereClause, object[] vars, string orderBy, uint limit)
        {
            if(tableName != null) {
                try {
                    List<object[]> resultsList = new List<object[]>();

                    string sql = "select ";
                    sql += what ?? "*";
                    sql += " from " + tableName;
                    if(join != null) {
                        sql += " " + join;
                    }
                    if(whereClause != null) {
                        sql += " where " + whereClause;
                    }
                    if(orderBy != null) {
                        sql += " order by " + orderBy;
                    }
                    if(limit > 0) {
                        sql += " limit " + limit;
                    }
                    ExecuteReader(sql, vars, resultsList);

                    if(resultsList.Count > 0) {
                        return resultsList;
                    }
                } catch(Exception e) {
                    Log.exception(e);
                }
            }

            return null;
        }

Usage Example

コード例 #1
0
 public List <object[]> Select(string join, string what, string whereClause, object[] vars, string orderBy, uint limit)
 {
     return(SqlController.Select(tableName,
                                 join,
                                 what ?? (join == null ? "*" : tableName + ".*"),
                                 whereClause,
                                 vars,
                                 orderBy,
                                 limit));
 }
All Usage Examples Of Hardly.SqlController::Select