Tag: cws_src680_qiq
User: fs      
Date: 06/05/18 02:17:07

Modified:
 /dba/dbaccess/source/ui/inc/
  defaultobjectnamecheck.hxx

Log:
 #i51143# make checker classes noncopyiable, added new classes for checking 
table and query names against both table and query containers (if the database 
supports queries in queries)

File Changes:

Directory: /dba/dbaccess/source/ui/inc/
=======================================

File [changed]: defaultobjectnamecheck.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +112 -17
----------------------
--- defaultobjectnamecheck.hxx  17 May 2006 11:42:09 -0000      1.1.2.1
+++ defaultobjectnamecheck.hxx  18 May 2006 09:17:04 -0000      1.1.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: defaultobjectnamecheck.hxx,v $
  *
- *  $Revision: 1.1.2.1 $
+ *  $Revision: 1.1.2.2 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/17 11:42:09 $
+ *  last change: $Author: fs $ $Date: 2006/05/18 09:17:04 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -47,9 +47,13 @@
 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
 #include <com/sun/star/container/XNameAccess.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
 /** === end UNO includes === **/
 
 #include <memory>
+#include <boost/noncopyable.hpp>
 
 //........................................................................
 namespace dbaui
@@ -63,7 +67,8 @@
     /** class implementing the IObjectNameCheck interface, and checking given 
object names
         against a simple name container
     */
-    class PlainNameCheck : public IObjectNameCheck
+    class PlainNameCheck :public ::boost::noncopyable
+                         ,public IObjectNameCheck
        {
     private:
         ::std::auto_ptr< PlainNameCheck_Impl >  m_pImpl;
@@ -88,8 +93,6 @@
 
     private:
         PlainNameCheck();                                   // never 
implemented
-        PlainNameCheck( const PlainNameCheck& );            // never 
implemented
-        PlainNameCheck& operator=( const PlainNameCheck& ); // never 
implemented
        };
 
        //====================================================================
@@ -99,7 +102,8 @@
     /** class implementing the IObjectNameCheck interface, and checking given 
object names
         against a hierarchical name container
     */
-    class HierarchicalNameCheck : public IObjectNameCheck
+    class HierarchicalNameCheck :public ::boost::noncopyable
+                                ,public IObjectNameCheck
     {
     private:
         std::auto_ptr< HierarchicalNameCheck_Impl > m_pImpl;
@@ -126,6 +130,97 @@
             const ::rtl::OUString& _rObjectName,
             ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
         ) const;
+
+    private:
+        HierarchicalNameCheck();                                            // 
never implemented
+    };
+
+    //====================================================================
+    //= TablesAndQueriesNameCheck
+    //====================================================================
+    struct TablesAndQueriesNameCheck_Impl;
+    /** class implementing the IObjectNameCheck interface, and checking given 
object names
+        against the tables and queries present at a sdb-level connection
+    */
+    class TablesAndQueriesNameCheck :public ::boost::noncopyable
+                                    ,public IObjectNameCheck
+    {
+    private:
+        std::auto_ptr< TablesAndQueriesNameCheck_Impl > m_pImpl;
+
+    public:
+        /** constructs a TablesAndQueriesNameCheck instance
+        @param _rxSdbLevelConnection
+            a connection supporting the css.sdb.Connection service, in other 
word, it
+            does expose the XTablesSupplier and XQueriesSupplier interfaces.
+        @throws ::com::sun::star::lang::IllegalArgumentException
+            if the given connection is <NULL/>
+        */
+        TablesAndQueriesNameCheck(
+            const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection >& _rxSdbLevelConnection
+        );
+
+        ~TablesAndQueriesNameCheck();
+
+        // IObjectNameCheck overridables
+        virtual bool    isNameValid(
+            const ::rtl::OUString& _rObjectName,
+            ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
+        ) const;
+
+    private:
+        TablesAndQueriesNameCheck();                                           
     // never implemented
+    };
+
+    //====================================================================
+    //= DynamicTableOrQueryNameCheck
+    //====================================================================
+    struct DynamicTableOrQueryNameCheck_Impl;
+    /** class implementing the IObjectNameCheck interface, and checking a 
given name
+        for being valid as either a query or a table name.
+
+        The class can be parametrized to act as either table name or query 
name validator.
+
+        For databases which support queries in queries, the name check is 
implicitly extended
+        to both queries and tables, no matter which category is checked. This 
prevents, for
+        such databases, that users can create a query with the name of an 
existing table,
+        or vice versa.
+
+        @seealso dbtools::DatabaseMetaData::supportsSubqueriesInFrom
+    */
+    class DynamicTableOrQueryNameCheck  :public ::boost::noncopyable
+                                        ,public IObjectNameCheck
+    {
+    private:
+        std::auto_ptr< DynamicTableOrQueryNameCheck_Impl > m_pImpl;
+
+    public:
+        /** constructs a DynamicTableOrQueryNameCheck instance
+        @param _rxSdbLevelConnection
+            a connection supporting the css.sdb.Connection service, in other 
word, it
+            does expose the XTablesSupplier and XQueriesSupplier interfaces.
+        @param _nCommandType
+            specifies whether table names or query names should be checked. 
Only valid values
+            are CommandType::TABLE and CommandType::QUERY.
+        @throws ::com::sun::star::lang::IllegalArgumentException
+            if the given connection is <NULL/>, or the given command type is 
neither
+            CommandType::TABLE nor CommandType::QUERY.
+        */
+        DynamicTableOrQueryNameCheck(
+            const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection >& _rxSdbLevelConnection,
+            sal_Int32 _nCommandType
+        );
+
+        ~DynamicTableOrQueryNameCheck();
+
+        // IObjectNameCheck overridables
+        virtual bool    isNameValid(
+            const ::rtl::OUString& _rObjectName,
+            ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
+        ) const;
+
+    private:
+        DynamicTableOrQueryNameCheck();                                        
        // never implemented
     };
 
 //........................................................................




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to