You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ad...@apache.org on 2007/05/18 08:43:05 UTC

svn commit: r539287 - in /incubator/tuscany/cpp/das: VSExpress/tuscany_das/ VSExpress/tuscany_das/das_runtime/ runtime/core/include/apache/das/ runtime/core/include/apache/das/rdb/ runtime/core/src/apache/das/ runtime/core/src/apache/das/rdb/ runtime/t...

Author: adrianocrestani
Date: Thu May 17 23:43:03 2007
New Revision: 539287

URL: http://svn.apache.org/viewvc?view=rev&rev=539287
Log:
- added ConnectionPtr
- removed Database class

Added:
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/CommandPtr.h
Removed:
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Database.h
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingObject.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Database.cpp
Modified:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/Command.h
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Connection.h
    incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASImpl.h
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/Command.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp
    incubator/tuscany/cpp/das/runtime/test/src/main.cpp

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj Thu May 17 23:43:03 2007
@@ -265,10 +265,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Database.cpp"
-					>
-				</File>
-				<File
 					RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilder.cpp"
 					>
 				</File>
@@ -338,6 +334,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\..\runtime\core\include\apache\das\CommandPtr.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\..\runtime\core\include\apache\das\DAS.h"
 					>
 				</File>
@@ -395,10 +395,6 @@
 				</File>
 				<File
 					RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASImpl.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Database.h"
 					>
 				</File>
 				<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=539287&r1=539286&r2=539287
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/Command.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/Command.h?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/Command.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/Command.h Thu May 17 23:43:03 2007
@@ -19,6 +19,8 @@
 #ifndef COMMAND_H
 #define COMMAND_H
 
+#include "apache/das/RefCountingObject.h"
+
 #include "commonj/sdo/DataObject.h"
 
 #include <string>
@@ -26,10 +28,13 @@
 namespace apache {
 	namespace das {
 
+class Command;
+typedef RefCountingObject<Command> CommandObject;
+
 /**
  * A Command is used to execute a read or write to a database
  */
-class Command {
+class Command : public CommandObject {
 
 	public:
 		Command(void);

Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/CommandPtr.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/CommandPtr.h?view=auto&rev=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/CommandPtr.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/CommandPtr.h Thu May 17 23:43:03 2007
@@ -0,0 +1,34 @@
+/*
+ * 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 COMMAND_PTR_H
+#define COMMAND_PTR_H
+
+#include "apache/das/RefCountingPointer.h"
+
+namespace apache {
+	namespace das {
+
+	class Command;
+	typedef RefCountingPointer<Command> CommandPtr;
+
+	};
+};
+
+#endif //COMMAND_PTR_H

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=539287&r1=539286&r2=539287
==============================================================================
--- 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 Thu May 17 23:43:03 2007
@@ -29,7 +29,7 @@
 #include <algorithm>
 
 #include "apache/das/rdb/StatementPtr.h"
-#include "apache/das/rdb/Database.h"
+#include "apache/das/rdb/Statement.h"
 #include "apache/das/rdb/SqlException.h"
 
 using std::string;
@@ -39,14 +39,11 @@
 	namespace das {
 		namespace rdb {
 
-class Database;
-
 class Connection {
 
 	private:
 		SQLHDBC connection;
 		SQLHENV environment;
-		Database* database;
 		std::list<StatementPtr*> statements;
 		
 	public:
@@ -56,7 +53,6 @@
 		void commit(void);
 		void rollback(void);
 		void setAutoCommit(bool autoCommit);
-		Database& getDatabase(void) const;
 		StatementPtr createStatement(void) throw (exception);
 		//PreparedStatement& prepareStatement(string sql);
 		

Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASImpl.h?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASImpl.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASImpl.h Thu May 17 23:43:03 2007
@@ -30,6 +30,7 @@
 #include "apache/das/rdb/Connection.h"
 #include "apache/das/rdb/Config.h"
 #include "apache/das/rdb/ReadCommandImpl.h"
+#include "apache/das/CommandPtr.h"
 
 #include "commonj/sdo/DataFactory.h"
 
@@ -45,11 +46,9 @@
 
 	private:
 		Connection* connection;
-		std::list<Command*>* createdCommands;
+		std::list<CommandPtr*>* createdCommands;
 		Config* config;
 		
-		Command& baseCreateCommand(std::string inSql);
-		
 	public:
 		DASImpl(Connection& inConnection);
 		virtual ~DASImpl(void);
@@ -57,7 +56,7 @@
 		Config& getConfig(void) const;
 		void setConnection(Connection* aConnection);
 		void releaseResources(void);
-		Command& createCommand(std::string sql);
+		CommandPtr createCommand(std::string sql);
 		void closeConnection(void);
 		
 };

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/Command.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/Command.cpp?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/Command.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/Command.cpp Thu May 17 23:43:03 2007
@@ -24,7 +24,9 @@
 
 Command::Command(void) {}
 
-Command::~Command(void) {}
+Command::~Command(void) {
+	CommandObject::free();
+}
 
 commonj::sdo::DataObjectPtr Command::executeQuery(void) {
 	return 0;

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp Thu May 17 23:43:03 2007
@@ -20,6 +20,9 @@
 #include "apache/das/RefCountingPointer.h"
 #include "apache/das/rdb/Statement.h"
 #include "apache/das/rdb/Connection.h"
+#include "apache/das/rdb/ReadCommandImpl.h"
+#include "apache/das/Command.h"
+#include "apache/das/CommandPtr.h"
 
 namespace apache {
 	namespace das {
@@ -216,6 +219,39 @@
          
 			}
         
+			{
+			/* 1) construct */
+			rdb::Connection* conn = new rdb::Connection("","","");
+            CommandPtr fptr = *(new CommandPtr());
+			CommandPtr a(*(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "")));
+			CommandPtr b(*(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "")));
+			Command& st = *(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), ""));
+			CommandPtr* c = new CommandPtr(st);
+			c->isObjectOwner();
+            /* 2) use the & operator= */
+            a = b;
+            
+            /* 3) copy */
+            CommandPtr d = a;
+
+			a = new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "");
+			a = *(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), ""));
+            
+            /* 4) use the == and ! */
+            if (a == b || !b){}
+            
+            /* 5) Use the T*  and  * */
+            CommandObject* dmsf = a;
+            CommandObject& dmsr = *b;
+
+			/* 6) Use the -> */
+			a->executeQuery(); 
+            
+            /* and again to catch the = */
+			delete c;
+            
+         
+			}
             
 #endif
             

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=539287&r1=539286&r2=539287
==============================================================================
--- 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 Thu May 17 23:43:03 2007
@@ -23,8 +23,6 @@
 		namespace rdb {
 
 Connection::Connection(string dns, string user, string password) throw (SqlException){
-	database = new Database(*this);
-
 	SQLRETURN result;
 
 	SQLSMALLINT autoCommit;
@@ -77,8 +75,6 @@
 		throw SqlException(error.c_str());
 	}
 
-	database = new Database(*this);
-
 }
 
 Connection::~Connection(void){
@@ -94,8 +90,6 @@
 
 	}
 
