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/07/17 00:06:46 UTC

svn commit: r556747 - in /incubator/tuscany/cpp/das: VSExpress/tuscany_das/ runtime/core/include/apache/das/ runtime/core/include/apache/das/rdb/ runtime/core/src/apache/das/ runtime/core/src/apache/das/rdb/ runtime/test/rsc/ runtime/test/src/

Author: adrianocrestani
Date: Mon Jul 16 15:06:39 2007
New Revision: 556747

URL: http://svn.apache.org/viewvc?view=rev&rev=556747
Log:
- modified the way testcase is accessing the database
- relationships, tables, keypairs and columns names are now all stored on lower case

Modified:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSet.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Statement.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp
    incubator/tuscany/cpp/das/runtime/test/rsc/TestCases.fdb
    incubator/tuscany/cpp/das/runtime/test/src/main.cpp

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

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/DataGraphPrinter.h Mon Jul 16 15:06:39 2007
@@ -21,7 +21,8 @@
 #define DATA_GRAPH_PRINTER_H
 
 #include <ostream>
-#include <sstream>
+
+#include "apache/das/StringWrapper.h"
 
 #include "commonj/sdo/DataObject.h"
 
@@ -35,7 +36,6 @@
 		std::ostream* out;
 
 		std::string getTab(int count) const;
-		std::string to_string(const int& t) const;
 		void printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref = false);
 
 	public:

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h Mon Jul 16 15:06:39 2007
@@ -21,6 +21,7 @@
 
 #include <string>
 #include <ctype.h>
+#include <sstream>
 
 namespace apache {
 	namespace das {
@@ -30,7 +31,10 @@
 	public:
 		static std::string toLower(std::string str);
 		static bool isValidRDBName(std::string name);
-
+		static std::string to_string(const int& t);
+		static std::string to_string(const long& t);
+		static std::string to_string(const unsigned int& t);
+		
 };
 
 	};

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h Mon Jul 16 15:06:39 2007
@@ -45,6 +45,8 @@
 		ResultSetMetaData* metaData;
 		StatementPtr stmt;
 
+		std::string getSQLString(unsigned int columnIndex) const;
+
 	public:
 		ResultSet(StatementPtr aStmt);
 		virtual ~ResultSet(void);

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h Mon Jul 16 15:06:39 2007
@@ -23,8 +23,8 @@
 #include <windows.h>
 #include <sql.h>
 
+#include "apache/das/StringWrapper.h"
 #include "apache/das/rdb/ResultSetPtr.h"
-
 #include "apache/das/rdb/Connection.h"
 #include "apache/das/rdb/ResultSet.h"
 
@@ -53,6 +53,7 @@
 		string queryString;
 
 		ResultSetPtr createResultSet(void);
+		std::string getError(void) const;
 		
 	public:
 		Statement(Connection& connection, SQLHSTMT statementHandle);

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=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DataGraphPrinter.cpp Mon Jul 16 15:06:39 2007
@@ -91,7 +91,7 @@
 
 					if (typeName == "String") {
 						wchar_t* buf = new wchar_t[200];
-						int copied = dataObject->getString((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str(), buf, 200);
+						int copied = dataObject->getString((((std::string) propertyList[j].getName()) + "[" + StringWrapper::to_string(j) + "]").c_str(), buf, 200);
 						buf[copied] = 0;
 						std::wstring wstr = buf;
 						std::string str(wstr.begin(), wstr.end());
@@ -101,7 +101,7 @@
 						out << getTab(tabCount) << str << " : " << objectList[j]->getType().getName();
 						delete [] buf;
 					} else if (typeName == "Integer") {
-						out << getTab(tabCount) << dataObject->getInteger((((std::string) propertyList[j].getName()) + "[" + to_string(j) + "]").c_str()) << " : " << objectList[j]->getType().getName();
+						out << getTab(tabCount) << dataObject->getInteger((((std::string) propertyList[j].getName()) + "[" + StringWrapper::to_string(j) + "]").c_str()) << " : " << objectList[j]->getType().getName();
 					}
 					
 				} else if (!ref) {
@@ -157,14 +157,6 @@
 	this->out = &out;
 	printDataGraph(root);
 	out << std::endl;
-
-}
-
-std::string DataGraphPrinter::to_string(const int& t) const {
-	std::stringstream ss;
-	ss << t;
-
-	return ss.str();
 
 }
 

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp Mon Jul 16 15:06:39 2007
@@ -42,5 +42,30 @@
 
 }
 
