Class Dialect
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Assembly: SoDataBase.dll
Syntax
public abstract class Dialect
Constructors
Dialect()
Declaration
Fields
_cmd
Declaration
protected SqlCommand _cmd
Field Value
_dbSchemaTable
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected DataTable _dbSchemaTable
Field Value
_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
_returnArguments
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected List<Argument> _returnArguments
Field Value
_returnDBFields
Contains information regarding the fields in returnfields. Does not contain information
regarding Arguments.
Declaration
protected FieldInfoCollection _returnDBFields
Field Value
_soSchemaTable
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected DataTable _soSchemaTable
Field Value
_stringFieldsInOrderByWithDistinct
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected HashSet<FieldInfo> _stringFieldsInOrderByWithDistinct
Field Value
_tables
Contains information regarding the current tables we are working with.
Declaration
protected TableInfoCollection _tables
Field Value
_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
_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
Properties
BlockUpperInOrderBy
Declaration
protected virtual bool BlockUpperInOrderBy { get; }
Property Value
CaseSensitiveDatabase
Is the database case-sensitive by default (something we work hard to make disappear)?
Declaration
protected virtual bool CaseSensitiveDatabase { get; }
Property Value
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
CurrentSqlType
Tells the system what kind of sql we are dealing with.
Declaration
protected virtual SqlType CurrentSqlType { get; set; }
Property Value
DefaultConnectionString
Get default connection string
Declaration
public abstract string DefaultConnectionString { get; }
Property Value
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
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
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
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
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
ReturnDBFields
Declaration
protected FieldInfoCollection ReturnDBFields { get; }
Property Value
ReturnFieldsIndexer
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public ReturnFieldsIndexer ReturnFieldsIndexer { get; }
Property Value
Tables
Declaration
protected TableInfoCollection Tables { get; set; }
Property Value
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
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
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
Returns
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 |
| bool |
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
Returns
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
ConvertToDbParameterType(object, FieldDataType)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public virtual object ConvertToDbParameterType(object value, FieldDataType dataType)
Parameters
Returns
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.
|
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
DataReaderGetBoolean(SoDataReader, IDataReader, int)
Gets the value of the specified column as a bool.
Declaration
public virtual bool DataReaderGetBoolean(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetByte(SoDataReader, IDataReader, int)
Gets the value of the specified column as a byte.
Declaration
public virtual byte DataReaderGetByte(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetBytes(SoDataReader, IDataReader, int, long, byte[], int, int)
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
Returns
DataReaderGetChar(SoDataReader, IDataReader, int)
Gets the value of the specified column as a single character.
Declaration
public virtual char DataReaderGetChar(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetChars(SoDataReader, IDataReader, int, long, char[], int, int)
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
Returns
DataReaderGetData(SoDataReader, IDataReader, int)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public IDataReader DataReaderGetData(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetDataTypeName(SoDataReader, IDataReader, int)
Return the name of the datatype of the i'th column
Declaration
public virtual string DataReaderGetDataTypeName(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
| Type |
Description |
| string |
Name of the data type in the column. for example: "int" or "varchar"
|
DataReaderGetDateTime(SoDataReader, IDataReader, int)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public DateTime DataReaderGetDateTime(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetDecimal(SoDataReader, IDataReader, int)
Gets the value of the specified column as a decimal.
Declaration
public virtual decimal DataReaderGetDecimal(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetDouble(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetFieldType(SoDataReader, IDataReader, int)
Return the actual Type class for the data type
Declaration
public virtual Type DataReaderGetFieldType(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetFloat(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetGuid(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetInt16(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetInt32(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetInt32Array(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetInt64(SoDataReader, IDataReader, int)
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
Returns
DataReaderGetItem(SoDataReader, IDataReader, int)
Declaration
protected virtual object DataReaderGetItem(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetName(SoDataReader, IDataReader, int)
Return the name of the i'th column.
Declaration
public virtual string DataReaderGetName(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
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, int)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public virtual object DataReaderGetNullValue(SoDataReader soReader, int i)
Parameters
Returns
DataReaderGetOrdinal(SoDataReader, IDataReader, string)
Return the index of the named field.
Declaration
public virtual int DataReaderGetOrdinal(SoDataReader soReader, IDataReader innerReader, string name)
Parameters
Returns
| Type |
Description |
| int |
A zero-based index suitable for use with GetValue(int) and the rest of the Get functions.
|
DataReaderGetString(SoDataReader, IDataReader, int)
Gets the value of the specified column as a string.
Declaration
public virtual string DataReaderGetString(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
Returns
DataReaderGetValue(SoDataReader, IDataReader, int)
Return the value of the datatype.
Declaration
public object DataReaderGetValue(SoDataReader soReader, IDataReader innerReader, int i)
Parameters
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, DbDataReader, int)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public bool DataReaderIsDBNull(SoDataReader soReader, DbDataReader innerReader, int i)
Parameters
Returns
DataReaderIsDBNullAsync(SoDataReader, DbDataReader, int, CancellationToken)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public Task<bool> DataReaderIsDBNullAsync(SoDataReader soReader, DbDataReader innerReader, int i, CancellationToken cancellationToken = default)
Parameters
Returns
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 |
| int |
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 |
| int |
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
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
Returns
| Type |
Description |
| string |
The parsed sql-statement.
|
EncodedArraySearch(Argument, Argument[], EncodedArraySearchType, FulltextEncodedSearch)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string EncodedArraySearch(Argument left, Argument[] right, Dialect.EncodedArraySearchType searchType, Dialect.FulltextEncodedSearch fts = null)
Parameters
Returns
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
Returns
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
Returns
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
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
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
GetFieldDbDataType(int)
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 |
| int |
index |
The index of the actual field.
|
Returns
| Type |
Description |
| FieldDataType |
The FieldDataType of the actual field.
|
GetFieldInfoFromIndex(int)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public FieldInfo GetFieldInfoFromIndex(int index)
Parameters
| Type |
Name |
Description |
| int |
index |
|
Returns
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 |
| int |
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()
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string GetOrderbyCollationHint()
Returns
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
Returns
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
Returns
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)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public static int[] IntArrayFromWordString(string wordString)
Parameters
| Type |
Name |
Description |
| string |
wordString |
|
Returns
IntArrayToWordString(params int[])
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public static string IntArrayToWordString(params int[] ids)
Parameters
| Type |
Name |
Description |
| int[] |
ids |
|
Returns
IntFromSingleWord(string)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
public static int IntFromSingleWord(string word)
Parameters
| Type |
Name |
Description |
| string |
word |
|
Returns
IntToSingleWord(int)
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 |
| int |
id |
|
Returns
InvokeToSql(params 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
Exceptions
IsAnyArgumentString(params 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 |
| bool |
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 |
| bool |
True if table is referenced
|
LockReader<T>(SoDataReader, Func<T>)
The PostgreSQL data reader is not thread safe in GetValue-like calls. Other readers are - here is a helper method to do the locking, or not.
Declaration
public virtual T LockReader<T>(SoDataReader soReader, Func<T> innerLogic)
Parameters
Returns
Type Parameters
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
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.
|
PreParseUnion(TableExpression)
Override this method if addtional parsing is required to be performed on the Union
Declaration
protected virtual void PreParseUnion(TableExpression cmd)
Parameters
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
Returns
TableOptions(TableInfo, SqlType)
Add table-level options. Called when constructiing the FROM clause, after any alias has been added
Declaration
protected virtual string TableOptions(TableInfo theTable, SqlType sqlType)
Parameters
Returns
TimeTLocal2DateTime(int)
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 |
| int |
time |
Seconds since local-time January 1st, 1970
|
Returns
| Type |
Description |
| DateTime |
Local-time DateTime converted to.
|
TimeTUtc2DateTime(int)
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 |
| int |
time |
Seconds since UTC 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
ToSql(FieldDataType)
ToSql( FieldDataType arg ) will return the db-type according to the in-parameter.
Declaration
protected virtual string ToSql(FieldDataType arg)
Parameters
Returns
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
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
ToSql(Argument)
Declaration
protected virtual string ToSql(Argument arg)
Parameters
Returns
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
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)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Day arg)
Parameters
| Type |
Name |
Description |
| Day |
arg |
|
Returns
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
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
ToSql(FieldInfo)
Will return the Field's name together with the generated table-alias.
T1."contact"
Declaration
protected virtual string ToSql(FieldInfo arg)
Parameters
Returns
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
Returns
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
Returns
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
Returns
ToSql(Greatest)
The MathMax-operator will return the correct field and its correct sqlOperator.
T0.lastUpdated = max of registered and updated;
Declaration
protected virtual string ToSql(Greatest arg)
Parameters
Returns
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
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
ToSql(HasFlag)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(HasFlag arg)
Parameters
Returns
ToSql(HasNoFlag)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(HasNoFlag arg)
Parameters
Returns
ToSql(Hour)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Hour arg)
Parameters
| Type |
Name |
Description |
| Hour |
arg |
|
Returns
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
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
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
ToSql(JsonValue)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(JsonValue arg)
Parameters
Returns
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
Returns
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
Returns
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%'
We add the wildcard-operator (%) to the end. A LIKE clause isn't very interesting
without it. If the programmer don't want this, parse and remove it when the function
returns the correct sql-string.
Declaration
protected virtual string ToSql(Like arg)
Parameters
| Type |
Name |
Description |
| Like |
arg |
|
Returns
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)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Minute arg)
Parameters
| Type |
Name |
Description |
| Minute |
arg |
|
Returns
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
Returns
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
Returns
ToSql(Month)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Month arg)
Parameters
| Type |
Name |
Description |
| Month |
arg |
|
Returns
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
Returns
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
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
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%'
We add the wildcard-operator (%) to the end. A NOT LIKE clause isn't very interesting
without it. If the programmer don't want this, parse and remove it when the function
returns the correct sql-string.
Declaration
protected virtual string ToSql(NotLike arg)
Parameters
Returns
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
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
Returns
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
Returns
| Type |
Description |
| string |
The RightOuterJoin sql string
|
ToSql(Second)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Second arg)
Parameters
| Type |
Name |
Description |
| Second |
arg |
|
Returns
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
Returns
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 crm5."contact".
|
ToSql(Trim)
Declaration
protected virtual string ToSql(Trim arg)
Parameters
| Type |
Name |
Description |
| Trim |
arg |
|
Returns
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
Returns
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)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSql(Year arg)
Parameters
| Type |
Name |
Description |
| Year |
arg |
|
Returns
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
Returns
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
Returns
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
Returns
| Type |
Description |
| string |
The sql-clause
|
ToSqlFrom(SqlType)
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(SqlType sqlType)
Parameters
| Type |
Name |
Description |
| SqlType |
sqlType |
|
Returns
ToSqlUpperIfNeeded(Argument)
All classes inheriting from this class must implement the following code:
static System.Collections.Hashtable _toSqlHelper = null;
protected override Hashtable System.Collections.ToSqlHelper
{
get {return _toSqlHelper;}
set {_toSqlHelper = value;}
}
This class is the sql-generator in the new SSearch.
It has various derived classes that represents the databases we use.
These classes contain the information needed to generate the db-specific sql.
Declaration
protected virtual string ToSqlUpperIfNeeded(Argument arg)
Parameters
Returns
UnionSql(TableExpression)
UnionSql will parse through the union-array list and return the correct sql-statement.
Declaration
protected virtual string UnionSql(TableExpression cmd)
Parameters
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.
|
Extension Methods