Class PrepareQuery
PrepareQuery is the class that creates basic database phrases.
Use of a sample;
insertQuery = PrepareQuery.setInsert(tableName, fieldNames, formData, fieldTypes, dateFormatter);
Inherited Members
Namespace: SDBCS.dbwork
Assembly: SDBCS.dll
Syntax
public class PrepareQuery
Remarks
Author Mehmet Hayati KINAŞ
Version 1.0
Constructors
PrepareQuery()
PrepareQuery class can use for preparing basic sql sentences.
Declaration
public PrepareQuery()
Fields
BG
This integer represent of Bigger
Declaration
public const int BG = 2
Field Value
Type | Description |
---|---|
System.Int32 |
BGE
This integer represent of Bigger or Equal
Declaration
public const int BGE = 4
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 |
EQ
This integer represent of Equal
Declaration
public const int EQ = 0
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 |
isLocale
Declaration
protected bool isLocale
Field Value
Type | Description |
---|---|
System.Boolean |
LK
This integer represent of Like
Declaration
public const int LK = 6
Field Value
Type | Description |
---|---|
System.Int32 |
NEQ
This integer represent of Not Equal
Declaration
public const int NEQ = 5
Field Value
Type | Description |
---|---|
System.Int32 |
NUMBER
This integer represent of data type.
Declaration
public const int NUMBER = 3
Field Value
Type | Description |
---|---|
System.Int32 |
SM
This integer represent of Smaller
Declaration
public const int SM = 1
Field Value
Type | Description |
---|---|
System.Int32 |
SME
This integer represent of Smaller or Equal
Declaration
public const int SME = 3
Field Value
Type | Description |
---|---|
System.Int32 |
STRING
This integer represent of data type.
Declaration
public const int STRING = 0
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
equalityStr
Declaration
protected string[] equalityStr { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
errorString
Declaration
public string errorString { get; set; }
Property Value
Type | Description |
---|---|
System.String |
queryStr
Declaration
protected string queryStr { get; set; }
Property Value
Type | Description |
---|---|
System.String |
queryString
Declaration
protected string[] queryString { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Methods
convert2EQLs(Int32[])
This method convert integers to sql comparison operators.
Declaration
public void convert2EQLs(int[] equalityInt)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | equalityInt | Integer representation of comparison operators. |
setDelete(String, String, String)
This method creates and return the delete statement string array.
Declaration
public string[] setDelete(string tableName, string keyField, string keyData)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The table name to be accessed. |
System.String | keyField | The key field name of the table to access. |
System.String | keyData | Key field data. |
Returns
Type | Description |
---|---|
System.String[] | Returns a string of delete sentences in [] format. |
setInsert(String, String[], String[], Int32[], DateFormatter)
This method creates the database insert statement and returns as a string array.
Declaration
public string[] setInsert(string tableName, string[] fieldNames, string[] formData, int[] fieldTypes, DateFormatter dateFormatter)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The table name to be accessed. |
System.String[] | fieldNames | Names of fields of the table to access. |
System.String[] | formData | An array of data from the HTML form to be used in the SQL statement. |
System.Int32[] | fieldTypes | The data types of the fields of the table to access. |
DateFormatter | dateFormatter | DateFormatter instance for formatting for dates. |
Returns
Type | Description |
---|---|
System.String[] | Returns a new record statement string []. |
setSelect(String, String[], String[], Int32[], String, DateFormatter, String[])
Creates and returns the database query statement (select).
Declaration
public string[] setSelect(string tableName, string[] fieldNames, string[] formData, int[] selectFTs, string orderBy, DateFormatter dateFormatter, string[] selectFields)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The table name to be accessed. |
System.String[] | fieldNames | Names of fields of the table to access. |
System.String[] | formData | An array of data from the HTML form to be used in the SQL statement. |
System.Int32[] | selectFTs | 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 | DateFormatter instance for formatting for dates. |
System.String[] | selectFields | List of selected fields from view. |
Returns
Type | Description |
---|---|
System.String[] | Returns a String array of query statements. |
setUpdate(String, String[], String[], Int32[], DateFormatter)
Creates and returns a database change statement string array.
Declaration
public string[] setUpdate(string tableName, string[] fieldNames, string[] formData, int[] fieldTypes, DateFormatter dateFormatter)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The table name to be accessed. |
System.String[] | fieldNames | Names of fields of the table to access. |
System.String[] | formData | An array of data from the HTML form to be used in the SQL statement. |
System.Int32[] | fieldTypes | The data types of the fields of the table to access. |
DateFormatter | dateFormatter | DateFormatter instance for formatting for dates. |
Returns
Type | Description |
---|---|
System.String[] | Returns an array of update statements. |