+std::string StringWrapper::to_string(const int& t) {
+	std::stringstream ss;
+	ss << t;
+
+	return ss.str();
+
+}
+
+std::string StringWrapper::to_string(const long& t) {
+	std::stringstream ss;
+	ss << t;
+
+	return ss.str();
+
+}
+
+std::string StringWrapper::to_string(const unsigned int& t) {
+	std::stringstream ss;
+	ss << t;
+
+	return ss.str();
+
+}
+
+
 	};
 };

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp Mon Jul 16 15:06:39 2007
@@ -32,6 +32,7 @@
 }
 
 Column::Column(std::string columnName, SQLSMALLINT sqlType) {
+	columnName = StringWrapper::toLower(columnName);
 
 	if (!StringWrapper::isValidRDBName(columnName)) {
 		throw DASInvalidColumnNameException("Column name must not contain whitespace characters!");
@@ -64,6 +65,7 @@
 }
 
 void Column::setPropertyName(std::string propertyName) {
+	propertyName = StringWrapper::toLower(propertyName);
 
 	if (!StringWrapper::isValidRDBName(propertyName)) {
 		throw DASInvalidPropertyNameException("Property name must not contain whitespace characters!");

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp Mon Jul 16 15:06:39 2007
@@ -30,6 +30,8 @@
 }
 
 KeyPair::KeyPair(std::string pkColumnName, std::string fkColumnName) {
+	pkColumnName = StringWrapper::toLower(pkColumnName);
+	fkColumnName = StringWrapper::toLower(fkColumnName);
 
 	if (!StringWrapper::isValidRDBName(pkColumnName)) {
 		throw DASInvalidColumnNameException("PK column name must not contain whitespace characters!");

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp Mon Jul 16 15:06:39 2007
@@ -42,6 +42,9 @@
 Relationship::Relationship(std::string pkTableName, std::string fkTableName, 
 						   std::string relationshipName) {
 
+    pkTableName = StringWrapper::toLower(pkTableName);
+	fkTableName = StringWrapper::toLower(fkTableName);
+
     if (relationshipName == "") {
 		this->relationshipName = fkTableName;
     } else {
@@ -50,7 +53,7 @@
 			throw DASInvalidRelationshipNameException("Relationship name must not contain whitespace characters!");
 		}
 
-		this->relationshipName = relationshipName;
+		this->relationshipName = StringWrapper::toLower(relationshipName);
 
     }
 

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSet.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSet.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSet.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSet.cpp Mon Jul 16 15:06:39 2007
@@ -96,6 +96,7 @@
 	if (metaData->getSQLType(columnIndex) == SQL_REAL) {
 		SQLFLOAT real = 0;
 		SQLINTEGER length = 0;
+		SQL_INTEGER
 		SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_FLOAT, &real, 1, &length);
 		
 		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
@@ -166,28 +167,12 @@
 }
 
 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, columnIndex + 1, SQL_C_CHAR, &strAux, 1, &length);
-	//	length++;
-	//	sqlPtr = (SQLCHAR*) malloc(length*sizeof(SQLCHAR));
-	//	SQLINTEGER aux = 0;
-	//	SQLGetData(statement, columnIndex + 1, 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;
-	return "";
+	if (metaData->getSQLType(columnIndex) == SQL_DECIMAL) {
+		return getSQLString(columnIndex);
+	} else {
+		throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not decimal!");
+	}
 
 }
 
@@ -218,30 +203,34 @@
 
 }
 
-std::string ResultSet::getSQLVarchar(unsigned int columnIndex) const {
+std::string ResultSet::getSQLString(unsigned int columnIndex) const {
+	SQLPOINTER sqlPtr = 0;
+	SQLCHAR strAux[1];
+	SQLINTEGER length = 0;
+	SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, &strAux, 1, &length);
 
-	if (metaData->getSQLType(columnIndex) == SQL_VARCHAR) {
-		SQLPOINTER sqlPtr = 0;
-		SQLCHAR strAux[1];
-		SQLINTEGER length = 0;
-		SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, &strAux, 1, &length);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		throw SQLException("Error to get database data!");
 
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-			throw SQLException("Error to get database data!");
+	length++;
+	sqlPtr = new SQLCHAR[length];
+	SQLINTEGER aux = 0;
+	result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, sqlPtr, length, &aux);
 
-		length++;
-		sqlPtr = new SQLCHAR[length];
-		SQLINTEGER aux = 0;
-		result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, sqlPtr, length, &aux);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		throw SQLException("Error to get database data!");
+		
+	std::string ret = (char*) sqlPtr;
+	delete [] ((SQLCHAR*) sqlPtr);
 
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-			throw SQLException("Error to get database data!");
-			
-		std::string ret = (char*) sqlPtr;
-		delete [] ((SQLCHAR*) sqlPtr);
+	return ret;
 
-		return ret;
+}
+
+std::string ResultSet::getSQLVarchar(unsigned int columnIndex) const {
 
+	if (metaData->getSQLType(columnIndex) == SQL_VARCHAR) {
+		return getSQLString(columnIndex);
 	} else {
 		throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not varchar!");
 	}

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp Mon Jul 16 15:06:39 2007
@@ -27,8 +27,8 @@
 	unsigned int columnCount = getColumnCount();
 	
 	for (unsigned int i = 0 ; i < columnCount ; i++) {
-		std::string columnName = getColumnName(i);
-		std::string tableName = getTableName(i);
+		std::string columnName = StringWrapper::toLower(getColumnName(i));
+		std::string tableName = StringWrapper::toLower(getTableName(i));
 		columnsIndexes.insert(std::make_pair(tableName + "." + columnName, i));
 
 	}
@@ -120,7 +120,7 @@
 	std::string ret((char*) sqlPtr);
 	delete [] sqlPtr;
 
-	return ret;
+	return StringWrapper::toLower(ret);
 
 }
 
