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/06/25 04:12:57 UTC

svn commit: r550317 - in /incubator/tuscany/cpp/das: ./ VSExpress/tuscany_das/ runtime/core/include/apache/das/rdb/ runtime/core/src/apache/das/ runtime/core/src/apache/das/rdb/ samples/ samples/SimpleRead/ samples/SimpleRead/VSExpress/ samples/SimpleR...

Author: adrianocrestani
Date: Sun Jun 24 19:12:55 2007
New Revision: 550317

URL: http://svn.apache.org/viewvc?view=rev&rev=550317
Log:
- Added constructor on Connection class that accepts a connection string
- Added SimpleRead samples
- Added Getting Started documentation

Added:
    incubator/tuscany/cpp/das/GettingStarted.html
    incubator/tuscany/cpp/das/samples/
    incubator/tuscany/cpp/das/samples/SimpleRead/
    incubator/tuscany/cpp/das/samples/SimpleRead/Readme.html
    incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/
    incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/
    incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.sln
    incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.suo   (with props)
    incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/SimpleRead.vcproj
    incubator/tuscany/cpp/das/samples/SimpleRead/rsc/
    incubator/tuscany/cpp/das/samples/SimpleRead/rsc/SimpleRead.fdb   (with props)
    incubator/tuscany/cpp/das/samples/SimpleRead/src/
    incubator/tuscany/cpp/das/samples/SimpleRead/src/main.cpp
Modified:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp

