// // Copyright (C) 2007 Refractions Research, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of version 2.1 of the GNU Lesser // General Public License as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #include "stdafx.h" #include "PostGisProvider.h" #include "SchemaCapabilities.h" #include namespace fdo { namespace postgis { SchemaCapabilities::SchemaCapabilities() { FDOLOG_WRITE("SchemaCapabilities created"); } SchemaCapabilities::~SchemaCapabilities() { } /////////////////////////////////////////////////////////////////////////////// // FdoIDisposable interface /////////////////////////////////////////////////////////////////////////////// void SchemaCapabilities::Dispose() { delete this; } /////////////////////////////////////////////////////////////////////////////// // FdoISchemaCapabilities interface /////////////////////////////////////////////////////////////////////////////// FdoClassType* SchemaCapabilities::GetClassTypes(FdoInt32& size) { static FdoClassType types[] = { FdoClassType_FeatureClass, FdoClassType_Class }; size = (sizeof(types) / sizeof(FdoClassType)); return types; } FdoDataType* SchemaCapabilities::GetDataTypes(FdoInt32& size) { static FdoDataType types[] = { FdoDataType_Boolean, FdoDataType_Byte, FdoDataType_DateTime, FdoDataType_Decimal, FdoDataType_Double, FdoDataType_Int16, FdoDataType_Int32, FdoDataType_Int64, FdoDataType_Single, FdoDataType_String // TODO: Types not supported //FdoDataType_BLOB //FdoDataType_CLOB }; size = (sizeof(types) / sizeof(FdoDataType)); return types; } FdoInt64 SchemaCapabilities::GetMaximumDataValueLength(FdoDataType type) { assert(!"NOT IMPLEMENTED"); return 0; } FdoInt32 SchemaCapabilities::GetMaximumDecimalPrecision() { return 0; } FdoInt32 SchemaCapabilities::GetMaximumDecimalScale() { return 0; } FdoInt32 SchemaCapabilities::GetNameSizeLimit(FdoSchemaElementNameType name) { FdoInt32 limit = 0; switch (name) { case FdoSchemaElementNameType_Datastore: case FdoSchemaElementNameType_Schema: case FdoSchemaElementNameType_Class: case FdoSchemaElementNameType_Property: // It's length of 'name' data type that is defined // as 64 bytes (including \0 terminator) // The value should be referenced using the constant NAMEDATALEN. limit = NAMEDATALEN - 1; break; case FdoSchemaElementNameType_Description: // Description is stored as a COMMENT associated with database object. // COMMENT stores data of 'text' type, without any size limit. // We set the limit arbitraily to 300 characters limit = 300; break; } return limit; } FdoString* SchemaCapabilities::GetReservedCharactersForName() { assert(!"NOT IMPLEMENTED"); return NULL; } FdoDataType* SchemaCapabilities::GetSupportedAutoGeneratedTypes(FdoInt32& size) { static FdoDataType types [] = { FdoDataType_Int32, FdoDataType_Int64 }; size = (sizeof(types) / sizeof(FdoDataType)); return types; } FdoDataType* SchemaCapabilities::GetSupportedIdentityPropertyTypes(FdoInt32& size) { static FdoDataType types[] = { FdoDataType_Boolean, FdoDataType_Byte, FdoDataType_DateTime, FdoDataType_Decimal, FdoDataType_Double, FdoDataType_Int16, FdoDataType_Int32, FdoDataType_Int64, FdoDataType_Single, FdoDataType_String }; size = (sizeof(types) / sizeof(FdoDataType)); return types; } bool SchemaCapabilities::SupportsAssociationProperties() { return false; } bool SchemaCapabilities::SupportsAutoIdGeneration() { return true; } bool SchemaCapabilities::SupportsCompositeId() { // TODO: If composite ID means multiple column PRIMARY KEY // then PostgreSQL does suppor it, and we can turn it on. return false; } bool SchemaCapabilities::SupportsCompositeUniqueValueConstraints() { // TODO: Unique constraint refering to a group of columns // is supported by PostgreSQL. return false; } bool SchemaCapabilities::SupportsDataStoreScopeUniqueIdGeneration() { return false; } bool SchemaCapabilities::SupportsDefaultValue() { return false; } bool SchemaCapabilities::SupportsExclusiveValueRangeConstraints() { return false; } bool SchemaCapabilities::SupportsInclusiveValueRangeConstraints() { return false; } bool SchemaCapabilities::SupportsInheritance() { return false; } bool SchemaCapabilities::SupportsMultipleSchemas() { return true; } bool SchemaCapabilities::SupportsNetworkModel() { // TODO: What's this about actually? return false; } bool SchemaCapabilities::SupportsNullValueConstraints() { return true; } bool SchemaCapabilities::SupportsObjectProperties() { return false; } bool SchemaCapabilities::SupportsSchemaModification() { return true; } bool SchemaCapabilities::SupportsSchemaOverrides() { return true; } bool SchemaCapabilities::SupportsUniqueValueConstraints() { return false; } bool SchemaCapabilities::SupportsValueConstraintsList() { // TODO: To be reviewed return false; } }} // namespace fdo::postgis