Class DbCmd
- Namespace
- PHCDataLayer
- Assembly
- PHCDataLayer.dll
public class DbCmd : CloneVO, IBaseSerialization, ICloneVO, ICloneable
- Inheritance
-
DbCmd
Fields
_commandText
protected string _commandText
Field Value
_connectionID
protected string _connectionID
Field Value
_tableName
Importantly, it serves to place the table name in the places of the sql command, which needs this reference, example "alter table ..."
protected string _tableName
Field Value
_transactionID
protected string _transactionID
Field Value
Properties
AppendDbName
public bool AppendDbName { get; set; }
Property Value
CommandText
Result property CommandText of the SqlCommand executed in the database
public string CommandText { get; set; }
Property Value
CommandTimeout
The default value of a SQL command is 30 seconds but we use default (300 = 5 minutes) because we have some "cenas" like (fxlog)
public int CommandTimeout { get; set; }
Property Value
Connection
Mandatory, If not provided, the command will try to create one with the value of the ConnectionString property. defines the connection that will be used to execute the command in the database, if the connection is not open, the command will try to open with a transaction using the value of 'RequireTransaction', then when executing 'Close' the command will remember if it was he who opened the connection and in that case it will close it automatically, along with the transaction.
public DbConnection Connection { get; set; }
Property Value
ConnectionID
protected string ConnectionID { get; }
Property Value
DataBaseName
public string DataBaseName { get; set; }
Property Value
DataParameters
public List<SqlParameter> DataParameters { get; set; }
Property Value
DtReader
Result property When the ExecuteType property is equal to "Reader" then the result of the sql command is stored in this property
public SqlDataReader DtReader { get; set; }
Property Value
EndTime
public DateTime EndTime { get; set; }
Property Value
EntityStructure
public VOStructure EntityStructure { get; set; }
Property Value
ErrorMsgs
Result property List of errors already translated into the language of LocaleManager
public List<string> ErrorMsgs { get; set; }
Property Value
ExceptionMsg
Result property When the sql command is executed in the database, if an exception occurs and if there is a message, this is where it is saved
public string ExceptionMsg { get; set; }
Property Value
ExceptionNumber
Result property When the sql command is executed in the database, if an exception occurs and if there is a number, this is where it is saved
public int ExceptionNumber { get; set; }
Property Value
ExecuteType
Result property Type of sql command executed on the database
public DbCmd.ExecuteTypes ExecuteType { get; set; }
Property Value
FirstRowColValue
Result property When the ExecuteType property is equal to "Scalar" then the result of the sql command is stored in this property
public object FirstRowColValue { get; set; }
Property Value
IgnoreErrorNumbers
When the command is executed in the database with an error, in catch although we keep that error, it is not generated in the log by "SystemController.LogManager.Log"
public List<int> IgnoreErrorNumbers { get; set; }
Property Value
RowsAffected
Result property When the ExecuteType property is equal to "NonQuery" then the result of the sql command is stored in this property
public int RowsAffected { get; set; }
Property Value
StartTime
public DateTime StartTime { get; set; }
Property Value
TableAliasName
public string TableAliasName { get; set; }
Property Value
TableName
public string TableName { get; set; }
Property Value
TargetStructure
public VOStructure TargetStructure { get; set; }
Property Value
TransactionID
protected string TransactionID { get; }
Property Value
XmlReader
Result property When the ExecuteType property is equal to "ReaderXML" then the result of the sql command is stored in this property
public XmlReader XmlReader { get; set; }
Property Value
Methods
AddConnectionToPool(DbConnection)
public DbConnection AddConnectionToPool(DbConnection connectionItem)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
connectionItem |
DbConnection |
Returns
AddConnectionToPool(string)
public DbConnection AddConnectionToPool(string connectionString)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
connectionString |
string |
Returns
Clone()
public object Clone()
Returns
Clone<T>(T)
public T Clone<T>(T cloneItem) where T : DbCmd
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
cloneItem |
T |
Returns
- T
Type Parameters
T
Close()
public void Close()
Close(bool)
public void Close(bool operationResult)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
operationResult |
bool |
ExecuteNonQuery()
Execute the command returned by GetCommand() with type NonQuery
public bool ExecuteNonQuery()
Returns
ExecuteNonQuery(SqlCommand)
Execute the command with type NonQuery
public bool ExecuteNonQuery(SqlCommand cmd)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
cmd |
SqlCommand |
Returns
ExecuteReader(ref SqlCommand)
Execute the command with type Reader
public bool ExecuteReader(ref SqlCommand sqlCmd)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
sqlCmd |
SqlCommand |
Returns
ExecuteScalar()
public bool ExecuteScalar()
Returns
ExecuteScalar(ref SqlCommand)
public bool ExecuteScalar(ref SqlCommand cmd)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
cmd |
SqlCommand |
Returns
GetCommand()
public virtual SqlCommand GetCommand()
Returns
GetDataBaseName()
protected string GetDataBaseName()
Returns
GetNativeConnectionString()
public string GetNativeConnectionString()
Returns
GetPath(string, string)
protected string GetPath(string table_name, string database_name)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
table_name |
string | |
database_name |
string |
Returns
GetRawEntityStructure()
public VOStructure GetRawEntityStructure()
Returns
GetTablePath()
protected string GetTablePath()
Returns
GetTablePath(string, string)
protected string GetTablePath(string _tableName, string _databaseName)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
_tableName |
string | |
_databaseName |
string |
Returns
IsReadOnlyDB()
public virtual bool IsReadOnlyDB()
Returns
OnGetTablePath(ref string)
protected void OnGetTablePath(ref string _tableName)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
_tableName |
string |
Open()
Open the connection to the database
public bool Open()
Returns
Parse()
public virtual string Parse()
Returns
PrepareConnection()
public void PrepareConnection()
RequireTransaction()
public virtual bool RequireTransaction()
Returns
SetConnection()
public virtual void SetConnection()