public override DbDataReader ExecuteReader(string cmd, int timeout = 0) { DbCommand command = DbDriver.CreateCommand(cmd, _connection); if (timeout > 0) { command.CommandTimeout = timeout; } return(command.ExecuteReader()); }
public override int ExecuteNonQuery(string cmd, int timeout = 0) { DbCommand command = DbDriver.CreateCommand(cmd, _connection); if (timeout > 0) { command.CommandTimeout = timeout; } return(command.ExecuteNonQuery()); }
/// <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; } }
public DataCommandBuilder(DbDriver driver, bool batchMode = false, SqlGenMode mode = SqlGenMode.PreferParam) { _driver = driver; _sqlDialect = _driver.SqlDialect; _batchMode = batchMode; _genMode = mode; _maxLiteralLength = _driver.SqlDialect.MaxLiteralLength; _dbCommand = _driver.CreateCommand(); //reserve spots: #0 for batch-begin (BEGIN; in ORACLE); #2 for Begin Trans _sqlStrings.Add(string.Empty); _sqlStrings.Add(string.Empty); }
/// <summary> /// Make a new pair of resources. /// </summary> /// <returns>pair of resources</returns> protected Pair<DbDriver, DbDriverCommand> MakeNew() { Log.Info(".MakeNew Obtaining new connection and statement"); try { // Get the driver DbDriver dbDriver = _databaseConnectionFactory.Driver; // Get the command DbDriverCommand dbCommand = dbDriver.CreateCommand(_sqlFragments, null, _contextAttributes); return new Pair<DbDriver, DbDriverCommand>(dbDriver, dbCommand); } catch (DatabaseConfigException ex) { throw new EPException("Error obtaining connection", ex); } }