public void Dispose() { if (m_reader != null) { m_reader.Dispose(); m_reader = null; } if (m_command != null) { m_command.Dispose(); m_command = null; } if (m_tmptable != null) { try { using (var c = m_connection.CreateCommand()) { c.CommandText = string.Format(@"DROP TABLE IF EXISTS ""{0}""", m_tmptable); c.ExecuteNonQuery(); } } catch { } finally { m_tmptable = null; } } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update co_crmmobiledesa_1_0_calendariointeraccionlocal set \"d\"=?,\"e\"=? where \"a\"=? and \"b\"=? and \"c\"=? and \"f\"=?"); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "tipoInteraccion", this.TipoInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "cantidadInteraccion", this.CantidadInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "diaInteraccion", this.DiaInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "mesInteraccion", this.MesInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "anioInteraccion", this.AnioInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "idTipoInteraccion", this.IdTipoInteraccion); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
public void Dispose() { if (m_insertPreviousElementCommand != null) { try { m_insertPreviousElementCommand.Dispose(); } catch {} finally { m_insertPreviousElementCommand = null; } } if (m_insertCurrentElementCommand != null) { try { m_insertCurrentElementCommand.Dispose(); } catch {} finally { m_insertCurrentElementCommand = null; } } if (m_transaction != null) { try { m_transaction.Rollback(); } catch {} finally { m_previousTable = null; m_currentTable = null; m_transaction = null; } } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update co_crmmobiledesa_1_0_localkeygenerator set \"first_id\"=?,\"last_id\"=?,\"next_id\"=? where \"remote_id\"=? and \"batch_id\"=?"); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "firstId", this.FirstId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "lastId", this.LastId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "nextId", this.NextId); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "remoteId", this.RemoteId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "batchId", this.BatchId); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update crmmobiledesa_1_0_changelogimpl set \"c\"=?,\"d\"=?,\"e\"=? where \"a\"=? and \"b\"=?"); com.sybase.afx.db.CommandUtil.SetChar(_conn.GetConnectionProfile(), cmd, "operationType", this.OperationType); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "rootEntityType", this.RootEntityType); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "rootSurrogateKey", this.RootSurrogateKey); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "entityType", this.EntityType); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "surrogateKey", this.SurrogateKey); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update sup_sis_subscription set \"device_id\"=?,\"user_name\"=?,\"h\"=?,\"i\"=?,\"admin_lock\"=?,\"l\"=?,\"m\"=?,\"n\"=? where \"domain\"=? and \"pkg\"=? and \"sync_group\"=? and \"cid\"=?"); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "deviceId", this.DeviceId); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "username", this.Username); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "appname", this.Appname); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), cmd, "enable", this.Enable); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), cmd, "adminLock", this.AdminLock); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "interval", this.Interval); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "protocol", this.Protocol); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "address", this.Address); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "domain", this.Domain); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "package", this.Package); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "syncGroup", this.SyncGroup); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "clientId", this.ClientId); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// return MBO count filter by query object /// </summary> public static int GetSize(Sybase.Persistence.Query query) { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection(); try { query.SetEntity(META_DATA); query.SetDatabaseMetaData(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.Metadata); int count_2 = 0; com.sybase.afx.db.DynamicQuery query_4 = new com.sybase.afx.db.DynamicQuery(); System.Data.IDbCommand ps_5 = query_4.CreateCommand(_conn, query, true); System.Data.IDataReader rs_6 = ps_5.ExecuteReader(); Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile(); com.sybase.afx.db.ReaderUtil.Read(profile, rs_6); count_2 = com.sybase.afx.db.ReaderUtil.GetInt(profile, rs_6, "count", 0); if (rs_6 != null) { com.sybase.afx.db.ReaderUtil.Close(profile, rs_6, count_2); } if (ps_5 != null) { ps_5.Dispose(); } return(count_2); } catch (Sybase.Persistence.PersistenceException ex_10) { throw ex_10; } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update crmmobiledesa_1_0_representantecomercial_pull_pq set \"username\"=?,\"remoteId\"=?,\"UsuarioParam\"=? where \"id\"=?"); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "username", this.Username); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "remoteId", this.RemoteId); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "UsuarioParam", this.UsuarioParam); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "id", this.Id); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update co_crmmobiledesa_1_0_customlocaldata set \"b\"=?,\"c\"=?,\"d\"=?,\"e\"=?,\"f\"=? where \"a\"=?"); com.sybase.afx.db.CommandUtil.SetNullableBoolean(_conn.GetConnectionProfile(), cmd, "valorBoolean", this.ValorBoolean); com.sybase.afx.db.CommandUtil.SetNullableInt(_conn.GetConnectionProfile(), cmd, "valorInteger", this.ValorInteger); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "valorString", this.ValorString); com.sybase.afx.db.CommandUtil.SetNullableDouble(_conn.GetConnectionProfile(), cmd, "valorDouble", this.ValorDouble); com.sybase.afx.db.CommandUtil.SetNullableDateTime(_conn.GetConnectionProfile(), cmd, "valorDateTime", this.ValorDateTime); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "idCustomLocalData", this.IdCustomLocalData); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
public void Dispose() { if (m_errorcmd != null) { try { if (m_errorcmd != null) { m_errorcmd.Dispose(); } } catch { } finally { m_errorcmd = null; } } try { if (m_connection != null) { m_connection.Dispose(); } } catch { } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { lock (YPF.Comercial.RRCC.SUP.CRMMobileDesaDB._synchronizeLock) { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update co_crmmobiledesa_1_0_representantecomercialsp set \"Usuario\"=?,\"UsuarioUserDefined\"=?,\"size_sp\"=? where \"user_sp\"=?"); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "Usuario", this.Usuario); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), cmd, "UsuarioUserDefined", this.UsuarioUserDefined); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), cmd, "size_sp", this.Size_sp); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "user_sp", this.User_sp); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } } }
/// <summary> /// Update the mobile business object /// </summary> public void Update() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand cmd = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "update co_crmmobiledesa_1_0_clientpersonalization set \"key_name\"=?,\"user\"=?,\"value\"=?,\"user_defined\"=?,\"description\"=? where \"id\"=?"); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "key_name", this.Key_name); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), cmd, "user", this.User); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "value", this.Value); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), cmd, "user_defined", this.User_defined); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), cmd, "description", this.Description); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), cmd, "id", this.Id); count = cmd.ExecuteNonQuery(); cmd.Dispose();; _isNew = false; _isDirty = false; _isDeleted = false; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
/// <summary> /// Delete the mobile business object. /// </summary> public void Delete() { lock (YPF.Comercial.RRCC.SUP.CRMMobileDesaDB._synchronizeLock) { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand ps1 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "delete co_crmmobiledesa_1_0_representantecomercialsp where \"user_sp\"=?"); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps1, "user_sp", this.User_sp); count = ps1.ExecuteNonQuery(); ps1.Dispose();; _isNew = false; _isDeleted = true; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } } RepresentanteComercial.Unsubscribe_all_pull(); }
public virtual void Dispose() { if (m_tablename != null) { try { using (var cmd = m_connection.CreateCommand()) { cmd.Transaction = m_transaction; cmd.ExecuteNonQuery(string.Format(@"DROP TABLE IF EXISTS ""{0}""", m_tablename)); } } catch {} finally { m_tablename = null; } } if (m_insertCommand != null) { try { m_insertCommand.Dispose(); } catch {} finally { m_insertCommand = null; } } if (m_transaction != null) { try { m_transaction.Rollback(); } catch {} finally { m_transaction = null; } } }
/// <summary> /// Delete the mobile business object. /// </summary> public void Delete() { Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection(); try { int count = 1; System.Data.IDbCommand ps1 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, "delete sup_sis_subscription where \"domain\"=? and \"pkg\"=? and \"sync_group\"=? and \"cid\"=?"); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps1, "domain", this.Domain); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps1, "package", this.Package); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps1, "syncGroup", this.SyncGroup); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps1, "clientId", this.ClientId); count = ps1.ExecuteNonQuery(); ps1.Dispose();; _isNew = false; _isDeleted = true; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } }
public void Dispose() { if (m_command != null) { try { m_command.Dispose(); } finally { m_command = null; } } }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.OfflineAuthentication __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "passwordHash", __theObject.PasswordHash); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "user", __theObject.User); ps.ExecuteNonQuery(); ps.Dispose();; }
public Boolean ExecuteSqlStatement(String executeStatement, Int32 commandTimeout) { System.Data.IDbCommand executeCommand = null; Boolean executeSuccess; executeSuccess = true; #if DEBUG DateTime startTime = DateTime.Now; #endif try { SetLastException(null); lastSqlStatement = executeStatement; lock (sqlLock) { OnDemandOpen(); executeCommand = CreateCommand(executeStatement); executeCommand.CommandTimeout = commandTimeout; executeCommand.ExecuteNonQuery(); } } // end try catch (Exception ExecuteException) { executeSuccess = false; SetLastException(ExecuteException); } // end catch (Exception) finally { if (executeCommand == null) { executeCommand.Dispose(); } OnDemandClose(); #if DEBUG System.Diagnostics.Debug.Write("----> Database Execute [" + ((DateTime.Now.Subtract(startTime).TotalMilliseconds).ToString()) + "]: " + (new System.Diagnostics.StackTrace().GetFrames()[1].GetMethod().Name)); System.Diagnostics.Debug.Write(" <-- FROM --> " + (new System.Diagnostics.StackTrace().GetFrames()[2].GetMethod().Name)); System.Diagnostics.Debug.Write(" <-- FROM --> " + (new System.Diagnostics.StackTrace().GetFrames()[3].GetMethod().Name)); System.Diagnostics.Debug.WriteLine(String.Empty); #endif } // end finally return(executeSuccess); }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.RepresentanteComercialSynchronizationParameters __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "Usuario", __theObject.Usuario); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), ps, "UsuarioUserDefined", __theObject.UsuarioUserDefined); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "size_sp", __theObject.Size_sp); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "user_sp", __theObject.User_sp); ps.ExecuteNonQuery(); ps.Dispose();; }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.intrnl.RepresentanteComercial_pull_pq __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "username", __theObject.Username); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "remoteId", __theObject.RemoteId); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "UsuarioParam", __theObject.UsuarioParam); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "id", __theObject.Id); ps.ExecuteNonQuery(); ps.Dispose();; }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.ChangeLogImpl __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetChar(_conn.GetConnectionProfile(), ps, "operationType", __theObject.OperationType); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "rootEntityType", __theObject.RootEntityType); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "rootSurrogateKey", __theObject.RootSurrogateKey); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "entityType", __theObject.EntityType); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "surrogateKey", __theObject.SurrogateKey); ps.ExecuteNonQuery(); ps.Dispose();; }
public Object LookupValue(String dataTable, String fieldExpression, String criteria, Object defaultValue) { System.Text.StringBuilder sqlStatement = new StringBuilder(); System.Data.IDbCommand lookupCommand = null; Object returnValue = null; try { SetLastException(null); OnDemandOpen(); sqlStatement.Append("SELECT " + fieldExpression + " FROM " + dataTable); if (criteria.Length > 0) { sqlStatement.Append(" WHERE " + criteria); } // end if lastSqlStatement = sqlStatement.ToString(); lookupCommand = CreateCommand(sqlStatement.ToString()); lock (sqlLock) { returnValue = lookupCommand.ExecuteScalar(); } } // end try catch (System.Data.SqlClient.SqlException SqlException) { SetLastException(SqlException); } // end catch (SqlException) catch (Exception LookupException) { SetLastException(LookupException); throw; } // end catch (Exception) finally { if (lookupCommand != null) { lookupCommand.Dispose(); } OnDemandClose(); } // end finally if (returnValue == null) // TODO: monitor for C# impacts with DBNull { returnValue = defaultValue; } // end if return(returnValue); }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.LocalKeyGenerator __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "firstId", __theObject.FirstId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "lastId", __theObject.LastId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "nextId", __theObject.NextId); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "remoteId", __theObject.RemoteId); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "batchId", __theObject.BatchId); ps.ExecuteNonQuery(); ps.Dispose();; }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.CustomLocalData __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetNullableBoolean(_conn.GetConnectionProfile(), ps, "valorBoolean", __theObject.ValorBoolean); com.sybase.afx.db.CommandUtil.SetNullableInt(_conn.GetConnectionProfile(), ps, "valorInteger", __theObject.ValorInteger); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "valorString", __theObject.ValorString); com.sybase.afx.db.CommandUtil.SetNullableDouble(_conn.GetConnectionProfile(), ps, "valorDouble", __theObject.ValorDouble); com.sybase.afx.db.CommandUtil.SetNullableDateTime(_conn.GetConnectionProfile(), ps, "valorDateTime", __theObject.ValorDateTime); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "idCustomLocalData", __theObject.IdCustomLocalData); ps.ExecuteNonQuery(); ps.Dispose();; }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.ClientPersonalization __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "key_name", __theObject.Key_name); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "user", __theObject.User); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "value", __theObject.Value); com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), ps, "user_defined", __theObject.User_defined); com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "description", __theObject.Description); com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "id", __theObject.Id); ps.ExecuteNonQuery(); ps.Dispose();; }
private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal __theObject) { System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql); com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "tipoInteraccion", __theObject.TipoInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "cantidadInteraccion", __theObject.CantidadInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "diaInteraccion", __theObject.DiaInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "mesInteraccion", __theObject.MesInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "anioInteraccion", __theObject.AnioInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps, "idTipoInteraccion", __theObject.IdTipoInteraccion); ps.ExecuteNonQuery(); ps.Dispose();; }
public void Dispose() { if (m_reader != null) { m_reader.Dispose(); m_reader = null; } if (m_command != null) { m_command.Dispose(); m_command = null; } }
/// <summary> /// 销毁DbCommand /// </summary> /// <param name="dbCommand">DbCommand对象。</param> protected override void DestroyDbCommand(System.Data.IDbCommand dbCommand) { if (dbCommand == null) { return; } dbCommand.Cancel(); if (dbCommand.Transaction == null) { dbCommand.Connection = null; } //dbCommand.Transaction = null; dbCommand.Dispose(); }
/// <summary> /// Libera a instancia. /// </summary> public void Dispose() { if (_dataReader != null) { _dataReader.Close(); _dataReader.Dispose(); _dataReader = null; } if (_command != null) { _command.Dispose(); _command = null; } GC.SuppressFinalize(this); }
/// <summary> /// Find a mobile business object YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal /// </summary> /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception> /// <remarks> </remarks> public static YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal FindByPrimaryKey(int diaInteraccion , int mesInteraccion , int anioInteraccion , int idTipoInteraccion) { YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal result_2 = null; System.Data.IDataReader rs_4 = null; int count_5 = 0; Sybase.Persistence.ConnectionWrapper _conn = null; try { _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection(); string _selectSQL = "SELECT x.\"d\",x.\"e\",x.\"a\",x.\"b\",x.\"c\",x.\"f\" FROM \"co_crmmobiledesa_1_0_calendariointeraccionlocal\" x WHERE x.\"a\" = ? AND x.\"b\" = ? AND x.\"c\" = ? AND x.\"f\" = ?"; System.Data.IDbCommand ps_3 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, _selectSQL); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps_3, "diaInteraccion", diaInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps_3, "mesInteraccion", mesInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps_3, "anioInteraccion", anioInteraccion); com.sybase.afx.db.CommandUtil.SetInt(_conn.GetConnectionProfile(), ps_3, "idTipoInteraccion", idTipoInteraccion); rs_4 = ps_3.ExecuteReader(); Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile(); while (com.sybase.afx.db.ReaderUtil.Read(profile, rs_4)) { YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal entity_6 = new YPF.Comercial.RRCC.SUP.CalendarioInteraccionLocal(); entity_6.Bind(profile, rs_4); count_5++; result_2 = entity_6; } if (rs_4 != null) { com.sybase.afx.db.ReaderUtil.Close(profile, rs_4, count_5); } if (ps_3 != null) { ps_3.Dispose(); } _selectSQL = null; } catch (System.Data.DataException ex) { throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex); } finally { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection(); } return(result_2); }