78 } |
81 } |
79 |
82 |
80 //Executes the heap simulation failure. |
83 //Executes the heap simulation failure. |
81 inline void CSqlSrvSession::DbSetAllocFail(TInt aHeapFailureMode, TInt aFailedAllocNumber) |
84 inline void CSqlSrvSession::DbSetAllocFail(TInt aHeapFailureMode, TInt aFailedAllocNumber) |
82 { |
85 { |
83 User::__DbgSetAllocFail(RHeap::EUser, |
86 TInt mode = aHeapFailureMode & (KDelayedDbHeapFailureMask - 1); |
84 static_cast <RHeap::TAllocFail> (aHeapFailureMode & (KDelayedDbHeapFailureMask - 1)), |
87 if(mode >= RAllocator::EBurstRandom && mode <= RAllocator::EBurstFailNext) |
85 aFailedAllocNumber); |
88 { |
|
89 const TUint KBurst = 50; |
|
90 User::__DbgSetBurstAllocFail(RHeap::EUser, static_cast <RHeap::TAllocFail> (mode), aFailedAllocNumber, KBurst); |
|
91 } |
|
92 else |
|
93 { |
|
94 User::__DbgSetAllocFail(RHeap::EUser, static_cast <RHeap::TAllocFail> (mode), aFailedAllocNumber); |
|
95 } |
86 } |
96 } |
87 |
97 |
88 //Executes the delayed heap simulation failure, if the connection is in test mode |
98 //Executes the delayed heap simulation failure, if the connection is in test mode |
89 inline void CSqlSrvSession::DbSetDelayedAllocFail() |
99 inline void CSqlSrvSession::DbSetDelayedAllocFail() |
90 { |
100 { |
91 if(iDbResourceTestMode & KDelayedDbHeapFailureMask) |
101 if(iDbResourceTestMode & KDelayedDbHeapFailureMask) |
92 { |
102 { |
93 User::__DbgSetAllocFail(RHeap::EUser, |
103 TInt mode = iDbResourceTestMode & (KDelayedDbHeapFailureMask - 1); |
94 static_cast <RHeap::TAllocFail> (iDbResourceTestMode & (KDelayedDbHeapFailureMask - 1)), |
104 if(mode >= RAllocator::EBurstRandom && mode <= RAllocator::EBurstFailNext) |
95 iFailedAllocNumber); |
105 { |
|
106 const TUint KBurst = 50; |
|
107 User::__DbgSetBurstAllocFail(RHeap::EUser, static_cast <RHeap::TAllocFail> (mode), iFailedAllocNumber, KBurst); |
|
108 } |
|
109 else |
|
110 { |
|
111 User::__DbgSetAllocFail(RHeap::EUser, static_cast <RHeap::TAllocFail> (mode), iFailedAllocNumber); |
|
112 } |
96 } |
113 } |
97 } |
114 } |
98 |
115 |
99 #else //_DEBUG |
116 #else //_DEBUG |
100 |
117 |
1061 Arg 1: [in] db names buffer |
1084 Arg 1: [in] db names buffer |
1062 Arg 2: [in] file session handle |
1085 Arg 2: [in] file session handle |
1063 Arg 3: [in] database file handle |
1086 Arg 3: [in] database file handle |
1064 |
1087 |
1065 @panic SqlDb 2 Client panic. iDatabase is NULL (the database object is not created yet). |
1088 @panic SqlDb 2 Client panic. iDatabase is NULL (the database object is not created yet). |
|
1089 @panic SqlDb 4 Client panic. Invalid IPC data, an indication of a problme in client side sql library. |
1066 */ |
1090 */ |
1067 void CSqlSrvSession::DbAttachFromHandleL(const RMessage2& aMessage) |
1091 void CSqlSrvSession::DbAttachFromHandleL(const RMessage2& aMessage) |
1068 { |
1092 { |
1069 __SQLPANIC_CLIENT(iDatabase != NULL, aMessage, ESqlPanicInvalidObj); |
1093 __SQLPANIC_CLIENT(iDatabase != NULL, aMessage, ESqlPanicInvalidObj); |
1070 //Read-only flag, buffer length, buffer allocation |
1094 //Read-only flag, buffer length, buffer allocation |
1071 TBool readOnly = (aMessage.Int0() & 0x80000000) != 0; |
1095 TBool readOnly = (aMessage.Int0() & 0x80000000) != 0; |
1072 const TInt KBufLen = aMessage.Int0() & 0x7FFFFFFF; |
1096 const TInt KBufLen = aMessage.Int0() & 0x7FFFFFFF; |
1073 if(KBufLen <= 0) |
1097 __SQLPANIC_CLIENT(KBufLen > 0, aMessage, ESqlPanicBadArgument); |
1074 { |
|
1075 __SQLLEAVE(KErrArgument); |
|
1076 } |
|
1077 HBufC8* buf = HBufC8::NewLC(KBufLen); |
1098 HBufC8* buf = HBufC8::NewLC(KBufLen); |
1078 TPtr8 bufPtr = buf->Des(); |
1099 TPtr8 bufPtr = buf->Des(); |
1079 aMessage.ReadL(1, bufPtr); |
1100 aMessage.ReadL(1, bufPtr); |
1080 SQLPROFILER_REPORT_IPC(ESqlIpcRead, KBufLen); |
1101 SQLPROFILER_REPORT_IPC(ESqlIpcRead, KBufLen); |
1081 if(KBufLen != bufPtr.Length()) |
1102 if(KBufLen != bufPtr.Length()) |
1484 SQLPROFILER_REPORT_IPC(ESqlIpcRead, prmLen); |
1505 SQLPROFILER_REPORT_IPC(ESqlIpcRead, prmLen); |
1485 aStmt.BindL(prmBuf); |
1506 aStmt.BindL(prmBuf); |
1486 } |
1507 } |
1487 |
1508 |
1488 /** |
1509 /** |
|
1510 Processes the request for retrieving the statement declared column type names. |
|
1511 |
|
1512 If the client side buffer size is not big enough, the function returns the size + KSqlClientBufOverflowCode. |
|
1513 In this case the client must increase the buffer and try again to get the buffer only |
|
1514 |
1489 Usage of the IPC call arguments: |
1515 Usage of the IPC call arguments: |
1490 Arg 0: [in] input buffer max length in 16-bit characters |
1516 Arg 0: [in] input buffer max length in 16-bit characters |
1491 Arg 1: [in/out] buffer |
1517 Arg 1: [out] ipc buffer, declared column type names |
1492 */ |
1518 */ |
1493 void CSqlSrvSession::StmtDeclColumnTypesL(const RMessage2& aMessage, TInt aStmtHandle) |
1519 TInt CSqlSrvSession::StmtDeclColumnTypesL(const RMessage2& aMessage, TInt aStmtHandle) |
1494 { |
1520 { |
1495 CSqlSrvStatement& stmt = ::SqlSessObjFind(iStatements, aStmtHandle, aMessage); |
1521 CSqlSrvStatement& stmt = ::SqlSessObjFind(iStatements, aStmtHandle, aMessage); |
1496 HBufC* colTypesBuf = stmt.GetDeclColumnTypesL(); |
1522 const RSqlBufFlat& declColumnTypesBuf = stmt.GetDeclColumnTypesL(); |
1497 CleanupStack::PushL(colTypesBuf); |
1523 TInt size = declColumnTypesBuf.Size(); |
1498 if(colTypesBuf->Des().Length() > aMessage.Int0()) |
1524 if(size <= aMessage.Int0()) |
1499 { |
1525 { |
1500 __SQLLEAVE(KErrOverflow); |
1526 aMessage.WriteL(1, declColumnTypesBuf.BufDes()); |
1501 } |
1527 return 0; |
1502 aMessage.WriteL(1, colTypesBuf->Des()); |
1528 } |
1503 SQLPROFILER_REPORT_IPC(ESqlIpcWrite, (colTypesBuf->Des().Length() * sizeof(TText))); |
1529 return size + KSqlClientBufOverflowCode; |
1504 CleanupStack::PopAndDestroy(colTypesBuf); |
|
1505 } |
1530 } |
1506 |
1531 |
1507 |
1532 |
1508 ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
1533 ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
1509 //////////////////////// Helper methods ///////////////////////////////// |
1534 //////////////////////// Helper methods ///////////////////////////////// |
1553 /** |
1578 /** |
1554 Reads a 8-bit string with "aByteLen" bytes length, which is in "aArgNum" argument of aMessage. |
1579 Reads a 8-bit string with "aByteLen" bytes length, which is in "aArgNum" argument of aMessage. |
1555 The string will be zero terminated after the "read" operation. |
1580 The string will be zero terminated after the "read" operation. |
1556 Returns TDes8 reference pointing to the zero-terminated string. |
1581 Returns TDes8 reference pointing to the zero-terminated string. |
1557 |
1582 |
1558 @leave KErrBadDescriptor The transferred data length is bigger than the aByteLen value |
1583 @panic SqlDb 3 Client panic. The string length is not equal to aByteLen. If happens then it is an indication of a |
1559 |
1584 problem inside client side sql library. |
1560 @panic SqlDb 4 Client panic. Negative aByteLen value. |
1585 @panic SqlDb 4 Client panic. Negative aByteLen value. |
1561 */ |
1586 */ |
1562 TDes8& CSqlSrvSession::ReadString8ZL(const RMessage2& aMessage, TInt aArgNum, TInt aByteLen) |
1587 TDes8& CSqlSrvSession::ReadString8ZL(const RMessage2& aMessage, TInt aArgNum, TInt aByteLen) |
1563 { |
1588 { |
1564 __SQLPANIC_CLIENT(aByteLen >= 0, aMessage, ESqlPanicBadArgument); |
1589 __SQLPANIC_CLIENT(aByteLen >= 0, aMessage, ESqlPanicBadArgument); |
1565 TDes8& buf = Server().GetBuf8L(aByteLen + 1); |
1590 TDes8& buf = Server().GetBuf8L(aByteLen + 1); |
1566 aMessage.ReadL(aArgNum, buf); |
1591 aMessage.ReadL(aArgNum, buf); |
1567 SQLPROFILER_REPORT_IPC(ESqlIpcRead, aByteLen); |
1592 SQLPROFILER_REPORT_IPC(ESqlIpcRead, aByteLen); |
1568 if(buf.Length() > aByteLen) |
1593 __SQLPANIC_CLIENT(buf.Length() == aByteLen, aMessage, ESqlPanicBadHandle); |
1569 { |
|
1570 __SQLLEAVE(KErrBadDescriptor); |
|
1571 } |
|
1572 buf.Append(TChar(0)); |
1594 buf.Append(TChar(0)); |
1573 return buf; |
1595 return buf; |
1574 } |
1596 } |
1575 |
1597 |
1576 /** |
1598 /** |
1577 Reads a 16-bit string with "aCharLen" character length, which is in "aArgNum" argument of aMessage. |
1599 Reads a 16-bit string with "aCharLen" character length, which is in "aArgNum" argument of aMessage. |
1578 The string will be zero terminated after the "read" operation. |
1600 The string will be zero terminated after the "read" operation. |
1579 Returns TDes16 reference pointing to the zero-terminated string. |
1601 Returns TDes16 reference pointing to the zero-terminated string. |
1580 |
1602 |
1581 @leave KErrBadDescriptor The transferred data length is bigger than the aCharLen value |
1603 @panic SqlDb 3 Client panic. The string length is not equal to aCharLen. If happens then it is an indication of a |
1582 |
1604 problem inside client side sql library. |
1583 @panic SqlDb 4 Client panic. Negative aCharLen value. |
1605 @panic SqlDb 4 Client panic. Negative aCharLen value. |
1584 */ |
1606 */ |
1585 TDes16& CSqlSrvSession::ReadString16ZL(const RMessage2& aMessage, TInt aArgNum, TInt aCharLen) |
1607 TDes16& CSqlSrvSession::ReadString16ZL(const RMessage2& aMessage, TInt aArgNum, TInt aCharLen) |
1586 { |
1608 { |
1587 __SQLPANIC_CLIENT(aCharLen >= 0, aMessage, ESqlPanicBadArgument); |
1609 __SQLPANIC_CLIENT(aCharLen >= 0, aMessage, ESqlPanicBadArgument); |
1588 TDes16& buf = Server().GetBuf16L(aCharLen + 1); |
1610 TDes16& buf = Server().GetBuf16L(aCharLen + 1); |
1589 aMessage.ReadL(aArgNum, buf); |
1611 aMessage.ReadL(aArgNum, buf); |
1590 SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aCharLen * sizeof(TText))); |
1612 SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aCharLen * sizeof(TText))); |
1591 if(buf.Length() > aCharLen) |
1613 __SQLPANIC_CLIENT(buf.Length() == aCharLen, aMessage, ESqlPanicBadHandle); |
1592 { |
|
1593 __SQLLEAVE(KErrBadDescriptor); |
|
1594 } |
|
1595 buf.Append(TChar(0)); |
1614 buf.Append(TChar(0)); |
1596 return buf; |
1615 return buf; |
1597 } |
1616 } |
1598 |
1617 |
1599 /** |
1618 /** |
1600 Reads a 16-bit string with "aCharLen" character length, which is in "aArgNum" argument of aMessage. |
1619 Reads a 16-bit string with "aCharLen" character length, which is in "aArgNum" argument of aMessage. |
1601 Returns TDes16 reference pointing to the string. |
1620 Returns TDes16 reference pointing to the string. |
1602 |
1621 |
1603 @leave KErrBadDescriptor The transferred data length is bigger than the aCharLen value |
1622 @panic SqlDb 3 Client panic. The string length is not equal to aCharLen. If happens then it is an indication of a |
1604 |
1623 problem inside client side sql library. |
1605 @panic SqlDb 4 Client panic. Negative aCharLen value. |
1624 @panic SqlDb 4 Client panic. Negative aCharLen value. |
1606 */ |
1625 */ |
1607 TDes16& CSqlSrvSession::ReadString16L(const RMessage2& aMessage, TInt aArgNum, TInt aCharLen) |
1626 TDes16& CSqlSrvSession::ReadString16L(const RMessage2& aMessage, TInt aArgNum, TInt aCharLen) |
1608 { |
1627 { |
1609 __SQLPANIC_CLIENT(aCharLen >= 0, aMessage, ESqlPanicBadArgument); |
1628 __SQLPANIC_CLIENT(aCharLen >= 0, aMessage, ESqlPanicBadArgument); |
1610 TDes16& buf = Server().GetBuf16L(aCharLen); |
1629 TDes16& buf = Server().GetBuf16L(aCharLen); |
1611 aMessage.ReadL(aArgNum, buf); |
1630 aMessage.ReadL(aArgNum, buf); |
1612 SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aCharLen * sizeof(TText))); |
1631 SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aCharLen * sizeof(TText))); |
1613 if(buf.Length() > aCharLen) |
1632 __SQLPANIC_CLIENT(buf.Length() == aCharLen, aMessage, ESqlPanicBadHandle); |
1614 { |
|
1615 __SQLLEAVE(KErrBadDescriptor); |
|
1616 } |
|
1617 return buf; |
1633 return buf; |
1618 } |
1634 } |
1619 |
1635 |
1620 /** |
1636 /** |
1621 The method constructs a CSqlSecurityPolicy object from the passed as an argument descriptor. |
1637 The method constructs a CSqlSecurityPolicy object from the passed as an argument descriptor. |