Added: incubator/tuscany/cpp/das/GettingStarted.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/GettingStarted.html?view=auto&rev=550317
==============================================================================
--- incubator/tuscany/cpp/das/GettingStarted.html (added)
+++ incubator/tuscany/cpp/das/GettingStarted.html Sun Jun 24 19:12:55 2007
@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+	<TITLE>Tuscany - Getting Started</TITLE>
+	<META NAME="GENERATOR" CONTENT="BrOffice.org 2.0  (Win32)">
+	<META NAME="CREATED" CONTENT="20070623;19202290">
+	<META NAME="CHANGEDBY" CONTENT="a a">
+	<META NAME="CHANGED" CONTENT="20070624;2200915">
+	<!-- 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.
+-->
+	<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+	<STYLE>
+	<!--
+		TD P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H1 { color: #000000 }
+		P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H2 { background: #dddddd; border: 1px solid #999999; padding-top: 0.11cm; padding-bottom: 0.11cm; padding-left: 0.16cm; padding-right: 0.11cm; color: #990000 }
+		A:link { color: #3366aa; text-decoration: none }
+	-->
+	</STYLE>
+</HEAD>
+<BODY LANG="en-US" TEXT="#000000" LINK="#3366aa" DIR="LTR" STYLE="border: none; padding: 0cm">
+<DIV ID="bodyColumn" DIR="LTR">
+	<P LANG="pt-BR"><BR><BR>
+	</P>
+	<DIV ID="contentBox" DIR="LTR">
+		<H1 LANG="pt-BR"><FONT SIZE=6 STYLE="font-size: 28pt">Tuscany -
+		Getting Started - DAS C++</FONT></H1>
+		<P LANG="pt-BR">This document describes what is needed to install
+		Tuscany DAS for C++. If you haven't already done so, the first step
+		is to download the DAS C++  from its repository:
+		<A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/" TARGET="_blank">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/</A>.
+				</P>
+		<H2 LANG="pt-BR">Contents</H2>
+		<OL>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm"><A HREF="#requirements">System
+			Requirements</A>
+			</P>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm"><A HREF="#Installing">Installing
+			Tuscany DAS C++ on Windows.</A></P>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm"><A HREF="#samples">Samples</A>
+						</P>
+			<LI><P LANG="pt-BR"><A HREF="#help">Getting Help</A>
+			</P>
+		</OL>
+		<H2 LANG="pt-BR"><A NAME="requirements"></A>System Requirements</H2>
+		<P LANG="pt-BR">In order to use Tuscany DAS there are some minimum
+		requirements:</P>
+		<TABLE WIDTH=896 BORDER=1 CELLPADDING=2 CELLSPACING=0 >
+			<COL WIDTH=150>
+			<COL WIDTH=739>
+			<TR>
+				<TD WIDTH=150>
+					<P LANG="pt-BR"><B>Software</B></P>
+				</TD>
+				<TD WIDTH=739>
+					<P LANG="pt-BR"><B>Download Link</B></P>
+				</TD>
+			</TR>
+			<TR>
+				<TD WIDTH=150>
+					<P LANG="pt-BR">Operating systems:
+					</P>
+					<UL>
+						<LI><P LANG="pt-BR">Windows XP SP2
+						</P>
+					</UL>
+				</TD>
+				<TD WIDTH=739></TD>
+			</TR>
+			<TR>
+				<TD WIDTH=150>
+					<P LANG="pt-BR">Tuscany SDO C++ (from the trunk)</P>
+				</TD>
+				<TD WIDTH=739>
+					<P LANG="pt-BR">To compile and install Tuscany SDO C++ follow
+					the instructions on
+					<A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/GettingStarted.html">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/GettingStarted.html</A><FONT COLOR="#000000">
+					page. But instead of download the source from Tuscany downloads page, download the SDO C++ source from the trunk: <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/" TARGET="_blank">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/</A></FONT></P>
+				</TD>
+			</TR>
+		</TABLE>
+		<H2 LANG="pt-BR"><A NAME="Installing"></A>Installing Tuscany DAS
+		C++ on Windows</H2>
+		<OL>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">Download the
+			contents under
+			<A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/</A><FONT COLOR="#000000">
+			into folder &lt;tuscany_das_cpp&gt;.</FONT></P>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">The following
+			environment variables are required:
+			</P>
+			<UL>
+				<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">TUSCANY_SDOCPP=&lt;path
+				to tuscany sdo for c++ folder&gt;
+				</P>
+			</UL>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">Build the source
+			using Visual Studio Express solution under folder
+			&lt;tuscany_das_cpp&gt;/VSExpress/das_runtime/.</P>
+			<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">Run the testcases:
+			</P>
+			<UL>
+				<LI><P LANG="pt-BR" STYLE="margin-bottom: 0cm">&lt;tuscany_das_cpp&gt;/VSExpress/das_runtime/das_test/Debug/das_test.exe
+								</P>
+			</UL>
+			<P LANG="pt-BR">The output of all tests must show &ldquo;OK&rdquo;.</P>
+		</OL>
+		<H2 LANG="pt-BR"><A NAME="samples"></A>Samples</H2>
+		<TABLE CELLPADDING=2 CELLSPACING=2 border=1>
+			<TR>
+				<TD>
+					<P LANG="pt-BR">SimpleRead</P>
+				</TD>
+				<TD>
+					<P LANG="pt-BR">This sample shows how to load data from a RDB
+					source, using RDB DAS, into a SDO graph and then retrieve data from
+					it.
+					</P>
+				</TD>
+			</TR>
+		</TABLE>
+		<H2 LANG="pt-BR"><A NAME="help"></A>Getting Help</H2>
+		<P LANG="pt-BR">Any problem with this release can be reported to
+		the Tuscany <A HREF="http://cwiki.apache.org/TUSCANY/mailing-lists.html" TARGET="_blank">mailing
+		lists</A> or create a JIRA issue
+		at&nbsp;<A HREF="http://issues.apache.org/jira/browse/Tuscany" TARGET="_blank">http://issues.apache.org/jira/browse/Tuscany</A>.</P>
+		<P LANG="pt-BR">&nbsp;</P>
+		<TABLE CELLPADDING=2 CELLSPACING=2>
+			<TR>
+				<TD>
+					<P LANG="pt-BR">Thank you for your interest in Tuscany.</P>
+					<P LANG="pt-BR"><EM><STRONG>-The Tuscany Development Team</STRONG></EM>
+										</P>
+				</TD>
+			</TR>
+		</TABLE>
+	</DIV>
+</DIV>
+</BODY>
+</HTML>
\ No newline at end of file

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

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h?view=diff&rev=550317&r1=550316&r2=550317
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h Sun Jun 24 19:12:55 2007
@@ -47,7 +47,8 @@
 		std::list<StatementPtr*> statements;
 		
 	public:
-		Connection(string dns, string user, string password) throw (SqlException);
+		Connection(string dsn, string user, string password) throw (SqlException);
+		Connection(string connectString) throw (SqlException);
 		virtual ~Connection(void);
 		SQLHDBC getODBCConnection(void) const;
 		void commit(void);

Modified: 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=diff&rev=550317&r1=550316&r2=550317
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp Sun Jun 24 19:12:55 2007
@@ -36,7 +36,7 @@
 		out << std::endl << "[" << typeList[i].getName();
 
 		const commonj::sdo::Type* base = typeList[i].getBaseType();
-		out << "{";
+		/*out << "{";
 		out << " baseType = " << ((base == 0) ? "NULL" : base->getName());
 		out << " uri = " << typeList[i].getURI();
 		out << " abstractType = " << typeList[i].isAbstractType();
@@ -44,15 +44,15 @@
 		out << " dataObjectType = " << typeList[i].isDataObjectType();
 		out << " dataType = " << typeList[i].isDataType();
 		out << " openType = " << typeList[i].isOpenType();
-		out << " sequencedType = " << typeList[i].isSequencedType();
-		out << "} ]" << std::endl;
+		out << " sequencedType = " << typeList[i].isSequencedType() << " } ";*/
+		out << "]" << std::endl;
 
 		commonj::sdo::PropertyList propertyList = typeList[i].getProperties();
 		
 		for (unsigned int j = 0 ; j < propertyList.size() ; j++) {
 
-			out << propertyList[j].getName();
-			out << "{";
+			out << propertyList[j].getName() << std::endl;
+			/*out << "{";
 			out << " type = " << propertyList[j].getType().getName();
 			out << " alias = " << propertyList[j].getAlias();
 			out << " aliasCount = " << propertyList[j].getAliasCount();
@@ -61,7 +61,7 @@
 			out << " many = " << propertyList[j].isMany();
 			out << " readOnly = " << propertyList[j].isReadOnly();
 			out << " reference = " << propertyList[j].isReference();
-			out << "}" << std::endl;
+			out << "}" << std::endl;*/
 
 		}
 
@@ -74,7 +74,7 @@
 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() << "]";
+	out << getTab(tabCount) << "[" << dataObject->getType().getURI() << "." << dataObject->getType().getName() << "]";
 	tabCount++;
 
 	for (unsigned int i = 0 ; i < propertyList.size() ; i++) {

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp?view=diff&rev=550317&r1=550316&r2=550317
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp Sun Jun 24 19:12:55 2007
@@ -22,7 +22,7 @@
 	namespace das {
 		namespace rdb {
 
-Connection::Connection(string dns, string user, string password) throw (SqlException){
+Connection::Connection(string dsn, string user, string password) throw (SqlException){
 	SQLRETURN result;
 
 	SQLINTEGER error;
@@ -55,7 +55,7 @@
 	setAutoCommit(false);
 
 	//Connect to the datasource
-	result = SQLConnect(connection,  reinterpret_cast<SQLCHAR *>(const_cast<char *> (dns.c_str())), SQL_NTS,
+	result = SQLConnect(connection,  reinterpret_cast<SQLCHAR *>(const_cast<char *> (dsn.c_str())), SQL_NTS,
 									 reinterpret_cast<SQLCHAR *>(const_cast<char *> (user.c_str())), SQL_NTS,
 									 reinterpret_cast<SQLCHAR *>(const_cast<char *> (password.c_str())), SQL_NTS);
 
@@ -66,6 +66,61 @@
 
 		SQLFreeHandle(SQL_HANDLE_DBC, connection);
 		SQLFreeHandle(SQL_HANDLE_ENV, environment);
+
+		string error("Error to establish the connection.\nSQLSTATE: ");
+		error += reinterpret_cast<char*>(&sqlStat);
+		throw SqlException(error.c_str());
+	}
+
+}
+
+Connection::Connection(string connectString) throw (SqlException) {
+	SQLRETURN result;
+
+	SQLINTEGER error;
+	SQLCHAR sqlStat;
+	SQLCHAR * message = 0;
+	SQLSMALLINT messageLength;
+	SQLCHAR     outConnectString[1024];
+	
+	//Alloc environment handle
+	result = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&environment);
+
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		throw SqlException("Error to alloc the environment handle - SQLHENV");
+
+	//Set the environment
+	result = SQLSetEnvAttr(environment, SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3, 0);
+
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+		SQLFreeHandle(SQL_HANDLE_ENV, environment);
+		throw SqlException("Error to set the environment handle - SQLHENV");
+	}	
+
+	//Allocate connection handle
+	result = SQLAllocHandle(SQL_HANDLE_DBC, environment, &connection);
+
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+		SQLFreeHandle(SQL_HANDLE_ENV, environment);
+		throw SqlException("Error to alloc the connection handle - SQLHDBC");
+	}
+
+	setAutoCommit(false);
+
+	//Connect to the datasource
+	result = SQLDriverConnect( connection, 0, (SQLCHAR*) (char*) connectString.c_str(), SQL_NTS,
+                             (SQLCHAR*)outConnectString, sizeof(outConnectString),
+                             &messageLength, SQL_DRIVER_COMPLETE );
+
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+
+		SQLGetDiagRec(SQL_HANDLE_DBC, connection,1, 
+		              &sqlStat, &error,message,100,&messageLength);
+
+		SQLFreeHandle(SQL_HANDLE_DBC, connection);
+		SQLFreeHandle(SQL_HANDLE_ENV, environment);
+
+		string outC = (char*) outConnectString;
 
 		string error("Error to establish the connection.\nSQLSTATE: ");
 		error += reinterpret_cast<char*>(&sqlStat);

Added: incubator/tuscany/cpp/das/samples/SimpleRead/Readme.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/Readme.html?view=auto&rev=550317
==============================================================================
--- incubator/tuscany/cpp/das/samples/SimpleRead/Readme.html (added)
+++ incubator/tuscany/cpp/das/samples/SimpleRead/Readme.html Sun Jun 24 19:12:55 2007
@@ -0,0 +1,195 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+	<STYLE>
+	<!--
+		TD P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H1 { color: #000000 }
+		P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H2 { background: #dddddd; border: 1px solid #999999; padding-top: 0.11cm; padding-bottom: 0.11cm; padding-left: 0.16cm; padding-right: 0.11cm; color: #990000 }
+		A:link { color: #3366aa; text-decoration: none }
+	-->
+	</STYLE>
+
+	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+	<TITLE>Tuscany RDB DAS Sample</TITLE>
+	<META NAME="GENERATOR" CONTENT="BrOffice.org 2.0  (Win32)">
+	<META NAME="CREATED" CONTENT="20070623;3134782">
+	<META NAME="CHANGEDBY" CONTENT="a a">
+	<META NAME="CHANGED" CONTENT="20070624;4073367">
+	<META NAME="ProgId" CONTENT="Word.Document">
+	<META NAME="Originator" CONTENT="Microsoft Word 10">
+	<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+  <o:Author>IBM_USER</o:Author>
+  <o:LastAuthor>IBM_USER</o:LastAuthor>
+  <o:Revision>5</o:Revision>
+  <o:TotalTime>25</o:TotalTime>
+  <o:Created>2006-10-19T16:54:00Z</o:Created>
+  <o:LastSaved>2006-10-24T16:41:00Z</o:LastSaved>
+  <o:Pages>1</o:Pages>
+  <o:Words>739</o:Words>
+  <o:Characters>4216</o:Characters>
+  <o:Company>IBM</o:Company>
+  <o:Lines>35</o:Lines>
+  <o:Paragraphs>9</o:Paragraphs>
+  <o:CharactersWithSpaces>4946</o:CharactersWithSpaces>
+  <o:Version>10.6735</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]-->
+	<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+  <w:SpellingState>Clean</w:SpellingState>
+  <w:GrammarState>Clean</w:GrammarState>
+  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+	<!--[if !mso]><object
+ classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
+<style>
+st1\:*{behavior:url(#ieooui) }
+</style>
+<![endif]-->
+	<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+	{mso-style-name:"Table Normal";
+	mso-tstyle-rowband-size:0;
+	mso-tstyle-colband-size:0;
+	mso-style-noshow:yes;
+	mso-style-parent:"";
+	mso-padding-alt:0in 5.4pt 0in 5.4pt;
+	mso-para-margin:0in;
+	mso-para-margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:10.0pt;
+	font-family:"Times New Roman";}
+</style>
+<![endif]-->
+	<!--[if gte mso 9]><xml>
+ <u1:shapelayout u2:ext="edit">
+  <u1:idmap u2:ext="edit" data="1"/>
+ </u1:shapelayout>
+</xml><![endif]-->
+	<!--[if gte mso 9]><xml>
+ <o:shapedefaults v:ext="edit" spidmax="3074"/>
+</xml><![endif]-->
+	<!--[if gte mso 9]><xml>
+ <o:shapelayout v:ext="edit">
+  <o:idmap v:ext="edit" data="1"/>
+ </o:shapelayout></xml><![endif]-->
+	<!-- <p class=MsoNormal><span style="font-size: 9pt">&nbsp;</span></p>
+<pre><a name="header-text">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
+&quot;License&quot;); 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
+&quot;AS IS&quot; 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.   </a></pre>
+<p class=MsoNormal><span style="font-size: 9pt"><br>
+&nbsp;</span></p>
+<p class=MsoNormal><span style='font-size:9.0pt'>
+<o:p>&nbsp;</o:p></span></p>
+
+-->
+	<STYLE>
+	<!--
+		TD P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H1 { color: #000000 }
+		P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+		H2 { background: #dddddd; border: 1px solid #999999; padding-top: 0.11cm; padding-bottom: 0.11cm; padding-left: 0.16cm; padding-right: 0.11cm; color: #990000 }
+		A:link { color: #3366aa; text-decoration: none }
+
+	-->
+	</STYLE>
+</HEAD>
+<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" VLINK="#800080" DIR="LTR" STYLE="border: none; padding: 0cm">
+<H1 LANG="pt-BR">Tuscany RDB DAS Sample (SimpleRead)&nbsp;</H1>
+<P LANG="pt-BR">This sample shows how to load data from a RDB source,
+using RDB DAS, into a SDO graph and then retrieve data from it.</P>
+<P LANG="pt-BR"><h2>Setup</h2></P>
+<UL>
+	<LI><P LANG="pt-BR"><SPAN STYLE="text-decoration: none"><FONT COLOR="#000000">Follow
+	the
+	<A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/GettingStarted.html">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/GettingStarted.html</A>
+	document to download, compile and install Tuscany DAS for C++.</FONT></SPAN></P>
+	<LI><P LANG="pt-BR" STYLE="text-decoration: none">Set TUSCANY_DASCPP
+	environment variable as &lt;tuscany_das_cpp&gt/deploy/</P>
+	<LI><P LANG="pt-BR"><SPAN STYLE="text-decoration: none"><FONT COLOR="#000000">Download
+	latest stable version of Firebird Superserver. You can find it here:
+	<A HREF="http://www.firebirdsql.org/index.php?op=files&amp;id=engine_201">http://www.firebirdsql.org/index.php?op=files&amp;id=engine_201</A><A HREF="http://incubator.apache.org/tuscany/sdo-downloads.html">.</A></FONT></SPAN></P>
+	<LI><P LANG="pt-BR"><SPAN STYLE="text-decoration: none">Download the
+	latest stable version of Firebird ODBC Driver. You can find it here:
+	<A HREF="http://www.firebirdsql.org/index.php?op=files&amp;id=odbc">http://www.firebirdsql.org/index.php?op=files&amp;id=odbc</A>.</SPAN></P>
+	<LI><P LANG="pt-BR"><SPAN STYLE="text-decoration: none">Install
+	Firebird ODBC Driver on your OS. ODBC Help may also be found at
+	<A HREF="http://www.firebirdsql.org/index.php?op=files&amp;id=odbc">http://www.firebirdsql.org/index.php?op=files&amp;id=odbc</A>.</SPAN></P>
+	<LI><P LANG="pt-BR" STYLE="font-weight: medium; text-decoration: none">
+	<FONT SIZE=3>Run Firebird as Superserver. </FONT>
+	</P>
+</UL>
+<H2 LANG="pt-BR">Compiling the Sample</H2>
+<P LANG="pt-BR">Compile the sample source using Visual Studio Express
+solution under &lt;tuscany_das_cpp&gt;/samples/SimpleRead/VSExpress/.</P>
+<H2 LANG="pt-BR">Running the Sample</H2>
+<P LANG="pt-BR"><FONT >To run the
+sample execute the file
+&lt;tuscany_das_cpp&gt;/samples/SimpleRead/VSExpress/debug/SimpleRead.exe</FONT></P>
+<P LANG="pt-BR"><B>Requirements</B>:</P>
+<UL>
+	<LI><P LANG="pt-BR">Firebird must be running as Superserver and
+	accepting connection from localhost.</P>
+	<LI><P LANG="pt-BR">The sample tries to access the data source using
+	user &ldquo;SYSDA&rdquo; and password &ldquo;masterkey&rdquo;.  You
+	can modify it to meet your firebird user and password access on
+	sample main function:</P>
+</UL>
+<P LANG="pt-BR" STYLE="margin-left: 2cm; margin-bottom: 0cm"><SPAN LANG=""><FONT SIZE=2>...</FONT></SPAN></P>
+<P LANG="" STYLE="margin-left: 2cm; margin-bottom: 0cm"><FONT SIZE=2>string
+user = <FONT COLOR="#800000">&quot;SYSDBA&quot;</FONT><FONT COLOR="#000000">;</FONT></FONT></P>
+<P LANG="pt-BR" STYLE="margin-left: 2cm; margin-bottom: 0cm"><SPAN LANG=""><FONT SIZE=2><FONT COLOR="#000000">string
+password = </FONT><FONT COLOR="#800000">&quot;masterkey&quot;</FONT><FONT COLOR="#000000">;</FONT></FONT></SPAN></P>
+<P LANG="" STYLE="margin-left: 2.02cm; margin-bottom: 0cm"><FONT SIZE=2>...</FONT></P>
+
+<P LANG="pt-BR"><h2>Sample Architecture</h2></P>
+<P LANG="pt-BR">The sample files are located under
+&lt;tuscany_das_cpp&gt;/samples/SimpleRead/.</P>
+<P LANG="pt-BR"><B>Contents</B>:</P>
+<UL>
+	<LI><P LANG="pt-BR">/src/main.cpp: This file contains the sample
+	code that prints the animals table's data that is stored on
+	/rsc/SimpleRead.fdb data source.</P>
+</UL>
+<UL>
+	<LI><P LANG="pt-BR">/rsc/SimpleRead.fdb: This is a Firebird data
+	source file that contains a table called &ldquo;animals&rdquo;
+	created with the following sql:</P>
+</UL>
+<P LANG="pt-BR" STYLE="margin-left: 2cm; margin-bottom: 0cm"><FONT SIZE=2>CREATE
+TABLE animals ( </FONT>
+</P>
+<P LANG="pt-BR" STYLE="margin-left: 4cm; margin-bottom: 0cm"><FONT SIZE=2>	id
+INT NOT NULL, </FONT>
+</P>
+<P LANG="pt-BR" STYLE="margin-left: 4cm; margin-bottom: 0cm"><FONT SIZE=2>	name
+VARCHAR(20), </FONT>
+</P>
+<P LANG="pt-BR" STYLE="margin-left: 4cm; margin-bottom: 0cm"><FONT SIZE=2>	PRIMARY
+KEY (id) </FONT>
+</P>
+<P LANG="pt-BR" STYLE="margin-left: 2cm; margin-bottom: 0cm"><FONT SIZE=2>);
+ </FONT>
+</P>
+
+</HTML>
\ No newline at end of file

Added: incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.sln
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.sln?view=auto&rev=550317
==============================================================================
--- incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.sln (added)
+++ incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.sln Sun Jun 24 19:12:55 2007
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleRead", "SimpleRead\SimpleRead.vcproj", "{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Debug|Win32.Build.0 = Debug|Win32
+		{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Release|Win32.ActiveCfg = Release|Win32
+		{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.suo
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.suo?view=auto&rev=550317
==============================================================================
Binary file - no diff available.

Propchange: incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead.suo
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/SimpleRead.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/SimpleRead.vcproj?view=auto&rev=550317
==============================================================================
--- incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/SimpleRead.vcproj (added)
+++ incubator/tuscany/cpp/das/samples/SimpleRead/VSExpress/SimpleRead/SimpleRead.vcproj Sun Jun 24 19:12:55 2007
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="SimpleRead"
+	ProjectGUID="{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(LIBXML2_HOME)\include&quot;;&quot;$(TUSCANY_DASCPP)/include&quot;;&quot;$(TUSCANY_SDOCPP)/include&quot;"
+				PreprocessorDefinitions="WIN32;_CONSOLE;_DEBUG"
+				RuntimeLibrary="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib tuscany_das.lib tuscany_sdo.lib"
+				AdditionalLibraryDirectories="$(TUSCANY_DASCPP)/lib;$(TUSCANY_SDOCPP)/lib"
+				GenerateDebugInformation="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\main.cpp"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: incubator/tuscany/cpp/das/samples/SimpleRead/rsc/SimpleRead.fdb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/rsc/SimpleRead.fdb?view=auto&rev=550317
==============================================================================
Binary file - no diff available.

Propchange: incubator/tuscany/cpp/das/samples/SimpleRead/rsc/SimpleRead.fdb
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/tuscany/cpp/das/samples/SimpleRead/src/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/samples/SimpleRead/src/main.cpp?view=auto&rev=550317
==============================================================================
--- incubator/tuscany/cpp/das/samples/SimpleRead/src/main.cpp (added)
+++ incubator/tuscany/cpp/das/samples/SimpleRead/src/main.cpp Sun Jun 24 19:12:55 2007
@@ -0,0 +1,103 @@
+/*
+ * 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 <string>
+#include <iostream>
+
+// including DAS headers
+#include <apache/das/rdb/Connection.h>
+#include <apache/das/rdb/DASImpl.h>
+#include <apache/das/rdb/SqlException.h>
+#include <apache/das/CommandPtr.h>
+
+// including SDO header
+#include <commonj/sdo/DataObject.h>
+
+using namespace apache::das::rdb;
+using namespace apache::das;
+using namespace commonj::sdo;
+using namespace std;
+
+void main() {
+	char* tuscanyDASCPPPath = getenv("TUSCANY_DASCPP");
+	
+	if (tuscanyDASCPPPath == 0) {
+		cout << "environment variable TUSCANY_DASCPP not set!" << endl;
+		system("PAUSE");
+		return;
+
+	}
+
+	try {
+		// Connect to a database using a connect string
+		string user = "SYSDBA";
+		string password = "masterkey";
+		string dataSourcePath = (string) tuscanyDASCPPPath + "/../samples/SimpleRead/rsc/SimpleRead.fdb";
+
+		Connection connection(
+				"DRIVER=Firebird/InterBase(r) driver; " +
+				"UID=" + user + 
+				"; PWD=" + masterkey + 
+				";DBNAME=localhost:" + dataSourcePath + ";"
+			);
+
+		// Create a DAS instance providing a connection using a factory 
+		DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(connection);
+
+		// Create a DAS command from a sql string
+		CommandPtr command = das->createCommand("SELECT * FROM animals;");
+
+		// Execute the command that returns the graph root data object
+		DataObjectPtr root = command->executeQuery();
+
+		// Gets the cart list
+		DataObjectList& cartList = root->getList("ANIMALS");
+		
+		// for each cart on the list is printed the its id and name
+		for (int i = 0 ; i < cartList.size() ; i++) {
+			// Gets the cart id
+			long id = cartList[i]->getInteger("ID");
+
+			// Gets the the name string length and allocate enough space for it
+			unsigned int stringLength = cartList[i]->getLength("NAME");
+			wchar_t* buffer = new wchar_t[stringLength];
+
+			// Gets the cart name
+			cartList[i]->getString("NAME", buffer, stringLength);
+			wstring name = wstring(buffer, stringLength);
+
+			// Print the cart data
+			wcout << "[Animal: " << i << "]" << endl;
+			wcout << "\tid = " << id << endl;
+			wcout << "\tname = " << name << endl << endl;
+
+		}
+
+		system("PAUSE");
+
+	} catch (SqlException& ex) {
+		cout << "couldn't connect to the data source!" << endl;
+		system("PAUSE");
+		return;
+
+	}
+
+	
+
+}



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