2 // Open Service Platform
3 // Copyright (c) 2012-2013 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.
18 * @file FNet_NetAccountDatabase.cpp
19 * @brief This is the implementation file for the %_NetAccountDatabase class.
21 * This file contains the implementation of the %_NetAccountDatabase class.
24 #include <unique_ptr.h>
25 #include <FBaseString.h>
26 #include <FBaseColIList.h>
27 #include <FBaseColIListT.h>
28 #include <FIoDatabase.h>
29 #include <FIoDbStatement.h>
30 #include <FIoDbEnumerator.h>
31 #include <FIoDirectory.h>
33 #include <FBaseSysLog.h>
34 #include <FApp_AppInfo.h>
35 #include "FNet_NetTypes.h"
36 #include "FNet_NetUtility.h"
37 #include "FNet_NetAccountDatabase.h"
40 using namespace Tizen::App;
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Collection;
43 using namespace Tizen::Io;
45 namespace Tizen { namespace Net {
48 _NetAccountDatabase::InitializeRepository(void)
50 static const wchar_t _NET_ACCOUNT_DATABASE_CREATE_TABLE_STATEMENT[] =
51 L"CREATE TABLE IF NOT EXISTS NetAccountTable (accountId INTEGER UNIQUE, accountName TEXT(256) UNIQUE, profileName TEXT(256) UNIQUE, isReadOnly INTEGER)";
56 if (!Database::Exists(_NetAccountDatabase::GetDbPath()))
58 SysLog(NID_NET, "NetAccount database is NOT found, so create it now.");
61 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), true);
62 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
64 r = accountDb.ExecuteSql(String(_NET_ACCOUNT_DATABASE_CREATE_TABLE_STATEMENT), true);
65 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
71 _NetAccountDatabase::AddAccount(const String& accountName, const String& profileName, _NetAccountOwner owner, NetAccountId& accountId)
73 static const wchar_t _NET_ACCOUNT_DATABASE_GET_MAX_ACCOUNT_ID_STATEMENT[] =
74 L"SELECT MAX(accountId) FROM NetAccountTable";
75 static const wchar_t _NET_ACCOUNT_DATABASE_ADD_ACCOUNT_STATEMENT[] =
76 L"INSERT INTO NetAccountTable (accountId, accountName, profileName, isReadOnly) VALUES(?, ?, ?, ?)";
80 unique_ptr<DbStatement> pStmt;
81 unique_ptr<DbEnumerator> pEnum;
82 bool isReadOnly = true;
83 NetAccountId netAccountId = INVALID_HANDLE;
85 SysSecureLog(NID_NET, "AddAccount() has been called with accountName:%ls, profileName:%ls, owner:%d",
86 accountName.GetPointer(), profileName.GetPointer(), owner);
88 accountId = INVALID_HANDLE;
90 SysTryReturnResult(NID_NET, !accountName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. accountName is an empty string.");
91 SysTryReturnResult(NID_NET, !profileName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. profileName is an empty string.");
93 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
94 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
96 if (owner == _NET_ACCOUNT_OWNER_THIS)
105 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_MAX_ACCOUNT_ID_STATEMENT)));
107 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
109 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
112 while (pEnum->MoveNext() == E_SUCCESS)
114 pEnum->GetIntAt(0, netAccountId);
119 if (netAccountId >= _PS_ACCOUNT_ID_START)
125 netAccountId = _PS_ACCOUNT_ID_START;
128 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_ADD_ACCOUNT_STATEMENT)));
130 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
132 r = pStmt->BindInt(0, netAccountId);
133 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
135 r = pStmt->BindString(1, accountName);
136 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
138 r = pStmt->BindString(2, profileName);
139 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
141 r = pStmt->BindInt(3, (int)isReadOnly);
142 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
144 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
146 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
148 accountId = netAccountId;
154 _NetAccountDatabase::RemoveAccountByAccountId(NetAccountId accountId)
156 static const wchar_t _NET_ACCOUNT_DATABASE_REMOVE_ACCOUNT_BY_ACCOUNT_ID_STATEMENT[] =
157 L"DELETE FROM NetAccountTable WHERE accountId=?";
159 SysSecureLog(NID_NET, "RemoveAccountByAccountId() has been called with accountId:%d", accountId);
161 result r = E_SUCCESS;
163 unique_ptr<DbStatement> pStmt;
164 unique_ptr<DbEnumerator> pEnum;
166 SysTryReturnResult(NID_NET, accountId > 0, E_INVALID_ARG, "Invalid argument is used. accountId=%d", accountId);
168 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
169 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
171 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_REMOVE_ACCOUNT_BY_ACCOUNT_ID_STATEMENT)));
173 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
175 r = pStmt->BindInt(0, accountId);
176 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
178 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
185 _NetAccountDatabase::RemoveAccountByProfileName(const String& profileName)
187 static const wchar_t _NET_ACCOUNT_DATABASE_REMOVE_ACCOUNT_BY_PROFILE_NAME_STATEMENT[] =
188 L"DELETE FROM NetAccountTable WHERE profileName=?";
190 SysLog(NID_NET, "RemoveAccountByProfileName() has been called with profileName:%ls", profileName.GetPointer());
192 result r = E_SUCCESS;
194 unique_ptr<DbStatement> pStmt;
195 unique_ptr<DbEnumerator> pEnum;
197 SysTryReturnResult(NID_NET, !profileName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. profileName is an empty string.");
199 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
200 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
202 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_REMOVE_ACCOUNT_BY_PROFILE_NAME_STATEMENT)));
204 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
206 r = pStmt->BindString(0, profileName);
207 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
209 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
216 _NetAccountDatabase::UpdateAccountName(NetAccountId accountId, const String& accountName)
218 static const wchar_t _NET_ACCOUNT_DATABASE_UPDATE_ACCOUNT_NAME_STATEMENT[] =
219 L"UPDATE NetAccountTable SET accountName=? WHERE accountId=?";
221 SysSecureLog(NID_NET, "UpdateAccountName() has been called with accountId:%d, accountName:%ls", accountId, accountName.GetPointer());
223 result r = E_SUCCESS;
225 unique_ptr<DbStatement> pStmt;
226 unique_ptr<DbEnumerator> pEnum;
228 SysTryReturnResult(NID_NET, accountId > 0, E_INVALID_ARG, "AccountId[%d] is invalid.", accountId);
229 SysTryReturnResult(NID_NET, !accountName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. accountName is an empty string.");
231 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
232 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
234 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_UPDATE_ACCOUNT_NAME_STATEMENT)));
236 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
238 r = pStmt->BindString(0, accountName);
239 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
241 r = pStmt->BindInt(1, accountId);
242 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
244 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
250 IListT<NetAccountId>*
251 _NetAccountDatabase::GetAccountIdsN(void)
253 static const wchar_t _NET_ACCOUNT_DATABASE_GET_ACCOUNT_IDS_STATEMENT[] =
254 L"SELECT accountId FROM NetAccountTable";
256 result r = E_SUCCESS;
258 unique_ptr<DbStatement> pStmt;
259 unique_ptr<DbEnumerator> pEnum;
260 unique_ptr< ArrayListT<NetAccountId> > pList;
262 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
263 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
265 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_ACCOUNT_IDS_STATEMENT)));
267 SysTryReturn(NID_NET, pStmt != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
269 pList.reset(new (std::nothrow) ArrayListT<NetAccountId>());
271 SysTryReturn(NID_NET, pList != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
273 r = pList->Construct();
274 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
276 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
278 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
282 while (pEnum->MoveNext() == E_SUCCESS)
284 NetAccountId accountId = INVALID_HANDLE;
286 r = pEnum->GetIntAt(0, accountId);
287 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
289 r = pList->Add(accountId);
290 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
294 ClearLastResult(); // To suppress E_OUT_OF_RANGE
296 return pList.release();
300 _NetAccountDatabase::GetAccountNamesN(void)
302 static const wchar_t _NET_ACCOUNT_DATABASE_GET_ACCOUNT_NAMES_STATEMENT[] =
303 L"SELECT accountName FROM NetAccountTable";
305 result r = E_SUCCESS;
307 unique_ptr<DbStatement> pStmt;
308 unique_ptr<DbEnumerator> pEnum;
309 unique_ptr<ArrayList, _CollectionDeleter> pList;
311 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
312 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
314 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_ACCOUNT_NAMES_STATEMENT)));
316 SysTryReturn(NID_NET, pStmt != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
318 pList.reset(new (std::nothrow) ArrayList());
320 SysTryReturn(NID_NET, pList != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
322 r = pList->Construct();
323 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
325 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
327 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
331 while (pEnum->MoveNext() == E_SUCCESS)
333 unique_ptr<String> pAccountName(new (std::nothrow) String());
334 SysTryReturn(NID_NET, pAccountName != null, null, E_OUT_OF_MEMORY,
335 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
337 r = pEnum->GetStringAt(0, *pAccountName);
338 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
340 r = pList->Add(*pAccountName);
341 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
343 pAccountName.release();
347 ClearLastResult(); // To suppress E_OUT_OF_RANGE
349 return pList.release();
353 _NetAccountDatabase::GetProfileNamesN(void)
355 static const wchar_t _NET_ACCOUNT_DATABASE_GET_PROFILE_NAMES_STATEMENT[] =
356 L"SELECT profileName FROM NetAccountTable";
358 result r = E_SUCCESS;
360 unique_ptr<DbStatement> pStmt;
361 unique_ptr<DbEnumerator> pEnum;
362 unique_ptr<ArrayList, _CollectionDeleter> pList;
364 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
365 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
367 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_PROFILE_NAMES_STATEMENT)));
369 SysTryReturn(NID_NET, pStmt != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
371 pList.reset(new (std::nothrow) ArrayList());
373 SysTryReturn(NID_NET, pList != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
375 r = pList->Construct();
376 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
378 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
380 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
384 while (pEnum->MoveNext() == E_SUCCESS)
386 unique_ptr<String> pProfileName(new (std::nothrow) String());
387 SysTryReturn(NID_NET, pProfileName != null, null, E_OUT_OF_MEMORY,
388 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
390 r = pEnum->GetStringAt(0, *pProfileName);
391 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
393 r = pList->Add(*pProfileName);
394 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
396 pProfileName.release();
400 ClearLastResult(); // To suppress E_OUT_OF_RANGE
402 return pList.release();
406 _NetAccountDatabase::GetAccountName(NetAccountId accountId, String& accountName)
408 static const wchar_t _NET_ACCOUNT_DATABASE_GET_ACCOUNT_NAME_STATEMENT[] =
409 L"SELECT accountName FROM NetAccountTable WHERE accountId=?";
411 SysSecureLog(NID_NET, "GetAccountName() has been called with accountId:%d", accountId);
413 result r = E_SUCCESS;
415 unique_ptr<DbStatement> pStmt;
416 unique_ptr<DbEnumerator> pEnum;
418 SysTryReturnResult(NID_NET, accountId > 0, E_INVALID_ARG, "Invalid argument is used. accountId=%d", accountId);
420 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
421 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
423 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_ACCOUNT_NAME_STATEMENT)));
425 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
427 r = pStmt->BindInt(0, accountId);
428 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
432 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
435 while (pEnum->MoveNext() == E_SUCCESS)
437 pEnum->GetStringAt(0, accountName);
447 _NetAccountDatabase::GetProfileName(NetAccountId accountId, String& profileName)
449 static const wchar_t _NET_ACCOUNT_DATABASE_GET_PROFILE_NAME_STATEMENT[] =
450 L"SELECT profileName FROM NetAccountTable WHERE accountId=?";
452 SysSecureLog(NID_NET, "GetProfileName() has been called with accountId:%d", accountId);
454 result r = E_SUCCESS;
456 unique_ptr<DbStatement> pStmt;
457 unique_ptr<DbEnumerator> pEnum;
459 SysTryReturnResult(NID_NET, accountId > 0, E_INVALID_ARG, "Invalid argument is used. accountId=%d", accountId);
461 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
462 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
464 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_PROFILE_NAME_STATEMENT)));
466 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
468 r = pStmt->BindInt(0, accountId);
469 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
473 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
476 while (pEnum->MoveNext() == E_SUCCESS)
478 pEnum->GetStringAt(0, profileName);
488 _NetAccountDatabase::GetAccountIdByAccountName(const String& accountName, NetAccountId& accountId)
490 static const wchar_t _NET_ACCOUNT_DATABASE_GET_ACCOUNT_ID_BY_ACCOUNT_NAME_STATEMENT[] =
491 L"SELECT accountId FROM NetAccountTable WHERE accountName=?";
493 SysSecureLog(NID_NET, "GetAccountIdByAccountName() has been called with accountName:%ls", accountName.GetPointer());
495 result r = E_SUCCESS;
497 unique_ptr<DbStatement> pStmt;
498 unique_ptr<DbEnumerator> pEnum;
500 SysTryReturnResult(NID_NET, !accountName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. accountName is an empty string.");
502 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
503 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
505 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_ACCOUNT_ID_BY_ACCOUNT_NAME_STATEMENT)));
506 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
508 r = pStmt->BindString(0, accountName);
509 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
513 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
516 while (pEnum->MoveNext() == E_SUCCESS)
518 pEnum->GetIntAt(0, accountId);
528 _NetAccountDatabase::GetAccountIdByProfileName(const String& profileName, NetAccountId& accountId)
530 static const wchar_t _NET_ACCOUNT_DATABASE_GET_ACCOUNT_ID_BY_PROFILE_NAME_STATEMENT[] =
531 L"SELECT accountId FROM NetAccountTable WHERE profileName=?";
533 SysLog(NID_NET, "GetAccountIdByProfileName() has been called with profileName:%ls", profileName.GetPointer());
535 result r = E_SUCCESS;
537 unique_ptr<DbStatement> pStmt;
538 unique_ptr<DbEnumerator> pEnum;
540 SysTryReturnResult(NID_NET, !profileName.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. profileName is an empty string.");
542 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
543 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
545 pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_ACCOUNT_ID_BY_PROFILE_NAME_STATEMENT)));
547 SysTryReturnResult(NID_NET, pStmt != null, r, "Propagating.");
549 r = pStmt->BindString(0, profileName);
550 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
554 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
557 while (pEnum->MoveNext() == E_SUCCESS)
559 pEnum->GetIntAt(0, accountId);
569 _NetAccountDatabase::IsReadOnly(NetAccountId accountId)
571 static const wchar_t NET_ACCOUNT_DATABASE_GET_IS_READ_ONLY_STATEMENT[] =
572 L"SELECT isReadOnly FROM NetAccountTable WHERE accountId=?";
574 SysSecureLog(NID_NET, "IsReadOnly() has been called with accountId:%d", accountId);
576 result r = E_SUCCESS;
578 unique_ptr<DbStatement> pStmt;
579 unique_ptr<DbEnumerator> pEnum;
582 SysTryReturn(NID_NET, accountId > 0, true, E_INVALID_ARG,
583 "[%s] Invalid argument is used. accountId=%d", GetErrorMessage(E_INVALID_ARG), accountId);
585 r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false);
586 SysTryReturn(NID_NET, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
588 pStmt.reset(accountDb.CreateStatementN(String(NET_ACCOUNT_DATABASE_GET_IS_READ_ONLY_STATEMENT)));
590 SysTryReturn(NID_NET, pStmt != null, true, r, "[%s] Propagating.", GetErrorMessage(r));
592 r = pStmt->BindInt(0, accountId);
593 SysTryReturn(NID_NET, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
596 pEnum.reset(accountDb.ExecuteStatementN(*pStmt));
599 while (pEnum->MoveNext() == E_SUCCESS)
601 pEnum->GetIntAt(0, isReadOnly);
606 SysTryReturn(NID_NET, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
610 return (bool)isReadOnly;
614 _NetAccountDatabase::GetDbPath(void)
616 static const wchar_t _OLD_DATA_PATH[] = L"/Home/";
617 static const wchar_t _NET_ACCOUNT_DATABASE_FILE_NAME[] = L".tizen_netaccount.db";
620 _ApiVersion apiVersion = _AppInfo::GetApiVersion();
622 if (apiVersion == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
624 dbPath = String(_OLD_DATA_PATH);
628 dbPath = Tizen::App::App::GetInstance()->GetAppDataPath();
631 dbPath += String(_NET_ACCOUNT_DATABASE_FILE_NAME);
633 SysLog(NID_NET, "GetDbPath() has been succeeded with the path:%ls", dbPath.GetPointer());