You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ad...@apache.org on 2007/05/18 01:47:47 UTC
svn commit: r539176 - in /incubator/tuscany/cpp/das: VSExpress/tuscany_das/
VSExpress/tuscany_das/das_runtime/ VSExpress/tuscany_das/das_test/
runtime/core/include/apache/das/ runtime/core/include/apache/das/rdb/
runtime/core/src/ runtime/core/src/apac...
Author: adrianocrestani
Date: Thu May 17 16:47:45 2007
New Revision: 539176
URL: http://svn.apache.org/viewvc?view=rev&rev=539176
Log:
- added DataGraphPrinter
- fixed deploy.bat
- fixed composite relationship when not all the column are loaded in ResultSet
Added:
incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h
incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp
Modified:
incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj
incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln
incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Config.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Config.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp
incubator/tuscany/cpp/das/runtime/core/src/deploy.bat
incubator/tuscany/cpp/das/runtime/test/src/main.cpp
Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj Thu May 17 16:47:45 2007
@@ -116,11 +116,11 @@
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
- ConfigurationType="2"
+ ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
@@ -147,11 +147,11 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\runtime\core\include;"$(TUSCANY_SDOCPP)\include";"%LIBXML2_HOME%\include";"%ZLIB_HOME%\include";"%ICONV_HOME%\include""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
MinimalRebuild="true"
- BasicRuntimeChecks="3"
+ BasicRuntimeChecks="0"
RuntimeLibrary="3"
- PrecompiledHeaderFile=".\Debug/das_runtime.pch"
+ PrecompiledHeaderFile=""
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
@@ -171,23 +171,13 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLinkerTool"
- AdditionalDependencies="tuscany_sdo.lib odbc32.lib $(NOINHERIT)"
- OutputFile="Debug\tuscany_das.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""$(TUSCANY_SDOCPP)/lib""
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/tuscany_das.pdb"
- ImportLibrary=".\Debug/tuscany_das.lib"
- TargetMachine="1"
+ Name="VCLibrarianTool"
+ OutputFile=".\Debug/tuscany_das.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
- Name="VCManifestTool"
- />
- <Tool
Name="VCXDCMakeTool"
/>
<Tool
@@ -199,15 +189,8 @@
Name="VCFxCopTool"
/>
<Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
- Description="deploy"
- CommandLine="..\..\..\runtime\core\src\deploy.bat ..\..\..\ Debug"
+ CommandLine=""
/>
</Configuration>
</Configurations>
@@ -219,128 +202,128 @@
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<Filter
- Name="apache"
+ Name="apache::das"
>
- <Filter
- Name="das"
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\Command.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DAS.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DataGraphPrinter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\NullPointerException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingPointer.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="apache::das::rdb"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Column.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ColumnData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\CommandImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Config.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Connection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASFactoryImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Database.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilderMetaData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\KeyPair.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ODBCTypeHelper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\PreparedStatement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ReadCommandImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Relationship.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\RelationshipWrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSetMetaData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\SqlException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Statement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Table.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\TableData.cpp"
>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\Command.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\DAS.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\DASFactory.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\NullPointerException.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingObject.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingPointer.cpp"
- >
- </File>
- <Filter
- Name="rdb"
- >
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Column.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ColumnData.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\CommandImpl.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Config.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Connection.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASFactoryImpl.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASImpl.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Database.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilder.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilderMetaData.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\KeyPair.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ODBCTypeHelper.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\PreparedStatement.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ReadCommandImpl.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Relationship.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\RelationshipWrapper.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSet.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSetMetaData.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\SqlException.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Statement.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Table.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\TableData.cpp"
- >
- </File>
- </Filter>
- </Filter>
+ </File>
</Filter>
</Filter>
<Filter
@@ -348,146 +331,141 @@
Filter="h;hpp;hxx;hm;inl"
>
<Filter
- Name="apache"
+ Name="apache::das"
>
- <Filter
- Name="das"
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\Command.h"
>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\Command.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\DAS.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\DASFactory.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\NullPointerException.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingObject.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingPointer.h"
- >
- </File>
- <Filter
- Name="rdb"
- >
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Column.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ColumnData.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\CommandImpl.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Config.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Connection.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\das_constants.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASFactoryImpl.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASImpl.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Database.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilder.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilderMetaData.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\KeyPair.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ODBCTypeHelper.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\PreparedStatement.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ReadCommandImpl.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Relationship.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\RelationshipWrapper.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSet.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetMetaData.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetPtr.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\SqlException.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Statement.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\StatementPtr.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Table.h"
- >
- </File>
- <File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\TableData.h"
- >
- </File>
- </Filter>
- </Filter>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DAS.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASFactory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DataGraphPrinter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\NullPointerException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingPointer.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="apache::das::rdb"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Column.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ColumnData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\CommandImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Config.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Connection.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\das_constants.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASFactoryImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Database.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilderMetaData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\KeyPair.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ODBCTypeHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\PreparedStatement.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ReadCommandImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Relationship.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\RelationshipWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetMetaData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\SqlException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Statement.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\StatementPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Table.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\TableData.h"
+ >
+ </File>
</Filter>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
</Filter>
</Files>
<Globals>
Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj Thu May 17 16:47:45 2007
@@ -19,7 +19,7 @@
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- CharacterSet="2"
+ CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
@@ -39,10 +39,10 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(TUSCANY_SDOCPP)/include";..\..\..\deploy\include"
- PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ AdditionalIncludeDirectories=""$(TUSCANY_SDOCPP)/include";C:\Adriano\Faculdade\Tuscany\Tuscany\CPP\DAS\runtime\core\include"
+ PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;"
MinimalRebuild="true"
- BasicRuntimeChecks="3"
+ BasicRuntimeChecks="0"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/das_test.pch"
AssemblerListingLocation=".\Debug/"
@@ -62,14 +62,14 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="das_runtime.lib tuscany_sdo.lib odbc32.lib $(NOINHERIT)"
+ AdditionalDependencies="tuscany_das.lib tuscany_sdo.lib odbc32.lib $(NOINHERIT)"
OutputFile=".\Debug/das_test.exe"
LinkIncremental="2"
- AdditionalLibraryDirectories=""$(TUSCANY_SDOCPP)/lib";..\..\..\deploy\lib"
+ AdditionalLibraryDirectories=""$(TUSCANY_SDOCPP)/lib";C:\Adriano\Faculdade\Tuscany\Tuscany\CPP\DAS\VSExpress\tuscany_das\das_runtime\Debug"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/sdo_test.pdb"
+ ProgramDatabaseFile=""
SubSystem="1"
- TargetMachine="1"
+ TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
@@ -175,12 +175,6 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln Thu May 17 16:47:45 2007
@@ -4,9 +4,6 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_runtime", "das_runtime\das_runtime.vcproj", "{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_test", "das_test\das_test.vcproj", "{277D86C4-0113-49EE-A351-0D32FF2E1EF3}"
- ProjectSection(ProjectDependencies) = postProject
- {964F3F93-8D1C-46BE-9724-2313CE7380AA} = {964F3F93-8D1C-46BE-9724-2313CE7380AA}
- EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build", "Build\Build.vcproj", "{78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}"
ProjectSection(ProjectDependencies) = postProject
Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
Binary files - no diff available.
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h?view=auto&rev=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h Thu May 17 16:47:45 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef DATA_GRAPH_PRINTER_H
+#define DATA_GRAPH_PRINTER_H
+
+#include <ostream>
+#include <sstream>
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+
+class DataGraphPrinter {
+ private:
+ commonj::sdo::DataObjectPtr root;
+ unsigned int tabCount;
+ std::ostream* out;
+
+ std::string getTab(int count) const;
+ std::string to_string(const int& t) const;
+ void printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref = false);
+
+ public:
+ DataGraphPrinter(commonj::sdo::DataObjectPtr root);
+ virtual ~DataGraphPrinter(void);
+
+ virtual void print(std::ostream& out);
+ virtual void printMetaData(std::ostream& out);
+
+};
+
+ };
+};
+
+#endif //DATA_GRAPH_PRINTER_H
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h Thu May 17 16:47:45 2007
@@ -33,7 +33,6 @@
namespace rdb {
class Table;
-class KeyPair;
class Column {
@@ -45,24 +44,22 @@
std::string mappedName;
SQLSMALLINT sqlType;
Table* containerTable;
- std::list<KeyPair*>* keyPairs;
void setContainerTable(Table* containerTable);
public:
+ Column(const Column& column);
Column(std::string columnName, SQLSMALLINT sqlType);
virtual ~Column(void);
void setReferencedTableAndColumn(std::string referencedTableName, std::string referencedColumnName);
- void setPK(bool pk);
void setMappedName(std::string mappedName);
- void addKeyPair(KeyPair& keyPair);
-
+ void setPK(bool pk);
+
+ bool isPK(void) const;
std::string getMappedName(void) const;
- bool isFK(void) const;
std::string getReferencedTableName(void) const;
std::string getReferencedColumnName(void) const;
- bool isPK(void) const;
SQLSMALLINT getSQLType(void) const;
Table* getContainerTable(void) const;
std::list<KeyPair*>& getKeyPairs(void) const;
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Config.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Config.h?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Config.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Config.h Thu May 17 16:47:45 2007
@@ -57,7 +57,6 @@
DAS& getDAS(void) const;
bool isConvOverConfig(void) const;
- void loadConvOverConfigFKs(std::list<Column*>& columns);
Table* getTable(std::string tableName) const;
Relationship* getRelationship(std::string tableName, std::string referencedTableName) const;
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h Thu May 17 16:47:45 2007
@@ -44,7 +44,7 @@
private:
ResultSetMetaData* resultSetMetaData;
std::map<std::string, Table*>* graphTables;
- std::list<Relationship*>* relationships;
+ std::map<std::string, Relationship*>* relationships;
Config* config;
public:
@@ -55,7 +55,7 @@
std::map<std::string, Table*>& getTables(void) const;
Config& getConfig(void) const;
Table* getTable(std::string tableName) const;
- std::list<Relationship*>& getRelationships(void) const;
+ std::map<std::string, Relationship*>& getRelationships(void) const;
commonj::sdo::DataFactoryPtr createGraph(void) const;
};
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h Thu May 17 16:47:45 2007
@@ -33,7 +33,6 @@
#include "apache/das/rdb/ResultSet.h"
#include "apache/das/rdb/Column.h"
#include "apache/das/rdb/DASImpl.h"
-#include "apache/das/rdb/GraphBuilderMetaData.h"
#include "apache/das/rdb/ODBCTypeHelper.h"
#include "commonj/sdo/DataFactory.h"
@@ -44,30 +43,25 @@
namespace rdb {
class Config;
-class GraphBuilderMetaData;
class Column;
+class GraphBuilderMetaData;
class Table {
private:
std::map<std::string, Column*>* columns;
- std::list<std::string> pkColumns;
- std::list<Relationship*> relationships;
- GraphBuilderMetaData* graphBuilderMetaData;
std::string tableName;
std::string mappedName;
public:
- Table(GraphBuilderMetaData& graphBuilderMetaData, std::string tableName);
+ Table(std::string tableName);
+ Table(const Table& table);
virtual ~Table(void);
- void addColumns(std::list<Column*>& columns);
+ void addColumn(Column& column);
void setMappedName(std::string mappedName);
- void addPKColumn(std::string columnName);
- void addRelationship(Relationship& relationship);
-
+
std::string getMappedName(void) const;
- GraphBuilderMetaData& getGraphBuilderMetaData(void) const;
std::string getTableName(void) const;
Column* getColumn(std::string columnName) const;
const std::map<std::string, Column*>& getColumns(void) const;
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp?view=auto&rev=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp Thu May 17 16:47:45 2007
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "apache/das/DataGraphPrinter.h"
+
+namespace apache {
+ namespace das {
+
+DataGraphPrinter::DataGraphPrinter(commonj::sdo::DataObjectPtr root) {
+ this->root = root;
+}
+
+DataGraphPrinter::~DataGraphPrinter(void) {}
+
+void DataGraphPrinter::printMetaData(std::ostream& out) {
+ tabCount = 0;
+ const commonj::sdo::TypeList& typeList = root->getDataFactory()->getTypes();
+
+ for (int i = 0 ; i < typeList.size() ; i++) {
+ out << std::endl << "[" << typeList[i].getName() << "]" << std::endl;
+ commonj::sdo::PropertyList propertyList = typeList[i].getProperties();
+
+ for (int j = 0 ; j < propertyList.size() ; j++) {
+
+ out << propertyList[j].getName();
+
+ if (propertyList[j].isReference()) {
+ out << "-> ";
+ } else {
+ out << " - ";
+ }
+
+ out << propertyList[j].getType().getName() << std::endl;
+
+ }
+
+ }
+
+ out << std::endl;
+
+}
+
+void DataGraphPrinter::printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref) {
+ std::ostream& out = *this->out;
+ commonj::sdo::PropertyList& propertyList = dataObject->getType().getProperties();
+ out << getTab(tabCount) << "[" << dataObject->getType().getName() << "]";
+ tabCount++;
+
+ for (int i = 0 ; i < propertyList.size() ; i++) {
+
+ if (propertyList[i].isMany()) {
+ out << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << "[" << propertyList[i].getType().getName() << " LIST]";
+ tabCount++;
+ commonj::sdo::DataObjectList& objectList = dataObject->getList(propertyList[i]);
+
+ for (int j = 0 ; j < objectList.size() ; j++) {
+
+ if (objectList[j]->getType().isDataType()) {
+ std::string typeName = objectList[j]->getType().getName();
+
+ if (typeName == "String") {
+ wchar_t* buf = new wchar_t[200];
+ int copied = dataObject->getString((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str(), buf, 200);
+ buf[copied] = 0;
+ std::wstring wstr = buf;
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+
+
+ out << getTab(tabCount) << str << " : " << objectList[j]->getType().getName();
+ delete [] buf;
+ } else if (typeName == "Integer") {
+ out << getTab(tabCount) << dataObject->getInteger((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str()) << " : " << objectList[j]->getType().getName();
+ }
+
+ } else if (!ref) {
+ printDataGraph(objectList[j], propertyList[i].isReference());
+ }
+
+ }
+
+ if (objectList.size() == 0) {
+ out << getTab(tabCount) << "--empty--";
+ }
+
+ tabCount--;
+
+ } else {
+ commonj::sdo::DataObjectPtr actual = dataObject->getDataObject(propertyList[i]);
+ std::string typeName = actual->getType().getName();
+ if (typeName == "String") {
+ wchar_t* buf = new wchar_t[200];
+ int copied = dataObject->getString(propertyList[i], buf, 200);
+ buf[copied] = 0;
+ std::wstring wstr = buf;
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+
+
+ out << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << str << " : " << actual->getType().getName();
+ delete [] buf;
+ } else if (typeName == "Integer") {
+ out << getTab(tabCount) << dataObject->getInteger(propertyList[i]) << " : " << actual->getType().getName();
+ }
+
+ }
+
+ if (propertyList.size() == 0) {
+ out << getTab(tabCount) << "--empty--";
+ }
+
+ }
+
+ tabCount--;
+
+}
+
+void DataGraphPrinter::print(std::ostream& out) {
+ tabCount = 0;
+ this->out = &out;
+ printDataGraph(root);
+ out << std::endl;
+
+}
+
+std::string DataGraphPrinter::to_string(const int& t) const {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string DataGraphPrinter::getTab(int count) const {
+ std::string ret;
+ ret.append(count* 3, ' ');
+ return "\n" + ret;
+
+}
+
+ };
+};
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp Thu May 17 16:47:45 2007
@@ -22,13 +22,21 @@
namespace das {
namespace rdb {
+Column::Column(const Column& column) {
+ this->columnName = column.columnName;
+ this->mappedName = column.columnName;
+ this->sqlType = column.sqlType;
+ this->containerTable = column.containerTable;
+ this->pk = column.pk;
+
+}
+
Column::Column(std::string columnName, SQLSMALLINT sqlType) {
this->columnName = columnName;
this->mappedName = columnName;
this->sqlType = sqlType;
containerTable = 0;
pk = false;
- keyPairs = 0;
}
@@ -42,14 +50,6 @@
return containerTable;
}
-void Column::setPK(bool pk) {
- this->pk = pk;
-}
-
-bool Column::isPK(void) const {
- return pk;
-}
-
std::string Column::getName(void) const {
return columnName;
}
@@ -58,14 +58,6 @@
return sqlType;
}
-std::list<KeyPair*>& Column::getKeyPairs(void) const {
- return *keyPairs;
-}
-
-bool Column::isFK(void) const {
- return (keyPairs != 0 && keyPairs->size() > 0);
-}
-
void Column::setMappedName(std::string mappedName) {
this->mappedName = mappedName;
}
@@ -74,14 +66,12 @@
return mappedName;
}
-void Column::addKeyPair(KeyPair& keyPair) {
-
- if (keyPairs == 0) {
- keyPairs = new std::list<KeyPair*>();
- }
-
- keyPairs->push_back(&keyPair);
-
+void Column::setPK(bool pk) {
+ this->pk = pk;
+}
+
+bool Column::isPK(void) const {
+ return pk;
}
};
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Config.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Config.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Config.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Config.cpp Thu May 17 16:47:45 2007
@@ -51,69 +51,7 @@
void Config::addTable(Table& table) {
- std::list<Relationship*>* relationships = RelationshipWrapper::
- getRelationshipsByTableName(*this->relationships, table.getTableName());
- std::list<Relationship*>::iterator it;
-
- for (it = relationships->begin() ; it != relationships->end() ; it++) {
- table.addRelationship(**it);
- }
-
- delete relationships;
tables->insert(std::make_pair(table.getTableName(), &table));
-
- //load PKs
- ResultSetPtr pksResultSet = 0;
- Connection* conn = ((DASImpl*) das)->getConnection();
-
- try {
- pksResultSet = conn->getDatabase().getPKs(table.getTableName());
- } catch (std::runtime_error& e) {
- convOverConfig = true;
- return;
-
- }
-
- if (pksResultSet) {
-
- while (pksResultSet->next()) {
- table.addPKColumn(pksResultSet->getSQLVarchar(3));
- }
-
- }
-
- //load FKs
- ResultSetPtr fksResultSet = 0;
-
- try {
- fksResultSet = conn->getDatabase().getFKs(table.getTableName());
- } catch (std::runtime_error& e) {
- convOverConfig = true;
- return;
-
- }
-
- while (fksResultSet->next()) {
- std::string fkColumnName = fksResultSet->getSQLVarchar(7);
- std::string pkTableName = fksResultSet->getSQLVarchar(2);
- std::string pkColumnName = fksResultSet->getSQLVarchar(3);
-
- fkColumnName = fkColumnName.substr(1, fkColumnName.size() - 2);
- pkColumnName = pkColumnName.substr(1, pkColumnName.size() - 2);
-
- Relationship* relationship = getRelationship(pkTableName, table.getTableName());
-
- if (relationship == 0) {
- relationship = new Relationship(pkTableName, table.getTableName());
- addRelationship(*relationship);
-
- }
-
- KeyPair* keyPair = new KeyPair(pkColumnName, fkColumnName);
- relationship->addKeyPair(*keyPair);
-
- }
-
}
std::map<std::string, Relationship*>& Config::getRelationships(void) const {
@@ -121,20 +59,14 @@
}
void Config::addRelationship(Relationship& relationship) {
- relationships->insert(std::make_pair(relationship.getPKTableName() + relationship.getFKTableName(),
+ relationships->insert(std::make_pair(relationship.getPKTableName() + "." + relationship.getFKTableName(),
&relationship));
relationship.setConfig(this);
- Table* table = getTable(relationship.getPKTableName());
-
- if (table != 0) {
- table->addRelationship(relationship);
- }
-
}
Relationship* Config::getRelationship(std::string tableName, std::string referencedTableName) const {
- std::map<std::string, Relationship*>::iterator it = relationships->find(tableName + referencedTableName);
+ std::map<std::string, Relationship*>::iterator it = relationships->find(tableName + "." + referencedTableName);
if (it == relationships->end()) {
return 0;
@@ -165,19 +97,6 @@
DAS& Config::getDAS(void) const {
return *das;
-}
-
-void Config::loadConvOverConfigFKs(std::list<Column*>& columns) {
- std::list<Column*>::iterator it;
-
- for (it == columns.begin() ; it != columns.end() ; it++) {
- Column* column = *it;
- std::string columnName = column->getName();
-
-
-
- }
-
}
};
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp Thu May 17 16:47:45 2007
@@ -18,146 +18,10 @@
*/
#include "apache/das/rdb/GraphBuilder.h"
-//test
-#include "commonj/sdo/TypeList.h"
-#include "commonj/sdo/Type.h"
-#include <iostream>
-#include <sstream>
-#include <queue>
-
namespace apache {
namespace das {
namespace rdb {
-void printDataGraphMetaData(commonj::sdo::DataFactoryPtr dataFactory) {
- const commonj::sdo::TypeList& typeList = dataFactory->getTypes();
-
- for (int i = 0 ; i < typeList.size() ; i++) {
- std::cout << "\n[" << typeList[i].getName() << "]\n";
- commonj::sdo::PropertyList propertyList = typeList[i].getProperties();
-
- for (int j = 0 ; j < propertyList.size() ; j++) {
-
- std::cout << propertyList[j].getName();
-
- if (propertyList[j].isReference()) {
- std::cout << "-> ";
- } else {
- std::cout << " - ";
- }
-
- std::cout << propertyList[j].getType().getName() << "\n";
-
- }
-
- }
-
-}
-int tabCount = 0;
-std::string getTab(int count) {
- std::string ret = "\n";
- ret.append(count* 3, ' ');
- return ret;
-
-}
-
-#include <sstream>
-
-std::string to_string (const int& t)
-{
- std::stringstream ss;
- ss << t;
- return ss.str();
-}
-
-void printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref = false) {
- commonj::sdo::PropertyList& propertyList = dataObject->getType().getProperties();
- std::cout << getTab(tabCount) << "[" << dataObject->getType().getName() << "]";
- tabCount++;
-
- for (int i = 0 ; i < propertyList.size() ; i++) {
-
- if (propertyList[i].isMany()) {
- std::cout << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << "[LIST]";
- tabCount++;
- commonj::sdo::DataObjectList& objectList = dataObject->getList(propertyList[i]);
-
- for (int j = 0 ; j < objectList.size() ; j++) {
-
- if (objectList[j]->getType().isDataType()) {
- std::string typeName = objectList[j]->getType().getName();
-
- if (typeName == "String") {
- wchar_t* buf = new wchar_t[200];
- int copied = dataObject->getString((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str(), buf, 200);
- buf[copied] = 0;
- std::wstring wstr = buf;
- std::string str(wstr.begin(), wstr.end());
- str.assign(wstr.begin(), wstr.end());
-
-
- std::cout << getTab(tabCount) << str << " : " << objectList[j]->getType().getName();
- delete [] buf;
- } else if (typeName == "Integer") {
- std::cout << getTab(tabCount) << dataObject->getInteger((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str()) << " : " << objectList[j]->getType().getName();
- }
-
- } else if (!ref) {
- printDataGraph(objectList[j], propertyList[i].isReference());
- }
-
- }
-
- if (objectList.size() == 0) {
- std::cout << getTab(tabCount) << "--empty--";
- }
-
- tabCount--;
-
- } else {
- commonj::sdo::DataObjectPtr actual = dataObject->getDataObject(propertyList[i]);
- std::string typeName = actual->getType().getName();
- if (typeName == "String") {
- wchar_t* buf = new wchar_t[200];
- int copied = dataObject->getString(propertyList[i], buf, 200);
- buf[copied] = 0;
- std::wstring wstr = buf;
- std::string str(wstr.begin(), wstr.end());
- str.assign(wstr.begin(), wstr.end());
-
-
- std::cout << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << str << " : " << actual->getType().getName();
- delete [] buf;
- } else if (typeName == "Integer") {
- std::cout << getTab(tabCount) << dataObject->getInteger(propertyList[i]) << " : " << actual->getType().getName();
- }
-
- }
-
- if (propertyList.size() == 0) {
- std::cout << getTab(tabCount) << "--empty--";
- }
-
- /*for (int j = 0 ; j < propertyList.size() ; j++) {
-
- std::cout << propertyList[j].getName();
-
- if (propertyList[j].isReference()) {
- std::cout << "-> ";
- } else {
- std::cout << " - ";
- }
-
- std::cout << propertyList[j].getType().getName() << "\n";
-
- }*/
-
- }
-
- tabCount--;
-
-}
-
GraphBuilder::GraphBuilder(Config& config, ResultSetPtr resultSet) {
graphBuilderMetaData = new GraphBuilderMetaData(config, resultSet->getResultSetMetaData()) ;
commonj::sdo::DataFactoryPtr dataFactory = graphBuilderMetaData->createGraph();
@@ -177,6 +41,7 @@
if (!tableData->hasPK()) {
delete tableData;
continue;
+
}
std::map<std::string, std::list<TableData*>*>::iterator it2 =
@@ -226,7 +91,7 @@
}
std::map<std::string, Table*>::const_iterator it2;
- std::list<Relationship*>& relationships = graphBuilderMetaData->getRelationships();
+ std::map<std::string, Relationship*>& relationships = graphBuilderMetaData->getRelationships();
std::map<std::string, std::map<KeyDataList*, TableData*, KeyDataCmp>*> tablesDataByPK;
std::map<std::string, std::list<TableData*>*>::iterator it3;
KeyDataCmp keyDataCmp;
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp Thu May 17 16:47:45 2007
@@ -27,7 +27,7 @@
this->config = &config;
graphTables = new std::map<std::string, Table*>();
std::map<std::string, Relationship*>& configRelationships = config.getRelationships();
- relationships = new std::list<Relationship*>();
+ relationships = new std::map<std::string, Relationship*>();
std::map<std::string, Relationship*>::iterator relationshipIterator;
unsigned int colCount = resultSetMetaData.getColumnCount();
@@ -37,42 +37,116 @@
std::string columnName = resultSetMetaData.getColumnName(i);
SQLSMALLINT columnSQLType = resultSetMetaData.getSQLType(i);
std::string columnTableName = resultSetMetaData.getTableName(i);
- Table* table = config.getTable(columnTableName);
+ std::map<std::string, Table*>::iterator tableIterator = graphTables->
+ find(columnTableName);
- if (table == 0) {
- Table* newTable = new Table(*this, columnTableName);
- config.addTable(*newTable);
- table = newTable;
+ Table* table = 0;
+ Table* configTable = config.getTable(columnTableName);
+
+ if (tableIterator == graphTables->end()) {
+ table = new Table(columnTableName);
+
+ if (configTable != 0) {
+ table->setMappedName(configTable->getMappedName());
+ }
+
+ graphTables->insert(std::make_pair(table->getTableName(), table));
+ } else {
+ table = tableIterator->second;
}
- std::map<std::string, std::list<Column*>*>::iterator it = tablesColumns.
- find(columnTableName);
+ if (configTable == 0) {
+ table->addColumn(*(new Column(columnName, columnSQLType)));
+ } else {
+ Column* column = configTable->getColumn(columnName);
- if (it == tablesColumns.end()) {
- std::list<Column*>* columnsList = new std::list<Column*>();
- columnsList->push_back(new Column(columnName, columnSQLType));
- tablesColumns.insert(std::make_pair(columnTableName, columnsList));
- graphTables->insert(std::make_pair(table->getTableName(), table));
+ if (column != 0) {
+ table->addColumn(*(new Column(*column)));
+ } else {
+ table->addColumn(*(new Column(columnName, columnSQLType)));
+ }
- } else {
- tablesColumns[columnTableName]->push_back(new Column(columnName, columnSQLType));
}
}
+ std::map<std::string, Table*>::iterator tableIterator;
+ for (tableIterator = graphTables->begin() ; tableIterator != graphTables->end() ;
+ tableIterator++) {
+
+ Table& table = *tableIterator->second;
+ Table* configTable = config.getTable(table.getTableName());
+ bool hasPK = false;
+
+ if (configTable != 0 && configTable->getPKColumnCount() ==
+ table.getPKColumnCount()) {
+ hasPK = true;
+
+ }
+
+ const std::map<std::string, Column*>& tableColumns = table.getColumns();
+ std::map<std::string, Column*>::const_iterator columnIterator;
+
+ if (!hasPK) {
+ for (columnIterator = tableColumns.begin() ;
+ columnIterator != tableColumns.end() ; columnIterator++) {
+
+ std::string columnName = columnIterator->second->getName();
+
+ if (columnName == "id") {
+ columnIterator->second->setPK(true);
+ hasPK = true;
+ break;
+
+ }
+
+ }
+
+ }
+
+ if (!hasPK) {
+
+ if (configTable == 0 || configTable->getColumns().size() == 0) {
+
+ for (columnIterator = tableColumns.begin() ;
+ columnIterator != tableColumns.end() ; columnIterator++) {
+ columnIterator->second->setPK(true);
+ }
+
+ }
+
+ }
+
+ }
+
for (relationshipIterator = configRelationships.begin() ;
relationshipIterator != configRelationships.end() ; relationshipIterator++) {
Relationship& relationship = *relationshipIterator->second;
+ bool contains = true;
std::map<std::string, KeyPair*>& keyPairs = relationship.getKeyPairs();
std::map<std::string, KeyPair*>::iterator keyPairIterator;
- bool contains = true;
+ std::map<std::string, Table*>::iterator pkTableIterator =
+ graphTables->find(relationship.getPKTableName());
+ if (pkTableIterator == graphTables->end()) {
+ continue;
+ }
+
+ Table& pkTable = *pkTableIterator->second;
+
for (keyPairIterator = keyPairs.begin() ; keyPairIterator != keyPairs.end() ;
keyPairIterator++) {
KeyPair& keyPair = *keyPairIterator->second;
+ Column* pkColumn = pkTable.getColumn(keyPair.getPKColumnName());
+
+ if (pkColumn == 0 || !pkColumn->isPK()) {
+ contains = false;
+ break;
+
+ }
if (!resultSetMetaData.containsColumn(relationship.getPKTableName(),
keyPair.getPKColumnName()) ||
@@ -87,26 +161,76 @@
}
if (contains) {
- relationships->push_back(&relationship);
+ relationships->insert(std::make_pair(
+ relationship.getPKTableName() + "." + relationship.getFKTableName(),
+ &relationship));
+
}
}
- std::map<std::string, Table*>::iterator it;
+ for (tableIterator = graphTables->begin() ; tableIterator != graphTables->end() ;
+ tableIterator++) {
- for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
- Table* table = it->second;
- std::string tableName = table->getTableName();
- std::list<Column*>* columns = tablesColumns[tableName];
+ Table& table = *tableIterator->second;
+ const std::map<std::string, Column*>& tableColumns = table.getColumns();
+ std::map<std::string, Column*>::const_iterator columnIterator;
- table->addColumns(*columns);
- delete columns;
+ for (columnIterator = tableColumns.begin() ;
+ columnIterator != tableColumns.end() ; columnIterator++) {
- }
+ std::string columnName = columnIterator->second->getName();
+
+ if (columnName.size() > 3 &&
+ columnName.substr(columnName.size() - 3, 3) == "_id") {
+
+ std::string pkTableName = columnName.substr(0, columnName.size() - 3);
+ std::string pkXfk = pkTableName + "." + table.getTableName();
+
+ std::map<std::string, Table*>::iterator pkTableIterator =
+ graphTables->find(pkTableName);
+
+ if (pkTableIterator == graphTables->end()) {
+ continue;
+ }
+
+ Column* pkColumn = pkTableIterator->second->getColumn("id");
+ if (!pkColumn) {
+ continue;
+ }
+
+ std::map<std::string, Relationship*>::iterator relationshipIterator =
+ relationships->find(pkXfk);
+ if (relationshipIterator == relationships->end() &&
+ pkColumn->isPK()) {
+
+ if (pkTableIterator->second->getPKColumnCount() == 1) {
+ Relationship* relationship =
+ new Relationship(pkTableName, table.getTableName());
+
+ relationship->addKeyPair(*(new KeyPair("id", columnName)));
+ relationships->insert(std::make_pair(relationship->getName(), relationship));
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
}
GraphBuilderMetaData::~GraphBuilderMetaData(void) {
+ std::map<std::string, Table*>::iterator it;
+
+ for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
+ delete it->second;
+ }
+
delete graphTables;
delete relationships;
@@ -117,7 +241,7 @@
dataFactory->addType(DAS_NAMESPACE, DAS_ROOT_NAME);
std::map<std::string, Table*>::const_iterator it;
- std::list<Relationship*>::const_iterator it2;
+ std::map<std::string, Relationship*>::const_iterator it2;
for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
Table& table = *(it->second);
@@ -134,7 +258,7 @@
}
for (it2 = relationships->begin() ; it2 != relationships->end() ; it2++) {
- const Relationship& relationship = **it2;
+ const Relationship& relationship = *it2->second;
dataFactory->addPropertyToType(DAS_NAMESPACE, relationship.getPKTableName().c_str(),
relationship.getName().c_str(), DAS_NAMESPACE,
@@ -169,7 +293,7 @@
}
-std::list<Relationship*>& GraphBuilderMetaData::getRelationships(void) const {
+std::map<std::string, Relationship*>& GraphBuilderMetaData::getRelationships(void) const {
return *relationships;
}
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp Thu May 17 16:47:45 2007
@@ -23,7 +23,7 @@
namespace rdb {
Relationship::Relationship(std::string pkTableName, std::string fkTableName) {
- this->relationshipName = pkTableName + fkTableName;
+ this->relationshipName = fkTableName;
this->pkTableName = pkTableName;
this->fkTableName = fkTableName;
keyPairs = new std::map<std::string, KeyPair*>();
@@ -77,20 +77,6 @@
keyPair.setRelationship(this);
keyPairs->insert(
std::make_pair(keyPair.getPKColumnName() + keyPair.getFKColumnName(), &keyPair));
-
- if (config != 0) {
- Table* table = config->getTable(fkTableName);
-
- if (table != 0) {
- Column* column = table->getColumn(keyPair.getFKColumnName());
-
- if (column != 0) {
- column->addKeyPair(keyPair);
- }
-
- }
-
- }
}
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp Thu May 17 16:47:45 2007
@@ -29,7 +29,7 @@
for (unsigned int i = 0 ; i < columnCount ; i++) {
std::string columnName = getColumnName(i);
std::string tableName = getTableName(i);
- columnsIndexes.insert(std::make_pair(tableName + columnName, i));
+ columnsIndexes.insert(std::make_pair(tableName + "." + columnName, i));
}
@@ -108,7 +108,6 @@
return getSQLType(getColumnIndex(tableName, columnName));
}
-
std::string ResultSetMetaData::getSQLTypeName(unsigned int columnIndex) const {
SQLCHAR* sqlPtr = 0;
char strAux[1];
@@ -147,10 +146,10 @@
}
unsigned int ResultSetMetaData::getColumnIndex(std::string tableName, std::string columnName) const {
- std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + columnName);
+ std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
if (it == columnsIndexes.end()) {
- throw std::invalid_argument("No such column name: " + columnName);
+ throw std::invalid_argument("No such column name: " + columnName + "on table " + tableName);
}
return it->second;
@@ -196,7 +195,7 @@
}
bool ResultSetMetaData::containsColumn(std::string tableName, std::string columnName) const {
- std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + columnName);
+ std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
if (it == columnsIndexes.end()) {
return false;
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp Thu May 17 16:47:45 2007
@@ -22,12 +22,26 @@
namespace das {
namespace rdb {
-Table::Table(GraphBuilderMetaData& graphBuilderMetaData, std::string tableName) {
- this->graphBuilderMetaData = &graphBuilderMetaData;
+Table::Table(std::string tableName) {
this->tableName = tableName;
this->mappedName = tableName;
- columns = new std::map<std::string, Column*>();
-
+ this->columns = new std::map<std::string, Column*>();
+
+}
+
+Table::Table(const Table& table) {
+ tableName = table.tableName;
+ mappedName = table.mappedName;
+ this->columns = new std::map<std::string, Column*>(*table.columns);
+
+ std::map<std::string, Column*>::iterator it;
+ for (it = columns->begin() ; it != columns->end() ; it++) {
+ Column* newColumn = new Column(*it->second);
+ newColumn->setContainerTable(this);
+ columns->insert(it, std::make_pair(it->first, newColumn));
+
+ }
+
}
Table::~Table(void) {
@@ -41,16 +55,15 @@
}
-void Table::addRelationship(Relationship& relationship) {
- relationships.push_back(&relationship);
-}
-
std::string Table::getTableName(void) const {
return tableName;
}
-void Table::addColumns(std::list<Column*>& columns) {
- std::list<Column*>::iterator it;
+void Table::addColumn(Column& column) {
+ columns->insert(std::make_pair(column.getName(), &column));
+ column.setContainerTable(this);
+
+ /*std::list<Column*>::iterator it;
for (it = columns.begin() ; it != columns.end() ;) {
std::map<std::string, Column*>::iterator it2 = this->columns->
find((*it)->getName());
@@ -135,22 +148,14 @@
}
- delete relationships;
+ delete relationships;*/
}
-GraphBuilderMetaData& Table::getGraphBuilderMetaData(void) const {
- return *graphBuilderMetaData;
-}
-
-void Table::addPKColumn(std::string columnName) {
- pkColumns.push_back(columnName);
-}
-
void Table::createGraph(const GraphBuilderMetaData& graphBuilderMetaData, commonj::sdo::DataFactoryPtr dataFactory) const {
std::map<std::string, Column*>::const_iterator it;
- std::list<Relationship*>& relationships = graphBuilderMetaData.getRelationships();
- std::list<Relationship*>::const_iterator relationshipIterator;
+ std::map<std::string, Relationship*>& relationships = graphBuilderMetaData.getRelationships();
+ std::map<std::string, Relationship*>::const_iterator relationshipIterator;
std::list<Relationship*> tablePKRelationships;
std::list<Relationship*> tableFKRelationships;
std::list<std::string> relationshipColumns;
@@ -158,8 +163,8 @@
for (relationshipIterator = relationships.begin() ; relationshipIterator !=
relationships.end() ; relationshipIterator++) {
- if ((*relationshipIterator)->getFKTableName() == tableName) {
- std::map<std::string, KeyPair*>& keyPairs = (*relationshipIterator)->getKeyPairs();
+ if (relationshipIterator->second->getFKTableName() == tableName) {
+ std::map<std::string, KeyPair*>& keyPairs = relationshipIterator->second->getKeyPairs();
std::map<std::string, KeyPair*>::const_iterator keyPairIterator;
for (keyPairIterator = keyPairs.begin() ; keyPairIterator !=
@@ -243,7 +248,19 @@
}
unsigned int Table::getPKColumnCount(void) const {
- return pkColumns.size();
+ unsigned int count = 0;
+ std::map<std::string, Column*>::const_iterator it;
+
+ for (it = columns->begin() ; it != columns->end() ; it++) {
+
+ if (it->second->isPK()) {
+ count++;
+ }
+
+ }
+
+ return count;
+
}
};
Modified: incubator/tuscany/cpp/das/runtime/core/src/deploy.bat
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/deploy.bat?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/deploy.bat (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/deploy.bat Thu May 17 16:47:45 2007
@@ -42,12 +42,14 @@
if not exist %deploydir%\include mkdir %deploydir%\include
if not exist %deploydir%\include\apache mkdir %deploydir%\include\apache
+
if not exist %deploydir%\include\apache\das mkdir %deploydir%\include\apache\das
-if not exist %deploydir%\include\apache\das\rdb mkdir %deploydir%\include\apache\das
-\rdb
-copy %includedir%\apache\das\* %deploydir%\include\apache\das
+if not exist %deploydir%\include\apache\das\rdb mkdir %deploydir%\include\apache\das\rdb
+
+
+
copy %includedir%\apache\das\* %deploydir%\include\apache\das
copy %includedir%\apache\das\rdb\* %deploydir%\include\apache\das\rdb
copy %inpath%\tuscany_das.lib %deploydir%\lib
Modified: incubator/tuscany/cpp/das/runtime/test/src/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/test/src/main.cpp?view=diff&rev=539176&r1=539175&r2=539176
==============================================================================
--- incubator/tuscany/cpp/das/runtime/test/src/main.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/test/src/main.cpp Thu May 17 16:47:45 2007
@@ -8,7 +8,9 @@
#include <apache/das/rdb/ResultSet.h>
#include <apache/das/NullPointerException.h>
#include <apache/das/rdb/das_constants.h>
-
+#include <apache/das/rdb/Column.h>
+#include <apache/das/rdb/Table.h>
+#include <apache/das/DataGraphPrinter.h>
#include <commonj/sdo/DataObject.h>
using namespace std;
@@ -86,26 +88,145 @@
cout << "-------------testIncompleteCompositeRelationship--------------" << endl;
Connection con("testDSN", "root", "masterkey");
+
+ {
+ DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+ Config& config = das->getConfig();
+
+ Table* table = new Table("department");
+ apache::das::rdb::Column* column = new apache::das::rdb::Column("id", SQL_INTEGER);
+ column->setPK(true);
+ table->addColumn(*column);
+ column = new apache::das::rdb::Column("name", SQL_VARCHAR);
+ column->setPK(true);
+ table->addColumn(*column);
+ config.addTable(*table);
+
+ Relationship* relationship = new Relationship("department", "employee");
+ relationship->addKeyPair(*(new KeyPair("id", "department_id")));
+ relationship->addKeyPair(*(new KeyPair("name", "department_name")));
+ config.addRelationship(*relationship);
+
+ Command& command = das->createCommand(
+ "SELECT department.id, department.name, employee.id, employee.department_id FROM department, employee;");
+
+ commonj::sdo::DataObjectPtr root = command.executeQuery();
+
+ cout << "relationship ignored when the ResultSet does not contain all KeyPairs = ";
+ try {
+ root->getDataFactory()->getType(DAS_NAMESPACE, "department").getProperty("employee");
+ cout << "not ignored" << endl;
+
+ } catch (SDOPropertyNotFoundException ex) {
+ cout << "OK" << endl;
+ }
+
+ }
+
+ {
+ DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+ Config& config = das->getConfig();
+
+ Table* table = new Table("department");
+ apache::das::rdb::Column* column = new apache::das::rdb::Column("name", SQL_INTEGER);
+ column->setPK(true);
+ table->addColumn(*column);
+ config.addTable(*table);
+
+ Relationship* relationship = new Relationship("department", "employee");
+ relationship->addKeyPair(*(new KeyPair("id", "department_id")));
+ relationship->addKeyPair(*(new KeyPair("name", "department_name")));
+ config.addRelationship(*relationship);
+
+ Command& command = das->createCommand(
+ "SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
+
+ commonj::sdo::DataObjectPtr root = command.executeQuery();
+
+ cout << "relationship ignored when a defined relationship pk is not a table pk = ";
+ try {
+ root->getDataFactory()->getType(DAS_NAMESPACE, "department").getProperty("employee");
+ cout << "not ignored" << endl;
+
+ } catch (SDOPropertyNotFoundException ex) {
+ cout << "OK" << endl;
+ }
+
+ }
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testCompositeRelationship() {
+ cout << "-------------testCompositeRelationship--------------" << endl;
+
+ Connection con("testDSN", "root", "masterkey");
DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
Config& config = das->getConfig();
+ Table* table = new Table("department");
+ apache::das::rdb::Column* column = new apache::das::rdb::Column("id", SQL_INTEGER);
+ column->setPK(true);
+ table->addColumn(*column);
+ column = new apache::das::rdb::Column("name", SQL_VARCHAR);
+ column->setPK(true);
+ table->addColumn(*column);
+ config.addTable(*table);
+
Relationship* relationship = new Relationship("department", "employee");
relationship->addKeyPair(*(new KeyPair("id", "department_id")));
relationship->addKeyPair(*(new KeyPair("name", "department_name")));
config.addRelationship(*relationship);
Command& command = das->createCommand(
- "SELECT department.id, department.name, employee.id FROM department, employee;");
+ "SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
commonj::sdo::DataObjectPtr root = command.executeQuery();
- cout << "relationship ignored = ";
+ /*DataGraphPrinter printer(root);
+ printer.printMetaData(std::cout);
+ printer.print(std::cout);*/
+
+ cout << "relationship created = ";
try {
- root->getDataFactory()->getType(DAS_NAMESPACE, "department").getProperty("departmentemployee");
- cout << "not ignored" << endl;
+ root->getDataFactory()->getType(DAS_NAMESPACE, "department").getProperty("employee");
+ cout << "OK" << endl;
} catch (SDOPropertyNotFoundException ex) {
+ cout << "not created" << endl;
+ }
+
+ cout << "references set = ";
+ if (root->getDataObject("department[1]")->getList("employee").size() != 0) {
cout << "OK" << endl;
+ } else {
+ cout << "not set" << endl;
+ }
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testeCOCRelationship() {
+ cout << "-------------testeCOCRelationship--------------" << endl;
+
+ Connection con("testDSN", "root", "masterkey");
+ DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+
+ Command& command = das->createCommand(
+ "SELECT * FROM department, company;");
+
+ commonj::sdo::DataObjectPtr root = command.executeQuery();
+
+
+ cout << "relationship created = ";
+ try {
+ root->getDataFactory()->getType(DAS_NAMESPACE, "company").getProperty("department");
+ cout << "OK" << endl;
+
+ } catch (SDOPropertyNotFoundException ex) {
+ cout << "not created" << endl;
}
cout << "---------------------------------" << endl << endl;
@@ -135,6 +256,8 @@
testStatementAndResultSetPointer();
testUniqueObjectByID();
testIncompleteCompositeRelationship();
+ testCompositeRelationship();
+ testeCOCRelationship();
system("PAUSE");
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org