Class PostgreSqlDialect
This class contains the common SQL-syntax for PostgreSQL.
Inheritance
PostgreSqlDialect
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public class PostgreSqlDialect : Dialect
Properties
DefaultConnectionString
Get default connection string
Declaration
public override string DefaultConnectionString { get; }
Property Value
Overrides
HasAliasOnDelete
Used to check if alias is used with fields and tables in the SQL DELETE-command.
Declaration
protected override bool HasAliasOnDelete { get; }
Property Value
Overrides
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 override bool HasAliasOnInsert { get; }
Property Value
Overrides
HasAliasOnUpdate
Used to check if alias is used with fields and tables in the SQL UPDATE-command.
Declaration
protected override bool HasAliasOnUpdate { get; }
Property Value
Overrides
Methods
ConvertToDbParameterType(object, FieldDataType)
This class contains the common SQL-syntax for PostgreSQL.
Declaration
public override object ConvertToDbParameterType(object value, FieldDataType dataType)
Parameters
Returns
Overrides
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 override 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
Overrides
LockReader<T>(SoDataReader, Func<T>)
The PostgreSQL data reader is not thread safe so we need to lock every call; typically to the innerReader. This is helper method to do that.
Declaration
public override T LockReader<T>(SoDataReader soReader, Func<T> innerLogic)
Parameters
Returns
Type Parameters
Overrides
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 override 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
Overrides
ToSql(Add)
The Add-operator will return the correct field and its correct sqlOperator.
T0.associate_id = T0.associate_id + 1;
Declaration
protected override string ToSql(Add arg)
Parameters
| Type |
Name |
Description |
| Add |
arg |
|
Returns
Overrides
ToSql(DateAdd)
This class contains the common SQL-syntax for PostgreSQL.
Declaration
protected override string ToSql(DateAdd arg)
Parameters
Returns
Overrides
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 override string ToSql(Equal arg)
Parameters
| Type |
Name |
Description |
| Equal |
arg |
|
Returns
Overrides
ToSql(FieldInfo)
Will return the Field's name together with the generated table-alias.
T1."contact"
Declaration
protected override string ToSql(FieldInfo arg)
Parameters
Returns
Overrides
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 override string ToSql(Like arg)
Parameters
| Type |
Name |
Description |
| Like |
arg |
|
Returns
Overrides
ToSql(Lower)
ToSql( Lower arg ) will return the given argument enclosed by the SQL LOWER function.
Declaration
protected override string ToSql(Lower arg)
Parameters
| Type |
Name |
Description |
| Lower |
arg |
The argument to wrap LOWER around.
|
Returns
| Type |
Description |
| string |
The parsed LOWER-string
|
Overrides
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 override string ToSql(NotLike arg)
Parameters
Returns
Overrides
ToSql(TableInfo)
Will return the Table's name including table prefix.
Declaration
protected override 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".
|
Overrides
ToSql(Trim)
Declaration
protected override string ToSql(Trim arg)
Parameters
| Type |
Name |
Description |
| Trim |
arg |
|
Returns
Overrides
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 override string ToSql(UnEqual arg)
Parameters
Returns
Overrides
ToSql(Upper)
ToSql( Upper arg ) will return the given argument anclosed by the SQL UPPER function.
Declaration
protected override string ToSql(Upper arg)
Parameters
| Type |
Name |
Description |
| Upper |
arg |
The argument to wrap UPPER around.
|
Returns
| Type |
Description |
| string |
The parsed UPPER-string
|
Overrides
ToSql(WaitFor)
This class contains the common SQL-syntax for PostgreSQL.
Declaration
protected string ToSql(WaitFor arg)
Parameters
Returns
Extension Methods