persistentstorage/sql/SRC/Server/SqlSrvCollation.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 // SqlSrvStatementCollation.cpp
    14 // SqlSrvStatementCollation.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include "SqlSrvCollation.h"
    18 #include "SqlSrvCollation.h"
    19 #include "SqlAssert.h"
    19 #include "SqlPanic.h"
    20 #include "SqlUtil.h"
    20 #include "SqlUtil.h"
    21 #include "sqlite3.h"
    21 #include "sqlite3.h"
    22 #include "SqliteSymbian.h"		//sqlite3SymbianLastOsError()
    22 #include "SqliteSymbian.h"		//sqlite3SymbianLastOsError()
    23 
    23 
    24 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    24 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
   153 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL.
   153 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL.
   154 */
   154 */
   155 TSqlCollationUtil::TSqlCollationUtil(sqlite3* aDbHandle) :
   155 TSqlCollationUtil::TSqlCollationUtil(sqlite3* aDbHandle) :
   156 	iDbHandle(aDbHandle)
   156 	iDbHandle(aDbHandle)
   157 	{
   157 	{
   158 	__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicBadArgument));
   158 	__SQLASSERT(iDbHandle != NULL, ESqlPanicBadArgument);
   159 	}
   159 	}
   160 
   160 
   161 /**
   161 /**
   162 Installs user defined collations.
   162 Installs user defined collations.
   163 
   163 
   192 
   192 
   193 @panic SqlDb 2 In _DEBUG mode. iDbHandle is NULL.
   193 @panic SqlDb 2 In _DEBUG mode. iDbHandle is NULL.
   194 */
   194 */
   195 void TSqlCollationUtil::InstallCollationsL()
   195 void TSqlCollationUtil::InstallCollationsL()
   196 	{
   196 	{
   197 	__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
   197 	__SQLASSERT(iDbHandle != NULL, ESqlPanicInvalidObj);
   198 	(void)sqlite3SymbianLastOsError();//clear last OS error
   198 	(void)sqlite3SymbianLastOsError();//clear last OS error
   199 	//Register user defined collations
   199 	//Register user defined collations
   200 	for(TInt i=0;i<KCollationMethodCount;++i)
   200 	for(TInt i=0;i<KCollationMethodCount;++i)
   201 		{
   201 		{
   202 		TInt err = sqlite3_create_collation16(iDbHandle, reinterpret_cast <const char*> (KCollationMethodName[i]), 
   202 		TInt err = sqlite3_create_collation16(iDbHandle, reinterpret_cast <const char*> (KCollationMethodName[i]), 
   222 
   222 
   223 @see TSqlCollationUtil::CollationsCount() 
   223 @see TSqlCollationUtil::CollationsCount() 
   224 */
   224 */
   225 TPtrC TSqlCollationUtil::CollationName(TInt aIndex) const
   225 TPtrC TSqlCollationUtil::CollationName(TInt aIndex) const
   226 	{
   226 	{
   227 	__ASSERT_DEBUG((TUint)aIndex < KCollationMethodCount, __SQLPANIC(ESqlPanicBadArgument));
   227 	__SQLASSERT((TUint)aIndex < KCollationMethodCount, ESqlPanicBadArgument);
   228 	return TPtrC(KCollationMethodName[aIndex]);
   228 	return TPtrC(KCollationMethodName[aIndex]);
   229 	}
   229 	}