C# Class Azavea.Open.DAO.PostgreSQL.PostgreSqlDaLayer

Implements a FastDao layer customized for PostGreSQL (optionally with PostGIS installed).
Inheritance: Azavea.Open.DAO.SQL.SqlDaDdlLayer
ファイルを表示 Open project: azavea/net-dao-postgresql

Public Methods

Method Description
CreateGeometry ( object input ) : object

Creates a geometry object from the string input.

CreateQuery ( ClassMapping mapping, DaoCriteria crit ) : IDaQuery
PostgreSqlDaLayer ( PostgreSqlDescriptor connDesc ) : System

Construct the layer. Should typically be called only by the appropriate ConnectionDescriptor.

Protected Methods

Method Description
AddColDefinition ( StringBuilder sb, string col, ClassMapping mapping, string separator, ICollection extraStatements ) : bool

Add the definition for the given column to the create table statement.

ExpressionToQuery ( SqlDaQuery queryToAddTo, IExpression expr, ClassMapping mapping, string colPrefix, string booleanOperator ) : bool

Converts a single Expression to SQL (mapping the columns as appropriate) and appends to the given string builder. The expression's SQL will already be wrapped in parends, so you do not need to add them here.

GetAsciiStringType ( ) : string

PostgreSQL encoding is specified by the database not by the column, so we just use TEXT again.

GetAutoType ( Type baseType ) : string

Returns the DDL for the type of an automatically incrementing column. Some databases only store autonums in one col type so baseType may be ignored.

GetBooleanType ( ) : string

Returns the SQL type used to store a boolean in the DB.

GetByteArrayType ( ) : string

Returns the SQL type used to store a byte array in the DB.

GetLongType ( ) : string

Returns the SQL type used to store a long in the DB.

GetStringType ( ) : string

Returns the SQL type used to store a "normal" (unicode) string in the DB.

PreProcessPropertyValues ( string table, object>.IDictionary propValues ) : void

Overriden to convert IGeometries to correctly-encoded strings that PostGIS can recognize. This is called prior to inserting or updating these values in the table.

Method Details

AddColDefinition() protected method

Add the definition for the given column to the create table statement.
protected AddColDefinition ( StringBuilder sb, string col, ClassMapping mapping, string separator, ICollection extraStatements ) : bool
sb StringBuilder Current create table statement to append to.
col string Name of the column to add a definition for.
mapping ClassMapping Classmapping we're creating a table for.
separator string Separator to use before appending to sb.
extraStatements ICollection If adding this column requires any additional /// SQL statements to be run afterwards, put them here.
return bool

CreateGeometry() public method

Creates a geometry object from the string input.
public CreateGeometry ( object input ) : object
input object An "e" well known text string.
return object

CreateQuery() public method

public CreateQuery ( ClassMapping mapping, DaoCriteria crit ) : IDaQuery
mapping ClassMapping
crit Azavea.Open.DAO.Criteria.DaoCriteria
return IDaQuery

ExpressionToQuery() protected method

Converts a single Expression to SQL (mapping the columns as appropriate) and appends to the given string builder. The expression's SQL will already be wrapped in parends, so you do not need to add them here.
protected ExpressionToQuery ( SqlDaQuery queryToAddTo, IExpression expr, ClassMapping mapping, string colPrefix, string booleanOperator ) : bool
queryToAddTo Azavea.Open.DAO.SQL.SqlDaQuery Query we're adding the expression to.
expr IExpression The expression. NOTE: It should NOT be null. This method does not check.
mapping ClassMapping Class mapping for the class we're dealing with.
colPrefix string What to prefix column names with, I.E. "Table." for "Table.Column". /// May be null if no prefix is desired. May be something other than /// the table name if the tables are being aliased.
booleanOperator string The boolean operator (AND or OR) to insert before /// this expression. Blank ("") if we don't need one.
return bool

GetAsciiStringType() protected method

PostgreSQL encoding is specified by the database not by the column, so we just use TEXT again.
protected GetAsciiStringType ( ) : string
return string

GetAutoType() protected method

Returns the DDL for the type of an automatically incrementing column. Some databases only store autonums in one col type so baseType may be ignored.
protected GetAutoType ( Type baseType ) : string
baseType System.Type The data type of the column (nominally).
return string

GetBooleanType() protected method

Returns the SQL type used to store a boolean in the DB.
protected GetBooleanType ( ) : string
return string

GetByteArrayType() protected method

Returns the SQL type used to store a byte array in the DB.
protected GetByteArrayType ( ) : string
return string

GetLongType() protected method

Returns the SQL type used to store a long in the DB.
protected GetLongType ( ) : string
return string

GetStringType() protected method

Returns the SQL type used to store a "normal" (unicode) string in the DB.
protected GetStringType ( ) : string
return string

PostgreSqlDaLayer() public method

Construct the layer. Should typically be called only by the appropriate ConnectionDescriptor.
public PostgreSqlDaLayer ( PostgreSqlDescriptor connDesc ) : System
connDesc PostgreSqlDescriptor Connection to the PostGreSQL / PostGIS DB we'll be using.
return System

PreProcessPropertyValues() protected method

Overriden to convert IGeometries to correctly-encoded strings that PostGIS can recognize. This is called prior to inserting or updating these values in the table.
protected PreProcessPropertyValues ( string table, object>.IDictionary propValues ) : void
table string The table these values will be inserted or updated into.
propValues object>.IDictionary A dictionary of "column"/value pairs for the object to insert or update.
return void