tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adrianocrest...@apache.org
Subject svn commit: r528386 - in /incubator/tuscany/cpp/das: VSExpress/tuscany_das/ VSExpress/tuscany_das/das_lite/ VSExpress/tuscany_das/das_runtime/ runtime/das_lite/src/
Date Fri, 13 Apr 2007 08:23:38 GMT
Author: adrianocrestani
Date: Fri Apr 13 01:23:33 2007
New Revision: 528386

URL: http://svn.apache.org/viewvc?view=rev&rev=528386
Log: (empty)

Added:
    incubator/tuscany/cpp/das/runtime/das_lite/src/Column.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/Column.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/Config.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/Config.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/Table.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/Table.h
Modified:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_lite/das_lite.vcproj
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.ncb
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.suo
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.ncb
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
    incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ConnectionImpl.h
    incubator/tuscany/cpp/das/runtime/das_lite/src/ReadCommandImpl.cpp
    incubator/tuscany/cpp/das/runtime/das_lite/src/das_constants.h

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_lite/das_lite.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_lite/das_lite.vcproj?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_lite/das_lite.vcproj (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_lite/das_lite.vcproj Fri Apr 13 01:23:33 2007
@@ -17,7 +17,7 @@
 			Name="Debug|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
+			ConfigurationType="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -37,7 +37,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;C:\Program Files\Microsoft Visual Studio 8\VC\include&quot;;C:\Adriano\Faculdade\Tuscany\Tuscany\CPP\DAS\runtime\das_lite\src;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt&quot;;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include&quot;;C:\Adriano\Faculdade\Tuscany\Tuscany\CPP\SDO\include;&quot;%LIBXML2_HOME%\include&quot;;&quot;%ZLIB_HOME%\include&quot;;&quot;%ICONV_HOME%\include&quot;"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Microsoft Visual Studio 8\VC\include&quot;;C:\Adriano\Faculdade\Tuscany\Tuscany\CPP\DAS\runtime\das_lite\src;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt&quot;;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include&quot;;&quot;$(TUSCANY_SDOCPP)\include&quot;;&quot;%LIBXML2_HOME%\include&quot;;&quot;%ZLIB_HOME%\include&quot;;&quot;%ICONV_HOME%\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG"
 				RuntimeLibrary="3"
 				DebugInformationFormat="4"
@@ -52,12 +52,15 @@
 				Name="VCPreLinkEventTool"
 			/>
 			<Tool
-				Name="VCLibrarianTool"
+				Name="VCLinkerTool"
 			/>
 			<Tool
 				Name="VCALinkTool"
 			/>
 			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
 				Name="VCXDCMakeTool"
 			/>
 			<Tool
@@ -67,6 +70,12 @@
 				Name="VCFxCopTool"
 			/>
 			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -144,10 +153,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Column.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\CommandImpl.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Config.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\ConnectionImpl.cpp"
 				>
 			</File>
@@ -168,13 +185,45 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\GraphBuilder.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\GraphBuilderMetaData.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\KeyPair.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ODBCTypeHelper.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\ReadCommandImpl.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Relationship.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ResultSet.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ResultSetMetaData.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\Statement.cpp"
 				>
 			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Table.cpp"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
@@ -186,6 +235,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Column.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\Command.h"
 				>
 			</File>
@@ -194,6 +247,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Config.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\ConnectionImpl.h"
 				>
 			</File>
@@ -218,11 +275,43 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\GraphBuilder.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\GraphBuilderMetaData.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\KeyPair.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ODBCTypeHelper.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\ReadCommandImpl.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Relationship.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ResultSet.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\ResultSetMetaData.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\das_lite\src\Statement.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\das_lite\src\Table.h"
 				>
 			</File>
 		</Filter>

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.ncb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.ncb?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln Fri Apr 13 01:23:33 2007
@@ -5,6 +5,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_lite", "..\das_lite\das_lite.vcproj", "{FFDC7773-6FA6-4477-8624-8D96AACB6BF0}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d", "..\..\..\..\d\d.vcproj", "{D188253F-3662-4624-ADFB-72F072541902}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -18,6 +20,10 @@
 		{FFDC7773-6FA6-4477-8624-8D96AACB6BF0}.Debug|Win32.Build.0 = Debug|Win32
 		{FFDC7773-6FA6-4477-8624-8D96AACB6BF0}.Release|Win32.ActiveCfg = Release|Win32
 		{FFDC7773-6FA6-4477-8624-8D96AACB6BF0}.Release|Win32.Build.0 = Release|Win32
+		{D188253F-3662-4624-ADFB-72F072541902}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D188253F-3662-4624-ADFB-72F072541902}.Debug|Win32.Build.0 = Debug|Win32
+		{D188253F-3662-4624-ADFB-72F072541902}.Release|Win32.ActiveCfg = Release|Win32
+		{D188253F-3662-4624-ADFB-72F072541902}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.suo
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.suo?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.ncb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.ncb?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
Binary files - no diff available.

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=528386&r1=528385&r2=528386
==============================================================================
Binary files - no diff available.

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Column.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Column.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Column.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Column.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,75 @@
+/*
+ * 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 "Column.h"
+
+Column::Column(std::string columnName, SQLSMALLINT sqlType) {
+	this->columnName = columnName;
+	this->mappedName = columnName;
+	this->sqlType = sqlType;
+	containerTable = 0;
+	fk = false;
+	pk = false;
+	
+}
+
+Column::~Column(void) {}
+
+void Column::setReferencedTableName(std::string referencedTable) {
+	this->referencedTableName = referencedTableName;
+}
+
+void Column::setContainerTable(Table* containerTable) {
+	this->containerTable = containerTable;
+}
+
+Table* Column::getContainerTable(void) const {
+	return containerTable;
+}
+
+void Column::setPK(bool pk) {
+	this->pk = pk;
+}
+
+bool Column::isFK(void) const {
+	return (references != "");
+}
+
+bool Column::isPK(void) const {
+	return pk;
+}
+
+std::string Column::getName(void) const {
+	return columnName;
+}
+
+std::string Column::getReferencedTableName(void) const {
+	return referencedTableName;
+}
+
+SQLSMALLINT Column::getSQLType(void) const {
+	return sqlType`;
+}
+
+void Column::setMappedName(std::string mappedName) {
+	this->mappedName = mappedName;
+}
+
+std::string Column::getMappedName(void) const {
+	return mappedName;
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Column.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Column.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Column.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Column.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,58 @@
+/*
+ * 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 COLUMN_H
+#define COLUMN_H
+
+#include "Table.h"
+#include "das_constants.h"
+
+class Column {
+
+	friend class Table;
+
+	private:
+		bool pk;
+		std::string referencedTableName;
+		std::string columnName;
+		std::string mappedName;
+		SQLSMALLINT sqlType;
+		Table* containerTable;
+
+		void setContainerTable(Table* containerTable);
+		Table* getContainerTable(void) const;
+
+	public:
+		Column(std::string columnName, SQLSMALLINT sqlType);
+		virtual ~Column(void);
+
+		void setReferencedTable(std::string referencedTableName);
+		void setPK(bool pk);
+		void setMappedName(std::string mappedName);
+
+		std::string getMappedName(void) const;
+		bool isFK(void) const;
+		std::string getReferencedTableName(void) const;
+		bool isPK(void) const;
+		SQLSMALLINT getSQLType(void) const;
+
+		std::string getName(void) const;
+
+};
+
+#endif //COLUMN_H

Modified: incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.cpp?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.cpp Fri Apr 13 01:23:33 2007
@@ -18,8 +18,9 @@
  */
 #include "CommandImpl.h"
 
