Show / Hide Table of Contents

Class ExecuteTable

ExecuteTable is the class that automates database operations. With this class, database queries are automatically generated and the process is completed by executing queries. For the creation of a sample;
executeTable = new ExecuteTable(dbName, tableName, fieldNames, fieldTypes, orderBy, dateFormatter, selectFields, selectFTs, messageBean);
It is enough to write a code like this.
Next action;
tableData = (String[][])executeTable.tableAction(action, formData, prepareQuery);
to run the method.
The important thing to consider here is to determine the variables in both the constructor and the method correctly.

Inheritance
System.Object
ExecuteTable
ExecTableWithRef
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SDBCS.dbwork
Assembly: SDBCS.dll
Syntax
public class ExecuteTable
Remarks

Author Mehmet Hayati KINAŞ

Version 1.0

Constructors

ExecuteTable(RunDB, String[], String[], Int32[], String, DateFormatter, String[], Int32[], MessageBean)

The basic variables of the constructor include database, table, form, and field information. In this way, the connection between the database and form is established and transactions are automated.

Declaration
public ExecuteTable(RunDB runDB, string[] tableNames, string[] fieldNames, int[] fieldTypes, string orderBy, DateFormatter dateFormatter, string[] selectFields, int[] selectFTs, MessageBean messageBean)
Parameters
Type Name Description
RunDB runDB

For connecting the database and executing processes.

System.String[] tableNames

The table names to be accessed.

System.String[] fieldNames

Names of fields of the table to access.

System.Int32[] fieldTypes

The data types of the fields of the table to access.

System.String orderBy

The field names to sort in the query statement to be generated.

DateFormatter dateFormatter

The DateFormatter instance to format dates.

System.String[] selectFields

List of selected fields from view.

System.Int32[] selectFTs

The data types of the selection fields of the table to access.

MessageBean messageBean

The MessageBean instance for getting general messages.

Fields

BEGINEXECUTENONQUERY

This integer represent of begin non query execution type.

Declaration
public const int BEGINEXECUTENONQUERY = 0
Field Value
Type Description
System.Int32

BEGINEXECUTEREADER

This integer represent of begin query execution type.

Declaration
public const int BEGINEXECUTEREADER = 1
Field Value
Type Description
System.Int32

CONNECTIONSTRING

This integer represent of DB connection type.

Declaration
public const int CONNECTIONSTRING = 1
Field Value
Type Description
System.Int32

DATAFILEPATH

This integer represent of DB connection file path.

Declaration
public const int DATAFILEPATH = 0
Field Value
Type Description
System.Int32

DATE

This integer represent of data type.

Declaration
public const int DATE = 2
Field Value
Type Description
System.Int32

dateData

Declaration
protected DateTime[][] dateData
Field Value
Type Description
System.DateTime[][]

dateFormatter

Declaration
protected DateFormatter dateFormatter
Field Value
Type Description
DateFormatter

dbQuery

Declaration
protected bool dbQuery
Field Value
Type Description
System.Boolean

doubleData

Declaration
protected double[][] doubleData
Field Value
Type Description
System.Double[][]

errorString

Declaration
protected string errorString
Field Value
Type Description
System.String

EXECUTENONQUERY

This integer represent of execute non query execution type.

Declaration
public const int EXECUTENONQUERY = 2
Field Value
Type Description
System.Int32

EXECUTEREADER

This integer represent of execute query execution type.

Declaration
public const int EXECUTEREADER = 3
Field Value
Type Description
System.Int32

EXECUTESCALAR

This integer represent of execute scalar execution type.

Declaration
public const int EXECUTESCALAR = 4
Field Value
Type Description
System.Int32

fieldCount

Declaration
public int fieldCount
Field Value
Type Description
System.Int32

fieldNames

Declaration
protected string[] fieldNames
Field Value
Type Description
System.String[]

fieldTypes

Declaration
protected int[] fieldTypes
Field Value
Type Description
System.Int32[]

INTEGER

This integer represent of data type.

Declaration
public const int INTEGER = 1
Field Value
Type Description
System.Int32

integerData

Declaration
protected int[][] integerData
Field Value
Type Description
System.Int32[][]

keyField

Declaration
protected string keyField
Field Value
Type Description
System.String

messageBean

MessageBean instance for getting default messages.

Declaration
protected MessageBean messageBean
Field Value
Type Description
MessageBean

messages

Declaration
protected string[] messages
Field Value
Type Description
System.String[]

messageScript

Declaration
protected string messageScript
Field Value
Type Description
System.String

NUMBER

This integer represent of data type.

Declaration
public const int NUMBER = 3
Field Value
Type Description
System.Int32

orderBy

Declaration
protected string orderBy
Field Value
Type Description
System.String

queryString

Declaration
protected string queryString
Field Value
Type Description
System.String

resultMessage

Declaration
protected string resultMessage
Field Value
Type Description
System.String

rowCount

