equal
deleted
inserted
replaced
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // NTT DOCOMO, INC - Fix for Bug 1915 "SQL server panics when using long column type strings" |
12 // NTT DOCOMO, INC - Fix for defect 1915 "SQL server panics when using long column type strings" |
13 // |
13 // |
14 // Description: |
14 // Description: |
15 // |
15 // |
16 |
16 |
17 #include "SqlStatementImpl.h" //CSqlStatementImpl |
17 #include "SqlStatementImpl.h" //CSqlStatementImpl |
43 @panic SqlDb 4 In _DEBUG mode, aIndex is NULL. |
43 @panic SqlDb 4 In _DEBUG mode, aIndex is NULL. |
44 @panic SqlDb 4 In _DEBUG mode, *aIndex value is negative. |
44 @panic SqlDb 4 In _DEBUG mode, *aIndex value is negative. |
45 */ |
45 */ |
46 TBool RSqlLongColumnColl::TData::Compare(const TInt* aIndex, const RSqlLongColumnColl::TData& aData) |
46 TBool RSqlLongColumnColl::TData::Compare(const TInt* aIndex, const RSqlLongColumnColl::TData& aData) |
47 { |
47 { |
48 __SQLASSERT(aIndex != NULL, ESqlPanicBadArgument); |
48 __ASSERT_DEBUG(aIndex != NULL, __SQLPANIC2(ESqlPanicBadArgument)); |
49 __SQLASSERT(*aIndex >= 0, ESqlPanicBadArgument); |
49 __ASSERT_DEBUG(*aIndex >= 0, __SQLPANIC2(ESqlPanicBadArgument)); |
50 return *aIndex == aData.iIndex; |
50 return *aIndex == aData.iIndex; |
51 } |
51 } |
52 |
52 |
53 /** |
53 /** |
54 Reads a long column value, identified by aColumnIndex parameter, from the server and stores the value in the collection. |
54 Reads a long column value, identified by aColumnIndex parameter, from the server and stores the value in the collection. |
61 KErrNoMemory Out of memory; |
61 KErrNoMemory Out of memory; |
62 Note that other system-wide or database specific error codes may also be returned. |
62 Note that other system-wide or database specific error codes may also be returned. |
63 */ |
63 */ |
64 TInt RSqlLongColumnColl::Append(RSqlLongColumnColl::TColumnReader& aReader, TInt aColumnIndex, TInt aColumnSize) |
64 TInt RSqlLongColumnColl::Append(RSqlLongColumnColl::TColumnReader& aReader, TInt aColumnIndex, TInt aColumnSize) |
65 { |
65 { |
66 __SQLASSERT(aColumnIndex >= 0, ESqlPanicBadArgument); |
66 __ASSERT_DEBUG(aColumnIndex >= 0, __SQLPANIC(ESqlPanicBadArgument)); |
67 __SQLASSERT(aColumnSize >= KSqlMaxDesLen, ESqlPanicBadArgument); |
67 __ASSERT_DEBUG(aColumnSize >= KSqlMaxDesLen, __SQLPANIC(ESqlPanicBadArgument)); |
68 LONGCOL_INVARIANT(); |
68 LONGCOL_INVARIANT(); |
69 HBufC8* colBuf = HBufC8::New(aColumnSize); |
69 HBufC8* colBuf = HBufC8::New(aColumnSize); |
70 if(!colBuf) |
70 if(!colBuf) |
71 { |
71 { |
72 return KErrNoMemory; |
72 return KErrNoMemory; |
94 void RSqlLongColumnColl::Invariant() const |
94 void RSqlLongColumnColl::Invariant() const |
95 { |
95 { |
96 for(TInt i=iValues.Count()-1;i>=0;--i) |
96 for(TInt i=iValues.Count()-1;i>=0;--i) |
97 { |
97 { |
98 const RSqlLongColumnColl::TData& data = iValues[i]; |
98 const RSqlLongColumnColl::TData& data = iValues[i]; |
99 __SQLASSERT(data.iIndex >= 0, ESqlPanicInternalError); |
99 __ASSERT_DEBUG(data.iIndex >= 0, __SQLPANIC(ESqlPanicInternalError)); |
100 __SQLASSERT(data.iData != NULL, ESqlPanicInternalError); |
100 __ASSERT_DEBUG(data.iData != NULL, __SQLPANIC(ESqlPanicInternalError)); |
101 for(TInt j=i-1;j>=0;--j) |
101 for(TInt j=i-1;j>=0;--j) |
102 { |
102 { |
103 __SQLASSERT(data.iIndex != iValues[j].iIndex, ESqlPanicInternalError); |
103 __ASSERT_DEBUG(data.iIndex != iValues[j].iIndex, __SQLPANIC(ESqlPanicInternalError)); |
104 } |
104 } |
105 } |
105 } |
106 } |
106 } |
107 #endif |
107 #endif |
108 |
108 |
316 |
316 |
317 @see RSqlStatement::BindNull() |
317 @see RSqlStatement::BindNull() |
318 */ |
318 */ |
319 TInt CSqlStatementImpl::BindNull(TInt aParamIndex) |
319 TInt CSqlStatementImpl::BindNull(TInt aParamIndex) |
320 { |
320 { |
321 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
321 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
322 iBound = EFalse; |
322 iBound = EFalse; |
323 iParamValBufIt.MoveTo(aParamIndex); |
323 iParamValBufIt.MoveTo(aParamIndex); |
324 iParamValBufIt.SetNull(); |
324 iParamValBufIt.SetNull(); |
325 return KErrNone; |
325 return KErrNone; |
326 } |
326 } |
332 |
332 |
333 @see RSqlStatement::BindInt() |
333 @see RSqlStatement::BindInt() |
334 */ |
334 */ |
335 TInt CSqlStatementImpl::BindInt(TInt aParamIndex, TInt aParamValue) |
335 TInt CSqlStatementImpl::BindInt(TInt aParamIndex, TInt aParamValue) |
336 { |
336 { |
337 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
337 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
338 iBound = EFalse; |
338 iBound = EFalse; |
339 iParamValBufIt.MoveTo(aParamIndex); |
339 iParamValBufIt.MoveTo(aParamIndex); |
340 return iParamValBufIt.SetInt(aParamValue); |
340 return iParamValBufIt.SetInt(aParamValue); |
341 } |
341 } |
342 |
342 |
347 |
347 |
348 @see RSqlStatement::BindInt64() |
348 @see RSqlStatement::BindInt64() |
349 */ |
349 */ |
350 TInt CSqlStatementImpl::BindInt64(TInt aParamIndex, TInt64 aParamValue) |
350 TInt CSqlStatementImpl::BindInt64(TInt aParamIndex, TInt64 aParamValue) |
351 { |
351 { |
352 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
352 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
353 iBound = EFalse; |
353 iBound = EFalse; |
354 iParamValBufIt.MoveTo(aParamIndex); |
354 iParamValBufIt.MoveTo(aParamIndex); |
355 return iParamValBufIt.SetInt64(aParamValue); |
355 return iParamValBufIt.SetInt64(aParamValue); |
356 } |
356 } |
357 |
357 |
362 |
362 |
363 @see RSqlStatement::BindReal() |
363 @see RSqlStatement::BindReal() |
364 */ |
364 */ |
365 TInt CSqlStatementImpl::BindReal(TInt aParamIndex, TReal aParamValue) |
365 TInt CSqlStatementImpl::BindReal(TInt aParamIndex, TReal aParamValue) |
366 { |
366 { |
367 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
367 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
368 iBound = EFalse; |
368 iBound = EFalse; |
369 iParamValBufIt.MoveTo(aParamIndex); |
369 iParamValBufIt.MoveTo(aParamIndex); |
370 return iParamValBufIt.SetReal(aParamValue); |
370 return iParamValBufIt.SetReal(aParamValue); |
371 } |
371 } |
372 |
372 |
377 |
377 |
378 @see RSqlStatement::BindText() |
378 @see RSqlStatement::BindText() |
379 */ |
379 */ |
380 TInt CSqlStatementImpl::BindText(TInt aParamIndex, const TDesC& aParamText) |
380 TInt CSqlStatementImpl::BindText(TInt aParamIndex, const TDesC& aParamText) |
381 { |
381 { |
382 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
382 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
383 iBound = EFalse; |
383 iBound = EFalse; |
384 iParamValBufIt.MoveTo(aParamIndex); |
384 iParamValBufIt.MoveTo(aParamIndex); |
385 return iParamValBufIt.SetText(aParamText); |
385 return iParamValBufIt.SetText(aParamText); |
386 } |
386 } |
387 |
387 |
392 |
392 |
393 @see RSqlStatement::BindBinary() |
393 @see RSqlStatement::BindBinary() |
394 */ |
394 */ |
395 TInt CSqlStatementImpl::BindBinary(TInt aParamIndex, const TDesC8& aParamData) |
395 TInt CSqlStatementImpl::BindBinary(TInt aParamIndex, const TDesC8& aParamData) |
396 { |
396 { |
397 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
397 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
398 iBound = EFalse; |
398 iBound = EFalse; |
399 iParamValBufIt.MoveTo(aParamIndex); |
399 iParamValBufIt.MoveTo(aParamIndex); |
400 return iParamValBufIt.SetBinary(aParamData); |
400 return iParamValBufIt.SetBinary(aParamData); |
401 } |
401 } |
402 |
402 |
407 |
407 |
408 @see RSqlStatement::BindZeroBlob() |
408 @see RSqlStatement::BindZeroBlob() |
409 */ |
409 */ |
410 TInt CSqlStatementImpl::BindZeroBlob(TInt aParamIndex, TInt aBlobSize) |
410 TInt CSqlStatementImpl::BindZeroBlob(TInt aParamIndex, TInt aBlobSize) |
411 { |
411 { |
412 __SQLASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, ESqlPanicBadColumnIndex); |
412 __ASSERT_ALWAYS((TUint)aParamIndex < (TUint)iParamCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
413 iBound = EFalse; |
413 iBound = EFalse; |
414 iParamValBufIt.MoveTo(aParamIndex); |
414 iParamValBufIt.MoveTo(aParamIndex); |
415 return iParamValBufIt.SetZeroBlob(aBlobSize); |
415 return iParamValBufIt.SetZeroBlob(aBlobSize); |
416 } |
416 } |
417 |
417 |
423 |
423 |
424 @see RSqlStatement::ColumnType(). |
424 @see RSqlStatement::ColumnType(). |
425 */ |
425 */ |
426 TSqlColumnType CSqlStatementImpl::ColumnType(TInt aColumnIndex) |
426 TSqlColumnType CSqlStatementImpl::ColumnType(TInt aColumnIndex) |
427 { |
427 { |
428 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
428 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
429 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
429 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
430 iColumnValBufIt.MoveTo(aColumnIndex); |
430 iColumnValBufIt.MoveTo(aColumnIndex); |
431 return static_cast <TSqlColumnType> (iColumnValBufIt.Type()); |
431 return static_cast <TSqlColumnType> (iColumnValBufIt.Type()); |
432 } |
432 } |
433 |
433 |
434 /** |
434 /** |
445 |
445 |
446 @see RSqlStatement::DeclaredColumnType(). |
446 @see RSqlStatement::DeclaredColumnType(). |
447 */ |
447 */ |
448 TInt CSqlStatementImpl::DeclaredColumnType(TInt aColumnIndex, TSqlColumnType& aColumnType) |
448 TInt CSqlStatementImpl::DeclaredColumnType(TInt aColumnIndex, TSqlColumnType& aColumnType) |
449 { |
449 { |
450 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
450 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
451 if(iDeclaredColumnTypes.Count() == 0) //initialise iDeclaredColumnTypes array if necessary |
451 if(iDeclaredColumnTypes.Count() == 0) //initialise iDeclaredColumnTypes array if necessary |
452 { |
452 { |
453 RSqlBufFlat declaredColumnTypeBuf; |
453 RSqlBufFlat declaredColumnTypeBuf; |
454 TInt err = declaredColumnTypeBuf.SetCount(iColumnCnt); |
454 TInt err = declaredColumnTypeBuf.SetCount(iColumnCnt); |
455 if(err != KErrNone) |
455 if(err != KErrNone) |
504 else if(colTypeName.FindF(KRealKWD) >= 0 || colTypeName.FindF(KFloatKWD) >= 0 || colTypeName.FindF(KDoubleKWD) >= 0) |
504 else if(colTypeName.FindF(KRealKWD) >= 0 || colTypeName.FindF(KFloatKWD) >= 0 || colTypeName.FindF(KDoubleKWD) >= 0) |
505 { |
505 { |
506 colType = ESqlReal; |
506 colType = ESqlReal; |
507 } |
507 } |
508 err = iDeclaredColumnTypes.Append(colType); |
508 err = iDeclaredColumnTypes.Append(colType); |
509 __SQLASSERT(err == KErrNone, ESqlPanicInternalError);//memory for the array elements has been reserved already |
509 __ASSERT_DEBUG(err == KErrNone, __SQLPANIC(ESqlPanicInternalError));//memory for the array elements has been reserved already |
510 ++colIdx; |
510 ++colIdx; |
511 } //end of - while(declColumnTypeBufIt.Next()) |
511 } //end of - while(declColumnTypeBufIt.Next()) |
512 __SQLASSERT(colIdx == iColumnCnt, ESqlPanicInternalError); |
512 __ASSERT_DEBUG(colIdx == iColumnCnt, __SQLPANIC(ESqlPanicInternalError)); |
513 declaredColumnTypeBuf.Close(); |
513 declaredColumnTypeBuf.Close(); |
514 } //end of - if(iDeclaredColumnTypes.Count() == 0 && iColumnCnt > 0) |
514 } //end of - if(iDeclaredColumnTypes.Count() == 0 && iColumnCnt > 0) |
515 aColumnType = iDeclaredColumnTypes[aColumnIndex]; |
515 aColumnType = iDeclaredColumnTypes[aColumnIndex]; |
516 return KErrNone; |
516 return KErrNone; |
517 } |
517 } |
524 |
524 |
525 @see RSqlStatement::ColumnSize(). |
525 @see RSqlStatement::ColumnSize(). |
526 */ |
526 */ |
527 TInt CSqlStatementImpl::ColumnSize(TInt aColumnIndex) |
527 TInt CSqlStatementImpl::ColumnSize(TInt aColumnIndex) |
528 { |
528 { |
529 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
529 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
530 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
530 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
531 iColumnValBufIt.MoveTo(aColumnIndex); |
531 iColumnValBufIt.MoveTo(aColumnIndex); |
532 return iColumnValBufIt.Size(); |
532 return iColumnValBufIt.Size(); |
533 } |
533 } |
534 |
534 |
535 /** |
535 /** |
540 |
540 |
541 @see RSqlStatement::ColumnInt(). |
541 @see RSqlStatement::ColumnInt(). |
542 */ |
542 */ |
543 TInt CSqlStatementImpl::ColumnInt(TInt aColumnIndex) |
543 TInt CSqlStatementImpl::ColumnInt(TInt aColumnIndex) |
544 { |
544 { |
545 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
545 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
546 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
546 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
547 iColumnValBufIt.MoveTo(aColumnIndex); |
547 iColumnValBufIt.MoveTo(aColumnIndex); |
548 __SQLASSERT(iColumnValBufIt.IsPresent(), ESqlPanicValueNotPresent); |
548 __ASSERT_DEBUG(iColumnValBufIt.IsPresent(), __SQLPANIC(ESqlPanicValueNotPresent)); |
549 return iColumnValBufIt.Int(); |
549 return iColumnValBufIt.Int(); |
550 } |
550 } |
551 |
551 |
552 /** |
552 /** |
553 Implements RSqlStatement::ColumnInt64(). |
553 Implements RSqlStatement::ColumnInt64(). |
557 |
557 |
558 @see RSqlStatement::ColumnInt64(). |
558 @see RSqlStatement::ColumnInt64(). |
559 */ |
559 */ |
560 TInt64 CSqlStatementImpl::ColumnInt64(TInt aColumnIndex) |
560 TInt64 CSqlStatementImpl::ColumnInt64(TInt aColumnIndex) |
561 { |
561 { |
562 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
562 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
563 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
563 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
564 iColumnValBufIt.MoveTo(aColumnIndex); |
564 iColumnValBufIt.MoveTo(aColumnIndex); |
565 __SQLASSERT(iColumnValBufIt.IsPresent(), ESqlPanicValueNotPresent); |
565 __ASSERT_DEBUG(iColumnValBufIt.IsPresent(), __SQLPANIC(ESqlPanicValueNotPresent)); |
566 return iColumnValBufIt.Int64(); |
566 return iColumnValBufIt.Int64(); |
567 } |
567 } |
568 |
568 |
569 /** |
569 /** |
570 Implements RSqlStatement::ColumnReal(). |
570 Implements RSqlStatement::ColumnReal(). |
574 |
574 |
575 @see RSqlStatement::ColumnReal(). |
575 @see RSqlStatement::ColumnReal(). |
576 */ |
576 */ |
577 TReal CSqlStatementImpl::ColumnReal(TInt aColumnIndex) |
577 TReal CSqlStatementImpl::ColumnReal(TInt aColumnIndex) |
578 { |
578 { |
579 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
579 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
580 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
580 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
581 iColumnValBufIt.MoveTo(aColumnIndex); |
581 iColumnValBufIt.MoveTo(aColumnIndex); |
582 __SQLASSERT(iColumnValBufIt.IsPresent(), ESqlPanicValueNotPresent); |
582 __ASSERT_DEBUG(iColumnValBufIt.IsPresent(), __SQLPANIC(ESqlPanicValueNotPresent)); |
583 return iColumnValBufIt.Real(); |
583 return iColumnValBufIt.Real(); |
584 } |
584 } |
585 |
585 |
586 /** |
586 /** |
587 Return a text (16 bit) descriptor to a text column identified by aColumnIndex. |
587 Return a text (16 bit) descriptor to a text column identified by aColumnIndex. |
595 @panic SqlDb 5 Column index out of bounds. |
595 @panic SqlDb 5 Column index out of bounds. |
596 @panic SqlDb 11 Statement cursor not positioned on a row |
596 @panic SqlDb 11 Statement cursor not positioned on a row |
597 */ |
597 */ |
598 TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TPtrC& aPtr) |
598 TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TPtrC& aPtr) |
599 { |
599 { |
600 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
600 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
601 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
601 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
602 iColumnValBufIt.MoveTo(aColumnIndex); |
602 iColumnValBufIt.MoveTo(aColumnIndex); |
603 if(iColumnValBufIt.IsPresent()) |
603 if(iColumnValBufIt.IsPresent()) |
604 { |
604 { |
605 aPtr.Set(iColumnValBufIt.Text()); |
605 aPtr.Set(iColumnValBufIt.Text()); |
606 return KErrNone; |
606 return KErrNone; |
642 @panic SqlDb 5 Column index out of bounds. |
642 @panic SqlDb 5 Column index out of bounds. |
643 @panic SqlDb 11 Statement cursor not positioned on a row |
643 @panic SqlDb 11 Statement cursor not positioned on a row |
644 */ |
644 */ |
645 TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TDes& aDest) |
645 TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TDes& aDest) |
646 { |
646 { |
647 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
647 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
648 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
648 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
649 iColumnValBufIt.MoveTo(aColumnIndex); |
649 iColumnValBufIt.MoveTo(aColumnIndex); |
650 TInt err = KErrNone; |
650 TInt err = KErrNone; |
651 //The text column value has not been transferred to the client side if its length is >= KSqlMaxDesLen characters. |
651 //The text column value has not been transferred to the client side if its length is >= KSqlMaxDesLen characters. |
652 //In this case an additional call to the server is made to get the column value. |
652 //In this case an additional call to the server is made to get the column value. |
653 if(!iColumnValBufIt.IsPresent()) |
653 if(!iColumnValBufIt.IsPresent()) |
695 @panic SqlDb 5 Column index out of bounds. |
695 @panic SqlDb 5 Column index out of bounds. |
696 @panic SqlDb 11 Statement cursor not positioned on a row |
696 @panic SqlDb 11 Statement cursor not positioned on a row |
697 */ |
697 */ |
698 TInt CSqlStatementImpl::ColumnBinary(TInt aColumnIndex, TPtrC8& aPtr) |
698 TInt CSqlStatementImpl::ColumnBinary(TInt aColumnIndex, TPtrC8& aPtr) |
699 { |
699 { |
700 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
700 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
701 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
701 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
702 iColumnValBufIt.MoveTo(aColumnIndex); |
702 iColumnValBufIt.MoveTo(aColumnIndex); |
703 if(iColumnValBufIt.IsPresent()) |
703 if(iColumnValBufIt.IsPresent()) |
704 { |
704 { |
705 aPtr.Set(iColumnValBufIt.Binary()); |
705 aPtr.Set(iColumnValBufIt.Binary()); |
706 return KErrNone; |
706 return KErrNone; |
742 @panic SqlDb 5 Column index out of bounds. |
742 @panic SqlDb 5 Column index out of bounds. |
743 @panic SqlDb 11 Statement cursor not positioned on a row |
743 @panic SqlDb 11 Statement cursor not positioned on a row |
744 */ |
744 */ |
745 TInt CSqlStatementImpl::ColumnBinary(TInt aColumnIndex, TDes8& aDest) |
745 TInt CSqlStatementImpl::ColumnBinary(TInt aColumnIndex, TDes8& aDest) |
746 { |
746 { |
747 __SQLASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, ESqlPanicBadColumnIndex); |
747 __ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex)); |
748 __SQLASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, ESqlPanicInvalidRow); |
748 __ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow)); |
749 iColumnValBufIt.MoveTo(aColumnIndex); |
749 iColumnValBufIt.MoveTo(aColumnIndex); |
750 TInt err = KErrNone; |
750 TInt err = KErrNone; |
751 //The binary column value has not been transferred to the client side if its length is >= KSqlMaxDesLen bytes. |
751 //The binary column value has not been transferred to the client side if its length is >= KSqlMaxDesLen bytes. |
752 //In this case an additional call to the server is made to get the column value. |
752 //In this case an additional call to the server is made to get the column value. |
753 if(!iColumnValBufIt.IsPresent()) |
753 if(!iColumnValBufIt.IsPresent()) |