-CommandImpl::CommandImpl(std::string sqlString) {
+CommandImpl::CommandImpl(DAS& das, std::string sqlString) {
 	statement = new Statement(sqlString);
+	this->das = &das;
 
     //try {
         /*URL url = getClass().getResource("/xml/sdoJava.xsd");

Modified: incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.h?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.h (original)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/CommandImpl.h Fri Apr 13 01:23:33 2007
@@ -32,7 +32,7 @@
 
 	protected:
 		Statement *statement;
-
+		
 		ConnectionImpl* getConnection(void);
 
 	public:

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Config.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Config.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Config.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Config.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,104 @@
+/*
+ * 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 "Config.h"
+
+Config::Config(void) {}
+
+Config::~Config(void) {
+	std::map<std::string, Table*>::iterator tableIterator;
+	std::map<std::string, Column*>::iterator columnIterator;
+	std::map<std::string, Relationship*>::iterator relationshipIterator;
+
+	for (tableIterator = tables.begin() ; tableIterator != tables.end() ; 
+		tableIterator++) {
+		delete *tableIterator->second;
+	}
+	
+	for (columnIterator = columns.begin() ; columnIterator != columns.end() ; 
+		columnIterator++) {
+			delete *columnIterator->second;
+	}
+
+	for (relationshipIterator = relationships.begin() ; 
+		relationshipIterator != relationshipIterator.end() ; tableIterator++) {
+			delete *relationshipIterator->second;
+	}
+
+}
+
+
+void Config::addTable(Table& table) {
+	tables.insert(std::make_pair(table.getTableName(), &table));
+}
+
+void Config::addColumn(Column& column) {
+	columns.insert(std::make_pair(column.getName(), &column));
+}
+
+void Config::addRelationship(Relationship& relationship) {
+	columns.insert(std::make_pair(relationship.getPKTable + relationship.getFKTable, 
+		&relationship));
+}
+
+Relationship* Config::getRelationship(std::string tableName, std::string referencedTableName) const {
+	std::map<std::string, Relationship*>::iterator it = 
+		relationships.find(tableName + referencedTableName);
+
+	if (it == relationships.end()) {
+		return 0;
+	}
+
+	return *it;
+
+}
+
+std::map<std::string, Relationship*>& Config::getRelationships(void) const {
+	return relationships;
+}
+
+std::map<std::string, Table*>& Config::getTables(void) const {
+	return tables;
+}
+
+std::map<std::string, Column*>& Config::getColumns(void) const {
+	return columns;
+}
+
+
+Table* Config::getTable(std::string tableName) const {
+	std::map<std::string, Table*>::iterator tableIterator = tables.find(tableName);
+
+	if (tableIterator == tables.end()) {
+		return 0;
+	}
+
+	return tableIterator->second;
+
+}
+
+Column* Config::getColumn(std::string columnName) const {
+	std::map<std::string, Column*>::iterator columnIterator = columns.find(columnName);
+
+	if (columnIterator == columns.end()) {
+		return 0;
+	}
+
+	return columnIterator->second;
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Config.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Config.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Config.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Config.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,50 @@
+/*
+ * 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 CONFIG_H
+#define CONFIG_H
+
+#include <list>
+#include <map>
+
+#include "Table.h"
+#include "Column.h"
+#include "Relationship.h"
+
+class Config {
+
+	private:
+		std::map<std::string, Relationship*> relationships;
+		std::map<std::string, Table*> tables;
+		
+	public:
+		Config(void);
+		virtual ~Config(void);
+
+		void addTable(Table& table);
+		void addRelationship(Relationship& relationship);
+
+		std::map<std::string, Relationship*>& getRelationships(void) const;
+		std::map<std::string, Table*>& getTables(void) const;
+		
+		Table* getTable(std::string tableName) const;
+		Relationship* getRelationship(std::string tableName, std::string referencedTableName) const;
+		
+};
+
+#endif //CONFIG_H

Modified: incubator/tuscany/cpp/das/runtime/das_lite/src/ConnectionImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ConnectionImpl.h?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ConnectionImpl.h (original)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ConnectionImpl.h Fri Apr 13 01:23:33 2007
@@ -27,16 +27,18 @@
 class ConnectionImpl {
 
 	private:
-		HDBC* connection;
-		HENV* environment;
+		HDBC connection;
+		HENV environment;
+		Statement* statement;
 		
 	public:
-		ConnectionImpl(HENV* aEnvironment, HDBC* aConnection);
+		ConnectionImpl(std::string dns, std::string user, std::string password);
 		virtual ~ConnectionImpl(void);
-		HDBC* getODBCConnection(void);
+		HDBC getODBCConnection(void) const;
 		void cleanUp(void);
 		void errorCleanUp(void);
-		HSTMT* prepareStatement(std::string queryString);
+		Statement& createStatement(void);
+		Statement& prepareStatement(std::string queryString);
 		
 };
 

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,51 @@
+/*
+ * 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 "GraphBuilder.h"
+
+GraphBuilder::GraphBuilder(ResultSet& resultSet) :
+		graphBuiderMetaData(resultSet.getMetaData()) {
+
+	this->resultSet* = resultSet;
+	
+	commonj::sdo::DataFactoryPtr dataFactory = graphBuiderMetaData.createGraph();
+	root = dataFactory->create(DAS_NAMESPACE, DAS_ROOT_NAME);
+	
+	const std::map<std::string, Table*> tables = graphBuiderMetaData.getTables();
+	std::map<std::string, Table*>::const_iterator it;
+	while (resultSet.next()) {
+
+		for (it = tables.begin() ; it != tables.end() ; i++) {
+			Table* table = it->second;
+			DataObjectPtr tableDataObject = root->createDataObject();
+
+			root->
+
+		}
+
+	}
+	
+}
+
+GraphBuilder::~GraphBuilder(void) {
+	delete root;
+}
+
+DataObjectPtr GraphBuilder::getRoot(void) const {
+	return root;
+}
\ No newline at end of file

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilder.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,42 @@
+/*
+ * 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 GRAPH_BUILDER_H
+#define GRAPH_BUILDER_H
+
+#include "ResultSet.h"
+#include "GraphBuiderMetaData.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "das_constants.h"
+
+class GraphBuilder {
+	private:
+		ResultSet* resultSet;
+		GraphBuiderMetaData graphBuiderMetaData;
+		commonj::sdo::DataObjectPtr root;
+		
+	public:
+		GraphBuilder(ResultSet& resultSet);
+		virtual ~GraphBuilder(void);
+
+		DataObjectPtr getRoot(void) const;
+
+};
+
+#endif //GRAPH_BUILDER_META_DATA_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,112 @@
+/*
+ * 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 "GraphBuilderMetaData.h"
+
+GraphBuilderMetaData::GraphBuilderMetaData(Config& config, ResultSetMetaData& resultSetMetaData) {
+	this->resultSetMetaData = &resultSetMetaData;
+	this->config = &config;
+
+	const ResultSetMetaData& metaData = resultSet.getMetaData();
+	unsigned int colCount = metaData.getColumnCount();
+	std::map<std::string, std::list<Column*>*> tablesColumns;
+	
+	for (int i = 0 ; i < colCount ; i++) {
+		std::string columnName = metaData.getColumnName(i);
+		SQLSMALLINT columnSQLType = metaData.getSQLType(i);
+		std::string columnTableName = metaData.getTableName(i);
+		Table* table = config.getTable(columnTableName);
+
+		if (table == 0) {
+			Table* newTable = new Table(*this, columnTableName);
+			config.addTable(*newTable);
+			tablesColumns.insert(std::make_pair(columnTableName, new std::list<std::string>()));
+			table = newTable;
+
+		} else {
+			tablesColumns.insert(std::make_pair(table->getTableName(), new std::list<std::string>()));
+		}
+
+		graphTables.insert(std::make_pair(table->getTableName(), table));
+		tablesColumns[table->getTableName()]->insert(new Column(columnName, columnSQLType));
+
+	}
+
+	std::map<std::string, Table*>::iterator it;
+
+	for (it = graphTables.begin() ; it != graphTables.end() ; it++) {
+		Table* table = *it;
+		std::string tableName = table->getTableName();
+		std::list<Column>* columns = tablesColumns[tableName];
+
+		table->addColumns(*columns);
+		delete columns;
+
+	}
+
+}
+
+GraphBuilderMetaData::~GraphBuilderMetaData(void) {}
+
+commonj::sdo::DataFactoryPtr GraphBuilderMetaData::createGraph(void) const {
+	commonj::sdo::DataFactoryPtr dataFactory = commonj::sdo::DataFactory::getDataFactory();
+	dataFactory->addType(DAS_NAMESPACE, DAS_ROOT_NAME);
+
+	std::map<std::string, Table*>& tables = config.getTables();
+	std::map<std::string, Table*>::iterator it;
+	
+	for (it = tables.begin() ; it != tables.end() ; it++) {
+		Table& table = **it;
+		std::string tableName = table.getTableName();
+
+		dataFactory->addType(DAS_NAMESPACE, tableName);
+		dataFactory->addPropertyToType(DAS_NAMESPACE,DAS_ROOT_NAME,DAS_ROOT_NAME + 
+			tableName + "Property",DAS_NAMESPACE, tableName, true, false, true);
+
+	}
+
+	for (it = tables.begin() ; it != tables.end() ; it++) {
+		table.createGraph(dataFactory);
+	}
+
+	return dataFactory;
+
+}
+
+ResultSetMetaData& GraphBuilderMetaData::getResultSetMetaData(void) const {
+	return *resultSetMetaData;
+}
+
+Config& GraphBuilderMetaData::getConfig(void) const {
+	return *config;
+}
+
+std::map<std::string, Table*>& GraphBuilderMetaData::getTables(void) const {
+	return graphTables;
+}
+
+Table* GraphBuilderMetaData::getTable(std::string tableName) const {
+	std::map<std::string, Table*>::iterator it = graphTables.find(tableName);
+
+	if (it == graphTables.end()) {
+		return 0;
+	}
+
+	return it->second;
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/GraphBuilderMetaData.h Fri Apr 13 01:23:33 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 GRAPH_BUILDER_META_DATA_H
+#define GRAPH_BUILDER_META_DATA_H
+
+#include <string>
+#include <map>
+#include <list>
+
+#include "ResultSet.h"
+#include "Table.h"
+#include "Config.h"
+#include "ResultSetMetaData.h"
+#include "commonj/sdo/DataFactory.h"
+#include "das_constants.h"
+
+class GraphBuilderMetaData {
+
+	private:
+		ResultSetMetaData* resultSetMetaData;
+		std::map<std::string, Table*> graphTables;
+		Config* config;
+
+	public:
+		GraphBuilderMetaData(Config& config, ResultSetMetaData& resultSet);
+		virtual ~GraphBuilderMetaData(void);
+
+		ResultSetMetaData& getResultSetMetaData(void) const;
+		std::map<std::string, Table*>& getGraphTables(void) const;
+		Config& getConfig(void) const;
+		Table* getTable(std::string tableName) const;
+
+		commonj::sdo::DataFactoryPtr createGraph(void) const;
+
+};
+
+#endif //GRAPH_BUILDER_META_DATA_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,41 @@
+/*
+ * 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 "KeyPair.h"
+
+KeyPair::KeyPair(std::string pkColumnName, std::string fkColumnName) {
+	this->pkColumnName = pkColumnName;
+	this->fkColumnName = fkColumnName;
+
+}
+
+KeyPair::~KeyPair(void) {}
+
+std::string KeyPair::getPKColumnName(void) const {
+	return pkColumnName;
+}
+
+std::string KeyPair::getFKColumnName(void) const {
+	return fkColumnName;
+}
+
+void KeyPair::addKeyPair(KeyPair& keyPair) {
+	keyPairs.insert(
+		std::make_pair(keyPair.pkColumnName + keyPair.getFKColumnName, &keyPair));
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/KeyPair.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,37 @@
+/*
+ * 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 KEY_PAIR_H
+#define KEY_PAIR_H
+
+class KeyPair {
+
+	private:
+		std::string pkColumnName;
+		std::string fkColumnName;
+		
+	public:
+		KeyPair(std::string pkColumnName, std::string fkColumnName);
+		virtual ~KeyPair(void);
+
+		std::string getPKColumnName(void) const;
+		std::string getFKColumnName(void) const;
+
+};
+
+#endif //KEY_PAIR_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,40 @@
+/*
+ * 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 "ODBCTypeHelper.h"
+
+const std::string ODBCTypeHelper::getSDOType(SQLSMALLINT sqlType) {
+
+	switch (sqlType) {
+	
+		case SQL_CHAR :
+			return "Integer";
+
+		case SQL_REAL :
+			return "Float";
+
+		case SQL_FLOAT :
+		case SQL_DOUBLE :
+			return "Double";
+
+		default :
+			return "String";
+	
+	}
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ODBCTypeHelper.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,36 @@
+/*
+ * 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 ODBC_TYPE_HELPER_H
+#define ODBC_TYPE_HELPER_H
+
+#include <windows.h>
+#include <sql.h>
+#include <string>
+
+#include "commonj/sdo/Type.h"
+#include "das_constants.h"
+
+class ODBCTypeHelper {
+
+	public:
+		static const std::string getSDOType(SQLSMALLINT sqlType);
+
+};
+
+#endif //ODBC_TYPE_HELPER_H

Modified: incubator/tuscany/cpp/das/runtime/das_lite/src/ReadCommandImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ReadCommandImpl.cpp?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ReadCommandImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ReadCommandImpl.cpp Fri Apr 13 01:23:33 2007
@@ -18,7 +18,6 @@
  */
 #include "ReadCommandImpl.h"
 
-
 int getColumnCount(HSTMT statement) {
 	SQLINTEGER columnCount = 0;
 	SQLRETURN ret = SQLColAttribute(statement, NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
@@ -31,12 +30,28 @@
 	SQLCHAR* sqlPtr = 0;
 	char strAux[1];
 	SQLSMALLINT length = 0;
-	SQLColAttributeA(statement, column, SQL_DESC_BASE_COLUMN_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	SQLColAttribute(statement, column, SQL_DESC_BASE_COLUMN_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
 	length++;
-	sqlPtr = (SQLCHAR*) new char(length);
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
 	SQLColAttributeA(statement, column, SQL_DESC_BASE_COLUMN_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
 
 	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+	return ret;
+
+}
+
+std::string getColumnTableName(HSTMT statement, int column) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(statement, column, SQL_DESC_TABLE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(statement, column, SQL_DESC_TABLE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
 	return ret;
 
 }
@@ -50,7 +65,7 @@
 	sqlPtr = (SQLCHAR*) malloc(length*sizeof(SQLCHAR));
 	SQLINTEGER aux = 0;
 	SQLGetData(statement, column, SQL_C_CHAR, sqlPtr, length, &aux);
-		
+		sqlfo
 	std::string ret = (char*) sqlPtr;
 	return ret;
 
@@ -75,7 +90,6 @@
 
 }
 
-
 ReadCommandImpl::ReadCommandImpl(std::string sqlString) : CommandImpl(sqlString) {}
 
 ReadCommandImpl::~ReadCommandImpl(void) {}
@@ -97,17 +111,15 @@
     //} catch (SQLException e) {
       //  throw new RuntimeException(e);
     //} finally {
-        if (success) {
+        /*if (success) {
             statement->getConnection()->cleanUp();
         } else {
             statement->getConnection()->errorCleanUp();
-        }
+        }*/
     //}
 }
 
 commonj::sdo::DataObjectPtr ReadCommandImpl::buildGraph(HSTMT& statement) { /*throws SQLException*/
-	commonj::sdo::DataFactoryPtr dataFactory = commonj::sdo::DataFactory::getDataFactory();
-	
 	int columnCount = getColumnCount(statement);
 	int col;
 	int i;
@@ -116,40 +128,36 @@
 	std::string columnName;
 
 	dataFactory->addType(DAS_NAMESPACE, DAS_ROOT);
-	const commonj::sdo::Type& type = dataFactory->getType(DAS_NAMESPACE, DAS_ROOT);
-	const commonj::sdo::Type& typeInt = dataFactory->getType("commonj.sdo","Integer");
-	std::string str1 = "adriano";
-	str1 = "crestani";
-	int t = -1;
+	const commonj::sdo::Type& dasType = dataFactory->getType(DAS_NAMESPACE, DAS_ROOT);
+	const commonj::sdo::Type& intType = dataFactory->getType("commonj.sdo","Integer");
+	const commonj::sdo::Type& stringType = dataFactory->getType("commonj.sdo","String");
 	
 	for (col = 1 ; col <= columnCount ; col++) {
 		sqlType = getSQLColumnType(statement, col);
 		columnName = getColumnName(statement, col);
 		columnTypes.push_back(sqlType);
-		std::string aux = getColumnName(statement, col);
-		//std::string* aux = new std::string();
-
-	t = -1;
-		//if (sqlType == SQL_INTEGER) {
-			dataFactory->addPropertyToType(type, aux, typeInt);
-			t = type.getProperties().size();
-		//} else if (sqlType == SQL_CHAR) {
-		//	dataFactory->addPropertyToType(DAS_NAMESPACE, DAS_ROOT, columnName, commonj::sdo::Type::SDOTypeNamespaceURI, "String", false);
-		//	t = dataFactory->getType(DAS_NAMESPACE, DAS_ROOT).getProperties().size();
-		//}
-//			delete aux;
 		
-	}
+		switch (sqlType) {
 
-	int m;
-	commonj::sdo::PropertyList list = type.getProperties();
-	for (m = 0 ; m < list.size() ; m++) {
-		std::string aux = list[m].getName();
+			case SQL_INTEGER :
+				dataFactory->addPropertyToType(dasType, columnName, intType);
+				break;
+
+			case SQL_CHAR :
+				dataFactory->addPropertyToType(dasType, columnName, stringType);
+				break;
+
+			default :
+				;
+				//throw exception
+
+		}
+	
 	}
 
 	commonj::sdo::DataObjectPtr rootDataObject = dataFactory->create(DAS_NAMESPACE, DAS_ROOT);
 	SQLRETURN sqlRet = SQLFetch(statement);
-	t = dataFactory->getType(DAS_NAMESPACE, DAS_ROOT).getProperties().size();
+
 	while (sqlRet == SQL_SUCCESS) {
 		std::list<SQLSMALLINT>::iterator it = columnTypes.begin();
 		int col = 0;
@@ -158,10 +166,10 @@
 			SQLSMALLINT sqlType = *it;
 
 			if (sqlType == SQL_INTEGER) {
-				rootDataObject->setInteger(col + 1, getIntegerData(statement, col + 1));
+				rootDataObject->setInteger(col, getIntegerData(statement, col + 1));
 
 			} else if (sqlType == SQL_CHAR) {
-				rootDataObject->setCString(col + 1, getStringData(statement, col + 1));
+				rootDataObject->setCString(col, getStringData(statement, col + 1));
 			}
 
 			sqlRet = SQLFetch(statement);

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,51 @@
+/*
+ * 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 "Relationship.h"
+
+Relationship(std::string pkTableName, std::string fkTableName) {
+	this->pkTableName = pkTableName;
+	this->fkTableName = fkTableName;
+
+}
+
+Relationship::~Relationship(void) {}
+
+std::string Relationship::getPKTableName(void) const {
+	return pkTableName;
+}
+
+std::string Relationship::getFKTableName(void) const {
+	return fkTableName;
+}
+
+std::map<std::string, KeyPair*>& Relationship::getKeyPairs(void) const {
+	return keyPairs;
+}
+
+KeyPair* Relationship::getKeyPair(std::string pkColumnName, std::string fkColumnName) const {
+	std::map<std::string, KeyPair*>::iterator it = keyPairs.
+		find(pkColumnName + fkColumnName);
+
+	if (it == keyPairs.end()) {
+		return 0;
+	}
+
+	return *it;
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Relationship.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,46 @@
+/*
+ * 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 RELATIONSHIP_H
+#define RELATIONSHIP_H
+
+#include <string>
+#include <map>
+
+class Relationship {
+
+	private:
+		std::string pkTableName;
+		std::string fkTableName;
+		std::map<std::string, KeyPair*> keyPairs;
+		
+	public:
+		Relationship(std::string pkTableName, std::string fkTableName);
+		virtual ~Relationship(void);
+
+		void addKeyPair(KeyPair& keyPair);
+
+		std::string getPKTableName(void) const;
+		std::string getFKTableName(void) const;
+
+		std::map<std::string, KeyPair*>& getKeyPairs(void) const;
+		KeyPair* getKeyPair(std::string pkColumnName, std::string fkColumnName) const;
+		
+};
+
+#endif //RELATIONSHIP_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,206 @@
+/*
+ * 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 "ResultSetMetaData.h"
+
+ResultSetMetaData::ResultSetMetaData(ResultSet* aResultSet) {
+	resultSet = aResultSet;
+	unsigned int columnCount = getColumnCount();
+	
+	for (unsigned int i = 1 ; i <= columnCount ; i++) {
+		columnsIndexes.insert(std::make_pair(getColumnName(i), i - 1));
+	}
+
+}
+
+virtual ResultSetMetaData::~ResultSetMetaData(void) {}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(SQLSMALLINT sqlType) {
+
+	switch (sqlType) {
+
+		case SQLCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_BINARY :
+			return SQL_C_BINARY;
+
+		case SQL_TYPE_DATE :
+			return SQL_C_TYPE_DATE;
+
+		case SQL_DECIMAL :
+			return SQL_C_CHAR;
+
+		case SQL_DOUBLE :
+			return SQL_C_DOUBLE;
+
+		case SQL_FLOAT :
+			return SQL_C_DOUBLE;
+
+		case SQL_INTEGER :
+			return SQL_C_LONG;
+
+		case SQL_LONGVARCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_LONGVARBINARY :
+			return SQL_C_BINARY;
+
+		case SQL_NUMERIC :
+			return SQL_C_CHAR;
+
+		case SQL_REAL :
+			return SQL_C_FLOAT;
+
+		case SQL_SMALLINT :
+			return SQL_C_SHORT;
+
+		case SQL_TYPE_TIME :
+			return SQL_C_TYPE_TIME;
+
+		case SQL_TYPE_TIMESTAMP :
+			return SQL_C_TYPE_TIMESTAMP;
+
+		case SQL_VARCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_VARBINARY :
+			return SQL_C_BINARY;
+
+		default :
+			throw logic_error("Illegal SQL type!");
+		
+	}
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(unsigned int columnIndex) {
+	SQLSMALLINT sqlType = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), column, SQL_DESC_TYPE, NULL, NULL, NULL, &sqlType);
+		
+	return sqlType;
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(std::string columnName) {
+	return getSQLType(getColumnIndex(columnName));
+}
+
+
+std::string ResultSetMetaData::getSQLTypeName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+std::string ResultSetMetaData::getSQLTypeName(std::string columnName) {
+	unsigned int columnIndex = getColumnIndex(columnName);
+}
+
+
+std::string ResultSetMetaData::getColumnName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_BASE_COLUMN_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_BASE_COLUMN_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+unsigned int ResultSetMetaData::getColumnIndex(std::string columnName) {
+	std::map<std::string, unsigned int>::iterator it = columnsIndexes.find(columnName);
+
+	if (it == columnsIndexes.end()) {
+		throw logic_error("No such column name: " + columnName);
+	}
+
+	return it->second;
+
+}
+
+
+std::string ResultSetMetaData::getTableName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TABLE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TABLE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+std::string ResultSetMetaData::getTableName(std::string columnName) {
+	return getTableName(getColumnIndex(columnName));
+}
+
+
+SQLSMALLINT ResultSetMetaData::getSQLType(unsigned int columnIndex) {
+	SQLSMALLINT sqlType = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE, NULL, NULL, NULL, &sqlType);
+		
+	return sqlType;
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(std::string columnName) {
+	return getSQLType(getColumnIndex(columnName));
+}
+
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(unsigned int columnIndex) {
+	return getSQLCType(getSQLType(columnIndex));
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(std::string columnName) {
+	return getSQLCType(getSQLType(getColumnIndex(columnName)));
+}
+
+unsigned int ResultSetMetaData::getColumnCount(void) {
+	SQLUINTEGER columnCount = 0;
+	SQLRETURN ret = SQLColAttribute(resultSet->getStatement().getODBCStatement(), NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
+	
+	return (unsigned int) columnCount;
+
+}
+
+const ResultSet& ResultSetMetaData::getResultSet(void) const {
+	return *resultSet;
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultMetadata.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 RESULT_SET_META_DATA_H
+#define RESULT_SET_META_DATA_H
+
+#include <string>
+#include <map>
+
+#include "ResultSet.h"
+
+class ResultSet;
+
+class ResultSetMetaData {
+
+	private:
+		ResultSet* resultSet;
+		std::map<std::string, int> columnsIndexes;
+
+		ResultSetMetaData(ResultSet* aResultSet);
+		virtual ~ResultSetMetaData(void);
+
+		SQLSMALLINT getSQLCType(SQLSMALLINT sqlType);
+
+	public:
+		const ResultSet& getResultSet(void) const;
+
+		SQLSMALLINT getSQLType(int columnIndex);
+		SQLSMALLINT getSQLType(std::string columnName);
+
+		std::string getSQLTypeName(int columnIndex);
+		std::string getSQLTypeName(std::string columnName);
+
+		std::string getColumnName(int columnIndex);
+		unsigned int getColumnIndex(std::string columnName);
+
+		std::string getTableName(int columnIndex);
+		std::string getTableName(std::string columnName);
+
+		SQLSMALLINT getSQLType(int columnIndex);
+		SQLSMALLINT getSQLType(std::string columnName);
+
+		SQLSMALLINT getSQLCType(int columnIndex);
+		SQLSMALLINT getSQLCType(std::string columnName);
+
+		unsigned int getColumnCount(void);
+
+		
+};
+
+#endif //RESULT_SET_META_DATA_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,167 @@
+/*
+ * 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 "ResultSet.h"
+
+ResultSet::ResultSet(Statement* aStmt) {
+	stmt = aStmt;
+}
+
+ResultSet::~ResultSet(void) {}
+
+const ResultSetMetaData& ResultSet::getMetaData(void) const {
+	return metaData;
+}
+
+const Statement& ResultSet::getStatement(void) const {
+	return *stmt;
+}
+
+wchar_t ResultSet::getSQLChar(unsigned int columnIndex) const {
+	wchar_t ret = 0;
+
+	if (metaData.getSQLType(columnIndex) == SQL_CHAR) {
+		SQLWCHAR strAux = 0;
+		SQLINTEGER length = 0;
+		SQLGetData(stmt->getODBCStatement(), columnIndex, SQL_C_WCHAR, &strAux, 1, &length);
+		
+		ret = (wchar_t) strAux;
+		
+	} else {
+		//throw an exception if the column type is not the requested
+	}
+
+	return ret;
+
+}
+
+wchar_t ResultSet::getSQLChar(std::string columnName) const {
+	return getSQLChar(metaData.getColumnIndex(columnName));
+}
+
+float ResultSet::getSQLReal(unsigned int columnIndex) const {
+	float ret = 0;
+
+	if (metaData.getSQLType(columnIndex) == SQL_REAL) {
+		SQLFLOAT real = 0;
+		SQLINTEGER length = 0;
+		SQLGetData(stmt->getODBCStatement(), columnIndex, SQL_C_FLOAT, &real, 1, &length);
+		
+		ret = (float) real;
+		
+	} else {
+		//throw an exception if the column type is not the requested
+	}
+
+	return ret;
+
+}
+
+float ResultSet::getSQLReal(std::string columnName) const {
+	return getSQLReal(metaData.getColumnIndex(columnName));
+}
+
+double ResultSet::getSQLFloat(unsigned int columnIndex) const {
+	double ret = 0;
+
+	if (metaData.getSQLType(columnIndex) == SQL_FLOAT) {
+		SQLDOUBLE data = 0;
+		SQLINTEGER length = 0;
+		SQLGetData(stmt->getODBCStatement(), columnIndex, SQL_C_DOUBLE, &data, 1, &length);
+		
+		ret = (double) strAux;
+		
+	} else {
+		//throw an exception if the column type is not the requested
+	}
+
+	return ret;
+
+}
+
+double ResultSet::getSQLFloat(std::string columnName) const {
+	return getSQLFloat(metaData.getColumnIndex(columnName));
+}
+
+double ResultSet::getSQLDouble(unsigned int columnIndex) const {
+	double ret = 0;
+
+	if (metaData.getSQLType(columnIndex) == SQL_DOUBLE) {
+		SQLDOUBLE data = 0;
+		SQLINTEGER length = 0;
+		SQLGetData(stmt->getODBCStatement(), columnIndex, SQL_C_DOUBLE, &data, 1, &length);
+		
+		ret = (double) strAux;
+		
+	} else {
+		//throw an exception if the column type is not the requested
+	}
+
+	return ret;
+
+}
+
+double ResultSet::getSQLDouble(std::string columnName) const {
+	return getSQLDouble(metaData.getColumnIndex(columnName));
+}
+
+std::string ResultSet::getSQLDecimal(unsigned int columnIndex) const {
+	std::string ret;
+
+	if (metaData.getSQLType(columnIndex) == SQL_DECIMAL) {
+		SQLPOINTER sqlPtr = 0;
+		SQLCHAR strAux[1];
+		SQLINTEGER length = 0;
+		SQLGetData(statement, column, SQL_C_CHAR, &strAux, 1, &length);
+		length++;
+		sqlPtr = (SQLCHAR*) malloc(length*sizeof(SQLCHAR));
+		SQLINTEGER aux = 0;
+		SQLGetData(statement, column, SQL_C_CHAR, sqlPtr, length, &aux);
+			
+		std::string ret = (char*) sqlPtr);
+		delete [] sqlPtr;
+		ret = &((double) strAux);
+		
+	} else {
+		//throw an exception if the column type is not the requested
+	}
+
+	return ret;
+
+}
+
+std::string ResultSet::getSQLDecimal(std::string columnName) const {
+	return getSQLDecimal(metaData.getColumnIndex(columnName));
+}
+
+bool ResultSet::isNull(unsigned int columnIndex) const {}
+
+bool ResultSet::isNull(std::string columnName) const {}
+
+bool ResultSet::next(void) {
+	return (SQL_SUCCESS == SQLFetch(stmt->getODBCStatement()));
+}
+
+unsigned int ResultSet::rowCount(void) const {
+	SQLINTEGER columnCount = 0;
+	SQLRETURN ret = SQLColAttribute(statement, NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
+	
+	return (unsigned int) columnCount;
+
+}
+

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSet.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 RESULT_SET_H
+#define RESULT_SET_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+
+#include "ResultSetMetaData.h"
+
+class ResultSet {
+
+	private:
+		ResultSetMetaData metaData;
+		Statement* stmt;
+
+	public:
+		ResultSet(Statement* aStmt);
+		virtual ~ResultSet(void);
+
+		const ResultMetaData& getMetaData(void) const;
+		const Statement& getStatement(void) const;
+		
+		wchar_t getSQLChar(unsigned int columnIndex) const;
+		wchar_t getSQLChar(std::string columnName) const;
+
+		float getSQLReal(unsigned int columnIndex) const;
+		float getSQLReal(std::string columnName) const;
+
+		double getSQLFloat(unsigned int columnIndex) const;
+		double getSQLFloat(std::string columnName) const;
+
+		double getSQLDouble(unsigned int columnIndex) const;
+		double getSQLDouble(std::string columnName) const;
+
+		std::string getSQLDecimal(unsigned int columnIndex) const;
+		std::string getSQLDecimal(std::string columnName) const;
+
+		bool isNull(unsigned int columnIndex) const;
+		bool isNull(std::string columnName) const;
+
+		unsigned int rowCount(void) const;
+
+		bool next(void);
+		
+};
+
+#endif //RESULT_SET_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,206 @@
+/*
+ * 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 "ResultSetMetaData.h"
+
+ResultSetMetaData::ResultSetMetaData(ResultSet* aResultSet) {
+	resultSet = aResultSet;
+	unsigned int columnCount = getColumnCount();
+	
+	for (unsigned int i = 1 ; i <= columnCount ; i++) {
+		columnsIndexes.insert(std::make_pair(getColumnName(i), i - 1));
+	}
+
+}
+
+virtual ResultSetMetaData::~ResultSetMetaData(void) {}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(SQLSMALLINT sqlType) {
+
+	switch (sqlType) {
+
+		case SQLCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_BINARY :
+			return SQL_C_BINARY;
+
+		case SQL_TYPE_DATE :
+			return SQL_C_TYPE_DATE;
+
+		case SQL_DECIMAL :
+			return SQL_C_CHAR;
+
+		case SQL_DOUBLE :
+			return SQL_C_DOUBLE;
+
+		case SQL_FLOAT :
+			return SQL_C_DOUBLE;
+
+		case SQL_INTEGER :
+			return SQL_C_LONG;
+
+		case SQL_LONGVARCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_LONGVARBINARY :
+			return SQL_C_BINARY;
+
+		case SQL_NUMERIC :
+			return SQL_C_CHAR;
+
+		case SQL_REAL :
+			return SQL_C_FLOAT;
+
+		case SQL_SMALLINT :
+			return SQL_C_SHORT;
+
+		case SQL_TYPE_TIME :
+			return SQL_C_TYPE_TIME;
+
+		case SQL_TYPE_TIMESTAMP :
+			return SQL_C_TYPE_TIMESTAMP;
+
+		case SQL_VARCHAR :
+			return SQL_C_CHAR;
+
+		case SQL_VARBINARY :
+			return SQL_C_BINARY;
+
+		default :
+			throw logic_error("Illegal SQL type!");
+		
+	}
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(unsigned int columnIndex) {
+	SQLSMALLINT sqlType = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), column, SQL_DESC_TYPE, NULL, NULL, NULL, &sqlType);
+		
+	return sqlType;
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(std::string columnName) {
+	return getSQLType(getColumnIndex(columnName));
+}
+
+
+std::string ResultSetMetaData::getSQLTypeName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+std::string ResultSetMetaData::getSQLTypeName(std::string columnName) {
+	unsigned int columnIndex = getColumnIndex(columnName);
+}
+
+
+std::string ResultSetMetaData::getColumnName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_BASE_COLUMN_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_BASE_COLUMN_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+unsigned int ResultSetMetaData::getColumnIndex(std::string columnName) {
+	std::map<std::string, unsigned int>::iterator it = columnsIndexes.find(columnName);
+
+	if (it == columnsIndexes.end()) {
+		throw logic_error("No such column name: " + columnName);
+	}
+
+	return it->second;
+
+}
+
+
+std::string ResultSetMetaData::getTableName(unsigned int columnIndex) {
+	SQLCHAR* sqlPtr = 0;
+	char strAux[1];
+	SQLSMALLINT length = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TABLE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+	length++;
+	sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+	SQLColAttributeA(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TABLE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+	std::string ret((char*) sqlPtr);
+	delete [] sqlPtr;
+
+	return ret;
+
+}
+
+std::string ResultSetMetaData::getTableName(std::string columnName) {
+	return getTableName(getColumnIndex(columnName));
+}
+
+
+SQLSMALLINT ResultSetMetaData::getSQLType(unsigned int columnIndex) {
+	SQLSMALLINT sqlType = 0;
+	SQLColAttribute(resultSet->getStatement().getODBCStatement(), columnIndex, SQL_DESC_TYPE, NULL, NULL, NULL, &sqlType);
+		
+	return sqlType;
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(std::string columnName) {
+	return getSQLType(getColumnIndex(columnName));
+}
+
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(unsigned int columnIndex) {
+	return getSQLCType(getSQLType(columnIndex));
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(std::string columnName) {
+	return getSQLCType(getSQLType(getColumnIndex(columnName)));
+}
+
+unsigned int ResultSetMetaData::getColumnCount(void) {
+	SQLUINTEGER columnCount = 0;
+	SQLRETURN ret = SQLColAttribute(resultSet->getStatement().getODBCStatement(), NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
+	
+	return (unsigned int) columnCount;
+
+}
+
+const ResultSet& ResultSetMetaData::getResultSet(void) const {
+	return *resultSet;
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/ResultSetMetaData.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 RESULT_SET_META_DATA_H
+#define RESULT_SET_META_DATA_H
+
+#include <string>
+#include <map>
+
+#include "ResultSet.h"
+
+class ResultSet;
+
+class ResultSetMetaData {
+
+	private:
+		ResultSet* resultSet;
+		std::map<std::string, int> columnsIndexes;
+
+		ResultSetMetaData(ResultSet* aResultSet);
+		virtual ~ResultSetMetaData(void);
+
+		SQLSMALLINT getSQLCType(SQLSMALLINT sqlType);
+
+	public:
+		const ResultSet& getResultSet(void) const;
+
+		SQLSMALLINT getSQLType(int columnIndex);
+		SQLSMALLINT getSQLType(std::string columnName);
+
+		std::string getSQLTypeName(int columnIndex);
+		std::string getSQLTypeName(std::string columnName);
+
+		std::string getColumnName(int columnIndex);
+		unsigned int getColumnIndex(std::string columnName);
+
+		std::string getTableName(int columnIndex);
+		std::string getTableName(std::string columnName);
+
+		SQLSMALLINT getSQLType(int columnIndex);
+		SQLSMALLINT getSQLType(std::string columnName);
+
+		SQLSMALLINT getSQLCType(int columnIndex);
+		SQLSMALLINT getSQLCType(std::string columnName);
+
+		unsigned int getColumnCount(void);
+
+		
+};
+
+#endif //RESULT_SET_META_DATA_H

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Table.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Table.cpp?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Table.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Table.cpp Fri Apr 13 01:23:33 2007
@@ -0,0 +1,207 @@
+/*
+ * 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 "Table.h"
+
+Table::Table(GraphBuilder& graphBuilderMetaData, std::string tableName) {
+	this->graphBuilderMetaData = &graphBuilderMetaData;
+	this->tableName = tableName;
+	this->mappedName = tableName;
+	convOverConfig = false;
+	loadFKs();
+	
+}
+
+Table::~Table(void) {
+	std::list<Column*>::iterator it;
+
+	for (it = columns.begin() ; it != columns.end() ; it++) {
+		delete *it;
+	}
+
+}
+
+std::string Table::getTableName(void) const {
+	return tableName;
+}
+
+void Table::loadColumn(std::list<Column*>& columns) {
+	ResultSet* pksResultSet = 0;
+
+	std::list<Columns*>::iterator it;
+	for (it = columns.begin() ; it != columns.end() ;) {
+		std::map<std::string, Column*>::iterator it2 = this->columns.
+			find((*it)->getName());
+		
+		if (it2 != this->columns.end()) {
+			(*it)->setContainerTable(this);
+			this->columns.insert(std::make_pair((*it)->getName(), column));
+			it++;
+
+		} else {
+			std::list<Column*>::iterator aux = it;
+			it++;
+			this->columns.erase(aux);
+
+		}
+
+	}
+
+	try {
+		pksResultSet = &conn.getDatabase().getPKs(tableName);
+	} throw (std::runtime_error& e) {}
+
+	if (pksResultSet != 0) {
+			
+		while (pkResultSet->next()) {
+			std::string pkColumnName = fksResultSet->getSQLVarchar(3);
+			Column* actualColumn = this->column[pkColumnName];
+
+			if (actualColumn->getName() == pkColumnName) {
+				actualColumn->setPK(true);
+					
+				break;
+
+			}
+
+		}
+
+	} else {
+		std::list<Columns*>::iterator it;
+
+		for (it == columns.begin() ; it != columns.end() ; it++) {
+			Column* column = *it;
+			std::string columnName = column->getName();
+
+			if (columnName == "id") {
+				column->setPK(true);
+			}
+			
+		}
+
+	}
+
+}
+
+void Table::loadFKs(void) {
+	Connection& conn = graphBuilderMetaData->getResultSetMetaData().
+		getResultSet().getStatement().getConnection();
+	ResultSet* fksResultSet = 0;
+
+	try {
+		fksResultSet = &conn.getDatabase().getFKs(tableName);
+	} throw (std::runtime_error& e) {
+		convOverConfig = true;
+		loadConvOverConfigFKs(columns);
+		return;
+
+	}
+			
+	while (fkResultSet->next()) {
+		std::string fkColumnName = fksResultSet->getSQLVarchar(7);
+		std::string pkTableName = fksResultSet->getSQLVarchar(2);
+		std::string pkColumnName = fksResultSet->getSQLVarchar(3);
+		
+		Relationship relationship = new Relationship(pkTableName, tableName);
+		graphBuilderMetaData->getConfig().addRelationship(*relationship);
+		
+		KeyPair keyPair = new KeyPair(pkColumnName, fkColumnName);
+		relationship.addKeyPair(*keyPair);
+
+	}
+
+}
+
+void Table::createGraph(commonj::sdo::DataFactoryPtr dataFactory) const {
+	std::map<std::string, Column*>::iterator it;
+
+	for (it = columns.begin() ; it != columns.end() ; it++) {
+		Column& column = **it;
+		dataFactory->addType(DAS_NAMESPACE, column.getName());
+
+		if (column.isFK()) {
+			std::string referencedTableName = column.getReferencedTableName();
+			Table* referencedTable = graphBuilderMetaData->getTable(referencedTableName);
+
+			if (referencedTable != 0) {
+				dataFactory->addPropertyToType(DAS_NAMESPACE,referencedTableName,
+					referencedTable + tableName + "Property", DAS_NAMESPACE, 
+					tableName, true, false, false);
+
+			} else {
+				dataFactory->addPropertyToType(DAS_NAMESPACE,tableName,
+					tableName + column.getName() + "Property", SDO_NAMESPACE, 
+					ODBCTypeHelper::getSDOType(column.getSQLType()) , false, false, true);
+
+			}
+
+		}
+
+	}
+
+}
+
+void Table::populateGraph(commonj::sdo::DataObjectPtr dataObject, 
+				   ResultSet& resultSet) const {
+
+	std::map<std::string, Column*>::iterator it;
+	for (it = columns.begin() ; it != columns.end() ; it++) {
+		Column* column = it->first;
+
+		if (column->isFK()) {
+
+		}
+
+	}
+
+}
+
+void Table::setMappedName(std::string mappedName) {
+	this->mappedName = mappedName;
+}
+
+std::string Table::getMappedName(void) const {
+	return mappedName;
+}
+
+void Table::loadConvOverConfigFKs(std::list<Column*>& columns) {
+	std::list<Columns*>::iterator it;
+
+	for (it == columns.begin() ; it != columns.end() ; it++) {
+		Column* column = *it;
+		std::string columnName = column->getName();
+
+		if (columnName.substr(columnName.size() - 4, 3) == "_id") {
+			std::string referencedTable = columnName.substr(0, columnName.size() - 3);
+			Relationship* relationship = graphBuilderMetaData->getConfig().
+				getRelationship(tableName, referencedTable);
+
+			if (relationship == 0) {
+				relationship = new Relationship(tableName, referencedTable);
+				graphBuilderMetaData->getConfig().addRelationship(*relationship);
+				
+			}
+
+			KeyPair keyPair = new KeyPair("id", column->getName());
+			relationship.addKeyPair(*keyPair);
+
+		}
+		
+	}
+
+}

Added: incubator/tuscany/cpp/das/runtime/das_lite/src/Table.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/Table.h?view=auto&rev=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/Table.h (added)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/Table.h Fri Apr 13 01:23:33 2007
@@ -0,0 +1,59 @@
+/*
+ * 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 TABLE_H
+#define TABLE_H
+
+#include <map>
+#include <list>
+#include <stdexcept>
+
+#include "das_constants.h"
+#include "Relationship.h"
+#include "Column.h"
+#include "ODBCTypeHelper.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+
+class Table {
+
+	private:
+		std::map<std::string, Column*> columns;
+		GraphBuilder* graphBuilderMetaData;
+		std::string tableName;
+		std::string mappedName;
+		bool convOverConfig;
+		
+	public:
+		Table(GraphBuilderMetaData& graphBuilderMetaData, std::string tableName);
+		virtual ~Table(void);
+
+		void addColumns(std::list<Column*>& columns);
+		void loadFKs(void);
+		void loadConvOverConfigFKs(std::list<Column*>& columns);
+		void setMappedName(std::string mappedName);
+
+		std::string getMappedName(void) const;
+		std::string getTableName(void) const;
+		
+		void createGraph(commonj::sdo::DataFactoryPtr dataFactory) const;
+		void populateGraph(commonj::sdo::DataObjectPtr dataObject, ResultSet& resultSet) const;
+
+};
+
+#endif //TABLE_H

Modified: incubator/tuscany/cpp/das/runtime/das_lite/src/das_constants.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/das_lite/src/das_constants.h?view=diff&rev=528386&r1=528385&r2=528386
==============================================================================
--- incubator/tuscany/cpp/das/runtime/das_lite/src/das_constants.h (original)
+++ incubator/tuscany/cpp/das/runtime/das_lite/src/das_constants.h Fri Apr 13 01:23:33 2007
@@ -1,2 +1,3 @@
-#define DAS_ROOT "DAS_ROOT"
+#define DAS_ROOT_NAME "DAS_ROOT"
 #define DAS_NAMESPACE "das.lite"
+#define SDO_NAMESPACE "commonj.sdo"



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message