2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 // This method is for internal use only. The Tizen platform team is not
18 // responsible for any behavioral correctness, consistency, and
19 // security-related issues that might arise after using this method.
21 // @file FIo_DbContextImpl.h
22 // @brief This is the header file for the %_DbContextImpl class.
24 // This header file contains declarations of the %_DbContextImpl class.
26 #ifndef _FIO_INTERNAL_DBCONTEXTIMPL_H_
27 #define _FIO_INTERNAL_DBCONTEXTIMPL_H_
29 #include <FOspConfig.h>
30 #include <FBaseString.h>
32 namespace Tizen { namespace Io
35 class _IDbUserFunctionListener;
36 class _IDbUserAggregateListener;
37 class _IDbUserCollationListener;
39 // This method is for internal use only. The Tizen platform team is not
40 // responsible for any behavioral correctness, consistency, and
41 // security-related issues that might arise after using this method.
43 // @enum _DbUserListenerErrorCode
44 // Defines Database error codes used by user listeners.
47 // @see Tizen::Io::_IDbUserFunctionListener, Tizen::Io::_IDbUserAggregateListener, and
48 // Tizen::Io::_IDbUserCollationListener.
50 enum _DbUserListenerErrorCode
52 DB_USER_LISTENER_OK = 0, /** Successful result */
53 DB_USER_LISTENER_ERROR, /** SQL error */
54 DB_USER_LISTENER_ABORT, /** Callback routine requested an abort */
55 DB_USER_LISTENER_NOMEM, /** Insufficient memory */
58 // This method is for internal use only. The Tizen platform team is not
59 // responsible for any behavioral correctness, consistency, and
60 // security-related issues that might arise after using this method.
63 // @brief This class provides methods for managing the user defined SQL function or aggregate.
65 class _OSP_EXPORT_ _DbContextImpl
66 : public Tizen::Base::Object
70 // This method is for internal use only. The Tizen platform team is not
71 // responsible for any behavioral correctness, consistency, and
72 // security-related issues that might arise after using this method.
74 // This is the default destructor for this class.
77 virtual ~_DbContextImpl(void);
79 // This method is for internal use only. The Tizen platform team is not
80 // responsible for any behavioral correctness, consistency, and
81 // security-related issues that might arise after using this method.
83 // Gets the String value from a parameter of the user defined SQL function or aggregate.
86 // @return An error code
87 // @param[in] argumentIndex The index of the arguments of the user defined SQL function or aggregate. @n
88 // It starts from @c 0.
89 // @param[in] value The String value obtained from the argument pointed by the specified @c argumentIndex.
90 // @exception E_SUCCESS The method was successful. @n
91 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
92 // @exception E_INVALID_ARG If the specified @c argumentIndex is negative. @n
93 // @exception E_DATABASE Failed to retrieve the String value.
95 result GetStringAt(int argumentIndex, Tizen::Base::String& value);
97 // This method is for internal use only. The Tizen platform team is not
98 // responsible for any behavioral correctness, consistency, and
99 // security-related issues that might arise after using this method.
101 // Sets the String value as result to be passsed to database engine.
104 // @return An error code
105 // @param[in] value String value to be set @n
106 // @exception E_SUCCESS The method was successful. @n
107 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
108 // @exception E_DATABASE Failed to set the result.
110 result SetResultString(const Tizen::Base::String& value);
112 // This method is for internal use only. The Tizen platform team is not
113 // responsible for any behavioral correctness, consistency, and
114 // security-related issues that might arise after using this method.
116 // Sets the integer value as result to be passsed to database engine.
119 // @return An error code.
120 // @param[in] result Interger value to be set. @n
121 // @exception E_SUCCESS The method was successful. @n
122 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
123 // @exception E_DATABASE Failed to set the result. @n
125 result SetResultInt(int value);
127 // This method is for internal use only. The Tizen platform team is not
128 // responsible for any behavioral correctness, consistency, and
129 // security-related issues that might arise after using this method.
131 // Sets the double value as result to be passsed to database engine.
134 // @return An error code.
135 // @param[in] result double value to be set. @n
136 // @exception E_SUCCESS The method was successful. @n
137 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
138 // @exception E_DATABASE Failed to set the result. @n
140 result SetResultDouble(double value);
142 // This method is for internal use only. The Tizen platform team is not
143 // responsible for any behavioral correctness, consistency, and
144 // security-related issues that might arise after using this method.
146 // Sets the result error code to be passsed to database engine.
149 // @return An error code.
150 // @param[in] errorCode SQLite error code. @n
151 // @exception E_SUCCESS The method was successful. @n
152 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
153 // @exception E_DATABASE Failed to set the error code. @n
155 result SetResultErrorCode(_DbUserListenerErrorCode errorCode);
157 // This method is for internal use only. The Tizen platform team is not
158 // responsible for any behavioral correctness, consistency, and
159 // security-related issues that might arise after using this method.
161 // Gets the user data if set any while creating SQL functions or aggregate.
164 // @return user data pointer.
165 // @exception E_SUCCESS The method was successful. @n
166 // @exception E_INVALID_STATE This instance has not been properly constructed yet. @n
167 void* GetUserData(void);
169 static void DestroyListener(void* pData);
172 // This method is for internal use only. The Tizen platform team is not
173 // responsible for any behavioral correctness, consistency, and
174 // security-related issues that might arise after using this method.
176 // This is the default constructor for this class.
179 _DbContextImpl(void);
181 static int ConvertDbErrorToNativeSqliteError(int errorCode);
189 _IDbUserFunctionListener* __pUserFunctionListener;
191 _IDbUserAggregateListener* __pUserAggregateListener;
193 _IDbUserCollationListener* __pUserCollationListener;
197 Tizen::Base::String __functionName;
199 Tizen::Base::String __collationName;
201 friend class _DatabaseImpl;
207 #endif //_FIO_INTERNAL_DBCONTEXTIMPL_H_