|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 |
|
18 SQL server message code maker. |
|
19 |
|
20 The function accepts as arguments the server function code, handle type and handle, |
|
21 and makes from them a 32-bit value, which is used as a function code in RMessage2 objects. |
|
22 |
|
23 @param aFunction function code |
|
24 @param aHandleType handle type - one of TSqlSrvHandleType enum item values |
|
25 @param aHandle handle |
|
26 |
|
27 @return The assembled from aFunction, aHandleType and aHandle message code which will be sent |
|
28 to the SQL server. |
|
29 |
|
30 @see RMessage2 |
|
31 @see TSqlSrvFunction |
|
32 |
|
33 @internalComponent |
|
34 */ |
|
35 inline TInt MakeMsgCode(TSqlSrvFunction aFunction, TSqlSrvHandleType aHandleType, TInt aHandle) |
|
36 { |
|
37 return (aHandleType | (aHandle << KSqlSrvHandleShiftBits) | aFunction); |
|
38 } |
|
39 |
|
40 //////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
41 ////////// Case insensitive string comparisons //// |
|
42 //////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
43 |
|
44 /** |
|
45 Used for comparing database names, table names, column names and parameter names when the text encoding is UTF8. |
|
46 |
|
47 @internalComponent |
|
48 */ |
|
49 inline TInt CompareNoCase8(const TDesC8& aLeft, const TDesC8& aRight) |
|
50 { |
|
51 return aLeft.CompareF(aRight); |
|
52 } |
|
53 |
|
54 /** |
|
55 Used for comparing database names, table names, column names and parameter names when the text encoding is UTF16. |
|
56 |
|
57 @internalComponent |
|
58 */ |
|
59 inline TInt CompareNoCase16(const TDesC16& aLeft, const TDesC16& aRight) |
|
60 { |
|
61 return aLeft.CompareF(aRight); |
|
62 } |
|
63 |
|
64 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
65 ////////// Buffer alignment functions ///////////// |
|
66 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
67 |
|
68 /** |
|
69 Returns aLen 8-byte aligned. |
|
70 |
|
71 @param aLen Length value which needs alignment |
|
72 |
|
73 @return 8-byte aligned aLen value |
|
74 |
|
75 @internalComponent |
|
76 */ |
|
77 inline TInt AlignedLen8(TInt aLen) |
|
78 { |
|
79 return (aLen + 7) & (TUint32)~0x07; |
|
80 } |
|
81 |
|
82 #ifdef _DEBUG |
|
83 /** |
|
84 Returns true if aLen is 8-byte aligned |
|
85 The function is implemented only in _DEBUG releases. |
|
86 |
|
87 @param aLen Length value which will be checked |
|
88 |
|
89 @return True if aLen is 8-byte aligned |
|
90 |
|
91 @internalComponent |
|
92 */ |
|
93 inline TBool IsAligned8(TInt aLen) |
|
94 { |
|
95 return (aLen & 0x07) == 0; |
|
96 } |
|
97 #endif |