Class Dialect
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
Inherited Members
Namespace: SuperOffice.Data.Dialect
Assembly: SoDataBase.dll
Syntax
public abstract class Dialect
Constructors
Dialect()
Default constructor
Declaration
protected Dialect()
Fields
_cmd
Current SqlCommand
Declaration
protected SqlCommand _cmd
Field Value
Type | Description |
---|---|
SqlCommand |
_dbSchemaTable
Declaration
protected DataTable _dbSchemaTable
Field Value
Type | Description |
---|---|
DataTable |
_filterCallbacks
Callbacks that can unconditionally throw away ("filter") a row during reading. Be careful if you think you need this; it can quickly become complex if the reasons for filtering a row reside inside something that could be part of an OR ...
Declaration
protected readonly List<Func<IDataReader, bool>> _filterCallbacks
Field Value
Type | Description |
---|---|
List<Func<IDataReader, Boolean>> |
_returnArguments
Declaration
protected List<Argument> _returnArguments
Field Value
Type | Description |
---|---|
List<Argument> |
_returnDBFields
Contains information regarding the fields in returnfields. Does not contain information regarding Arguments.
Declaration
protected FieldInfoCollection _returnDBFields
Field Value
Type | Description |
---|---|
FieldInfoCollection |
_soSchemaTable
Declaration
protected DataTable _soSchemaTable
Field Value
Type | Description |
---|---|
DataTable |
_stringFieldsInOrderByWithDistinct
Declaration
protected HashSet<FieldInfo> _stringFieldsInOrderByWithDistinct
Field Value
Type | Description |
---|---|
HashSet<FieldInfo> |
_tables
Contains information regarding the current tables we are working with.
Declaration
protected TableInfoCollection _tables
Field Value
Type | Description |
---|---|
TableInfoCollection |
_tablesInJoin
A sub-collection of _tables, containing those tables that are part of a join restriction. Populated by ParseJoinClause and used by ToSqlFrom to avoid listing tables twice
Declaration
protected TableInfoCollection _tablesInJoin
Field Value
Type | Description |
---|---|
TableInfoCollection |
_usedAliases
The user can use different types of aliases in the select-statement. Ex. use Personname on a field and use another text in the order-by clause. This table will store the aliases used in the query and validate them before the sql is sent to the database.
Declaration
protected ArrayList _usedAliases
Field Value
Type | Description |
---|---|
ArrayList |
SoParameterCollection
Declaration
protected ArrayList SoParameterCollection
Field Value
Type | Description |
---|---|
ArrayList |
Properties
BlockUpperInOrderBy
DB2 has somewhat pathological behaviour... if you have DISTINCT in the SELECT, then you cannot have UPPER in ORDERBY. Believe it or not. See http://publib.boulder.ibm.com/infocenter/db2v7luw/index.jsp?topic=/com.ibm.db2v7.doc/db2m0/sql0200.htm and look for message SQL0214N with reason code '2'.
Declaration
protected virtual bool BlockUpperInOrderBy { get; }
Property Value
Type | Description |
---|---|
Boolean |
CaseSensitiveDatabase
Is the database case-sensitive by default (something we work hard to make disappear)?
Declaration
protected virtual bool CaseSensitiveDatabase { get; }
Property Value
Type | Description |
---|---|
Boolean |
CurrentOuterSqlType
Tells the system if we are having an outer command on the current sql command.
Declaration
protected virtual SqlType CurrentOuterSqlType { get; set; }
Property Value
Type | Description |
---|---|
SqlType |
CurrentSqlType
Tells the system what kind of sql we are dealing with.
Declaration
protected virtual SqlType CurrentSqlType { get; set; }
Property Value
Type | Description |
---|---|
SqlType |
DefaultConnectionString
Get default connection string
Declaration
public abstract string DefaultConnectionString { get; }
Property Value
Type | Description |
---|---|
String |
HasAliasOnDelete
Used to check if alias is used with fields and tables in the SQL DELETE
-command.
Declaration
protected virtual bool HasAliasOnDelete { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Default value is true.
Examples
This method can be overridden in the following manner:
protected override bool HasaliasOnDelete { get { return false; } }
HasAliasOnInsert
Used to check if alias is used with fields and tables in the SQL INSERT
-command.
Declaration
protected virtual bool HasAliasOnInsert { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Default value is true
For example see HasAliasOnDelete
HasAliasOnSelect
Used to check if alias is used with fields and tables in the SQL SELECT
-command.
Declaration
protected virtual bool HasAliasOnSelect { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Default value is true
For example see HasAliasOnDelete
HasAliasOnUpdate
Used to check if alias is used with fields and tables in the SQL UPDATE
-command.
Declaration
protected virtual bool HasAliasOnUpdate { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Default value is true
For example see HasAliasOnDelete
MaxInSize
Oracle has a hard limit of 1000 on the number of items allowed in an IN clause. Bigger IN clauses are partitioned using an OR construct
Declaration
protected virtual int MaxInSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
ReturnDBFields
The ReturnFields.
Declaration
protected FieldInfoCollection ReturnDBFields { get; }
Property Value
Type | Description |
---|---|
FieldInfoCollection |
ReturnFieldsIndexer
Declaration
public ReturnFieldsIndexer ReturnFieldsIndexer { get; }
Property Value
Type | Description |
---|---|
ReturnFieldsIndexer |
Tables
The TableInfoCollection
Declaration
protected TableInfoCollection Tables { get; set; }
Property Value
Type | Description |
---|---|
TableInfoCollection |
VarcharType
Get the type of variable length characters used in the database. This can either be VARCHAR or NVARCHAR.
Declaration
protected string VarcharType { get; }
Property Value
Type | Description |
---|---|
String |
Methods
CheckForAlias()
Some of the databases we support supports aliasing on for example Insert and Update. Some don't. This function asks the current database if it support alias for the specific sql-command. Default value in Dialect is true. Each new database must therefore override the HasAliasOn... function to change this.
Declaration
protected bool CheckForAlias()
Returns
Type | Description |
---|---|
Boolean |
CheckForDistinct(PrivateSelect)
Some databases (ORACLE!!) are unable to do DISTINCT over the datatype we use for our 2k text strings; in those cases we need to 'fake' a distinct. This method is called when generating the SQL text, and controls whether we should say "distinct" as part of the select
Declaration
public virtual bool CheckForDistinct(PrivateSelect cmd)
Parameters
Type | Name | Description |
---|---|---|
PrivateSelect | cmd |
Returns
Type | Description |
---|---|
Boolean |
CheckForDuplicateRow(IDataReader)
Some databases (ORACLE!!) are unable to do DISTINCT over the datatype we use for our 2k text strings; in those cases we need to 'fake' a distinct. This method is called from the SoDataReader to determine if the current row is such a duplicate.
Declaration
public virtual bool CheckForDuplicateRow(IDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDataReader | reader | Reader containing the row to be evaluated |
Returns
Type | Description |
---|---|
Boolean | If true, then this row is a duplicate of one that has been previously passed to this method |
ComposeSelect(String, String, String, String, StringBuilder, PrivateSelect)
Compose the final SELECT from its constituent parts. This template-method pattern is used so specific dialects can insert options etc as needed
Declaration
protected virtual string ComposeSelect(string select, string fields, string from, string join, StringBuilder sql, PrivateSelect originalCommand)
Parameters
Type | Name | Description |
---|---|---|
String | select | |
String | fields | |
String | from | |
String | join | |
StringBuilder | sql | |
PrivateSelect | originalCommand |
Returns
Type | Description |
---|---|
String |
ConvertFromDbType(Object, FieldDataType)
Converts a value returned from the database to its normalised managed type.
Declaration
public virtual object ConvertFromDbType(object value, FieldDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
Object | value | value of the field as returned from the database |
FieldDataType | dataType | data type of the field in the database. |
Returns
Type | Description |
---|---|
Object | Value that can be casted to the default .net type representing the database type. |
Exceptions
Type | Condition |
---|---|
SoIllegalOperationException | Thrown if the data type is of an unsupported format. |
ConvertToDbParameterType(Object, FieldDataType)
Declaration
public virtual object ConvertToDbParameterType(object value, FieldDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
Object | value | |
FieldDataType | dataType |
Returns
Type | Description |
---|---|
Object |
ConvertToDbString(String)
Convert a string to a type that can be used in an SQL command when communication to the database.
Declaration
public virtual string ConvertToDbString(string value)
Parameters
Type | Name | Description |
---|---|---|
String | value | The string value that is to be converted. |
Returns
Type | Description |
---|---|
String | A string that can be used in an SQL command. |
Remarks
Appropriate ' characters are put in the front of and in the end of the string when processed by this method.
ConvertToDbType(Object, FieldDataType)
Convert a value to a format that can be used in an SQL string when executing database commands.
Declaration
public virtual string ConvertToDbType(object value, FieldDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
Object | value | The value to convert. |
FieldDataType | dataType | The data type of the value in the database. |
Returns
Type | Description |
---|---|
String | A string that can be used in a database SQL command. |
Exceptions
Type | Condition |
---|---|
SoIllegalOperationException | Thrown if the data type is of an unsupported format. |
DataReaderGetBoolean(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a bool.
Declaration
public virtual bool DataReaderGetBoolean(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Boolean |
DataReaderGetByte(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a byte.
Declaration
public virtual byte DataReaderGetByte(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Byte |
DataReaderGetBytes(SoDataReader, IDataReader, Int32, Int64, Byte[], Int32, Int32)
Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset
Declaration
public virtual long DataReaderGetBytes(SoDataReader soReader, IDataReader innerReader, int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | |
Int64 | fieldOffset | |
Byte[] | buffer | |
Int32 | bufferoffset | |
Int32 | length |
Returns
Type | Description |
---|---|
Int64 |
DataReaderGetChar(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a single character.
Declaration
public virtual char DataReaderGetChar(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0-based index |
Returns
Type | Description |
---|---|
Char |
DataReaderGetChars(SoDataReader, IDataReader, Int32, Int64, Char[], Int32, Int32)
Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset.
Declaration
public virtual long DataReaderGetChars(SoDataReader soReader, IDataReader innerReader, int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | |
Int64 | fieldoffset | |
Char[] | buffer | |
Int32 | bufferoffset | |
Int32 | length |
Returns
Type | Description |
---|---|
Int64 |
DataReaderGetData(SoDataReader, IDataReader, Int32)
Declaration
public IDataReader DataReaderGetData(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
IDataReader |
DataReaderGetDataTypeName(SoDataReader, IDataReader, Int32)
Return the name of the datatype of the i'th column
Declaration
public virtual string DataReaderGetDataTypeName(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0-based index. |
Returns
Type | Description |
---|---|
String | Name of the data type in the column. for example: "int" or "varchar" |
DataReaderGetDateTime(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a DateTime.
Declaration
public DateTime DataReaderGetDateTime(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | the real data reader |
Int32 | i | column index |
Returns
Type | Description |
---|---|
DateTime | The DateTime in local time (unless column is marked UTC), or MaxValue/MinValue |
Remarks
This method takes into account SuperOffice timezone handling, UTC datetimes (registered, updated) and standard datetime without timezone support. To avoid overmuch 'help' from zealous .NET code we always return the datetime as kind Unspecified, regardless of its origin.
DataReaderGetDecimal(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a decimal.
Declaration
public virtual decimal DataReaderGetDecimal(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Decimal |
DataReaderGetDouble(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a double-precision floating point number.
Declaration
public virtual double DataReaderGetDouble(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Double |
DataReaderGetFieldType(SoDataReader, IDataReader, Int32)
Return the actual Type class for the data type
Declaration
public virtual Type DataReaderGetFieldType(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0-based index. |
Returns
Type | Description |
---|---|
Type |
DataReaderGetFloat(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a single-precision floating point number.
Declaration
public virtual float DataReaderGetFloat(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Single |
DataReaderGetGuid(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a globally-unique identifier (GUID).
Declaration
public virtual Guid DataReaderGetGuid(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Guid |
DataReaderGetInt16(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a 16-bit signed integer.
Declaration
public virtual short DataReaderGetInt16(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Int16 |
DataReaderGetInt32(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a 32-bit signed integer.
Declaration
public virtual int DataReaderGetInt32(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Int32 |
DataReaderGetInt32Array(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as an array of 32-bit signed integers; database storage is an encoded string format
Declaration
public virtual int[] DataReaderGetInt32Array(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Int32[] |
DataReaderGetInt64(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a 64-bit signed integer.
Declaration
public virtual long DataReaderGetInt64(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Int64 |
DataReaderGetItem(SoDataReader, IDataReader, Int32)
Get object at the index
Declaration
protected virtual object DataReaderGetItem(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0-based index |
Returns
Type | Description |
---|---|
Object |
DataReaderGetName(SoDataReader, IDataReader, Int32)
Return the name of the i'th column.
Declaration
public virtual string DataReaderGetName(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0 based index. |
Returns
Type | Description |
---|---|
String | The name of the column. Usually the same as the database column name, but it depends on what you aliased the column as in your select statement |
DataReaderGetNullValue(SoDataReader, Int32)
Declaration
public virtual object DataReaderGetNullValue(SoDataReader soReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Object |
DataReaderGetOrdinal(SoDataReader, IDataReader, String)
Return the index of the named field.
Declaration
public virtual int DataReaderGetOrdinal(SoDataReader soReader, IDataReader innerReader, string name)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
String | name | The name of the field |
Returns
Type | Description |
---|---|
Int32 | A zero-based index suitable for use with GetValue(int) and the rest of the Get functions. |
DataReaderGetString(SoDataReader, IDataReader, Int32)
Gets the value of the specified column as a string.
Declaration
public virtual string DataReaderGetString(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
String |
DataReaderGetValue(SoDataReader, IDataReader, Int32)
Return the value of the datatype.
Declaration
public object DataReaderGetValue(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i | 0-based index |
Returns
Type | Description |
---|---|
Object | A generic object. What it is depends on the type of the column. Could be an int. Could be a string. You won't know until you check GetDataTypeName |
DataReaderIsDBNull(SoDataReader, IDataReader, Int32)
Declaration
public bool DataReaderIsDBNull(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | soReader | DataReader to read from. |
IDataReader | innerReader | |
Int32 | i |
Returns
Type | Description |
---|---|
Boolean |
DateTime2TimeTLocal(DateTime)
Convert the local-time DateTime to a local-time C time_t value.
Declaration
public virtual int DateTime2TimeTLocal(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Local-time DateTime to convert from |
Returns
Type | Description |
---|---|
Int32 | Seconds since local-time January 1st, 1970 |
DateTime2TimeTUtc(DateTime)
Convert the local-time DateTime to a UTC C time_t value.
Declaration
public virtual int DateTime2TimeTUtc(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Local-time DateTime to convert from |
Returns
Type | Description |
---|---|
Int32 | Seconds since UTC January 1st, 1970 |
DateToVarchar(String)
Subclass override: How to convert a datetime to a varchar (or whatever it's called), in the database, taking only the DATE part
Declaration
protected abstract string DateToVarchar(string innerValue)
Parameters
Type | Name | Description |
---|---|---|
String | innerValue | The actual reference to the datetime to work on; this is an opaque parameter that the method should NOT attempt to understand, just assume it will be a valid datetime value or parameter at query-execution time |
Returns
Type | Description |
---|---|
String |
DeleteSql(PrivateSave)
Will generate the Delete-statement.
Declaration
protected virtual string DeleteSql(PrivateSave cmd)
Parameters
Type | Name | Description |
---|---|---|
PrivateSave | cmd | Takes a Private save as in-parameter. This object contains the structure needed to build the sql-string. |
Returns
Type | Description |
---|---|
String | The generated sql-string. |
DifferenceSql(TableExpression)
DifferenceSql will parse through the difference-array list and return the correct sql-statement.
Declaration
protected virtual string DifferenceSql(TableExpression cmd)
Parameters
Type | Name | Description |
---|---|---|
TableExpression | cmd | The Difference statement. |
Returns
Type | Description |
---|---|
String | The parsed sql-statement. |
EncodedArraySearch(Argument, Argument[], Dialect.EncodedArraySearchType, Dialect.FulltextEncodedSearch)
Declaration
protected virtual string EncodedArraySearch(Argument left, Argument[] right, Dialect.EncodedArraySearchType searchType, Dialect.FulltextEncodedSearch fts = null)
Parameters
Type | Name | Description |
---|---|---|
Argument | left | |
Argument[] | right | |
Dialect.EncodedArraySearchType | searchType | |
Dialect.FulltextEncodedSearch | fts |
Returns
Type | Description |
---|---|
String |
FieldIsClob(Argument)
Determine if an argument is a field that is stored as a blob in the current database
Declaration
protected bool FieldIsClob(Argument arg)
Parameters
Type | Name | Description |
---|---|---|
Argument | arg |
Returns
Type | Description |
---|---|
Boolean |
FieldIsString(Argument)
Determine if an argument is a field that is stored as a blob in the current database
Declaration
protected bool FieldIsString(Argument arg)
Parameters
Type | Name | Description |
---|---|---|
Argument | arg |
Returns
Type | Description |
---|---|
Boolean |
GenerateCaseInsensitivity(FieldInfo, Parameter, String)
Oracle treats string a bit differently than other databases. Oracle is Case-sensitive. This function takes care of this without risking a full table scan.
Declaration
protected virtual string GenerateCaseInsensitivity(FieldInfo left, Parameter right, string sqloper)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | left | FieldInfo |
Parameter | right | Parameter |
String | sqloper | string sql operator |
Returns
Type | Description |
---|---|
String | The generated case-insensitive string |
GenerateSql(SqlCommand)
Starts the correct sql-generating function based on the type of command.
Declaration
public virtual SoSqlParameter GenerateSql(SqlCommand cmd)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | cmd | The object-structure we build the sql from. |
Returns
Type | Description |
---|---|
SoSqlParameter |
GetDefaultTransaction(SoConnection, SqlCommand)
Create and return a default transaction, if the Dialect feels it desirable
Declaration
protected virtual SoTransaction GetDefaultTransaction(SoConnection connection, SqlCommand sqlCommand)
Parameters
Type | Name | Description |
---|---|---|
SoConnection | connection | Connection the command will be executed on |
SqlCommand | sqlCommand | Command to be executed |
Returns
Type | Description |
---|---|
SoTransaction | Newly created default transaction, or null |
Remarks
On SQL Server, large SELECT's are problematic due to automatic lock escalation. When 5000 row locks have been accumulated, the server tends to escalate this to a table lock, thereby blocking concurrent INSERTs and UPDATEs, even if they are happening far away from the select.
A fairly clean way to avoid this is to have IsolationLevel.ReadUncommited on those selects - this causes them to create no locks and honour no locks. Whether to do this is something the concrete dialects need to take into account.
GetFieldDbDataType(Int32)
We need to know the data type of the first field we are returning (The select [fieldname]-clause). To get this information, we run through the private member _returnDBFields and return the data type that corresponds to the given index.
Declaration
public FieldDataType GetFieldDbDataType(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the actual field. |
Returns
Type | Description |
---|---|
FieldDataType | The FieldDataType of the actual field. |
GetFieldInfoFromIndex(Int32)
Declaration
public FieldInfo GetFieldInfoFromIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
FieldInfo |
GetIndexOfField(Argument)
Sometimes we need to know the index of one of the fields we are returning (The select [fieldname]-clause). To get this information, we run through the private member _returnArguments and return the correct index according to the in-parameter.
Declaration
public int GetIndexOfField(Argument field)
Parameters
Type | Name | Description |
---|---|---|
Argument | field | The field we want to know the index of. |
Returns
Type | Description |
---|---|
Int32 | The index of the in-parameter FieldInfo. |
GetIsolationLevel(IsolationLevel)
Get the IsolationLevel supported by the database.
Declaration
public virtual IsolationLevel GetIsolationLevel(IsolationLevel requestedLevel)
Parameters
Type | Name | Description |
---|---|---|
IsolationLevel | requestedLevel | Requested isolation level. |
Returns
Type | Description |
---|---|
IsolationLevel | IsolationLevel supported by the current database. |
GetOrderbyCollationHint()
Declaration
protected virtual string GetOrderbyCollationHint()
Returns
Type | Description |
---|---|
String |
GetOriginAsComment(SqlCommand)
Convert the Origin string into something that can be embedded in an SQL statement without breaking it
Declaration
protected virtual string GetOriginAsComment(SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | command |
Returns
Type | Description |
---|---|
String |
Remarks
The comment generated here is extremely useful for debugging, and contains not only the Origin string, but the database context (tenant/customer in Online!), associate, and service method info.
GetUpdatedSchemaTable(DataTable)
Get the schema as it is converted to from the underlying database schema types.
Declaration
public virtual DataTable GetUpdatedSchemaTable(DataTable dbSchemaTable)
Parameters
Type | Name | Description |
---|---|---|
DataTable | dbSchemaTable |
Returns
Type | Description |
---|---|
DataTable | Schema complient with internal NetServer types. |
HandleDateAndTimeWrapping(String, FieldDataType)
Date and Time (as separate types, not DateTime) are handled by in-database-conversions, on the fly; create the syntax for that, in case we happen to be dealing with them (the syntax is VERY db-dependent and implemented by virtual methods in the different dialects)
Declaration
protected string HandleDateAndTimeWrapping(string innerValue, FieldDataType fieldType)
Parameters
Type | Name | Description |
---|---|---|
String | innerValue | |
FieldDataType | fieldType |
Returns
Type | Description |
---|---|
String |
InsertSql(PrivateSave)
Will generate the insert-sql statement based on the in-parameter.
Declaration
protected virtual string InsertSql(PrivateSave cmd)
Parameters
Type | Name | Description |
---|---|---|
PrivateSave | cmd | Contains the object-structure that will describe the sql. |
Returns
Type | Description |
---|---|
String | The generated sql-string. |
IntArrayFromWordString(String)
Declaration
public static int[] IntArrayFromWordString(string wordString)
Parameters
Type | Name | Description |
---|---|---|
String | wordString |
Returns
Type | Description |
---|---|
Int32[] |
IntArrayToWordString(Int32[])
Declaration
public static string IntArrayToWordString(params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | ids |
Returns
Type | Description |
---|---|
String |
IntFromSingleWord(String)
Declaration
public static int IntFromSingleWord(string word)
Parameters
Type | Name | Description |
---|---|---|
String | word |
Returns
Type | Description |
---|---|
Int32 |
IntToSingleWord(Int32)
Map digits in an int to letters. 123 becomes AABCD, note the digit mapping and left-pad with A (= 0) to make at least five letters
Declaration
public static string IntToSingleWord(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id |
Returns
Type | Description |
---|---|
String |
InvokeToSql(Object[])
InvokeToSql checks the in-parameters type against the already existing ToSqlHelper-array. When the key is found in the array, the key's object (the ToSql(Argument) method) is called.
Declaration
protected string InvokeToSql(params object[] toSqlArguments)
Parameters
Type | Name | Description |
---|---|---|
Object[] | toSqlArguments | arguments as passed to the ToSql(Argument) method. The arguments' type needs to be an exact match of the type implemented in the appropriate ToSql method. |
Returns
Type | Description |
---|---|
String | returns the stringvalue returned from the Invoked ToSql(Argument) method |
Exceptions
Type | Condition |
---|---|
SoNotImplementedException | There is no appropriate ToSql(Argument) method to invoke. |
SoException | An exception was thrown while trying to invoke the ToSql(Argument) method |
IsAnyArgumentString(Argument[])
Determine if at least one of the given arguments is a FieldInfo of type string
Declaration
public static bool IsAnyArgumentString(params Argument[] arguments)
Parameters
Type | Name | Description |
---|---|---|
Argument[] | arguments | Zero or more arguments, null is allowed |
Returns
Type | Description |
---|---|
Boolean | true if at least one is a FieldInfo of type string |
IsTableReferencedInSelect(SoTable)
Is a table referenced at least one in the current SQL (by definition, not by instance!)
Declaration
protected bool IsTableReferencedInSelect(SoTable definition)
Parameters
Type | Name | Description |
---|---|---|
SoTable | definition | Definition of table to check for |
Returns
Type | Description |
---|---|
Boolean | True if table is referenced |
Remarks
This call is valid only after ToSqlFrom and ParseJoin have been executed, since these are the methods that populate the reference. Too-early calls will result in a 'false' result. Also note that calling this method on a delete, update or insert type sql will always yield 'false'.
ParseJoinClause(JoinRestriction)
ParseJoinClause will run through the JoinRestriction clause and return the corresponding clause as sql. It will also populate the _tablesInJoin with the mother table; the ToSql handlers for the specific join types will populate with the rest of the tables.
Declaration
protected virtual string ParseJoinClause(JoinRestriction res)
Parameters
Type | Name | Description |
---|---|---|
JoinRestriction | res | The JoinRestriction. |
Returns
Type | Description |
---|---|
String | Parsed sql-string |
ParseMathematicalArguments(MathematicalExpression, String)
Parses the argument-collection in MathematicalExpression.
Declaration
protected string ParseMathematicalArguments(MathematicalExpression arg, string oper)
Parameters
Type | Name | Description |
---|---|---|
MathematicalExpression | arg | Argument of type MathematicalExpression is used to make sure we have all the information needed to perform the necessary operations. |
String | oper | The operator to use. |
Returns
Type | Description |
---|---|
String | A string containing the information from the argument-collection. |
Remarks
All classes generalized from MathematicalExpression will use this function to parse the collection of arguments. Oper will tell the system if we are dealing with an Add, Subtract, Divide or Multiply operation.
PreParseUnion(TableExpression)
Override this method if addtional parsing is required to be performed on the Union
Declaration
protected virtual void PreParseUnion(TableExpression cmd)
Parameters
Type | Name | Description |
---|---|---|
TableExpression | cmd | The Union statement. |
SelectSql(PrivateSelect)
Will generate the select-sql based on the in-parameter.
Declaration
protected virtual string SelectSql(PrivateSelect cmd)
Parameters
Type | Name | Description |
---|---|---|
PrivateSelect | cmd | Contains the object-structure that will describe the sql. |
Returns
Type | Description |
---|---|
String | The generated sql-statement |
ShouldRowBeSkipped(IDataReader)
Invoke Filter callbacks to see if the row should be skipped. Use with care.
Declaration
public bool ShouldRowBeSkipped(IDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDataReader | reader |
Returns
Type | Description |
---|---|
Boolean |
TimeTLocal2DateTime(Int32)
Convert the time from a local-time C time_t value to local-time DateTime.
Declaration
public virtual DateTime TimeTLocal2DateTime(int time)
Parameters
Type | Name | Description |
---|---|---|
Int32 | time | Seconds since local-time January 1st, 1970 |
Returns
Type | Description |
---|---|
DateTime | Local-time DateTime converted to. |
TimeToVarchar(String)
Subclass override: How to convert a datetime to a varchar (or whatever it's called), in the database, taking only the TIME part
Declaration
protected abstract string TimeToVarchar(string innerValue)
Parameters
Type | Name | Description |
---|---|---|
String | innerValue | The actual reference to the datetime to work on; this is an opaque parameter that the method should NOT attempt to understand, just assume it will be a valid datetime value or parameter at query-execution time |
Returns
Type | Description |
---|---|
String |
TimeTUtc2DateTime(Int32)
Convert the time from a UTC C time_t value to local-time DateTime.
Declaration
public virtual DateTime TimeTUtc2DateTime(int time)
Parameters
Type | Name | Description |
---|---|---|
Int32 | time | Seconds since UTC January 1st, 1970 |
Returns
Type | Description |
---|---|
DateTime | Local time DateTime converted to. |
ToSql(FieldDataType)
ToSql( FieldDataType arg ) will return the db-type according to the in-parameter.
Declaration
protected virtual string ToSql(FieldDataType arg)
Parameters
Type | Name | Description |
---|---|---|
FieldDataType | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Add)
The Add-operator will return the correct field and its correct sqlOperator.
T0.associate_id = T0.associate_id + 1;
Declaration
protected virtual string ToSql(Add arg)
Parameters
Type | Name | Description |
---|---|---|
Add | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Alias)
ToSql( Alias arg ) parse the Alias-part of an sql-command and returns the correct alias for the field.
Declaration
protected virtual string ToSql(Alias arg)
Parameters
Type | Name | Description |
---|---|---|
Alias | arg | The alias arg. |
Returns
Type | Description |
---|---|
String | The finished string. |
ToSql(And)
The and (AND) operator will run through itself and its sub nodes and return the appropriate sql-syntax for the and-part.
Declaration
protected virtual string ToSql(And arg)
Parameters
Type | Name | Description |
---|---|---|
And | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Argument)
Not implemented.
Declaration
protected virtual string ToSql(Argument arg)
Parameters
Type | Name | Description |
---|---|---|
Argument | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Between)
The between-operator (BETWEEN) is used when you want the values between range a and range b.
SELECT T0.associate_id
FROM associate T0
WHERE associate_id BETWEEN 10 AND 100;
The operator can also give range-values based on sub-selects:
SELECT T0.associate_id
FROM associate T0
WHERE associate_id BETWEEN
(SELECT TO.associate_id
FROM associate T0
WHERE TO.name = 'SuperOffice')
AND
(SELECT TO.associate_id
FROM associate TO
WHERE TO.date > '08.10.2002');
This may not make very much sense, but the possibility to do it is here.
Declaration
protected virtual string ToSql(Between arg)
Parameters
Type | Name | Description |
---|---|---|
Between | arg |
Returns
Type | Description |
---|---|
String | string clause |
ToSql(Count)
ToSql( Count arg ) parses the Count clause in the sql command and returns the correct values.
Declaration
protected virtual string ToSql(Count arg)
Parameters
Type | Name | Description |
---|---|---|
Count | arg | The count-clause. |
Returns
Type | Description |
---|---|
String | The parsed string. |
ToSql(CountAll)
ToSql( CountAll arg ) parses the CountAll clause in the sql command and returns the correct values.
Declaration
protected virtual string ToSql(CountAll arg)
Parameters
Type | Name | Description |
---|---|---|
CountAll | arg | The countAll-clause. |
Returns
Type | Description |
---|---|
String | The parsed string; always COUNT(*) regardless of argument. |
ToSql(Day)
Declaration
protected virtual string ToSql(Day arg)
Parameters
Type | Name | Description |
---|---|---|
Day | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Distinct)
ToSql( Distinct arg ) parses the Distinct-part of an sql-command. Will throw an exception if the argument is null.
Declaration
protected virtual string ToSql(Distinct arg)
Parameters
Type | Name | Description |
---|---|---|
Distinct | arg | The Distinct in-parameter. |
Returns
Type | Description |
---|---|
String | The parsed sql string. |
ToSql(Divide)
The Divided-operator will return the correct field and its correct sqlOperator.
T0.associate_id = T0.associate_id / 1;
Declaration
protected virtual string ToSql(Divide arg)
Parameters
Type | Name | Description |
---|---|---|
Divide | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Equal)
You will never use the == (equal) operator on anything else then fields and numeric parameters ( expressions... and/ or other fields ). So we just return the arg.Left == arg.Right. If the right hand side isn't a numeric value, the return value is null.
Declaration
protected virtual string ToSql(Equal arg)
Parameters
Type | Name | Description |
---|---|---|
Equal | arg |
Returns
Type | Description |
---|---|
String |
ToSql(FieldInfo)
Will return the Field's name together with the generated table-alias.
T1."contact"
Declaration
protected virtual string ToSql(FieldInfo arg)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | arg |
Returns
Type | Description |
---|---|
String |
ToSql(FieldTypeConvert)
ToSql( FieldTypeConvert arg ) parse the FieldTypeConvert-part of an sql-command and returns the correct database-specific syntax for the conversion.
Declaration
protected virtual string ToSql(FieldTypeConvert arg)
Parameters
Type | Name | Description |
---|---|---|
FieldTypeConvert | arg |
Returns
Type | Description |
---|---|
String |
ToSql(GreaterThan)
The Greater Than (>) operator is only used in restrictions where the value in a field
should be greater then the given parameter, for example
WHERE contact.contactId > 100
Declaration
protected virtual string ToSql(GreaterThan arg)
Parameters
Type | Name | Description |
---|---|---|
GreaterThan | arg |
Returns
Type | Description |
---|---|
String |
ToSql(GreaterThanOrEqual)
The Greater Than Or Equal (>=) operator is only used in restrictions where the value in a field
should be greater than or equal to the given parameter, for example
WHERE contact.contactId >= 100
Declaration
protected virtual string ToSql(GreaterThanOrEqual arg)
Parameters
Type | Name | Description |
---|---|---|
GreaterThanOrEqual | arg |
Returns
Type | Description |
---|---|
String |
ToSql(GroupBy)
ToSql( GroupBy arg ) parses the Group by clause and returns the values first entered.
Declaration
protected virtual string ToSql(GroupBy arg)
Parameters
Type | Name | Description |
---|---|---|
GroupBy | arg | The Group by clause. |
Returns
Type | Description |
---|---|
String | The parsed Group by clause. |
ToSql(HasAll)
Process the special HasAny, which doesn't correspond to SQL. However it does work (only!) with our special simulated int[] datatype, encoded as words in a text field
Declaration
protected virtual string ToSql(HasAll arg)
Parameters
Type | Name | Description |
---|---|---|
HasAll | arg |
Returns
Type | Description |
---|---|
String |
ToSql(HasAny)
Process the special HasAny, which doesn't correspond to SQL. However it does work (only!) with our special simulated int[] datatype, encoded as words in a text field
Declaration
protected virtual string ToSql(HasAny arg)
Parameters
Type | Name | Description |
---|---|---|
HasAny | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Hour)
Declaration
protected virtual string ToSql(Hour arg)
Parameters
Type | Name | Description |
---|---|---|
Hour | arg |
Returns
Type | Description |
---|---|
String |
ToSql(In)
The not in-operator (NOT IN) is used when you want to get data that corresponds with the restriction-clause but does not contain the values described in the not in-clause.
SELECT T0.associate_id
FROM associate TO
WHERE associate_id BETWEEN 10 AND 100
AND T0.associate_id NOT IN (20, 30, 40, 50, 60, 70, 80, 90);
This example will give you all the associate_id's between 10 and 100 but the ones described in the not in-clause.
Declaration
protected virtual string ToSql(In arg)
Parameters
Type | Name | Description |
---|---|---|
In | arg |
Returns
Type | Description |
---|---|
String |
Remarks
This operator temporarily supports int[] fields, with HAS_ALL semantics
ToSql(InnerJoin)
ToSql( InnerJoin arg ) parses the InnerJoin of an Join-sql. It also adds the right-hand table to the _tablesInJoin collection.
Declaration
protected virtual string ToSql(InnerJoin arg)
Parameters
Type | Name | Description |
---|---|---|
InnerJoin | arg | The InnerJoin argument |
Returns
Type | Description |
---|---|
String | The InnerJoin sql string |
ToSql(IsNotNull)
The ToSql( IsNotNull ) is used when you want to check if a field is not null.
Declaration
protected virtual string ToSql(IsNotNull arg)
Parameters
Type | Name | Description |
---|---|---|
IsNotNull | arg | The field-info you want to check the value on |
Returns
Type | Description |
---|---|
String |
ToSql(IsNull)
The ToSql( IsNull ) is used when you want to check if a field is null.
Declaration
protected virtual string ToSql(IsNull arg)
Parameters
Type | Name | Description |
---|---|---|
IsNull | arg | The field-info you want to check the value on. |
Returns
Type | Description |
---|---|
String |
ToSql(LeftOuterJoin)
ToSql( LeftOuterJoin arg ) parses the LeftOuterJoin of an Join-sql. It also adds the right-hand table to the _tablesInJoin collection.
Declaration
protected virtual string ToSql(LeftOuterJoin arg)
Parameters
Type | Name | Description |
---|---|---|
LeftOuterJoin | arg | The LeftOuterJoin argument |
Returns
Type | Description |
---|---|
String | The LeftOuterJoin sql string |
ToSql(LessThan)
The Less Than (<) operator is only used in restrictions where the value in a field
should be less then the given parameter, for example
WHERE contact.contactId < 100
Declaration
protected virtual string ToSql(LessThan arg)
Parameters
Type | Name | Description |
---|---|---|
LessThan | arg |
Returns
Type | Description |
---|---|
String |
ToSql(LessThanOrEqual)
The Less Than Or Equal (<=) operator is only used in restrictions where the value in a field
should be less than or equal to the given parameter, for example
WHERE contact.contactId <= 100
Declaration
protected virtual string ToSql(LessThanOrEqual arg)
Parameters
Type | Name | Description |
---|---|---|
LessThanOrEqual | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Like)
The Like (LIKE) operator is used when you want the left string-value
to be somewhat similar to the right string-value,
WHERE contact.name LIKE 'Super%'
Declaration
protected virtual string ToSql(Like arg)
Parameters
Type | Name | Description |
---|---|---|
Like | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Lower)
ToSql( Lower arg ) will return the given argument enclosed by the SQL LOWER function.
Declaration
protected virtual string ToSql(Lower arg)
Parameters
Type | Name | Description |
---|---|---|
Lower | arg | The argument to wrap LOWER around. |
Returns
Type | Description |
---|---|
String | The parsed LOWER-string |
ToSql(Max)
ToSql( Max arg ) will return the given argument enclosed by the SQL MAX function.
Declaration
protected virtual string ToSql(Max arg)
Parameters
Type | Name | Description |
---|---|---|
Max | arg | The argument to use MAX on. |
Returns
Type | Description |
---|---|
String | The parsed MAX string |
ToSql(Min)
ToSql( MIN arg ) will return the given argument enclosed by the SQL MIN function.
Declaration
protected virtual string ToSql(Min arg)
Parameters
Type | Name | Description |
---|---|---|
Min | arg | The argument to use MIN on. |
Returns
Type | Description |
---|---|
String | The parsed MIN string |
ToSql(Minute)
Declaration
protected virtual string ToSql(Minute arg)
Parameters
Type | Name | Description |
---|---|---|
Minute | arg |
Returns
Type | Description |
---|---|
String |
ToSql(MissingAll)
Process the special HasAny, which doesn't correspond to SQL. However it does work (only!) with our special simulated int[] datatype, encoded as words in a text field
Declaration
protected virtual string ToSql(MissingAll arg)
Parameters
Type | Name | Description |
---|---|---|
MissingAll | arg |
Returns
Type | Description |
---|---|
String |
ToSql(MissingAny)
Process the special HasAny, which doesn't correspond to SQL. However it does work (only!) with our special simulated int[] datatype, encoded as words in a text field
Declaration
protected virtual string ToSql(MissingAny arg)
Parameters
Type | Name | Description |
---|---|---|
MissingAny | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Month)
Declaration
protected virtual string ToSql(Month arg)
Parameters
Type | Name | Description |
---|---|---|
Month | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Multiply)
The Multiply-operator will return the correct field and its correct sqlOperator.
T0.associate_id = T0.associate_id * 1;
Declaration
protected virtual string ToSql(Multiply arg)
Parameters
Type | Name | Description |
---|---|---|
Multiply | arg |
Returns
Type | Description |
---|---|
String |
ToSql(NotBetween)
The not between-operator (NOT BETWEEN) is used when you do not want the values between range a and range b.
SELECT T0.associate_id
FROM associate T0
WHERE associate_id NOT BETWEEN 10 AND 100;
The operator can also give range-values based on sub-selects:
SELECT T0.associate_id
FROM associate T0
WHERE associate_id NOT BETWEEN
(SELECT TO.associate_id
FROM associate T0
WHERE TO.name = 'SuperOffice')
AND 6
(SELECT TO.associate_id
FROM associate TO
WHERE TO.date > '08.10.2002');
This may not make very much sense, but the possibility to do it is here.
Declaration
protected virtual string ToSql(NotBetween arg)
Parameters
Type | Name | Description |
---|---|---|
NotBetween | arg |
Returns
Type | Description |
---|---|
String | string clause |
ToSql(NotIn)
The in-operator (IN) is used when you want to get specific data from the database but you don't want to use a regular restriction-clause to get it.
SELECT T0.associate_id
FROM associate TO
WHERE T0.associate_id IN (20, 30, 40, 50, 60, 70, 80, 90);
This example will give you the associate_id's described in the in-clause.
Declaration
protected virtual string ToSql(NotIn arg)
Parameters
Type | Name | Description |
---|---|---|
NotIn | arg |
Returns
Type | Description |
---|---|
String |
ToSql(NotLike)
The Not Like (NOT LIKE) operator is used when you do not want the left string-value
to be somewhat similar to the right string-value,
WHERE contact.name NOT LIKE 'Super%'
Declaration
protected virtual string ToSql(NotLike arg)
Parameters
Type | Name | Description |
---|---|---|
NotLike | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Or)
The or (OR) operator will run through itself and its subnodes and return the appropriate sql-syntax for the and-part.
Declaration
protected virtual string ToSql(Or arg)
Parameters
Type | Name | Description |
---|---|---|
Or | arg |
Returns
Type | Description |
---|---|
String |
ToSql(OrderBy)
The Order By is used when you want your data shown in a specific order.
Declaration
protected virtual string ToSql(OrderBy arg)
Parameters
Type | Name | Description |
---|---|---|
OrderBy | arg | The OrderBy clause |
Returns
Type | Description |
---|---|
String | The Order By sql-clause. |
ToSql(Parameter)
Returns the parameter, either as a string with apostrophe's around
'Super'
or as a "normal" numeric value.
Declaration
protected virtual string ToSql(Parameter arg)
Parameters
Type | Name | Description |
---|---|---|
Parameter | arg |
Returns
Type | Description |
---|---|
String |
ToSql(RightOuterJoin)
ToSql( RightOuterJoin arg ) parses the RightOuterJoin of an Join-sql. It also adds the right-hand table to the _tablesInJoin collection.
Declaration
protected virtual string ToSql(RightOuterJoin arg)
Parameters
Type | Name | Description |
---|---|---|
RightOuterJoin | arg | The RightOuterJoin argument |
Returns
Type | Description |
---|---|
String | The RightOuterJoin sql string |
ToSql(Second)
Declaration
protected virtual string ToSql(Second arg)
Parameters
Type | Name | Description |
---|---|---|
Second | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Soundex)
ToSql( Lower arg ) will return the given argument enclosed by the SQL LOWER function.
Declaration
protected virtual string ToSql(Soundex arg)
Parameters
Type | Name | Description |
---|---|---|
Soundex | arg | The argument to wrap LOWER around. |
Returns
Type | Description |
---|---|
String | The parsed LOWER-string |
ToSql(Subtract)
The Subtract-operator will return the correct field and its correct sqlOperator.
T0.associate_id = T0.associate_id - 1;
Declaration
protected virtual string ToSql(Subtract arg)
Parameters
Type | Name | Description |
---|---|---|
Subtract | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Sum)
ToSql( Sum arg ) will return the given argument enclosed by the SQL SUM function.
Declaration
protected virtual string ToSql(Sum arg)
Parameters
Type | Name | Description |
---|---|---|
Sum | arg | The argument to use SUM on. |
Returns
Type | Description |
---|---|
String | The parsed SUM string |
ToSql(TableInfo)
Will return the Table's name including table prefix.
Declaration
protected virtual string ToSql(TableInfo tableInfo)
Parameters
Type | Name | Description |
---|---|---|
TableInfo | tableInfo | The table to get the name for |
Returns
Type | Description |
---|---|
String | Name of the table like |
ToSql(Trim)
Trim in sybase: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc38151.1510/html/iqrefbb/Trim.htm Trim in mysql: http://www.w3resource.com/mysql/string-functions/mysql-trim-function.php Oracle doc: http://www.techonthenet.com/oracle/functions/trim.php
Declaration
protected virtual string ToSql(Trim arg)
Parameters
Type | Name | Description |
---|---|---|
Trim | arg |
Returns
Type | Description |
---|---|
String |
ToSql(UnEqual)
You will never use the != ( not equal ) operator on anything else then fields and numeric parameters ( or possible other fields ). So we just return the arg.Left != arg.Right. If the right hand side isn't a numeric value, the return value is null.
Declaration
protected virtual string ToSql(UnEqual arg)
Parameters
Type | Name | Description |
---|---|---|
UnEqual | arg |
Returns
Type | Description |
---|---|
String |
ToSql(Upper)
ToSql( Upper arg ) will return the given argument anclosed by the SQL UPPER function.
Declaration
protected virtual string ToSql(Upper arg)
Parameters
Type | Name | Description |
---|---|---|
Upper | arg | The argument to wrap UPPER around. |
Returns
Type | Description |
---|---|
String | The parsed UPPER-string |
ToSql(Year)
Declaration
protected virtual string ToSql(Year arg)
Parameters
Type | Name | Description |
---|---|---|
Year | arg |
Returns
Type | Description |
---|---|
String |
ToSqlField(ArgumentCollection)
This function will run through a fieldcollection and return the selected fields together with the appropriate table-alias. This is possible because each field has knowledge about its parent (table) and each table contains a auto generated alias. The order on the fields will not change according to the way the user has entered them.
Declaration
protected virtual string ToSqlField(ArgumentCollection arg)
Parameters
Type | Name | Description |
---|---|---|
ArgumentCollection | arg |
Returns
Type | Description |
---|---|
String |
ToSqlField(FieldInfoCollection)
This function will run through a fieldcollection and return the selected fields together with the appropriate table-alias. This is possible because each field has knowledge about its parent (table) and each table contains a auto generated alias. The order on the fields will not change according to the way the user has entered them.
Declaration
protected virtual string ToSqlField(FieldInfoCollection arg)
Parameters
Type | Name | Description |
---|---|---|
FieldInfoCollection | arg |
Returns
Type | Description |
---|---|
String |
ToSqlField(ReturnFieldsCollection)
ToSqlField( ReturnFieldsCollection arg ) will run through the in-parameter and create the correct sql-syntax for the fields the user want to return from the query.
Declaration
protected virtual string ToSqlField(ReturnFieldsCollection arg)
Parameters
Type | Name | Description |
---|---|---|
ReturnFieldsCollection | arg | The ReturnFieldsCollection the user wants to run through |
Returns
Type | Description |
---|---|
String | The sql-clause |
ToSqlFrom()
ToSqlFrom runs through the TableInfoCollection in Dialect and creates a string containing the table-name and alias of a table. If there are several tables, we add a ", " between each of them. Ex:
associate T0, contact T1, appointment T2
Tables in the _tablesInJoin collection are automatically skipped, and not part of this list
Declaration
protected virtual string ToSqlFrom()
Returns
Type | Description |
---|---|
String |
ToSqlUpperIfNeeded(Argument)
Declaration
protected virtual string ToSqlUpperIfNeeded(Argument arg)
Parameters
Type | Name | Description |
---|---|---|
Argument | arg |
Returns
Type | Description |
---|---|
String |
UnionSql(TableExpression)
UnionSql will parse through the union-array list and return the correct sql-statement.
Declaration
protected virtual string UnionSql(TableExpression cmd)
Parameters
Type | Name | Description |
---|---|---|
TableExpression | cmd | The Union statement. |
Returns
Type | Description |
---|---|
String | The parsed sql-statement. |
UpdateSql(PrivateSave)
Will generate the update-statement.
Declaration
protected virtual string UpdateSql(PrivateSave cmd)
Parameters
Type | Name | Description |
---|---|---|
PrivateSave | cmd | Takes a Private save as in-parameter. This object contains the structure needed to build the sql-string. |
Returns
Type | Description |
---|---|
String | The generated sql-string. |