2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 // This method is for internal use only. The Tizen platform team is not
19 // responsible for any behavioral correctness, consistency, and
20 // security-related issues that might arise after using this method.
22 // @file FIo_DbContextImpl.h
23 // @brief This is the header file for the %_DbContextImpl class.
25 // This header file contains declarations of the %_DbContextImpl class.
27 #ifndef _FIO_INTERNAL_DBCONTEXTIMPL_H_
28 #define _FIO_INTERNAL_DBCONTEXTIMPL_H_
30 #include <FOspConfig.h>
31 #include <FBaseString.h>
33 namespace Tizen { namespace Io
36 class _IDbUserFunctionListener;
37 class _IDbUserAggregateListener;
38 class _IDbUserCollationListener;
40 // This method is for internal use only. The Tizen platform team is not
41 // responsible for any behavioral correctness, consistency, and
42 // security-related issues that might arise after using this method.
44 // @enum _DbUserListenerErrorCode
45 // Defines Database error codes used by user listeners.
48 // @see Tizen::Io::_IDbUserFunctionListener, Tizen::Io::_IDbUserAggregateListener, and
49 // Tizen::Io::_IDbUserCollationListener.
51 enum _DbUserListenerErrorCode
53 DB_USER_LISTENER_OK = 0, /** Successful result */
54 DB_USER_LISTENER_ERROR, /** SQL error */
55 DB_USER_LISTENER_ABORT, /** Callback routine requested an abort */
56 DB_USER_LISTENER_NOMEM, /** Insufficient memory */
59 // This method is for internal use only. The Tizen platform team is not
60 // responsible for any behavioral correctness, consistency, and
61 // security-related issues that might arise after using this method.
64 // @brief This class provides methods for managing the user defined SQL function or aggregate.
66 class _OSP_EXPORT_ _DbContextImpl
67 : public Tizen::Base::Object
71 // This method is for internal use only. The Tizen platform team is not
72 // responsible for any behavioral correctness, consistency, and
73 // security-related issues that might arise after using this method.
75 // This is the default destructor for this class.
78 virtual ~_DbContextImpl(void);
80 // This method is for internal use only. The Tizen platform team is not
81 // responsible for any behavioral correctness, consistency, and
82 // security-related issues that might arise after using this method.
84 // Gets the String value from a parameter of the user defined SQL function or aggregate.
87 // @return An error code
88 // @param[in] argumentIndex The index of the arguments of the user defined SQL function or aggregate. @n
89 // It starts from @c 0.
90 // @param[in] value The String value obtained from the argument pointed by the specified @c argumentIndex.
91 // @exception E_SUCCESS The method was successful. @n
92 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
93 // @exception E_INVALID_ARG If the specified @c argumentIndex is negative. @n
94 // @exception E_DATABASE Failed to retrieve the String value.
96 result GetStringAt(int argumentIndex, Tizen::Base::String& value);
98 // This method is for internal use only. The Tizen platform team is not
99 // responsible for any behavioral correctness, consistency, and
100 // security-related issues that might arise after using this method.
102 // Sets the String value as result to be passsed to database engine.
105 // @return An error code
106 // @param[in] value String value to be set @n
107 // @exception E_SUCCESS The method was successful. @n
108 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
109 // @exception E_DATABASE Failed to set the result.
111 result SetResultString(const Tizen::Base::String& value);
113 // This method is for internal use only. The Tizen platform team is not
114 // responsible for any behavioral correctness, consistency, and
115 // security-related issues that might arise after using this method.
117 // Sets the integer value as result to be passsed to database engine.
120 // @return An error code.
121 // @param[in] result Interger value to be set. @n
122 // @exception E_SUCCESS The method was successful. @n
123 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
124 // @exception E_DATABASE Failed to set the result. @n
126 result SetResultInt(int value);
128 // This method is for internal use only. The Tizen platform team is not
129 // responsible for any behavioral correctness, consistency, and
130 // security-related issues that might arise after using this method.
132 // Sets the double value as result to be passsed to database engine.
135 // @return An error code.
136 // @param[in] result double value to be set. @n
137 // @exception E_SUCCESS The method was successful. @n
138 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
139 // @exception E_DATABASE Failed to set the result. @n
141 result SetResultDouble(double value);
143 // This method is for internal use only. The Tizen platform team is not
144 // responsible for any behavioral correctness, consistency, and
145 // security-related issues that might arise after using this method.
147 // Sets the result error code to be passsed to database engine.
150 // @return An error code.
151 // @param[in] errorCode SQLite error code. @n
152 // @exception E_SUCCESS The method was successful. @n
153 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
154 // @exception E_DATABASE Failed to set the error code. @n
156 result SetResultErrorCode(_DbUserListenerErrorCode errorCode);
158 // This method is for internal use only. The Tizen platform team is not
159 // responsible for any behavioral correctness, consistency, and
160 // security-related issues that might arise after using this method.
162 // Gets the user data if set any while creating SQL functions or aggregate.
165 // @return user data pointer.
166 // @exception E_SUCCESS The method was successful. @n
167 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
168 void* GetUserData(void);
170 static void DestroyListener(void* pData);
173 // This method is for internal use only. The Tizen platform team is not
174 // responsible for any behavioral correctness, consistency, and
175 // security-related issues that might arise after using this method.
177 // This is the default constructor for this class.
180 _DbContextImpl(void);
182 static int ConvertDbErrorToNativeSqliteError(int errorCode);
190 _IDbUserFunctionListener* __pUserFunctionListener;
192 _IDbUserAggregateListener* __pUserAggregateListener;
194 _IDbUserCollationListener* __pUserCollationListener;
198 Tizen::Base::String __functionName;
200 Tizen::Base::String __collationName;
202 friend class _DatabaseImpl;
208 #endif //_FIO_INTERNAL_DBCONTEXTIMPL_H_