bool FdoSmPhPostGisOwner::IsDbObjectNameReserved( FdoStringP objectName ) { bool isReserved = FdoSmPhGrdOwner::IsDbObjectNameReserved( objectName ); // The PostGIS DbObjectReader does not currently pick up indexes so // they are not cached in the owner's DbObject list and are thus not picked // up by base IsDbObjectNameReserved. // Do extra check against pg_class table to ensure objectName not currently // used by an index. if ( !isReserved ) { FdoStringP sqlString = FdoStringP::Format( L"select 1 from pg_catalog.pg_class C, pg_catalog.pg_namespace N " L"where C.relnamespace = N.oid and upper(N.nspname || '.' || C.relname) = %ls", (FdoString*) GetManager()->FormatSQLVal(objectName.Upper(), FdoSmPhColType_String) ); FdoSmPhRowP row = new FdoSmPhRow( GetManager(), L"GetObjectExists" ); FdoSmPhRdQueryReaderP reader = GetManager()->CreateQueryReader( row, sqlString ); isReserved = reader->ReadNext(); } return isReserved; }
FdoSmPhRdSqsConstraintReader::FdoSmPhRdSqsConstraintReader( FdoSmPhOwnerP owner, FdoSmPhRdTableJoinP join, FdoStringP constraintType ) : FdoSmPhRdConstraintReader(), mConstraintName(constraintType.Upper()), mOwner(owner) { SetSubReader( MakeReader(owner,DbObjectName2Objects(L""),join,constraintType) ); }
FdoSmPhRdSqsConstraintReader::FdoSmPhRdSqsConstraintReader( FdoSmPhOwnerP owner, FdoStringsP tableNames, FdoStringP constraintType ) : FdoSmPhRdConstraintReader(), mConstraintName(constraintType.Upper()), mOwner(owner) { SetSubReader( MakeReader(owner,tableNames,(FdoSmPhRdTableJoin*) NULL,constraintType) ); }
FdoSmPhRdSqsConstraintReader::FdoSmPhRdSqsConstraintReader( FdoSmPhOwnerP owner, FdoStringP tableName, FdoStringP constraintType ) : FdoSmPhRdConstraintReader(), mConstraintName(constraintType.Upper()), mTableName(tableName), mOwner(owner) { SetSubReader( MakeReader(owner,DbObjectName2Objects(tableName),(FdoSmPhRdTableJoin*) NULL,constraintType) ); }
FdoSmPhRdMySqlConstraintReader::FdoSmPhRdMySqlConstraintReader( FdoSmPhOwnerP owner, FdoSmPhRdTableJoinP join, FdoStringP constraintType ) : FdoSmPhRdConstraintReader(), mConstraintName(constraintType.Upper()), mOwner(owner) { FdoStringsP tableNames = FdoStringCollection::Create(); SetSubReader( MakeReader(owner,tableNames,join,constraintType) ); }
wchar_t *OdbcConnectionUtil::GetConnectionString(StringConnTypeRequest pTypeReq, FdoString *suffix, bool bAddExtraneousSpaces) { FdoStringP service = UnitTestUtil::GetEnviron("service"); FdoStringP username = UnitTestUtil::GetEnviron("username"); FdoStringP password = UnitTestUtil::GetEnviron("password"); FdoStringP datastore = UnitTestUtil::GetEnviron("datastore", suffix); FdoStringP dsnname = UnitTestUtil::GetEnviron("dsnname"); FdoStringP OracleDriverName = theOracleDriverName; static wchar_t connectString[200]; connectString[0] = L'\0'; switch (pTypeReq) { case Connection_WithDatastore: if (m_ProviderActive == L"OdbcMySql") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER=%ls;SERVER=%ls;DATABASE=%ls;USER=%ls;PASSWORD=%ls;OPTION=3;\"", (FdoString*) MYSQL_ODBC_DRIVER_NAME, (FdoString*) service, (FdoString*) datastore, (FdoString*) username, (FdoString*) password ); else if (m_ProviderActive == L"OdbcSqlServer") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={SQL Server};SERVER=%ls;DATABASE=%ls;UID=%ls;PWD=%ls;\"", (FdoString*) service, (FdoString*) datastore, (FdoString*) username, (FdoString*) password ); else if (m_ProviderActive == L"OdbcSybase") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={Adaptive Server Enterprise};SERVER=%ls;PORT=5000;DATABASE=%ls;UID=%ls;PWD=%ls;\"", (FdoString*) service, (FdoString*) datastore, (FdoString*) username, (FdoString*) password ); else if (m_ProviderActive == L"OdbcOracle") { FdoStringP pDatastore = datastore; pDatastore = pDatastore.Upper(); swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={%ls};UID=%ls;PWD=%ls;DBQ=%ls;XSM=%ls;\"", (FdoString*)OracleDriverName, (FdoString*)pDatastore, (FdoString*)password, (FdoString*)service, (FdoString*)pDatastore); } else if (m_ProviderActive == L"OdbcAccess") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcExcel") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*) dsnname ); else if (m_ProviderActive == L"OdbcText") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*) dsnname ); break; case Connection_NoDatastore: if (m_ProviderActive == L"OdbcMySql") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER=%ls;SERVER=%ls;USER=%ls;PASSWORD=%ls;OPTION=3;\"", (FdoString*)MYSQL_ODBC_DRIVER_NAME, (FdoString*)service, (FdoString*)username, (FdoString*)password ); else if (m_ProviderActive == L"OdbcSqlServer") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={SQL Server};SERVER=%ls;UID=%ls;PWD=%ls;\"", (FdoString*)service, (FdoString*)username, (FdoString*)password ); else if (m_ProviderActive == L"OdbcSybase") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={Adaptive Server Enterprise};SERVER=%ls;PORT=5000;UID=%ls;PWD=%ls;\"", (FdoString*)service, (FdoString*)username, (FdoString*)password ); else if (m_ProviderActive == L"OdbcOracle") { FdoStringP pDatastore = datastore; pDatastore = pDatastore.Upper(); swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={%ls};UID=%ls;PWD=%ls;DBQ=%ls;\"", (FdoString*)OracleDriverName, (FdoString*)pDatastore /*username*/, (FdoString*)password, (FdoString*)service ); } else if (m_ProviderActive == L"OdbcAccess") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcExcel") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcText") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); break; case Connection_WithDSN: if (m_ProviderActive == L"OdbcMySql") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=%ls;Password=%ls;", (FdoString*)dsnname, (FdoString*)username, (FdoString*)password ); else if (m_ProviderActive == L"OdbcSqlServer") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=%ls;Password=%ls;", (FdoString*)dsnname, (FdoString*)username, (FdoString*)password ); else if (m_ProviderActive == L"OdbcOracle") { FdoStringP pDatastore = datastore; pDatastore = pDatastore.Upper(); swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=%ls;Password=%ls;", (FdoString*)dsnname, (FdoString*)pDatastore, (FdoString*)password ); } else if (m_ProviderActive == L"OdbcSybase") { swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=%ls;Password=%ls;", (FdoString*)dsnname, (FdoString*)username, (FdoString*)password ); } else if (m_ProviderActive == L"OdbcAccess") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcDbase") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcExcel") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); else if (m_ProviderActive == L"OdbcText") swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"DataSourceName=%ls;UserId=;Password=;", (FdoString*)dsnname ); break; case Connection_OraSetup: swprintf( connectString, sizeof(connectString)/sizeof(wchar_t), L"ConnectionString=\"DRIVER={%ls};UID=%ls;PWD=%ls;DBQ=%ls;;\"", (FdoString*)OracleDriverName, (FdoString*)username, (FdoString*)password, (FdoString*)service ); break; } return connectString; }