-	delete database;
-
 	SQLDisconnect(connection);
     SQLFreeHandle(SQL_HANDLE_DBC,connection);
     SQLFreeHandle(SQL_HANDLE_ENV, environment);
@@ -119,10 +113,6 @@
 		SQLSetConnectAttr(connection,SQL_ATTR_AUTOCOMMIT,reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON), SQL_IS_INTEGER );
 	else
 		SQLSetConnectAttr(connection,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF, SQL_IS_INTEGER );
-}
-
-Database& Connection::getDatabase(void) const {
-	return *database;
 }
 
 StatementPtr Connection::createStatement(void) throw (SqlException){

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp?view=diff&rev=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp Thu May 17 23:43:03 2007
@@ -23,17 +23,19 @@
 		namespace rdb {
 
 DASImpl::DASImpl(Connection& inConnection) {
-	createdCommands = new std::list<Command*>();
+	createdCommands = new std::list<CommandPtr*>();
     setConnection(&inConnection);
 	config = new Config(*this);
 
 }
 
 DASImpl::~DASImpl() {
-	std::list<Command*>::iterator it;
+	std::list<CommandPtr*>::iterator it;
 
 	for (it = createdCommands->begin() ; it != createdCommands->end() ; it++) {
+		delete **it;
 		delete *it;
+
 	}
 
 	delete createdCommands;
@@ -54,24 +56,36 @@
 	closeConnection();
 }
 
-Command& DASImpl::createCommand(std::string sql) {
-	return baseCreateCommand(sql);
-}
-
-Command& DASImpl::baseCreateCommand(std::string inSql) {
-	CommandImpl* returnCmd = NULL;
+CommandPtr DASImpl::createCommand(std::string sql) {
+	CommandPtr command = 0;
     //trim(inSql);
-    char firstChar = toupper(inSql[0]);
+    char firstChar = toupper(sql[0]);
 
     switch (firstChar) {
         case 'S':
-            returnCmd = new ReadCommandImpl(*this, inSql);
+            command = new ReadCommandImpl(*this, sql);
             break;
      
     }
 
-	createdCommands->push_back(returnCmd);
-    return *returnCmd;
+	std::list<CommandPtr*>::iterator it;
+
+	for (it = createdCommands->begin() ; it != createdCommands->end() ; ) {
+		
+		if (**it) {
+			it++;
+
+		} else {
+			std::list<CommandPtr*>::iterator aux = it;
+			it++;
+			createdCommands->erase(aux);
+
+		}
+
+	}
+	
+	createdCommands->push_back(new CommandPtr(command, false));
+    return command;
 
 }
 
@@ -80,8 +94,8 @@
 	if (connection != NULL) {
 
         //try {
-            SQLDisconnect(connection);
-            connection = NULL;
+            delete connection;
+			connection = NULL;
         //} catch (SQLException e) {
           //  throw new RuntimeException(e);
         //}

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=539287&r1=539286&r2=539287
==============================================================================
--- incubator/tuscany/cpp/das/runtime/test/src/main.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/test/src/main.cpp Thu May 17 23:43:03 2007
@@ -2,7 +2,7 @@
 #include <apache/das/rdb/Connection.h>
 #include <apache/das/DAS.h>
 #include <apache/das/rdb/DASImpl.h>
-#include <apache/das/Command.h>
+#include <apache/das/CommandPtr.h>
 #include <apache/das/rdb/ResultSet.h>
 #include <apache/das/rdb/Statement.h>
 #include <apache/das/rdb/ResultSet.h>
@@ -17,14 +17,49 @@
 using namespace apache::das;
 using namespace apache::das::rdb;
 
-void testStatementAndResultSetPointer() {
-	cout << "-------------testStatementAndResultSetPointer--------------" << endl;
-	Connection* conn = new Connection("testDSN", "root", "masterkey");
+Connection* getConnection() {
+	return new Connection("testDSN", "root", "masterkey");
+}
+
+void testPointers() {
+	cout << "-------------testPointers--------------" << endl;
+	Connection* conn = getConnection();
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
+	Command* comm = new ReadCommandImpl(*das, "select * from company");
+	CommandPtr comm1 = *comm;
+	CommandPtr comm2 = comm1;
+	CommandPtr comm3 = das->createCommand("select * from company;");
 	StatementPtr stmtPtr1 = conn->createStatement();
 	Statement* stmt = stmtPtr1;
 	StatementPtr stmtPtr2 = stmtPtr1;
 	StatementPtr stmtPtr3 = conn->createStatement();
 	StatementPtr* stmtPtr4 = new StatementPtr(stmt);
+
+	cout << "Command pointer working correctly = ";
+	try {
+		comm1->executeQuery();
+		cout << "OK" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "NullPointerException" << endl;
+	}
+
+	comm1 = 0;
+	comm2 = 0;
+	cout << "Command object deleted when there is no more reference = ";
+	try {
+		comm1->executeQuery();
+		cout << "not deleted" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "OK" << endl;
+	}
+
+	delete das;
+	cout << "Command pointer set as null when object is deleted = ";
+	if (comm3 != 0) { 
+		cout << "not null" << endl;
+	} else {
+		cout << "OK" << endl;
+	}
 	
 	ResultSetPtr resultSetPtr = stmtPtr1->executeQuery("select * from company;");
 
@@ -37,7 +72,7 @@
 	}
 
 	stmtPtr1->executeQuery("select * from employee;");
-	cout << "ResultSet object deleted when there is another query = ";
+	cout << "ResultSet object deleted when there is another query on its statement = ";
 	try {
 		resultSetPtr->getStatement();
 		cout << "not deleted" << endl;
@@ -73,10 +108,9 @@
 	resultSetPtr2 = 0;
 
 	cout << "Statement pointer set as null when object is deleted = ";
-	try {
-		stmtPtr3->getODBCStatement();
+	if (stmtPtr3 != 0) { 
 		cout << "not null" << endl;
-	} catch (NullPointerException& exp) {
+	} else {
 		cout << "OK" << endl;
 	}
 
@@ -87,10 +121,10 @@
 void testIncompleteCompositeRelationship() {
 	cout << "-------------testIncompleteCompositeRelationship--------------" << endl;
 
-	Connection con("testDSN", "root", "masterkey");
+	Connection* conn = getConnection();
 
 	{
-		DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+		DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
 		Config& config = das->getConfig();
 
 		Table* table = new Table("department");
@@ -107,10 +141,10 @@
 		relationship->addKeyPair(*(new KeyPair("name", "department_name")));
 		config.addRelationship(*relationship);
 
-		Command& command = das->createCommand(
+		CommandPtr command = das->createCommand(
 			"SELECT department.id, department.name, employee.id, employee.department_id FROM department, employee;");
 
-		commonj::sdo::DataObjectPtr root = command.executeQuery();
+		commonj::sdo::DataObjectPtr root = command->executeQuery();
 
 		cout << "relationship ignored when the ResultSet does not contain all KeyPairs = ";
 		try {
@@ -124,7 +158,7 @@
 	}
 
 	{
-		DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+		DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
 		Config& config = das->getConfig();
 
 		Table* table = new Table("department");
@@ -138,10 +172,10 @@
 		relationship->addKeyPair(*(new KeyPair("name", "department_name")));
 		config.addRelationship(*relationship);
 
-		Command& command = das->createCommand(
+		CommandPtr command = das->createCommand(
 			"SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
 
-		commonj::sdo::DataObjectPtr root = command.executeQuery();
+		commonj::sdo::DataObjectPtr root = command->executeQuery();
 
 		cout << "relationship ignored when a defined relationship pk is not a table pk = ";
 		try {
@@ -154,6 +188,8 @@
 
 	}
 
+	delete conn;
+
 	cout << "---------------------------------" << endl << endl;
 
 }
@@ -161,8 +197,8 @@
 void testCompositeRelationship() {
 	cout << "-------------testCompositeRelationship--------------" << endl;
 
-	Connection con("testDSN", "root", "masterkey");
-	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+	Connection* conn = getConnection();
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
 	Config& config = das->getConfig();
 
 	Table* table = new Table("department");
@@ -179,10 +215,10 @@
 	relationship->addKeyPair(*(new KeyPair("name", "department_name")));
 	config.addRelationship(*relationship);
 
-	Command& command = das->createCommand(
+	CommandPtr command = das->createCommand(
 		"SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
 
-	commonj::sdo::DataObjectPtr root = command.executeQuery();
+	commonj::sdo::DataObjectPtr root = command->executeQuery();
 
 	/*DataGraphPrinter printer(root);
 	printer.printMetaData(std::cout);
@@ -204,6 +240,8 @@
 		cout << "not set" << endl;
 	}
 
+	delete conn;
+
 	cout << "---------------------------------" << endl << endl;
 
 }
@@ -211,13 +249,13 @@
 void testeCOCRelationship() {
 	cout << "-------------testeCOCRelationship--------------" << endl;
 
-	Connection con("testDSN", "root", "masterkey");
-	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+	Connection* conn = getConnection();
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
 	
-	Command& command = das->createCommand(
+	CommandPtr command = das->createCommand(
 		"SELECT * FROM department, company;");
 
-	commonj::sdo::DataObjectPtr root = command.executeQuery();
+	commonj::sdo::DataObjectPtr root = command->executeQuery();
 
 
 	cout << "relationship created = ";
@@ -229,6 +267,8 @@
 		cout << "not created" << endl;
 	}
 
+	delete conn;
+
 	cout << "---------------------------------" << endl << endl;
 
 }
@@ -236,10 +276,10 @@
 void testUniqueObjectByID() {
 	cout << "-------------testUniqueObjectByID--------------" << endl;
 
-	Connection con("testDSN", "root", "masterkey");
-	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
-	Command& command = das->createCommand("SELECT * FROM company, employee where company.id = 1;");
-	commonj::sdo::DataObjectPtr root = command.executeQuery();
+	Connection* conn = getConnection();
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(*conn);
+	CommandPtr command = das->createCommand("SELECT * FROM company, employee where company.id = 1;");
+	commonj::sdo::DataObjectPtr root = command->executeQuery();
 
 	cout << "table duplicated row ignored = ";
 	if (root->getList("company").size() == 1) {
@@ -247,13 +287,15 @@
 	} else {
 		cout << "not ignored" << endl;
 	}
+
+	delete conn;
 	
 	cout << "---------------------------------" << endl << endl;
 
 }
 
 int main() {
-	testStatementAndResultSetPointer();
+	testPointers();
 	testUniqueObjectByID();
 	testIncompleteCompositeRelationship();
 	testCompositeRelationship();



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