public int Update(SqlStatement sql) { throw new NotImplementedException(); }
public DataTable Query(SqlStatement sql) { throw new NotImplementedException(); }
public object QueryScalar(SqlStatement sql) { throw new NotImplementedException(); }
OracleCommand CreateCommand(SqlStatement sql) { OracleCommand _c = new OracleCommand(sql.SqlClause); if (Connection == null) { _c2 = new OracleConnection(_c1); _c2.Open(); } if (IsTransaction) { if (_t2 == null) { _t2 = _c2.BeginTransaction(); } _c.Transaction = _t2; } _c.Connection = _c2; _c.CommandType = sql.CommandType; _c.CommandTimeout = 300; foreach (DataParameter dp in sql.Parameters) { OracleParameter op = new OracleParameter(); op.ParameterName = dp.ParameterName; op.Size = dp.Size; op.Direction = dp.Direction; if (dp.Value == null) { op.Value = DBNull.Value; } else { op.Value = dp.Value; } if (dp.DbType == DbType.DateTime) { if (dp.Value.ToString() == DateTime.MinValue.ToString() || dp.Value == null) { op.Value = OracleDateTime.Null; } else { op.Value = ((DateTime)dp.Value).ToString("yyyy-MM-dd HH:mm:ss"); } op.Size = 64; _c.CommandText.Replace(op.ParameterName, string.Format("to_date({0}, 'yyyy-mm-dd hh24:mi:ss')", op.ParameterName)); } else if (dp.DbType == DbType.String) { if (dp.Size > 65500) { op.OracleType = OracleType.Clob; if (dp.Value == null || dp.Value.ToString().Length == 0) { op.Value = DBNull.Value; } } else { if (dp.Value != null) { op.Value = getSubstringByBytes(dp.Value.ToString(), dp.Size); } } } _c.Parameters.Add(op); } return(_c); }
public override SqlStatement FormatSQL(SqlStatement sql) { return(base.FormatSQL(sql)); }
public BaseHandle() { sql = new SqlStatement(); }
OracleCommand CreateCommand(SqlStatement sql) { OracleCommand _c = new OracleCommand(sql.SqlClause); _c.Connection = Connection; _c.CommandTimeout = 300; _c.CommandType = sql.CommandType; create = false; if (IsTransaction) { if (_t2 == null) { _t2 = Connection.BeginTransaction(); } _c.Transaction = _t2; } foreach (DataParameter dp in sql.Parameters) { OracleParameter p = new OracleParameter(); p.ParameterName = String.Format("{0}", dp.ParameterName); p.Size = dp.Size; p.Direction = dp.Direction; if (dp.Value == null) { p.Value = DBNull.Value; } else { p.Value = dp.Value; } if (dp.DbType == DbType.DateTime) { if (dp.Value.ToString() == DateTime.MinValue.ToString()) { //p.Value = OracleDateTime.MinValue; p.Value = OracleDateTime.Null; } else if (dp.Value == null) { p.Value = OracleDateTime.Null; } else { p.Value = ((DateTime)dp.Value).ToString("yyyy-MM-dd HH:mm:ss");; } p.Size = 64; _c.CommandText = _c.CommandText.Replace(p.ParameterName, string.Format("to_date({0},'yyyy-mm-dd hh24:mi:ss')", p.ParameterName)); //if( _c.CommandText.IndexOf(string.Format("to_char({0},'yyyy-mm-dd hh24:mi:ss')", p.SourceColumn))<0) // _c.CommandText = _c.CommandText.Replace(p.SourceColumn, string.Format("to_char({0},'yyyy-mm-dd hh24:mi:ss')", p.SourceColumn)); } else if (dp.DbType == DbType.String) { if (dp.Size > 65500) { p.OracleType = OracleType.Clob; if (dp.Value == null || dp.Value.ToString().Length == 0) { p.Value = DBNull.Value; } } else { if (dp.Value != null) { p.Value = getSubStringByBytes(dp.Value.ToString(), p.Size); } } } _c.Parameters.Add(p); } return(_c); }