Declaration
public int rowCount
Field Value
Type Description
System.Int32

runDB

RunDB instance for executing DB processes.

Declaration
protected RunDB runDB
Field Value
Type Description
RunDB

selectFields

Declaration
protected string[] selectFields
Field Value
Type Description
System.String[]

selectFTs

Declaration
protected int[] selectFTs
Field Value
Type Description
System.Int32[]

selectQuery

Declaration
public string[] selectQuery
Field Value
Type Description
System.String[]

STRING

This integer represent of data type.

Declaration
public const int STRING = 0
Field Value
Type Description
System.Int32

stringData

Declaration
protected string[][] stringData
Field Value
Type Description
System.String[][]

tableNames

Declaration
protected string[] tableNames
Field Value
Type Description
System.String[]

Properties

isAfterCommit

Declaration
public bool isAfterCommit { get; set; }
Property Value
Type Description
System.Boolean

isDebug

If this class open for debugging usage or not.

Declaration
public bool isDebug { get; set; }
Property Value
Type Description
System.Boolean

Methods

closeAll()

For calling RunDB class closeAll() method.

Declaration
public void closeAll()

getDefErrStr()

For getting default error string

Declaration
public string getDefErrStr()
Returns
Type Description
System.String

defErrStr

getDefMsgScr()

For getting default message string

Declaration
public string getDefMsgScr()
Returns
Type Description
System.String

defMsgScr

getDefResMsg()

For getting default result message

Declaration
public string getDefResMsg()
Returns
Type Description
System.String

defResMsg

getErrorString()

For getting errorString.

Declaration
public string getErrorString()
Returns
Type Description
System.String

errorString

getMessageBean()

For getting messageBean

Declaration
public MessageBean getMessageBean()
Returns
Type Description
MessageBean

messageBean

getMessages()

For getting messages array

Declaration
public string[] getMessages()
Returns
Type Description
System.String[]

messages

getMessageScript()

For getting messageScript;

Declaration
public string getMessageScript()
Returns
Type Description
System.String

messageScript

getNewRecord(String[], String[], Int32[], PrepareQuery)

When new record is recorded to DB, probably you don't know id of new record. At this point this method send unique field data and retrieve this record with id.

Declaration
public string[] getNewRecord(string[] unqFields, string[] unqFieldData, int[] unqFieldTypes, PrepareQuery prepareQuery)
Parameters
Type Name Description
System.String[] unqFields

Unique fields names in string array.

System.String[] unqFieldData

Unique fields data in string array.

System.Int32[] unqFieldTypes

Unique fields types in integer array.

PrepareQuery prepareQuery

PrepareQuery instance for setting select query.

Returns
Type Description
System.String[]

String array for retrieving new record with id.

getQueryString()

For getting queryString.

Declaration
public string getQueryString()
Returns
Type Description
System.String

queryString

getResultMessage()

For getting resultMessage

Declaration
public string getResultMessage()
Returns
Type Description
System.String

resultMessage

initMessages()

For initializing default messages.

Declaration
public void initMessages()

selectData(Int32)

The base object type array returns the selected data of the return database. An error message(errorString) will occur if there is no data return.

Declaration
public object[][] selectData(int dataType)
Parameters
Type Name Description
System.Int32 dataType

The type of data you want to retrieve.

Returns
Type Description
System.Object[][]

Returns the array according to data type and data object in [number of records][field count] format.

setDefErrStr(String)

For setting default error string

Declaration
public void setDefErrStr(string defErrStr)
Parameters
Type Name Description
System.String defErrStr

setDefMsgScr(String)

For setting default message string

Declaration
public void setDefMsgScr(string defMsgScr)
Parameters
Type Name Description
System.String defMsgScr

setDefResMsg(String)

For setting default result message

Declaration
public void setDefResMsg(string defResMsg)
Parameters
Type Name Description
System.String defResMsg

setEmptyMessage()

For setting empty messages.

Declaration
public void setEmptyMessage()

setMessageBean(MessageBean)

For setting messageBean

Declaration
public void setMessageBean(MessageBean messageBean)
Parameters
Type Name Description
MessageBean messageBean

setMessages(String[])

For setting messages array

Declaration
public void setMessages(string[] messages)
Parameters
Type Name Description
System.String[] messages

setQueryString(String)

For setting sqlString.

Declaration
public void setQueryString(string sqlstring)
Parameters
Type Name Description
System.String sqlstring

tableAction(String, String[], PrepareQuery)

Perform table movements (select, insert, update, or delete) and return data.

Declaration
public bool tableAction(string action, string[] formData, PrepareQuery prepareQuery)
Parameters
Type Name Description
System.String action

The action variable determines which action will take.

System.String[] formData

Taken data from the form in String array

PrepareQuery prepareQuery

Represent of The PrepareQuery instance for setting queries.

Returns
Type Description
System.Boolean

If the DB action succeeds, it returns true, otherwise returns false.

In This Article
Back to top Generated by DocFX