db version will be added with integer format.
minor version and patch version can be 2 digits each.
Change-Id: Ia35a3874ba1178c2d882d76e439a336e06260a69
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+ -DTIZEN_MAJOR_VER=%{tizen_version_major} \
+ -DTIZEN_MINOR_VER=%{tizen_version_minor} \
+ -DTIZEN_PATCH_VER=%{tizen_version_patch}
+
%__make %{?jobs:-j%jobs}
%install
endif()
message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
+### Define tizen version for db version
+if(DEFINED TIZEN_MAJOR_VER)
+ ADD_DEFINITIONS("-DTIZEN_MAJOR_VER=\"${TIZEN_MAJOR_VER}\"")
+else()
+ message("TIZEN_MAJOR_VER is not defined. set it to 0")
+ ADD_DEFINITIONS("-DTIZEN_MAJOR_VER=\"0\"")
+endif()
+
+if(DEFINED TIZEN_MINOR_VER)
+ ADD_DEFINITIONS("-DTIZEN_MINOR_VER=\"${TIZEN_MINOR_VER}\"")
+else()
+ message("TIZEN_MINOR_VER is not defined. set it to 0")
+ ADD_DEFINITIONS("-DTIZEN_MINOR_VER=\"0\"")
+endif()
+
+if(DEFINED TIZEN_PATCH_VER)
+ ADD_DEFINITIONS("-DTIZEN_PATCH_VER=\"${TIZEN_PATCH_VER}\"")
+else()
+ message("TIZEN_PATCH_VER is not defined. set it to 0")
+ ADD_DEFINITIONS("-DTIZEN_PATCH_VER=\"${TIZEN_PATCH_VER}\"")
+endif()
+
### Get required CFLAGS, LDFLAGS from pkg-config
include(FindPkgConfig)
{
int ret = -1;
sqlite3 *handle;
+ char *query = NULL;
+ char *error_message = NULL;
ret = db_util_open(db_path, &handle, DB_UTIL_REGISTER_HOOK_METHOD);
if (ret != SQLITE_OK) {
}
*db_handle = handle;
+ /* add user_version for db upgrade*/
+ query = sqlite3_mprintf("PRAGMA user_version=%d", (atoi(TIZEN_MAJOR_VER) * 10000 + atoi(TIZEN_MINOR_VER) * 100 + atoi(TIZEN_PATCH_VER)));
+ if (SQLITE_OK !=
+ sqlite3_exec(handle, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ }
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+
return 0;
}