24 /** |
24 /** |
25 @return Represents the content of the current flat buffer field as integer value. |
25 @return Represents the content of the current flat buffer field as integer value. |
26 */ |
26 */ |
27 inline TInt TSqlBufRIterator::AsInt() const |
27 inline TInt TSqlBufRIterator::AsInt() const |
28 { |
28 { |
29 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
29 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
30 return *reinterpret_cast <const TInt32*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
30 return *reinterpret_cast <const TInt32*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
31 } |
31 } |
32 |
32 |
33 /** |
33 /** |
34 @return Represents the content of the current flat buffer field as 64 bit integer value. |
34 @return Represents the content of the current flat buffer field as 64 bit integer value. |
35 */ |
35 */ |
36 inline TInt64 TSqlBufRIterator::AsInt64() const |
36 inline TInt64 TSqlBufRIterator::AsInt64() const |
37 { |
37 { |
38 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
38 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
39 return *reinterpret_cast <const TInt64*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
39 return *reinterpret_cast <const TInt64*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
40 } |
40 } |
41 |
41 |
42 /** |
42 /** |
43 @return Represents the content of the current flat buffer field as real value. |
43 @return Represents the content of the current flat buffer field as real value. |
44 */ |
44 */ |
45 inline TReal TSqlBufRIterator::AsReal() const |
45 inline TReal TSqlBufRIterator::AsReal() const |
46 { |
46 { |
47 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
47 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
48 return *reinterpret_cast <const TReal*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
48 return *reinterpret_cast <const TReal*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos); |
49 } |
49 } |
50 |
50 |
51 /** |
51 /** |
52 @return Represents the content of the current flat buffer field as integer value. |
52 @return Represents the content of the current flat buffer field as integer value. |
54 the function will do a data conversion as described in the table which can be found |
54 the function will do a data conversion as described in the table which can be found |
55 in SqlBufIterator.h file. |
55 in SqlBufIterator.h file. |
56 */ |
56 */ |
57 TInt TSqlBufRIterator::Int() const |
57 TInt TSqlBufRIterator::Int() const |
58 { |
58 { |
59 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
59 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
60 switch(Type()) |
60 switch(Type()) |
61 { |
61 { |
62 case ESqlInt64: |
62 case ESqlInt64: |
63 { |
63 { |
64 TInt64 val = AsInt64(); |
64 TInt64 val = AsInt64(); |
92 the function will do a data conversion as described in the table which can be found |
92 the function will do a data conversion as described in the table which can be found |
93 in SqlBufIterator.h file. |
93 in SqlBufIterator.h file. |
94 */ |
94 */ |
95 TInt64 TSqlBufRIterator::Int64() const |
95 TInt64 TSqlBufRIterator::Int64() const |
96 { |
96 { |
97 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
97 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
98 switch(Type()) |
98 switch(Type()) |
99 { |
99 { |
100 case ESqlInt: |
100 case ESqlInt: |
101 case ESqlZeroBlob: |
101 case ESqlZeroBlob: |
102 return AsInt(); |
102 return AsInt(); |
126 the function will do a data conversion as described in the table which can be found |
126 the function will do a data conversion as described in the table which can be found |
127 in SqlBufIterator.h file. |
127 in SqlBufIterator.h file. |
128 */ |
128 */ |
129 TReal TSqlBufRIterator::Real() const |
129 TReal TSqlBufRIterator::Real() const |
130 { |
130 { |
131 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
131 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
132 switch(Type()) |
132 switch(Type()) |
133 { |
133 { |
134 case ESqlInt: |
134 case ESqlInt: |
135 case ESqlZeroBlob: |
135 case ESqlZeroBlob: |
136 { |
136 { |
157 the function will do a data conversion as described in the table which can be found |
157 the function will do a data conversion as described in the table which can be found |
158 in SqlBufIterator.h file. |
158 in SqlBufIterator.h file. |
159 */ |
159 */ |
160 TPtrC8 TSqlBufRIterator::Binary() const |
160 TPtrC8 TSqlBufRIterator::Binary() const |
161 { |
161 { |
162 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
162 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
163 TInt size = Size(); |
163 TInt size = Size(); |
164 if(Type() != ESqlBinary || size == 0) |
164 if(Type() != ESqlBinary || size == 0) |
165 { |
165 { |
166 return TPtrC8(); |
166 return TPtrC8(); |
167 } |
167 } |
174 the function will do a data conversion as described in the table which can be found |
174 the function will do a data conversion as described in the table which can be found |
175 in SqlBufIterator.h file. |
175 in SqlBufIterator.h file. |
176 */ |
176 */ |
177 TPtrC16 TSqlBufRIterator::Text() const |
177 TPtrC16 TSqlBufRIterator::Text() const |
178 { |
178 { |
179 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
179 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
180 TInt size = Size(); |
180 TInt size = Size(); |
181 if(Type() != ESqlText || size == 0) |
181 if(Type() != ESqlText || size == 0) |
182 { |
182 { |
183 return TPtrC16(); |
183 return TPtrC16(); |
184 } |
184 } |
194 class HReadOnlyBuf : public TMemBuf |
194 class HReadOnlyBuf : public TMemBuf |
195 { |
195 { |
196 public: |
196 public: |
197 static HReadOnlyBuf* NewL(const TUint8* aFrom, TInt aLen) |
197 static HReadOnlyBuf* NewL(const TUint8* aFrom, TInt aLen) |
198 { |
198 { |
199 __SQLASSERT(aLen >= 0, ESqlPanicBadArgument); |
199 __ASSERT_DEBUG(aLen >= 0, __SQLPANIC2(ESqlPanicBadArgument)); |
200 HReadOnlyBuf* self = new (ELeave) HReadOnlyBuf; |
200 HReadOnlyBuf* self = new (ELeave) HReadOnlyBuf; |
201 TUint8* p = const_cast <TUint8*> (aFrom); |
201 TUint8* p = const_cast <TUint8*> (aFrom); |
202 self->Set(p, p + aLen, MStreamBuf::ERead); |
202 self->Set(p, p + aLen, MStreamBuf::ERead); |
203 return self; |
203 return self; |
204 } |
204 } |
217 @leave KErrNoMemory, out of memory condition has occured, |
217 @leave KErrNoMemory, out of memory condition has occured, |
218 KErrArgument, the column type is not text, blob or null; |
218 KErrArgument, the column type is not text, blob or null; |
219 */ |
219 */ |
220 MStreamBuf* TSqlBufRIterator::StreamL() const |
220 MStreamBuf* TSqlBufRIterator::StreamL() const |
221 { |
221 { |
222 __SQLASSERT(iCurrent >= iBegin && iCurrent < iEnd, ESqlPanicInternalError); |
222 __ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError)); |
223 if(!::IsSequenceSqlType(Type())) |
223 if(!::IsSequenceSqlType(Type())) |
224 { |
224 { |
225 __SQLLEAVE(KErrArgument); |
225 __SQLLEAVE(KErrArgument); |
226 } |
226 } |
227 return HReadOnlyBuf::NewL(reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos, iCurrent->Size()); |
227 return HReadOnlyBuf::NewL(reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos, iCurrent->Size()); |