public static string GetCountSQL(this IDMLQueries queries, string sqlStatement)
        {
            var placeholders = queries.SQLPlaceholderValuesForCountQuery();

            return(string.Format("{0} {1} {2}",
                                 placeholders.GetPlaceholderValue(StatementPlaceholder.BeforeStatement),
                                 sqlStatement,
                                 placeholders.GetPlaceholderValue(StatementPlaceholder.AfterStatement)));
        }
 public DMLService(IDatabaseServices databaseServices) : base(databaseServices)
 {
     queries                    = new DMLQueries(this);
     identifiers                = new DMLIdentifiers(this);
     operators                  = new DMLOperators(this);
     functions                  = new DMLFunctions(this);
     aggregateFunctions         = new DMLAggregateFunctions(this);
     defaultValues              = new DMLDefaultValues(this);
     syntaxHighlightDefinitions = new DMLSyntaxHighlightDefinitions(this);
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DMLService"/> class.
 /// </summary>
 /// <param name="databaseServices">The database services.</param>
 public DMLService(IDatabaseServices databaseServices)
     : base(databaseServices)
 {
     _queries            = new DMLQueries(this);
     _identifiers        = new DMLIdentifiers(this);
     _operators          = new DMLOperators(this);
     _functions          = new DMLFunctions(this);
     _aggregateFunctions = new DMLAggregateFunctions(this);
     _defaultValues      = new DMLDefaultValues(this);
 }
        public static string GetMaxRecordsSQL(this IDMLQueries queries, int maxRecords, string selectSQL, string fromSQL, string whereSQL, string orderBySQL)
        {
            var placeholders = queries.SQLPlaceholderValuesForMaxRecords(maxRecords.ToString(CultureInfo.InvariantCulture));

            return(string.Format("{0} SELECT {1} {2} {3} FROM {4} {5} {6} WHERE {7} {8} {9} {10}",
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.BeforeStatement),
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.AfterSelectKeyword),
                                 selectSQL,
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.BeforeFromKeyword),
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.AfterFromKeyword),
                                 fromSQL,
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.BeforeWhereKeyword),
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.AfterWhereKeyword),
                                 whereSQL,
                                 (orderBySQL.IsNullOrEmpty()
                    ? ""
                    : string.Format("{0} ORDER BY {1} {2}",
                                    placeholders.GetPlaceholderValue(SelectPlaceholder.BeforeOrderByKeyword),
                                    placeholders.GetPlaceholderValue(SelectPlaceholder.AfterOrderByKeyword),
                                    orderBySQL)),
                                 placeholders.GetPlaceholderValue(SelectPlaceholder.AfterStatement)));
        }
 public static string GetMaxRecordsSQL(this IDMLQueries queries, int maxRecords, string selectSQL, string fromSQL, string whereSQL)
 {
     return(GetMaxRecordsSQL(queries, maxRecords, selectSQL, fromSQL, whereSQL, null));
 }