Merge "Alarm Conditional AppLaunch Refactoring" into tizen_2.2
[platform/framework/native/appfw.git] / src / io / FIo_DataControlResultSetImpl.cpp
index fe00c93..1378cdc 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -50,7 +49,8 @@ using namespace Tizen::Base::Utility;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::App;
 
-const char* _DATACONTROL_RESULTSET_DIR = "/tmp/osp/DataControlResultSet/\0";
+const char* _DATACONTROL_RESULT_DIR = "/tmp/osp/data-control/result/\0";
+const char* _DATACONTROL_RESULT_COMPAT_DIR = "/tmp/osp/DataControlResult/\0";
 
 namespace Tizen { namespace Io
 {
@@ -62,7 +62,7 @@ _DataControlResultSetImpl::_DataControlResultSetImpl(RequestId reqId)
        , __pageNo(1)
        , __countPerPage(0)
        , __result(E_SUCCESS)
-       , __tmpPath("")
+       , __tmpPath(L"")
        , __reqId(reqId)
 {
 }
@@ -86,11 +86,11 @@ _DataControlResultSetImpl::~_DataControlResultSetImpl(void)
 // [sizeof(int)] size
 // [  varient  ] content
 result
-_DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum)
+_DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum, String& version)
 {
-       String tempFilePath(_DATACONTROL_RESULTSET_DIR);
+       String tempFilePath;
        String columnName;
-       String appId;
+       String callerAppId;
        String reqType;
        String callerReqId;
        String* pNo = null;
@@ -116,7 +116,7 @@ _DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum)
 
        _ResultInfo* pResultInfo = pAppMgr->__resultManager.FindItem(static_cast< int >(__reqId)); // provider reqId
        SysTryReturnResult(NID_IO, pResultInfo, E_OBJ_NOT_FOUND,
-                       "The data control request specified with the reqId (%ld) did not exist.", __reqId);
+                       "The data control request specified with the req (%ld) did not exist.", __reqId);
 
        const _AppArg& arg = pResultInfo->arg;
 
@@ -127,7 +127,7 @@ _DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum)
        SysTryReturnResult(NID_IO, requestType ==  _DATACONTROL_REQUEST_TYPE_SQL_QUERY, E_INVALID_ARG,
                        "The reqId should be for the data control query request.");
 
-       appId = arg.GetCallerAppId();
+       callerAppId = arg.GetCallerAppId();
        callerReqId = arg.GetValue(OSP_K_REQUEST_ID);
 
        // list-based request
@@ -149,7 +149,15 @@ _DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum)
        Integer::Parse(*pCount, countPerPage);
 
        this->SetCapacity(pageNo, countPerPage);
-       tempFilePath.Append(appId);
+       if (version == L"ver_2.1.0.3")
+       {
+               tempFilePath.Append(_DATACONTROL_RESULT_DIR);
+       }
+       else
+       {
+               tempFilePath.Append(_DATACONTROL_RESULT_COMPAT_DIR);
+       }
+       tempFilePath.Append(callerAppId);
        tempFilePath.Append(callerReqId);
        __tmpPath = tempFilePath;
        SysSecureLog(NID_IO, "[DC_PROV_SEND] temp file path: %ls", tempFilePath.GetPointer());
@@ -187,7 +195,7 @@ _DataControlResultSetImpl::FillWith(IDbEnumerator* pDbEnum)
 
        SysTryReturnResult(NID_IO, pFile != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-       r = pFile->Construct(__tmpPath, "w+", true);
+       r = pFile->Construct(__tmpPath, L"w+", true);
        SysTryReturn(NID_IO, r == E_SUCCESS, r, r, "[%s] Failed to create temp file (%ls) for result set.",
                        GetErrorMessage(r), __tmpPath.GetPointer());