--- /dev/null
+#!/bin/sh
+
+source ./config
+
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+. ./config
+
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
#!/bin/sh
-export TET_INSTALL_PATH=/home/deuk/repository/tetware/TETware # local tetware path
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-export TET_ROOT=$TET_TARGET_PATH
+. ./_export_env.sh # setting environment variables
export TET_SUITE_ROOT=`pwd`
FILE_NAME_EXTENSION=`date +%s`
tcc -c -p ./
tcc -b -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+PKG_NAME=libslp-db-util
+TET_INSTALL_HOST_PATH=/var/tmp/TETware
+TET_INSTALL_TARGET_PATH=/opt/home/TETware
#!/bin/sh
export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware
+#export TET_INSTALL_PATH=/scratchbox/tetware
export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
export PATH=$TET_TARGET_PATH/bin:$PATH
export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
--- /dev/null
+#!/bin/sh
+
+. ./config
+
+TC_PATH=/opt/home/$PKG_NAME
+
+echo $TC_PATH
+
+sudo rm -rf ./results/*
+
+sdb shell "mkdir -p $TC_PATH"
+
+sdb shell "rm -rf $TC_PATH/results/*"
+
+sdb push . $TC_PATH
+
+
--- /dev/null
+#!/bin/sh
+
+source ./_export_target_env.sh
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
TARGETS = utc_ApplicationFW_db_util_close \
utc_ApplicationFW_db_util_open \
utc_ApplicationFW_db_util_open_with_options \
+ utc_ApplicationFW_db_util_create_collation \
PKGS = sqlite3 dlog db-util
/unit/utc_ApplicationFW_db_util_close
/unit/utc_ApplicationFW_db_util_open
/unit/utc_ApplicationFW_db_util_open_with_options
+/unit/utc_ApplicationFW_db_util_create_collation
--- /dev/null
+/*
+ * libslp-db-util
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <tet_api.h>
+#include <db-util.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_db_util_create_collation_func_01(void);
+static void utc_ApplicationFW_db_util_create_collation_func_02(void);
+
+static sqlite3* db_hd = NULL;
+char* db_path = "test.db";
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ { utc_ApplicationFW_db_util_create_collation_func_01, POSITIVE_TC_IDX },
+ { utc_ApplicationFW_db_util_create_collation_func_02, NEGATIVE_TC_IDX },
+ { NULL, 0 }
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+ if (db_hd)
+ db_util_close(db_hd);
+ db_hd = NULL;
+}
+
+/**
+ * @brief Positive test case of db_util_create_collation()
+ */
+static void utc_ApplicationFW_db_util_create_collation_func_01(void)
+{
+ int r = 0;
+
+ r = db_util_open(db_path, &db_hd, 0);
+ if (r != SQLITE_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = db_util_create_collation(db_hd, DB_UTIL_COL_UCA, DB_UTIL_COL_UTF8, "text");
+ if (r != SQLITE_OK) {
+ tet_infoline("db_util_create_collation() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of db_util_create_collation()
+ */
+static void utc_ApplicationFW_db_util_create_collation_func_02(void)
+{
+ int r = 0;
+
+ r = db_util_create_collation(NULL, DB_UTIL_COL_UCA, DB_UTIL_COL_UTF8, NULL);
+ if (r == SQLITE_OK) {
+ tet_infoline("db_util_create_collation() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+
+ tet_result(TET_PASS);
+}
DB_UTIL_TRACE_DEBUG("db_util_create_collation start");
+ if( (!db_handle) || (!col_name) ) {
+ DB_UTIL_TRACE_ERROR("wrong input param");
+ return DB_UTIL_ERROR;
+ }
+
ret = __db_util_dl_load_icu();
DB_UTIL_RETV_IF(ret != DB_UTIL_OK, DB_UTIL_ERROR);
#endif
default :
DB_UTIL_TRACE_WARNING("wrong collate input type");
+ ret = DB_UTIL_ERROR;
}
if(ret != DB_UTIL_OK)
#include <db-util-common.h>
+/**
+ * @addtogroup DB_UTIL
+ * @{
+ */
+
/*
- * Collations Types
+ * @brief Collations Types
*
* These types are intended for use in the
* 2nd parameter to the [db_util_create_collation()] interface.
*/
typedef enum {
- DB_UTIL_COL_UCA,
- DB_UTIL_COL_LS_AS_CI,
- DB_UTIL_COL_LS_AI_CI,
- DB_UTIL_COL_LS_AI_CI_LC,
- DB_UTIL_COL_KO_IC, //deprecated
- DB_UTIL_COL_KO_IC_LC //deprecated
+ DB_UTIL_COL_UCA, /**< */
+ DB_UTIL_COL_LS_AS_CI, /**< */
+ DB_UTIL_COL_LS_AI_CI, /**< */
+ DB_UTIL_COL_LS_AI_CI_LC, /**< */
+ DB_UTIL_COL_KO_IC, //deprecated
+ DB_UTIL_COL_KO_IC_LC //deprecated
} db_util_collate_type;
/*
- * Text Encodings
+ * @brief Text Encodings
*
* These encodings are intended for use in the
* 3rd parameter to the [db_util_create_collation()] interface.
*/
typedef enum {
- DB_UTIL_COL_UTF8 = SQLITE_UTF8,
- DB_UTIL_COL_UTF16 = SQLITE_UTF16
+ DB_UTIL_COL_UTF8 = SQLITE_UTF8, /**< */
+ DB_UTIL_COL_UTF16 = SQLITE_UTF16 /**< */
} db_util_collate_textrep;
-
/**
- * @defgroup DB_UTIL
- * @ingroup StorageFW
- * @{
- */
-
-/**
- * @fn int db_util_create_collation(sqlite3 *db_handle, db_util_collate_type type, db_util_collate_textrep text_type, char* col_name);
- * This function defines a new collating sequences with the database connection specified as the firtst argument.
- * This function is needed to be invoked after [db_util_open()].
- *
- * @param[in] Db connection handle to create collation with
- * @param[in] Collation type. This value must be one of the [db_util_collate_type]
- * @param[in] Encoding of text passed to the collating function callback
- * @param[in] The name of collation(UTF-8 string)
- * return This function returns DB_UTIL_OK or error code on failure
- * @exception None
- * @remarks None
+ * @brief This function defines a new collating sequences with the database connection specified as the firtst argument.
+ * @remarks This function is needed to be invoked after [db_util_open()].
+ * @param [in] Db connection handle to create collation with
+ * @param [in] Collation type. This value must be one of the [db_util_collate_type]
+ * @param [in] Encoding of text passed to the collating function callback
+ * @param [in] The name of collation(UTF-8 string)
+ * @return This function returns #DB_UTIL_OK or error code on failure
* @pre Database connected
* @post None
- * @code
*/
EXPORT_API int db_util_create_collation(
PARAM_IN sqlite3 *db_handle,
);
/**
-*@}
-*/
+ * @}
+ */
#ifdef __cplusplus
}
#include <stdbool.h>
#include <sqlite3.h>
+/**
+ * @addtogroup DB_UTIL
+ * @{
+ */
+
#ifndef EXPORT_API
#define EXPORT_API __attribute__ ((visibility("default")))
#endif
#define PARAM_OUT
#endif
+/**
+ * @brief Enumeration of error code.
+ */
typedef enum {
- DB_UTIL_ERROR = SQLITE_ERROR,
- DB_UTIL_OK = SQLITE_OK,
+ DB_UTIL_ERROR = SQLITE_ERROR, /**< Error */
+ DB_UTIL_OK = SQLITE_OK, /**< Successful */
} db_util_err;
+/**
+ * @}
+ */
#ifdef __cplusplus
}
#include <db-util-common.h>
-#define DB_UTIL_REGISTER_HOOK_METHOD 0x00000001
-#define DB_UTIL_LUCENE_INDEX 0x00000002
-
/**
-* @defgroup StorageFW Storage Framework
-* In order to support applications using DB
-*/
+ * @defgroup DB_UTIL DB Util
+ * @brief This provides functions to handle DB.
+ * @ingroup StorageFW
+ * @section DB_UTIL_HEADER Required Header
+ * \#include <db-util.h>
+ */
/**
- * @defgroup DB_UTIL
- * @ingroup StorageFW
+ * @addtogroup DB_UTIL
* @{
*/
+#define DB_UTIL_REGISTER_HOOK_METHOD 0x00000001
+#define DB_UTIL_LUCENE_INDEX 0x00000002
/**
* @brief invoke sqlite3_open with platform common configuration
EXPORT_API int db_util_close(sqlite3 *ppDB);
/**
-*@}
-*/
+ * @}
+ */
#ifdef __cplusplus
}
Name: libslp-db-util
Summary: DB Utility
-Version: 0.1.5
+Version: 0.1.8
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
%setup -q -n %{name}-%{version}
%build
-%if 0%{?tizen_build_binary_release_type_eng}
-export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
-export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
%endif
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
return DB_UTIL_ERROR;
}
- if(access(pszFilePath, R_OK)) {
+ if((geteuid() != 0) && (access(pszFilePath, R_OK))) {
if(errno == EACCES) {
DB_UTIL_TRACE_ERROR("file access permission error");
return SQLITE_PERM;
/* Open DB */
int rc = sqlite3_open(pszFilePath, ppDB);
if (SQLITE_OK != rc) {
- DB_UTIL_TRACE_ERROR("sqlite3_open error(%d), ");
+ DB_UTIL_TRACE_ERROR("sqlite3_open error(%d)", rc);
return rc;
}
mode = R_OK;
#endif
- if(access(pszFilePath, mode)) {
+ if((geteuid() != 0) && (access(pszFilePath, mode))) {
if(errno == EACCES) {
DB_UTIL_TRACE_ERROR("file access permission error");
return SQLITE_PERM;
/* Open DB */
int rc = sqlite3_open_v2(pszFilePath, ppDB, flags, zVfs);
if (SQLITE_OK != rc) {
- DB_UTIL_TRACE_ERROR("sqlite3_open_v2 error(%d), ");
+ DB_UTIL_TRACE_ERROR("sqlite3_open_v2 error(%d)",rc);
return rc;
}