@@ -141,11 +141,13 @@
 	std::string ret((char*) sqlPtr);
 	delete [] sqlPtr;
 
-	return ret;
+	return StringWrapper::toLower(ret);
 
 }
 
 unsigned int ResultSetMetaData::getColumnIndex(std::string tableName, std::string columnName) const {
+	tableName = StringWrapper::toLower(tableName);
+	columnName = StringWrapper::toLower(columnName);
 	std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
 
 	if (it == columnsIndexes.end()) {
@@ -169,7 +171,7 @@
 	std::string ret((char*) sqlPtr);
 	delete [] sqlPtr;
 
-	return ret;
+	return StringWrapper::toLower(ret);
 
 }
 

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Statement.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Statement.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Statement.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Statement.cpp Mon Jul 16 15:06:39 2007
@@ -38,17 +38,45 @@
 
 }
 
+std::string Statement::getError(void) const {
+	SQLCHAR state[5];
+	SQLCHAR message[1000];
+	SQLINTEGER nativeError = 0;
+	SQLSMALLINT messageLength = 0;
+
+	SQLRETURN result = SQLGetDiagRec(SQL_HANDLE_STMT, statementHandle, 1, 
+		              state, &nativeError, message, 1000, &messageLength);
+
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		return "";
+	}
+
+	if (messageLength < 1000) {
+		message[messageLength + 1] = 0;
+	}
+
+	std::string ret = (std::string) (char*) state;
+	ret += ": ";
+	ret += StringWrapper::to_string((long) nativeError);
+	ret += " - ";
+	ret += (char*) message;
+
+	return ret;
+
+}
+
 Connection& Statement::getConnection(void) const {
 	return *connection;
 }
 
-ResultSetPtr Statement::executeQuery(std::string sql) { /*throws SQLException*/
+ResultSetPtr Statement::executeQuery(std::string sql) {
 	SQLRETURN result = SQLExecDirect(statementHandle, (SQLCHAR*) (char*) sql.c_str(), SQL_NTS);
 
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		throw SQLException("Error to execute the statement handle - SQLSTMT");
-
-    return createResultSet();
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		throw SQLException(getError());
+	}
+	
+	return createResultSet();
 
 }
 

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Table.cpp Mon Jul 16 15:06:39 2007
@@ -23,6 +23,8 @@
 		namespace rdb {
 
 Table::Table(std::string tableName) {
+	tableName = StringWrapper::toLower(tableName);
+
 	if (tableName.find(' ') != -1 || tableName.find('\t') != -1 || tableName.find('\n') != -1 || tableName.find('\r') != -1) {
 		throw DASInvalidTableNameException("Table name must not contain whitespace characters!");
 	}
@@ -139,6 +141,8 @@
 }
 
 void Table::setTypeName(std::string typeName) {
+	typeName = StringWrapper::toLower(typeName);
+
 	if (typeName.find(' ') != -1 || typeName.find('\t') != -1 || typeName.find('\n') != -1 || typeName.find('\r') != -1) {
 		throw DASInvalidTypeNameException("Type must not contain whitespace characters!");
 	}

Modified: incubator/tuscany/cpp/das/runtime/test/rsc/TestCases.fdb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/test/rsc/TestCases.fdb?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/cpp/das/runtime/test/src/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/test/src/main.cpp?view=diff&rev=556747&r1=556746&r2=556747
==============================================================================
--- incubator/tuscany/cpp/das/runtime/test/src/main.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/test/src/main.cpp Mon Jul 16 15:06:39 2007
@@ -54,15 +54,13 @@
 		string password = "masterkey";
 		string dataSourcePath = (string) tuscanyDASCPPPath + "/../runtime/test/rsc/TestCases.fdb";
 
-		Connection connection((string)
+		return new Connection((string)
 				"DRIVER=Firebird/InterBase(r) driver; " +
 				"UID=" + user + 
 				"; PWD=" + password + 
 				";DBNAME=localhost:" + dataSourcePath + ";"
 			);
 
-		return new Connection("testDSN", "root", "masterkey");
-
 	} catch (SQLException& ex) {
 		cout << "couldn't connect to the data source!" << endl;
 		system("PAUSE");
@@ -389,6 +387,17 @@
 }
 
 int main() {
+	Connection& conn = *getConnection();
+
+	StatementPtr stmt = conn.createStatement();
+	ResultSetPtr rs = stmt->executeQuery("select * from test");
+	
+	while (rs->next()) {
+		std::string decimal = rs->getSQLDecimal(0);
+		cout << "Decimal = " + decimal << std::endl;
+
+	}
+
 	testPointers();
 	testUniqueObjectByID();
 	testIncompleteCompositeRelationship();



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