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.
19 * @file FIoDbStatement.cpp
20 * @brief This is the implementation file for DbStatement class.
25 #include <FBaseUtilStringUtil.h>
26 #include <FBaseSysLog.h>
27 #include <FIoDbStatement.h>
29 #include <FBase_NativeError.h>
30 #include <FIo_DbStatementImpl.h>
32 #define FIO_STMT_VAR_NUM_MAX 999
34 using namespace Tizen::Base;
36 namespace Tizen { namespace Io
39 DbStatement::DbStatement(void)
40 : __pDbStatementImpl(null)
42 __pDbStatementImpl = new (std::nothrow) _DbStatementImpl;
44 SysTryReturnVoidResult(NID_IO, __pDbStatementImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
47 DbStatement::~DbStatement(void)
49 delete __pDbStatementImpl;
53 DbStatement::BindInt(int columnIndex, int value)
55 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
56 "Wrong column index.");
58 return __pDbStatementImpl->BindInt(columnIndex, value);
62 DbStatement::BindInt64(int columnIndex, long long value)
64 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
65 "Wrong column index.");
67 return __pDbStatementImpl->BindInt64(columnIndex, value);
71 DbStatement::BindDouble(int columnIndex, double value)
73 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
74 "Wrong column index.");
76 return __pDbStatementImpl->BindDouble(columnIndex, value);
80 DbStatement::BindString(int columnIndex, const String& value)
82 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
83 "Wrong column index.");
85 return __pDbStatementImpl->BindString(columnIndex, value);
89 DbStatement::BindBlob(int columnIndex, const ByteBuffer& value)
91 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
92 "Wrong column index.");
94 return __pDbStatementImpl->BindBlob(columnIndex, value);
98 DbStatement::BindBlob(int columnIndex, const void* buffer, int size)
100 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
101 "Wrong column index.");
103 return __pDbStatementImpl->BindBlob(columnIndex, buffer, size);
107 DbStatement::BindDateTime(int columnIndex, const DateTime& value)
109 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
110 "Wrong column index.");
112 return __pDbStatementImpl->BindDateTime(columnIndex, value);
116 DbStatement::BindNull(int columnIndex)
118 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
119 "Wrong column index.");
121 return __pDbStatementImpl->BindNull(columnIndex);