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.
18 * @file FIoDbStatement.cpp
19 * @brief This is the implementation file for DbStatement class.
24 #include <FBaseUtilStringUtil.h>
25 #include <FBaseSysLog.h>
26 #include <FIoDbStatement.h>
28 #include <FBase_NativeError.h>
29 #include <FIo_DbStatementImpl.h>
31 #define FIO_STMT_VAR_NUM_MAX 999
33 using namespace Tizen::Base;
35 namespace Tizen { namespace Io
38 DbStatement::DbStatement(void)
39 : __pDbStatementImpl(null)
41 __pDbStatementImpl = new (std::nothrow) _DbStatementImpl;
43 SysTryReturnVoidResult(NID_IO, __pDbStatementImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
46 DbStatement::~DbStatement(void)
48 delete __pDbStatementImpl;
52 DbStatement::BindInt(int columnIndex, int value)
54 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
55 "Wrong column index.");
57 return __pDbStatementImpl->BindInt(columnIndex, value);
61 DbStatement::BindInt64(int columnIndex, long long value)
63 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
64 "Wrong column index.");
66 return __pDbStatementImpl->BindInt64(columnIndex, value);
70 DbStatement::BindDouble(int columnIndex, double value)
72 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
73 "Wrong column index.");
75 return __pDbStatementImpl->BindDouble(columnIndex, value);
79 DbStatement::BindString(int columnIndex, const String& value)
81 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
82 "Wrong column index.");
84 return __pDbStatementImpl->BindString(columnIndex, value);
88 DbStatement::BindBlob(int columnIndex, const ByteBuffer& value)
90 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
91 "Wrong column index.");
93 return __pDbStatementImpl->BindBlob(columnIndex, value);
97 DbStatement::BindBlob(int columnIndex, const void* buffer, int size)
99 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
100 "Wrong column index.");
102 return __pDbStatementImpl->BindBlob(columnIndex, buffer, size);
106 DbStatement::BindDateTime(int columnIndex, const DateTime& value)
108 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
109 "Wrong column index.");
111 return __pDbStatementImpl->BindDateTime(columnIndex, value);
115 DbStatement::BindNull(int columnIndex)
117 SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex <= FIO_STMT_VAR_NUM_MAX, E_INVALID_ARG,
118 "Wrong column index.");
120 return __pDbStatementImpl->BindNull(columnIndex);