예제 #1
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="databaseConnectionFactory">connection factory</param>
 /// <param name="sql">statement sql</param>
 /// <param name="contextAttributes">statement contextual attributes</param>
 protected ConnectionCache(
     DatabaseConnectionFactory databaseConnectionFactory,
     string sql,
     IEnumerable<Attribute> contextAttributes)
 {
     this._databaseConnectionFactory = databaseConnectionFactory;
     this._sql = sql;
     this._sqlFragments = PlaceholderParser.ParsePlaceholder(sql);
     this._contextAttributes = contextAttributes;
 }
예제 #2
0
 /// <summary>
 /// Gets the example query meta data.
 /// </summary>
 /// <param name="dbDriver">The driver.</param>
 /// <param name="sampleSQL">The sample SQL.</param>
 /// <param name="metadataSetting">The metadata setting.</param>
 /// <param name="contextAttributes">The context attributes.</param>
 /// <returns></returns>
 private static QueryMetaData GetExampleQueryMetaData(
     DbDriver dbDriver,
     string sampleSQL,
     ColumnSettings metadataSetting,
     IEnumerable<Attribute> contextAttributes)
 {
     var sampleSQLFragments = PlaceholderParser.ParsePlaceholder(sampleSQL);
     using (var dbCommand = dbDriver.CreateCommand(sampleSQLFragments, metadataSetting, contextAttributes)) {
         return dbCommand.MetaData;
     }
 }
예제 #3
0
        /// <summary>
        /// Gets the SQL fragments.
        /// </summary>
        /// <param name="databaseStreamSpec">The database stream spec.</param>
        /// <returns></returns>
        private static IList<PlaceholderParser.Fragment> GetSqlFragments(
            DBStatementStreamSpec databaseStreamSpec)
        {
            IList<PlaceholderParser.Fragment> sqlFragments;
            try {
                sqlFragments = PlaceholderParser.ParsePlaceholder(databaseStreamSpec.SqlWithSubsParams);
            }
            catch (PlaceholderParseException ex) {
                const string text = "Error parsing SQL";
                throw new ExprValidationException(text + ", reason: " + ex.Message, ex);
            }

            return sqlFragments;
        }