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/14 10:42:52 UTC
svn commit: r556242 [2/2] - 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/ run...
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -27,13 +27,13 @@
relationshipName = relationship.relationshipName;
pkTableName = relationship.pkTableName;
fkTableName = relationship.fkTableName;
- keyPairs = relationship.keyPairs;
-
+ this->keyPairs = new std::map<std::string, const KeyPair*>();
+
std::map<std::string, const KeyPair*>::iterator it;
- for (it = keyPairs->begin() ; it != keyPairs->end() ; it++) {
- KeyPair* newKeyPair = new KeyPair(*it->second);
- newKeyPair->setRelationship(this);
- keyPairs->insert(it, std::make_pair(it->first, newKeyPair));
+ for (it = relationship.keyPairs->begin() ; it != relationship.keyPairs->end() ; it++) {
+ KeyPair* newKP = new KeyPair(*it->second);
+ newKP->setRelationship(this);
+ this->keyPairs->insert(std::make_pair(it->first, newKP));
}
@@ -45,9 +45,23 @@
if (relationshipName == "") {
this->relationshipName = fkTableName;
} else {
+
+ if (!StringWrapper::isValidRDBName(relationshipName)) {
+ throw DASInvalidRelationshipNameException("Relationship name must not contain whitespace characters!");
+ }
+
this->relationshipName = relationshipName;
+
}
-
+
+ if (!StringWrapper::isValidRDBName(pkTableName)) {
+ throw DASInvalidTableNameException("PK Table name must not contain whitespace characters!");
+ }
+
+ if (!StringWrapper::isValidRDBName(fkTableName)) {
+ throw DASInvalidTableNameException("FK Table name must not contain whitespace characters!");
+ }
+
this->pkTableName = pkTableName;
this->fkTableName = fkTableName;
many = true;
@@ -64,11 +78,19 @@
}
KeyPair& Relationship::addKeyPair(std::string pkColumnName, std::string fkColumnName) {
- return newKeyPair(*(new KeyPair(pkColumnName, fkColumnName)));
+ KeyPair& newKP = newKeyPair(*(new KeyPair(pkColumnName, fkColumnName)));
+ newKP.setRelationship(this);
+
+ return newKP;
+
}
KeyPair& Relationship::addKeyPair(const KeyPair& keyPair) {
- return newKeyPair(*(new KeyPair(keyPair)));
+ KeyPair& newKP = newKeyPair(*(new KeyPair(keyPair)));
+ newKP.setRelationship(this);
+
+ return newKP;
+
}
KeyPair& Relationship::newKeyPair(KeyPair& keyPair) {
@@ -90,7 +112,14 @@
}
Relationship::~Relationship(void) {
+ std::map<std::string, const KeyPair*>::iterator it;
+
+ for (it = keyPairs->begin() ; it != keyPairs->end() ; it++) {
+ delete it->second;
+ }
+
delete keyPairs;
+
}
std::string Relationship::getPKTableName(void) const {
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp Sat Jul 14 01:42:49 2007
@@ -22,7 +22,18 @@
namespace das {
namespace rdb {
-std::list<Relationship*>* RelationshipWrapper::getRelationshipsByTableName(
+RelationshipWrapper::RelationshipWrapper(void) {}
+
+RelationshipWrapper::~RelationshipWrapper(void) {
+ std::list<std::list<Relationship*>*>::iterator it;
+
+ for (it = relationshipLists.begin() ; it != relationshipLists.end() ; it++) {
+ delete *it;
+ }
+
+}
+
+std::list<Relationship*>& RelationshipWrapper::getRelationshipsByTableName(
const std::map<std::string, Relationship*>& relationships, std::string tableName,
bool pkTable) {
@@ -47,11 +58,13 @@
}
- return relationshipList;
+ relationshipLists.push_back(relationshipList);
+
+ return *relationshipList;
}
-std::list<Relationship*>* RelationshipWrapper::getRelationshipsByTableName(const std::list<
+std::list<Relationship*>& RelationshipWrapper::getRelationshipsByTableName(const std::list<
Relationship*>& relationships, std::string tableName,
bool pkTable) {
@@ -76,7 +89,26 @@
}
- return relationshipList;
+ relationshipLists.push_back(relationshipList);
+
+ return *relationshipList;
+
+}
+
+void RelationshipWrapper::free(std::list<Relationship*>& relationshipList) {
+ std::list<std::list<Relationship*>*>::iterator it;
+
+ for (it = relationshipLists.begin() ; it != relationshipLists.end() ; it++) {
+
+ if (*it == &relationshipList) {
+ delete *it;
+ relationshipLists.erase(it);
+
+ return;
+
+ }
+
+ }
}
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -24,7 +24,7 @@
ResultSet::ResultSet(StatementPtr aStmt) {
stmt = aStmt;
- metaData = new ResultSetMetaData(this);
+ metaData = new ResultSetMetaData(*this);
}
@@ -34,7 +34,7 @@
}
-ResultSetMetaData& ResultSet::getResultSetMetaData(void) const {
+const ResultSetMetaData& ResultSet::getResultSetMetaData(void) const {
return *metaData;
}
@@ -46,7 +46,16 @@
SQLINTEGER sqlPtr = 0;
SQLSMALLINT length = 0;
SQLINTEGER aux = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_LONG, &sqlPtr, 0, &aux);
+
+ if (metaData->getSQLType(columnIndex) == SQL_INTEGER) {
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_LONG, &sqlPtr, 0, &aux);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not integer!");
+ }
return (long) sqlPtr;
@@ -62,12 +71,15 @@
if (metaData->getSQLType(columnIndex) == SQL_CHAR) {
SQLWCHAR strAux = 0;
SQLINTEGER length = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_WCHAR, &strAux, 1, &length);
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_WCHAR, &strAux, 1, &length);
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get database data!");
+
ret = (wchar_t) strAux;
} else {
- //throw an exception if the column type is not the requested
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not char!");
}
return ret;
@@ -84,12 +96,15 @@
if (metaData->getSQLType(columnIndex) == SQL_REAL) {
SQLFLOAT real = 0;
SQLINTEGER length = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_FLOAT, &real, 1, &length);
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_FLOAT, &real, 1, &length);
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get database data!");
+
ret = (float) real;
} else {
- //throw an exception if the column type is not the requested
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not real!");
}
return ret;
@@ -106,12 +121,15 @@
if (metaData->getSQLType(columnIndex) == SQL_FLOAT) {
SQLDOUBLE data = 0;
SQLINTEGER length = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get database data!");
+
ret = (double) data;
} else {
- //throw an exception if the column type is not the requested
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not float!");
}
return ret;
@@ -128,12 +146,15 @@
if (metaData->getSQLType(columnIndex) == SQL_DOUBLE) {
SQLDOUBLE data = 0;
SQLINTEGER length = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get database data!");
+
ret = (double) data;
} else {
- //throw an exception if the column type is not the requested
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not double!");
}
return ret;
@@ -188,25 +209,42 @@
unsigned int ResultSet::rowCount(void) const {
SQLINTEGER columnCount = 0;
- SQLRETURN ret = SQLColAttribute(stmt->getODBCStatement(), NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
-
+ SQLRETURN result = SQLColAttribute(stmt->getODBCStatement(), NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException("Error to get row count!");
+
return (unsigned int) columnCount;
}
std::string ResultSet::getSQLVarchar(unsigned int columnIndex) const {
- SQLPOINTER sqlPtr = 0;
- SQLCHAR strAux[1];
- SQLINTEGER length = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, &strAux, 1, &length);
- length++;
- sqlPtr = new SQLCHAR[length];
- SQLINTEGER aux = 0;
- SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, sqlPtr, length, &aux);
-
- std::string ret = (char*) sqlPtr;
- delete [] ((SQLCHAR*) sqlPtr);
- return ret;
+
+ 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!");
+
+ 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);
+
+ return ret;
+
+ } 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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -22,8 +22,8 @@
namespace das {
namespace rdb {
-ResultSetMetaData::ResultSetMetaData(ResultSet* aResultSet) {
- resultSet = aResultSet;
+ResultSetMetaData::ResultSetMetaData(const ResultSet& aResultSet) {
+ resultSet = &aResultSet;
unsigned int columnCount = getColumnCount();
for (unsigned int i = 0 ; i < columnCount ; i++) {
@@ -90,7 +90,7 @@
return SQL_C_BINARY;
default :
- throw std::invalid_argument("Illegal SQL type!");
+ throw DASInvalidSQLTypeException();
}
@@ -149,7 +149,7 @@
std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
if (it == columnsIndexes.end()) {
- throw std::invalid_argument("No such column name: " + columnName + "on table " + tableName);
+ throw DASColumnNotFoundException("No such column on table " + tableName + ": " + columnName);
}
return it->second;
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SQLException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SQLException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SQLException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SQLException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "apache/das/rdb/SQLException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+SQLException::SQLException(string errorText)
+ :exception(errorText.c_str()){}
+
+SQLException::~SQLException(){}
+
+ };
+ };
+};
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -43,7 +43,10 @@
}
ResultSetPtr Statement::executeQuery(std::string sql) { /*throws SQLException*/
- SQLExecDirect(statementHandle, (SQLCHAR*) (char*) sql.c_str(), SQL_NTS);
+ 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();
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -23,22 +23,27 @@
namespace rdb {
Table::Table(std::string 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!");
+ }
+
this->tableName = tableName;
this->typeName = tableName;
this->columns = new std::map<std::string, const Column*>();
}
+
Table::Table(const Table& table) {
tableName = table.tableName;
typeName = table.typeName;
- this->columns = new std::map<std::string, const Column*>(*table.columns);
+ this->columns = new std::map<std::string, const Column*>();
std::map<std::string, const Column*>::iterator it;
- for (it = columns->begin() ; it != columns->end() ; it++) {
+ for (it = table.columns->begin() ; it != table.columns->end() ; it++) {
Column* newColumn = new Column(*it->second);
newColumn->setContainerTable(this);
- columns->insert(it, std::make_pair(it->first, newColumn));
+ columns->insert(std::make_pair(it->first, newColumn));
}
@@ -134,7 +139,12 @@
}
void Table::setTypeName(std::string 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!");
+ }
+
this->typeName = typeName;
+
}
Column* Table::getColumn(std::string columnName) {
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/TableData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/TableData.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/TableData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/TableData.cpp Sat Jul 14 01:42:49 2007
@@ -22,13 +22,13 @@
namespace das {
namespace rdb {
-TableData::TableData(Table& table, ResultSetPtr resultSet) {
+TableData::TableData(const Table& table, ResultSetPtr resultSet) {
this->table = &table;
primaryKeys = new KeyDataList();
dataObject = 0;
const std::map<std::string, const Column*>& columns = table.getColumns();
std::map<std::string, const Column*>::const_iterator columnIterator;
- ResultSetMetaData& metaData = resultSet->getResultSetMetaData();
+ const ResultSetMetaData& metaData = resultSet->getResultSetMetaData();
for (columnIterator = columns.begin() ; columnIterator != columns.end() ;
columnIterator++) {
@@ -57,10 +57,12 @@
for (it = columnsData.begin() ; it != columnsData.end() ; it++) {
delete it->second;
}
+
+ delete primaryKeys;
}
-Table& TableData::getTable(void) const {
+const Table& TableData::getTable(void) const {
return *table;
}
@@ -87,23 +89,6 @@
return true;
- /*if (tableData.table->getTableName() != table->getTableName()) {
- return false;
- }
-
- std::map<std::string, ColumnData*>::const_iterator it;
- std::map<std::string, ColumnData*>::const_iterator it2;
- for (it = primaryKeys.begin(), it2 = tableData.primaryKeys.begin() ;
- it != primaryKeys.end(), it2 != tableData.primaryKeys.end() ; it++, it2++) {
-
- if (*it->second != *it2->second) {
- return false;
- }
-
- }
-
- return true;*/
-
}
bool TableData::operator==(const TableData& tableData) const {
@@ -119,7 +104,7 @@
}
bool TableData::hasPK(void) const {
- return (primaryKeys->size() == table->getPKColumnCount());
+ return (primaryKeys->size() == table->getPKColumnCount() && primaryKeys->size() > 0);
}
commonj::sdo::DataObjectPtr TableData::getGraphObject(void) const {
@@ -136,7 +121,7 @@
}
-KeyDataList& TableData::getPrimaryKeys(void) const {
+const KeyDataList& TableData::getPrimaryKeys(void) const {
return *primaryKeys;
}
@@ -144,9 +129,9 @@
std::map<std::string, ColumnData*>::iterator it = columnsData.find(columnName);
if (it == columnsData.end()) {
- throw std::invalid_argument("Column " + columnName + " does not exist!");
+ throw DASInvalidColumnNameException("Column " + columnName + " does not exist!");
}
-
+
foreignKeys.insert(std::make_pair(columnName, it->second));
}
@@ -212,7 +197,7 @@
if (primaryKeyIterator != keyDataList1->end()) {
if (it->second->getColumn().getSQLType() != primaryKeyIterator->second->getColumn().getSQLType()) {
- int fdjslkf = 0;
+ return false;
}
if (*it->second < *primaryKeyIterator->second) {
@@ -226,6 +211,7 @@
}
return false;
+
}
};
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=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/test/src/main.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/test/src/main.cpp Sat Jul 14 01:42:49 2007
@@ -24,8 +24,7 @@
#include <apache/das/CommandPtr.h>
#include <apache/das/rdb/ResultSet.h>
#include <apache/das/rdb/Statement.h>
-#include <apache/das/rdb/ResultSet.h>
-#include <apache/das/NullPointerException.h>
+#include <apache/das/DASNullPointerException.h>
#include <apache/das/rdb/das_constants.h>
#include <apache/das/rdb/Column.h>
#include <apache/das/rdb/Table.h>
@@ -64,7 +63,7 @@
return new Connection("testDSN", "root", "masterkey");
- } catch (SqlException& ex) {
+ } catch (SQLException& ex) {
cout << "couldn't connect to the data source!" << endl;
system("PAUSE");
exit(1);
@@ -79,7 +78,7 @@
void testPointers() {
cout << "-------------testPointers--------------" << endl;
Connection* conn = getConnection();
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(*conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
Command* comm = new ReadCommandImpl(*das, "select * from company");
CommandPtr comm1 = *comm;
CommandPtr comm2 = comm1;
@@ -94,8 +93,8 @@
try {
comm1->executeQuery();
cout << "OK" << endl;
- } catch (NullPointerException& exp) {
- cout << "NullPointerException" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
}
comm1 = 0;
@@ -104,7 +103,7 @@
try {
comm1->executeQuery();
cout << "not deleted" << endl;
- } catch (NullPointerException& exp) {
+ } catch (DASNullPointerException& exp) {
cout << "OK" << endl;
}
@@ -122,8 +121,8 @@
try {
resultSetPtr->getStatement();
cout << "OK" << endl;
- } catch (NullPointerException& exp) {
- cout << "NullPointerException" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
}
stmtPtr1->executeQuery("select * from employee;");
@@ -131,7 +130,7 @@
try {
resultSetPtr->getStatement();
cout << "not deleted" << endl;
- } catch (NullPointerException& exp) {
+ } catch (DASNullPointerException& exp) {
cout << "OK" << endl;
}
@@ -139,8 +138,8 @@
try {
stmtPtr1->getODBCStatement();
cout << "OK" << endl;
- } catch (NullPointerException& exp) {
- cout << "NullPointerException" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
}
stmtPtr1 = 0;
@@ -150,7 +149,7 @@
try {
stmtPtr1->getODBCStatement();
cout << "not deleted" << endl;
- } catch (NullPointerException& exp) {
+ } catch (DASNullPointerException& exp) {
cout << "OK" << endl;
}
@@ -181,7 +180,7 @@
{
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testIncompleteCompositeRelationship1.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand(
"SELECT department.id, department.name, employee.id, employee.department_id FROM department, employee;");
@@ -202,7 +201,7 @@
{
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testIncompleteCompositeRelationship2.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand(
"SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
@@ -232,7 +231,7 @@
Connection* conn = getConnection();
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testCompositeRelationship.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand(
"SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;");
@@ -266,7 +265,7 @@
cout << "-------------testeCOCRelationship--------------" << endl;
Connection* conn = getConnection();
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(*conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
CommandPtr command = das->createCommand(
"SELECT * FROM department, company;");
@@ -294,7 +293,7 @@
Connection* conn = getConnection();
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testKeyPairColumnTypeNotEqual.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand("SELECT * FROM department, employee;");
commonj::sdo::DataObjectPtr root = command->executeQuery();
@@ -317,7 +316,7 @@
cout << "-------------testUniqueObjectByID--------------" << endl;
Connection* conn = getConnection();
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(*conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
CommandPtr command = das->createCommand("SELECT * FROM company, department where company.id = 1;");
commonj::sdo::DataObjectPtr root = command->executeQuery();
@@ -340,7 +339,7 @@
Connection* conn = getConnection();
{
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testManyRelationship1.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand("SELECT * FROM company, department where company.id = 1;");
commonj::sdo::DataObjectPtr root = command->executeQuery();
@@ -362,7 +361,7 @@
{
ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testManyRelationship2.xml");
- DASImpl* das = (DASImpl*) DASImpl::getFACTORY()->createDAS(config, *conn);
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
CommandPtr command = das->createCommand("SELECT * FROM company, department where company.id = 1;");
commonj::sdo::DataObjectPtr root = command->executeQuery();
@@ -395,7 +394,7 @@
testIncompleteCompositeRelationship();
testCompositeRelationship();
testeCOCRelationship();
- testKeyPairColumnTypeNotEqual();
+ //testKeyPairColumnTypeNotEqual();
testManyRelationship();
system("PAUSE");
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org