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 [1/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...
Author: adrianocrestani
Date: Sat Jul 14 01:42:49 2007
New Revision: 556242
URL: http://svn.apache.org/viewvc?view=rev&rev=556242
Log:
- code revised and added some exceptions on invalid arguments
- created the following DAS exceptions: DASInvalidColumnNameException, DASColumnNotFoundException, DASInvalidPropertyNameException, DASInvalidTypeNameException, DASInvalidTableNameException, DASInvalidSQLTypeException and DASInvalidRelationshipNameException
- renamed NullPointerException class to DASNullPointerException
Added:
incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidPropertyNameException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidTypeNameException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASNullPointerException.h
- copied, changed from r542742, incubator/tuscany/cpp/das/runtime/core/include/apache/das/NullPointerException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SQLException.h
incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASNullPointerException.cpp
- copied, changed from r542742, incubator/tuscany/cpp/das/runtime/core/src/apache/das/NullPointerException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SQLException.cpp
Removed:
incubator/tuscany/cpp/das/runtime/core/include/apache/das/NullPointerException.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SqlException.h
incubator/tuscany/cpp/das/runtime/core/src/apache/das/NullPointerException.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/SqlException.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/RefCountingPointer.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ColumnData.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/include/apache/das/rdb/GraphBuilderMetaData.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/KeyPair.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ReadCommandImpl.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Relationship.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/RelationshipWrapper.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSet.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSetMetaData.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Statement.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h
incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/TableData.h
incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Column.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ColumnData.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ConfigImpl.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Connection.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASImpl.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/KeyPair.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/Relationship.cpp
incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/RelationshipWrapper.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/core/src/apache/das/rdb/TableData.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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -124,7 +124,6 @@
>
<Tool
Name="VCPreBuildEventTool"
- Description=""
CommandLine=""
/>
<Tool
@@ -224,11 +223,19 @@
>
</File>
<File
- RelativePath="..\..\..\runtime\core\src\apache\das\DataGraphPrinter.cpp"
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASInvalidPropertyNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASInvalidTypeNameException.cpp"
>
</File>
<File
- RelativePath="..\..\..\runtime\core\src\apache\das\NullPointerException.cpp"
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASNullPointerException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DataGraphPrinter.cpp"
>
</File>
<File
@@ -243,6 +250,10 @@
RelativePath="..\..\..\runtime\core\src\apache\das\SDODataObjectWrapper.cpp"
>
</File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\StringWrapper.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="apache::das::rdb"
@@ -268,6 +279,10 @@
>
</File>
<File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASColumnNotFoundException.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASFactoryImpl.cpp"
>
</File>
@@ -276,6 +291,22 @@
>
</File>
<File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidColumnNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidRelationshipNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidSQLTypeException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidTableNameException.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilder.cpp"
>
</File>
@@ -316,7 +347,7 @@
>
</File>
<File
- RelativePath="..\..\..\runtime\core\src\apache\das\rdb\SqlException.cpp"
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\SQLException.cpp"
>
</File>
<File
@@ -361,11 +392,19 @@
>
</File>
<File
- RelativePath="..\..\..\runtime\core\include\apache\das\DataGraphPrinter.h"
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASInvalidPropertyNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASInvalidTypeNameException.h"
>
</File>
<File
- RelativePath="..\..\..\runtime\core\include\apache\das\NullPointerException.h"
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASNullPointerException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DataGraphPrinter.h"
>
</File>
<File
@@ -380,6 +419,10 @@
RelativePath="..\..\..\runtime\core\include\apache\das\SDODataObjectWrapper.h"
>
</File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\StringWrapper.h"
+ >
+ </File>
</Filter>
<Filter
Name="apache::das::rdb"
@@ -409,6 +452,10 @@
>
</File>
<File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASColumnNotFoundException.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASFactoryImpl.h"
>
</File>
@@ -417,6 +464,22 @@
>
</File>
<File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidColumnNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidRelationshipNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidSQLTypeException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidTableNameException.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilder.h"
>
</File>
@@ -461,7 +524,7 @@
>
</File>
<File
- RelativePath="..\..\..\runtime\core\include\apache\das\rdb\SqlException.h"
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\SQLException.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=556242&r1=556241&r2=556242
==============================================================================
Binary files - no diff available.
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidPropertyNameException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidPropertyNameException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidPropertyNameException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidPropertyNameException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
+#define DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASInvalidPropertyNameException : public std::exception {
+
+ public:
+ DASInvalidPropertyNameException(std::string message = "");
+ virtual ~DASInvalidPropertyNameException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidTypeNameException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidTypeNameException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidTypeNameException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASInvalidTypeNameException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_TYPE_NAME_EXCEPTION_H
+#define DAS_INVALID_TYPE_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASInvalidTypeNameException : public std::exception {
+
+ public:
+ DASInvalidTypeNameException(std::string message = "");
+ virtual ~DASInvalidTypeNameException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_INVALID_TYPE_NAME_EXCEPTION_H
Copied: incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASNullPointerException.h (from r542742, incubator/tuscany/cpp/das/runtime/core/include/apache/das/NullPointerException.h)
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASNullPointerException.h?view=diff&rev=556242&p1=incubator/tuscany/cpp/das/runtime/core/include/apache/das/NullPointerException.h&r1=542742&p2=incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASNullPointerException.h&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/NullPointerException.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/DASNullPointerException.h Sat Jul 14 01:42:49 2007
@@ -19,23 +19,23 @@
/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
-#ifndef NULL_POINTER_EXCEPTION_H
-#define NULL_POINTER_EXCEPTION_H
+#ifndef DAS_NULL_POINTER_EXCEPTION_H
+#define DAS_NULL_POINTER_EXCEPTION_H
#include <stdexcept>
namespace apache {
namespace das {
-class NullPointerException : public std::exception {
+class DASNullPointerException : public std::exception {
public:
- NullPointerException(void);
- virtual ~NullPointerException(void);
+ DASNullPointerException(std::string message = "");
+ virtual ~DASNullPointerException(void);
};
};
};
-#endif //NULL_POINTER_EXCEPTION_H
+#endif //DAS_NULL_POINTER_EXCEPTION_H
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/RefCountingPointer.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/RefCountingPointer.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/RefCountingPointer.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/RefCountingPointer.h Sat Jul 14 01:42:49 2007
@@ -22,7 +22,7 @@
#include <iostream>
-#include "apache/das/NullPointerException.h"
+#include "apache/das/DASNullPointerException.h"
namespace apache {
namespace das {
Added: 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=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/StringWrapper.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,39 @@
+/*
+ * 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 STRING_WRAPPER_H
+#define STRING_WRAPPER_H
+
+#include <string>
+#include <ctype.h>
+
+namespace apache {
+ namespace das {
+
+class StringWrapper {
+
+ public:
+ static std::string toLower(std::string str);
+ static bool isValidRDBName(std::string name);
+
+};
+
+ };
+};
+
+#endif //STRING_WRAPPER_H
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Column.h Sat Jul 14 01:42:49 2007
@@ -26,6 +26,9 @@
#include <list>
#include "apache/das/rdb/Table.h"
+#include "apache/das/rdb/DASInvalidColumnNameException.h"
+#include "apache/das/DASInvalidPropertyNameException.h"
+#include "apache/das/StringWrapper.h"
#include "apache/das/rdb/das_constants.h"
namespace apache {
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ColumnData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ColumnData.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ColumnData.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ColumnData.h Sat Jul 14 01:42:49 2007
@@ -24,6 +24,7 @@
#include <sqlext.h>
#include <string>
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
#include "apache/das/rdb/Column.h"
#include "apache/das/rdb/TableData.h"
@@ -45,10 +46,10 @@
ColumnData(const Column& column, ResultSetPtr resultSet);
virtual ~ColumnData(void);
- bool operator==(ColumnData& columnData) const;
- bool operator!=(ColumnData& columnData) const;
- bool operator<(ColumnData& columnData) const;
- bool operator>(ColumnData& columnData) const;
+ bool operator==(const ColumnData& columnData) const;
+ bool operator!=(const ColumnData& columnData) const;
+ bool operator<(const ColumnData& columnData) const;
+ bool operator>(const ColumnData& columnData) const;
const Column& getColumn(void) const;
void populateDataGraph(TableData& tableData) const;
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -30,7 +30,7 @@
#include "apache/das/rdb/StatementPtr.h"
#include "apache/das/rdb/Statement.h"
-#include "apache/das/rdb/SqlException.h"
+#include "apache/das/rdb/SQLException.h"
using std::string;
using std::exception;
@@ -45,16 +45,17 @@
SQLHDBC connection;
SQLHENV environment;
std::list<StatementPtr*> statements;
+
+ void setAutoCommit(bool autoCommit);
public:
- Connection(string dsn, string user, string password) throw (SqlException);
- Connection(string connectString) throw (SqlException);
+ Connection(string dsn, string user, string password);
+ Connection(string connectString);
virtual ~Connection(void);
SQLHDBC getODBCConnection(void) const;
void commit(void);
void rollback(void);
- void setAutoCommit(bool autoCommit);
- StatementPtr createStatement(void) throw (SqlException);
+ StatementPtr createStatement(void);
//PreparedStatement& prepareStatement(string sql);
};
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_COLUMN_NOT_FOUND_EXCEPTION_H
+#define DAS_COLUMN_NOT_FOUND_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASColumnNotFoundException : public std::exception {
+
+ public:
+ DASColumnNotFoundException(std::string message = "");
+ virtual ~DASColumnNotFoundException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_COLUMN_NOT_FOUND_EXCEPTION_H
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -53,7 +53,7 @@
ConfigImpl* config;
public:
- static DASFactory* getFACTORY(void);
+ static DASFactory& getFACTORY(void);
DASImpl(const Config& config, Connection& inConnection);
DASImpl(Connection& inConnection);
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_COLUMN_NAME_EXCEPTION_H
+#define DAS_INVALID_COLUMN_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidColumnNameException : public std::exception {
+
+ public:
+ DASInvalidColumnNameException(std::string message = "");
+ virtual ~DASInvalidColumnNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_COLUMN_NAME_EXCEPTION_H
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
+#define DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidRelationshipNameException : public std::exception {
+
+ public:
+ DASInvalidRelationshipNameException(std::string = "");
+ virtual ~DASInvalidRelationshipNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_SQL_TYPE_EXCEPTION_H
+#define DAS_INVALID_SQL_TYPE_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidSQLTypeException : public std::exception {
+
+ public:
+ DASInvalidSQLTypeException(std::string message = "");
+ virtual ~DASInvalidSQLTypeException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_SQL_TYPE_EXCEPTION_H
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_TABLE_NAME_EXCEPTION_H
+#define DAS_INVALID_TABLE_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidTableNameException : public std::exception {
+
+ public:
+ DASInvalidTableNameException(std::string message = "");
+ virtual ~DASInvalidTableNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_TABLE_NAME_EXCEPTION_H
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h Sat Jul 14 01:42:49 2007
@@ -42,16 +42,16 @@
class GraphBuilderMetaData {
private:
- ResultSetMetaData* resultSetMetaData;
+ const ResultSetMetaData* resultSetMetaData;
std::map<std::string, Table*>* graphTables;
std::map<std::string, Relationship*>* relationships;
const ConfigImpl* config;
public:
- GraphBuilderMetaData(const ConfigImpl& config, ResultSetMetaData& resultSet);
+ GraphBuilderMetaData(const ConfigImpl& config, const ResultSetMetaData& resultSet);
virtual ~GraphBuilderMetaData(void);
- ResultSetMetaData& getResultSetMetaData(void) const;
+ const ResultSetMetaData& getResultSetMetaData(void) const;
std::map<std::string, Table*>& getTables(void) const;
const ConfigImpl& getConfig(void) const;
Table* getTable(std::string tableName) const;
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/KeyPair.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/KeyPair.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/KeyPair.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/KeyPair.h Sat Jul 14 01:42:49 2007
@@ -22,6 +22,9 @@
#include <map>
#include <string>
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/DASInvalidColumnNameException.h"
+
namespace apache {
namespace das {
namespace rdb {
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h Sat Jul 14 01:42:49 2007
@@ -26,7 +26,9 @@
#include "commonj/sdo/Type.h"
+#include "apache/das/StringWrapper.h"
#include "apache/das/rdb/das_constants.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
namespace apache {
namespace das {
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ReadCommandImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ReadCommandImpl.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ReadCommandImpl.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ReadCommandImpl.h Sat Jul 14 01:42:49 2007
@@ -35,12 +35,8 @@
class ReadCommandImpl : public CommandImpl {
- private:
- unsigned int startRow;
- unsigned int endRow;
-
public:
- commonj::sdo::DataObjectPtr buildGraph(ResultSetPtr resultSet); /*throws SQLException*/
+ commonj::sdo::DataObjectPtr buildGraph(ResultSetPtr resultSet);
ReadCommandImpl(DASImpl& das, std::string sqlString);
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Relationship.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Relationship.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Relationship.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Relationship.h Sat Jul 14 01:42:49 2007
@@ -24,6 +24,8 @@
#include "apache/das/rdb/KeyPair.h"
#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/rdb/DASInvalidTableNameException.h"
+#include "apache/das/rdb/DASInvalidRelationshipNameException.h"
namespace apache {
namespace das {
@@ -41,6 +43,7 @@
std::map<std::string, const KeyPair*>* keyPairs;
KeyPair& newKeyPair(KeyPair& keyPair);
+
public:
Relationship(const Relationship& relationship);
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/RelationshipWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/RelationshipWrapper.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/RelationshipWrapper.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/RelationshipWrapper.h Sat Jul 14 01:42:49 2007
@@ -30,15 +30,24 @@
namespace rdb {
class RelationshipWrapper {
+
+ private:
+ std::list<std::list<Relationship*>*> relationshipLists;
+ const std::map<std::string, Relationship*>* relationships;
public:
- static std::list<Relationship*>* getRelationshipsByTableName(const std::map<std::string,
+ RelationshipWrapper(void);
+ ~RelationshipWrapper(void);
+
+ std::list<Relationship*>& getRelationshipsByTableName(const std::map<std::string,
Relationship*>& relationships, std::string tableName,
bool pkTable = true);
- static std::list<Relationship*>* getRelationshipsByTableName(const std::list<
+ std::list<Relationship*>& getRelationshipsByTableName(const std::list<
Relationship*>& relationships, std::string tableName,
bool pkTable = true);
+
+ void free(std::list<Relationship*>& relationshipList);
};
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -27,6 +27,7 @@
#include "apache/das/rdb/StatementPtr.h"
#include "apache/das/RefCountingObject.h"
#include "apache/das/rdb/ResultSetMetaData.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
namespace apache {
namespace das {
@@ -48,7 +49,7 @@
ResultSet(StatementPtr aStmt);
virtual ~ResultSet(void);
- ResultSetMetaData& getResultSetMetaData(void) const;
+ const ResultSetMetaData& getResultSetMetaData(void) const;
StatementPtr getStatement(void) const;
wchar_t getSQLChar(unsigned int columnIndex) const;
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSetMetaData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSetMetaData.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSetMetaData.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/ResultSetMetaData.h Sat Jul 14 01:42:49 2007
@@ -24,6 +24,8 @@
#include "apache/das/rdb/Statement.h"
#include "apache/das/rdb/ResultSet.h"
+#include "apache/das/rdb/DASColumnNotFoundException.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
namespace apache {
namespace das {
@@ -34,13 +36,13 @@
class ResultSetMetaData {
private:
- ResultSet* resultSet;
+ const ResultSet* resultSet;
std::map<std::string, unsigned int> columnsIndexes;
static SQLSMALLINT getSQLCType(SQLSMALLINT sqlType);
public:
- ResultSetMetaData(ResultSet* aResultSet);
+ ResultSetMetaData(const ResultSet& aResultSet);
virtual ~ResultSetMetaData(void);
const ResultSet& getResultSet(void) const;
Added: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SQLException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SQLException.h?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SQLException.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/SQLException.h Sat Jul 14 01:42:49 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef SQL_EXCEPTION_H
+#define SQL_EXCEPTION_H
+
+#include <string>
+
+using std::exception;
+using std::string;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class SQLException : public exception{
+ public:
+ SQLException(string errorText);
+ ~SQLException();
+};
+
+ };
+ };
+};
+
+#endif;
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -43,7 +43,6 @@
class Statement : public StatementObject {
friend class ResultSet;
- friend class Database;
private:
SQLHSTMT statementHandle;
@@ -59,7 +58,7 @@
Statement(Connection& connection, SQLHSTMT statementHandle);
virtual ~Statement(void);
virtual SQLHSTMT getODBCStatement(void) const;
- virtual ResultSetPtr executeQuery(string sql); /*throws SQLException*/
+ virtual ResultSetPtr executeQuery(string sql);
virtual void close(void);
virtual Connection& getConnection(void) const;
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/Table.h Sat Jul 14 01:42:49 2007
@@ -33,6 +33,7 @@
#include "apache/das/rdb/Column.h"
#include "apache/das/rdb/DASImpl.h"
#include "apache/das/rdb/ODBCTypeHelper.h"
+#include "apache/das/DASInvalidTypeNameException.h"
#include "commonj/sdo/DataFactory.h"
#include "commonj/sdo/DataObject.h"
Modified: incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/TableData.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/TableData.h?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/TableData.h (original)
+++ incubator/tuscany/cpp/das/runtime/core/include/apache/das/rdb/TableData.h Sat Jul 14 01:42:49 2007
@@ -44,17 +44,17 @@
class TableData {
private:
- Table* table;
+ const Table* table;
commonj::sdo::DataObjectPtr dataObject;
std::map<std::string, ColumnData*> columnsData;
KeyDataList* primaryKeys;
std::map<std::string, ColumnData*> foreignKeys;
public:
- TableData(Table& table, ResultSetPtr resultSet);
+ TableData(const Table& table, ResultSetPtr resultSet);
virtual ~TableData(void);
- Table& getTable(void) const;
+ const Table& getTable(void) const;
bool hasPK(void) const;
commonj::sdo::DataObjectPtr getGraphObject(void) const;
@@ -66,7 +66,7 @@
bool operator<(const KeyDataList* primaryKeyList) const;
ColumnData* getColumnData(std::string columnName) const;
- KeyDataList& getPrimaryKeys(void) const;
+ const KeyDataList& getPrimaryKeys(void) const;
void addFK(std::string columnName);
void populateDataGraph(GraphBuilder& graphBuilder);
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,30 @@
+/*
+ * 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/DASInvalidPropertyNameException.h"
+
+namespace apache {
+ namespace das {
+
+ DASInvalidPropertyNameException::DASInvalidPropertyNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidPropertyNameException::~DASInvalidPropertyNameException(void) {}
+
+ };
+};
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,30 @@
+/*
+ * 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/DASInvalidTypeNameException.h"
+
+namespace apache {
+ namespace das {
+
+DASInvalidTypeNameException::DASInvalidTypeNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidTypeNameException::~DASInvalidTypeNameException(void) {}
+
+ };
+};
Copied: incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASNullPointerException.cpp (from r542742, incubator/tuscany/cpp/das/runtime/core/src/apache/das/NullPointerException.cpp)
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASNullPointerException.cpp?view=diff&rev=556242&p1=incubator/tuscany/cpp/das/runtime/core/src/apache/das/NullPointerException.cpp&r1=542742&p2=incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASNullPointerException.cpp&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/NullPointerException.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/DASNullPointerException.cpp Sat Jul 14 01:42:49 2007
@@ -17,14 +17,14 @@
* under the License.
*/
-#include "apache/das/NullPointerException.h"
+#include "apache/das/DASNullPointerException.h"
namespace apache {
namespace das {
-NullPointerException::NullPointerException(void) {}
+DASNullPointerException::DASNullPointerException(std::string message) : std::exception(message.c_str()) {}
-NullPointerException::~NullPointerException(void) {}
+DASNullPointerException::~DASNullPointerException(void) {}
};
};
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=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/RefCountingPointer.cpp Sat Jul 14 01:42:49 2007
@@ -117,7 +117,7 @@
/*SDO_API*/ T* RefCountingPointer<T>::operator->() const
{
if (pointee == 0)
- throw NullPointerException();
+ throw DASNullPointerException();
return pointee;
}
Added: 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=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/StringWrapper.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include "apache/das/StringWrapper.h"
+
+namespace apache {
+ namespace das {
+
+std::string StringWrapper::toLower(std::string str) {
+ unsigned int length = str.length();
+
+ for(int i=0; i != length; i++) {
+ str[i] = tolower(str[i]);
+ }
+
+ return str;
+
+}
+
+bool StringWrapper::isValidRDBName(std::string name) {
+
+ if (name.find(' ') != -1 || name.find('\t') != -1 || name.find('\n') != -1 || name.find('\r') != -1) {
+ return false;
+ } else {
+ return true;
+ }
+
+}
+
+ };
+};
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -32,6 +32,11 @@
}
Column::Column(std::string columnName, SQLSMALLINT sqlType) {
+
+ if (!StringWrapper::isValidRDBName(columnName)) {
+ throw DASInvalidColumnNameException("Column name must not contain whitespace characters!");
+ }
+
this->columnName = columnName;
this->propertyName = columnName;
this->sqlType = sqlType;
@@ -59,7 +64,13 @@
}
void Column::setPropertyName(std::string propertyName) {
+
+ if (!StringWrapper::isValidRDBName(propertyName)) {
+ throw DASInvalidPropertyNameException("Property name must not contain whitespace characters!");
+ }
+
this->propertyName = propertyName;
+
}
std::string Column::getPropertyName(void) const {
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ColumnData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ColumnData.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ColumnData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ColumnData.cpp Sat Jul 14 01:42:49 2007
@@ -25,6 +25,10 @@
ColumnData::ColumnData(const Column& column, ResultSetPtr resultSet) {
this->column = &column;
+ if (column.getContainerTable() == 0) {
+ throw std::invalid_argument("Column table not set");
+ }
+
switch (column.getSQLType()) {
case SQL_INTEGER :
@@ -35,6 +39,7 @@
data = new long;
long* aux = (long*) data;
*aux = sqlInteger;
+
}
break;
@@ -100,7 +105,7 @@
break;
default :
- throw std::logic_error("Invalid sql type!");
+ throw DASInvalidSQLTypeException();
}
@@ -129,10 +134,6 @@
break;
case SQL_DOUBLE :
- tableData.getGraphObject()->setDouble(column->getName().c_str(), *((double*) data));
-
- break;
-
case SQL_FLOAT :
tableData.getGraphObject()->setDouble(column->getName().c_str(), *((double*) data));
@@ -153,16 +154,16 @@
break;
default :
- throw std::logic_error("Invalid sql type!");
+ throw DASInvalidSQLTypeException();
}
}
-bool ColumnData::operator==(ColumnData& columnData) const {
+bool ColumnData::operator==(const ColumnData& columnData) const {
if (column->getSQLType() != columnData.column->getSQLType()) {
- throw std::invalid_argument("Different sql types!");
+ throw DASInvalidSQLTypeException("Different sql types!");
}
switch (column->getSQLType()) {
@@ -208,7 +209,7 @@
break;
default :
- throw std::logic_error("Invalid sql type!");
+ throw DASInvalidSQLTypeException();
}
@@ -216,7 +217,7 @@
}
-bool ColumnData::operator!=(ColumnData& columnData) const {
+bool ColumnData::operator!=(const ColumnData& columnData) const {
return !(*this == columnData);
}
@@ -224,10 +225,10 @@
return *column;
}
-bool ColumnData::operator<(ColumnData& columnData) const {
+bool ColumnData::operator<(const ColumnData& columnData) const {
if (column->getSQLType() != columnData.column->getSQLType()) {
- throw std::invalid_argument("Different sql types!");
+ throw DASInvalidSQLTypeException("Different sql types!");
}
switch (column->getSQLType()) {
@@ -273,7 +274,7 @@
break;
default :
- throw std::logic_error("Invalid sql type!");
+ throw DASInvalidSQLTypeException();
}
@@ -281,10 +282,10 @@
}
-bool ColumnData::operator>(ColumnData& columnData) const {
+bool ColumnData::operator>(const ColumnData& columnData) const {
if (column->getSQLType() != columnData.column->getSQLType()) {
- throw std::invalid_argument("Different sql types!");
+ throw DASInvalidSQLTypeException("Different sql types!");
}
switch (column->getSQLType()) {
@@ -330,7 +331,7 @@
break;
default :
- throw std::logic_error("Invalid sql type!");
+ throw DASInvalidSQLTypeException();
}
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ConfigImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ConfigImpl.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ConfigImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ConfigImpl.cpp Sat Jul 14 01:42:49 2007
@@ -31,8 +31,8 @@
ConfigImpl::ConfigImpl(const Config& config) : Config(config) {
ConfigImpl& thisConfig = (ConfigImpl&) config;
- tables = new std::map<std::string, const Table*>(*thisConfig.tables);
- relationships = new std::map<std::string, const Relationship*>(*thisConfig.relationships);
+ tables = new std::map<std::string, const Table*>();
+ relationships = new std::map<std::string, const Relationship*>();
std::map<std::string, const Table*>::iterator tableIterator;
std::map<std::string, const Relationship*>::iterator relationshipIterator;
@@ -40,14 +40,14 @@
for (tableIterator = tables->begin() ; tableIterator != tables->end() ;
tableIterator++) {
- tables->insert(tableIterator, std::make_pair(tableIterator->first, new Table(*tableIterator->second)));
+ tables->insert(std::make_pair(tableIterator->first, new Table(*tableIterator->second)));
}
for (relationshipIterator = relationships->begin() ;
relationshipIterator != relationships->end() ; relationshipIterator++) {
- relationships->insert(relationshipIterator, std::make_pair(relationshipIterator->first,
+ relationships->insert(std::make_pair(relationshipIterator->first,
new Relationship(*relationshipIterator->second)));
}
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -22,7 +22,7 @@
namespace das {
namespace rdb {
-Connection::Connection(string dsn, string user, string password) throw (SqlException){
+Connection::Connection(string dsn, string user, string password) {
SQLRETURN result;
SQLINTEGER error;
@@ -34,14 +34,14 @@
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");
+ 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");
+ throw SQLException("Error to set the environment handle - SQLHENV");
}
//Allocate connection handle
@@ -49,7 +49,7 @@
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
SQLFreeHandle(SQL_HANDLE_ENV, environment);
- throw SqlException("Error to alloc the connection handle - SQLHDBC");
+ throw SQLException("Error to alloc the connection handle - SQLHDBC");
}
setAutoCommit(false);
@@ -69,12 +69,12 @@
string error("Error to establish the connection.\nSQLSTATE: ");
error += reinterpret_cast<char*>(&sqlStat);
- throw SqlException(error.c_str());
+ throw SQLException(error);
}
}
-Connection::Connection(string connectString) throw (SqlException) {
+Connection::Connection(string connectString) {
SQLRETURN result;
SQLINTEGER error;
@@ -87,14 +87,14 @@
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");
+ 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");
+ throw SQLException("Error to set the environment handle - SQLHENV");
}
//Allocate connection handle
@@ -102,7 +102,7 @@
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
SQLFreeHandle(SQL_HANDLE_ENV, environment);
- throw SqlException("Error to alloc the connection handle - SQLHDBC");
+ throw SQLException("Error to alloc the connection handle - SQLHDBC");
}
setAutoCommit(false);
@@ -124,7 +124,7 @@
string error("Error to establish the connection.\nSQLSTATE: ");
error += reinterpret_cast<char*>(&sqlStat);
- throw SqlException(error.c_str());
+ throw SQLException(error);
}
}
@@ -153,11 +153,21 @@
}
void Connection::commit(void){
- SQLEndTran(SQL_HANDLE_DBC, connection, SQL_COMMIT);
+ SQLRETURN result = SQLEndTran(SQL_HANDLE_DBC, connection, SQL_COMMIT);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ throw SQLException("Commit error");
+ }
+
}
void Connection::rollback(void){
- SQLEndTran(SQL_HANDLE_DBC, connection, SQL_ROLLBACK);
+ SQLRETURN result = SQLEndTran(SQL_HANDLE_DBC, connection, SQL_ROLLBACK);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ throw SQLException("Rollback error");
+ }
+
}
void Connection::setAutoCommit(bool autoCommit){
@@ -167,17 +177,12 @@
SQLSetConnectAttr(connection,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF, SQL_IS_INTEGER );
}
-StatementPtr Connection::createStatement(void) throw (SqlException){
+StatementPtr Connection::createStatement(void) {
SQLHSTMT statementHandle;
SQLRETURN result = SQLAllocHandle(SQL_HANDLE_STMT, connection, &statementHandle);
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
-
- SQLDisconnect(connection);
- SQLFreeHandle(SQL_HANDLE_DBC, connection);
- SQLFreeHandle(SQL_HANDLE_ENV, environment);
-
- throw SqlException("Error to alloc the statement handle - SQLSTMT");
+ throw SQLException("Error to alloc the statement handle - SQLSTMT");
}
std::list<StatementPtr*>::iterator it;
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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/DASColumnNotFoundException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASColumnNotFoundException::DASColumnNotFoundException(std::string message) : std::exception(message.c_str()) {}
+
+DASColumnNotFoundException::~DASColumnNotFoundException(void) {}
+
+ };
+ };
+};
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp Sat Jul 14 01:42:49 2007
@@ -30,7 +30,7 @@
return new DASImpl(connection);
}
-DAS* DASFactoryImpl::createDAS(const Config& config, rdb::Connection& connection) {
+DAS* DASFactoryImpl::createDAS(const Config& config, Connection& connection) {
return new DASImpl(config, connection);
}
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -25,9 +25,9 @@
DASFactory* DASImpl::FACTORY = new DASFactoryImpl();
DASImpl::DASImpl(Connection& inConnection) {
- if (FACTORY == 0) {
+ /*if (FACTORY == 0) {
FACTORY = new DASFactoryImpl();
- }
+ }*/
createdCommands = new std::list<CommandPtr*>();
config = new ConfigImpl();
@@ -36,9 +36,9 @@
}
DASImpl::DASImpl(const Config& config, Connection& inConnection) {
- if (FACTORY == 0) {
+ /*if (FACTORY == 0) {
FACTORY = new DASFactoryImpl();
- }
+ }*/
createdCommands = new std::list<CommandPtr*>();
this->config = new ConfigImpl((ConfigImpl&) config);
@@ -47,9 +47,9 @@
}
DASImpl::DASImpl(const Config& config) {
- if (FACTORY == 0) {
+ /*if (FACTORY == 0) {
FACTORY = new DASFactoryImpl();
- }
+ }*/
createdCommands = new std::list<CommandPtr*>();
this->config = new ConfigImpl((ConfigImpl&) config);
@@ -70,8 +70,8 @@
}
-DASFactory* DASImpl::getFACTORY(void) {
- return FACTORY;
+DASFactory& DASImpl::getFACTORY(void) {
+ return *FACTORY;
}
void DASImpl::setConnection(Connection* aConnection) {
@@ -121,11 +121,11 @@
void DASImpl::closeConnection(void) {
- if (connection != NULL) {
+ if (connection != 0) {
//try {
delete connection;
- connection = NULL;
+ connection = 0;
//} catch (SQLException e) {
// throw new RuntimeException(e);
//}
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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/DASInvalidColumnNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidColumnNameException::DASInvalidColumnNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidColumnNameException::~DASInvalidColumnNameException(void) {}
+
+ };
+ };
+};
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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/DASInvalidRelationshipNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidRelationshipNameException::DASInvalidRelationshipNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidRelationshipNameException::~DASInvalidRelationshipNameException(void) {}
+
+ };
+ };
+};
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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/DASInvalidSQLTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidSQLTypeException::DASInvalidSQLTypeException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidSQLTypeException::~DASInvalidSQLTypeException(void) {}
+
+ };
+ };
+};
Added: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp?view=auto&rev=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp Sat Jul 14 01:42:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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/DASInvalidTableNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ DASInvalidTableNameException::DASInvalidTableNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidTableNameException::~DASInvalidTableNameException(void) {}
+
+ };
+ };
+};
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp Sat Jul 14 01:42:49 2007
@@ -27,7 +27,7 @@
commonj::sdo::DataFactoryPtr dataFactory = graphBuilderMetaData->createGraph();
this->resultSet = resultSet;
- const std::map<std::string, Table*> tables = graphBuilderMetaData->getTables();
+ const std::map<std::string, Table*>& tables = graphBuilderMetaData->getTables();
while (resultSet->next()) {
@@ -92,10 +92,10 @@
std::map<std::string, Table*>::const_iterator it2;
std::map<std::string, Relationship*>& relationships = graphBuilderMetaData->getRelationships();
- std::map<std::string, std::map<KeyDataList*, TableData*, KeyDataCmp>*> tablesDataByPK;
+ std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*> tablesDataByPK;
std::map<std::string, std::list<TableData*>*>::iterator it3;
for (it3 = tablesData.begin() ; it3 != tablesData.end() ; it3++) {
- std::map<KeyDataList*, TableData*, KeyDataCmp>* tableList = new std::map<KeyDataList*, TableData*, KeyDataCmp>();
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>* tableList = new std::map<const KeyDataList*, TableData*, KeyDataCmp>();
std::list<TableData*>::iterator it4;
for (it4 = it3->second->begin() ; it4 != it3->second->end() ; it4++) {
@@ -109,19 +109,19 @@
}
for (it2 = tables.begin() ; it2 != tables.end() ; it2++) {
- std::list<Relationship*>* fkTableRelationships = RelationshipWrapper::
- getRelationshipsByTableName(relationships, it2->first, false);
+ RelationshipWrapper relationshipWrapper;
+ std::list<Relationship*>& fkTableRelationships = relationshipWrapper.getRelationshipsByTableName(relationships, it2->first, false);
std::list<Relationship*>::iterator relationshipIterator;
- for (relationshipIterator = fkTableRelationships->begin() ;
- relationshipIterator != fkTableRelationships->end() ; relationshipIterator++) {
+ for (relationshipIterator = fkTableRelationships.begin() ;
+ relationshipIterator != fkTableRelationships.end() ; relationshipIterator++) {
std::list<TableData*>& fkTablesList =
*((std::map<std::string, std::list<TableData*>*>::iterator) tablesData.find(
(*relationshipIterator)->getFKTableName()))->second;
- std::map<KeyDataList*, TableData*, KeyDataCmp>& pkTablesData =
- *((std::map<std::string, std::map<KeyDataList*, TableData*, KeyDataCmp>*>::iterator)
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>& pkTablesData =
+ *((std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*>::iterator)
tablesDataByPK.find((*relationshipIterator)->getPKTableName()))->second;
std::list<TableData*>::iterator tableDataIterator;
@@ -145,7 +145,7 @@
}
- std::map<KeyDataList*, TableData*, KeyDataCmp>::iterator pkTablaDataIterator =
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>::iterator pkTablaDataIterator =
pkTablesData.find(&fksColumnList);
if (pkTablaDataIterator != pkTablesData.end()) {
@@ -167,11 +167,9 @@
}
- delete fkTableRelationships;
-
}
- std::map<std::string, std::map<KeyDataList*, TableData*, KeyDataCmp>*>::iterator tablesDataByPKIterator;
+ std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*>::iterator tablesDataByPKIterator;
for (tablesDataByPKIterator = tablesDataByPK.begin() ; tablesDataByPKIterator !=
tablesDataByPK.end() ; tablesDataByPKIterator++) {
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp Sat Jul 14 01:42:49 2007
@@ -22,7 +22,7 @@
namespace das {
namespace rdb {
-GraphBuilderMetaData::GraphBuilderMetaData(const ConfigImpl& config, ResultSetMetaData& resultSetMetaData) {
+GraphBuilderMetaData::GraphBuilderMetaData(const ConfigImpl& config, const ResultSetMetaData& resultSetMetaData) {
this->resultSetMetaData = &resultSetMetaData;
this->config = &config;
graphTables = new std::map<std::string, Table*>();
@@ -156,7 +156,7 @@
if (contains) {
relationships->insert(std::make_pair(
relationship.getPKTableName() + "." + relationship.getFKTableName(),
- &relationship));
+ new Relationship(relationship)));
}
@@ -203,7 +203,7 @@
Relationship* relationship =
new Relationship(pkTableName, table.getTableName());
- relationship->addKeyPair(KeyPair("id", columnName));
+ relationship->addKeyPair("id", columnName);
relationships->insert(std::make_pair(relationship->getName(), relationship));
}
@@ -219,10 +219,15 @@
}
GraphBuilderMetaData::~GraphBuilderMetaData(void) {
- std::map<std::string, Table*>::iterator it;
+ std::map<std::string, Table*>::iterator itTables;
+ std::map<std::string, Relationship*>::iterator itRelationships;
- for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
- delete it->second;
+ for (itTables = graphTables->begin() ; itTables != graphTables->end() ; itTables++) {
+ delete itTables->second;
+ }
+
+ for (itRelationships = relationships->begin() ; itRelationships != relationships->end() ; itRelationships++) {
+ delete itRelationships->second;
}
delete graphTables;
@@ -264,7 +269,7 @@
}
-ResultSetMetaData& GraphBuilderMetaData::getResultSetMetaData(void) const {
+const ResultSetMetaData& GraphBuilderMetaData::getResultSetMetaData(void) const {
return *resultSetMetaData;
}
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=556242&r1=556241&r2=556242
==============================================================================
--- 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 Sat Jul 14 01:42:49 2007
@@ -30,6 +30,15 @@
}
KeyPair::KeyPair(std::string pkColumnName, std::string fkColumnName) {
+
+ if (!StringWrapper::isValidRDBName(pkColumnName)) {
+ throw DASInvalidColumnNameException("PK column name must not contain whitespace characters!");
+ }
+
+ if (!StringWrapper::isValidRDBName(fkColumnName)) {
+ throw DASInvalidColumnNameException("FK column name must not contain whitespace characters!");
+ }
+
this->pkColumnName = pkColumnName;
this->fkColumnName = fkColumnName;
relationship = 0;
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp Sat Jul 14 01:42:49 2007
@@ -26,7 +26,7 @@
switch (sqlType) {
- case SQL_CHAR :
+ case SQL_INTEGER :
return "Integer";
case SQL_REAL :
@@ -36,14 +36,18 @@
case SQL_DOUBLE :
return "Double";
- default :
+ case SQL_VARCHAR :
return "String";
+
+ default :
+ throw DASInvalidSQLTypeException("Invalid sql type: " + sqlType + (std::string) "");
}
}
const SQLSMALLINT ODBCTypeHelper::getSQLType(std::string sqlTypeName) {
+ sqlTypeName = StringWrapper::toLower(sqlTypeName);
if ("varchar" == sqlTypeName) {
return SQL_VARCHAR;
@@ -62,7 +66,7 @@
} else if ("wchar" == sqlTypeName) {
return SQL_WCHAR;
} else {
- throw std::invalid_argument("sql type does not exist: " + sqlTypeName);
+ throw DASInvalidSQLTypeException("sql type does not exist: " + sqlTypeName);
}
}
Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp?view=diff&rev=556242&r1=556241&r2=556242
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp Sat Jul 14 01:42:49 2007
@@ -28,81 +28,16 @@
commonj::sdo::DataObjectPtr ReadCommandImpl::executeQuery(void) {
ResultSetPtr results = statement->executeQuery(sql);
- commonj::sdo::DataObjectPtr root = buildGraph(results);
-
- return root;
+ commonj::sdo::DataObjectPtr root = buildGraph(results);
+ return root;
+
}
-commonj::sdo::DataObjectPtr ReadCommandImpl::buildGraph(ResultSetPtr resultSet) { /*throws SQLException*/
+commonj::sdo::DataObjectPtr ReadCommandImpl::buildGraph(ResultSetPtr resultSet) {
GraphBuilder graphBuilder((ConfigImpl&) ((DASImpl*) das)->getConfig(), resultSet);
- commonj::sdo::DataObjectPtr root = graphBuilder.getRoot();
- //root->getChangeSummary()->beginLogging();
-
- //printDataGraph(dataFactory);
- //commonj::sdo::ChangeSummaryPtr changeSummary = rootDataObject->getChangeSummary();
-
- return root;
-
- /*int columnCount = getColumnCount(statement);
- int col;
- int i;
- SQLSMALLINT sqlType = 0;
- std::list<SQLSMALLINT> columnTypes;
- std::string columnName;
-
- dataFactory->addType(DAS_NAMESPACE, DAS_ROOT);
- const commonj::sdo::Type& dasType = dataFactory->getType(DAS_NAMESPACE, DAS_ROOT);
- const commonj::sdo::Type& intType = dataFactory->getType("commonj.sdo","Integer");
- const commonj::sdo::Type& stringType = dataFactory->getType("commonj.sdo","String");*/
-
- //for (col = 1 ; col <= columnCount ; col++) {
- // sqlType = getSQLColumnType(statement, col);
- // columnName = getColumnName(statement, col);
- // columnTypes.push_back(sqlType);
- //
- // switch (sqlType) {
-
- // case SQL_INTEGER :
- // dataFactory->addPropertyToType(dasType, columnName, intType);
- // break;
-
- // case SQL_CHAR :
- // dataFactory->addPropertyToType(dasType, columnName, stringType);
- // break;
-
- // default :
- // ;
- // //throw exception
-
- // }
- //
- //}
-
- /*commonj::sdo::DataObjectPtr rootDataObject = dataFactory->create(DAS_NAMESPACE, DAS_ROOT);
- SQLRETURN sqlRet = SQLFetch(statement);
-
- while (sqlRet == SQL_SUCCESS) {
- std::list<SQLSMALLINT>::iterator it = columnTypes.begin();
- int col = 0;
-
- while (it != columnTypes.end()) {
- SQLSMALLINT sqlType = *it;
-
- if (sqlType == SQL_INTEGER) {
- rootDataObject->setInteger(col, getIntegerData(statement, col + 1));
-
- } else if (sqlType == SQL_CHAR) {
- rootDataObject->setCString(col, getStringData(statement, col + 1));
- }
-
- sqlRet = SQLFetch(statement);
- col++;
- it++;
-
- }
-
- }*/
+
+ return graphBuilder.getRoot();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org