equal
deleted
inserted
replaced
21 #include "IPCBuf.h" //HIpcBuf |
21 #include "IPCBuf.h" //HIpcBuf |
22 #include "SqlDbSession.h" //RSqlDbSession |
22 #include "SqlDbSession.h" //RSqlDbSession |
23 #include "SqlSrvStartup.h" //StartSqlServer() |
23 #include "SqlSrvStartup.h" //StartSqlServer() |
24 #include "SqlResourceTest.h" //TSqlResourceTestData |
24 #include "SqlResourceTest.h" //TSqlResourceTestData |
25 #include "SqlSecurityImpl.h" //CSqlSecurityPolicy |
25 #include "SqlSecurityImpl.h" //CSqlSecurityPolicy |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "SqlDbSessionTraces.h" |
|
29 #endif |
|
30 #include "SqlTraceDef.h" |
26 |
31 |
27 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
32 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
28 ////////////////////// TSqlFhCmdFunctor /////////////////////////////////////////////// |
33 ////////////////////// TSqlFhCmdFunctor /////////////////////////////////////////////// |
29 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
34 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
30 |
35 |
194 return KErrNoMemory; |
199 return KErrNoMemory; |
195 } |
200 } |
196 TPtr8 bufPtr = buf->Des(); |
201 TPtr8 bufPtr = buf->Des(); |
197 RDesWriteStream out(bufPtr); |
202 RDesWriteStream out(bufPtr); |
198 TRAPD(err, SerializeToStreamL(out)); |
203 TRAPD(err, SerializeToStreamL(out)); |
199 __SQLASSERT(err == KErrNone, ESqlPanicInternalError);//"Write to descriptor" streaming operatons can't fail |
204 __ASSERT_DEBUG(err == KErrNone, __SQLPANIC(ESqlPanicInternalError));//"Write to descriptor" streaming operatons can't fail |
200 TUint32 arg0 = (TUint32)bufPtr.Length() | (aReadOnly ? 0x80000000 : 0); |
205 TUint32 arg0 = (TUint32)bufPtr.Length() | (aReadOnly ? 0x80000000 : 0); |
201 TIpcArgs ipcArgs(arg0, &bufPtr); |
206 TIpcArgs ipcArgs(arg0, &bufPtr); |
202 err = aDbFile.TransferToServer(ipcArgs, 2, 3); |
207 err = aDbFile.TransferToServer(ipcArgs, 2, 3); |
203 if(err == KErrNone) |
208 if(err == KErrNone) |
204 { |
209 { |
205 err = iDbSession.SendReceive(ESqlSrvDbAttachFromHandle, ipcArgs); |
210 err = iDbSession.SendReceive(ESqlSrvDbAttachFromHandle, ipcArgs); |
299 - Arg 2: [out] security policies buffer length if aFunction is ESqlSrvDbCreateSecure |
304 - Arg 2: [out] security policies buffer length if aFunction is ESqlSrvDbCreateSecure |
300 - Arg 3: [out] security policies buffer if aFunction is ESqlSrvDbCreateSecure |
305 - Arg 3: [out] security policies buffer if aFunction is ESqlSrvDbCreateSecure |
301 */ |
306 */ |
302 TInt RSqlDbSession::Connect(TSqlSrvFunction aFunction, const TDesC& aDbFileName, const TDesC8& aSecurityPolicyData, const TDesC8* aConfig) |
307 TInt RSqlDbSession::Connect(TSqlSrvFunction aFunction, const TDesC& aDbFileName, const TDesC8& aSecurityPolicyData, const TDesC8* aConfig) |
303 { |
308 { |
|
309 SQL_TRACE_SESSION(OstTraceExt2(TRACE_INTERNALS, RSQLDBSESSION_CONNECT_ENTRY, "Entry;0x%X;RSqlDbSession::Connect;aDbFileName=%S", (TUint)this, __SQLPRNSTR(aDbFileName))); |
304 #ifdef SYSLIBS_TEST |
310 #ifdef SYSLIBS_TEST |
305 const TInt KDefaultMsgBufLen = 4; |
311 const TInt KDefaultMsgBufLen = 4; |
306 #else |
312 #else |
307 const TInt KDefaultMsgBufLen = 128; |
313 const TInt KDefaultMsgBufLen = 128; |
308 #endif |
314 #endif |
356 } |
362 } |
357 if(err != KErrNone) |
363 if(err != KErrNone) |
358 { |
364 { |
359 Close(); |
365 Close(); |
360 } |
366 } |
|
367 SQL_TRACE_SESSION(OstTraceExt3(TRACE_INTERNALS, RSQLDBSESSION_CONNECT_EXIT, "Exit;0x%X;RSqlDbSession::Connect;err=%d;handle=0x%X", (TUint)this, err, (TUint)Handle())); |
361 return err; |
368 return err; |
362 } |
369 } |
363 |
370 |
364 /** |
371 /** |
365 Sends a command to the server to attach an existing database to the current connection. |
372 Sends a command to the server to attach an existing database to the current connection. |
648 /** |
655 /** |
649 Closes the database and releases the connection with the database server. |
656 Closes the database and releases the connection with the database server. |
650 */ |
657 */ |
651 void RSqlDbSession::Close() |
658 void RSqlDbSession::Close() |
652 { |
659 { |
|
660 SQL_TRACE_SESSION(OstTraceExt2(TRACE_INTERNALS, RSQLDBSESSION_CLOSE, "0x%X;RSqlDbSession::Close;handle=0x%X", (TUint)this, (TUint)Handle())); |
653 if(Handle()) |
661 if(Handle()) |
654 { |
662 { |
655 (void)SendReceive(ESqlSrvDbClose); |
663 (void)SendReceive(ESqlSrvDbClose); |
656 } |
664 } |
657 TSqlResourceTestData::Release(); |
665 TSqlResourceTestData::Release(); |
846 } |
854 } |
847 if(KConfigStrLen > 0) |
855 if(KConfigStrLen > 0) |
848 { |
856 { |
849 //coverity[DEADCODE] |
857 //coverity[DEADCODE] |
850 //The ASSERT might be useful in catching future defect in this function |
858 //The ASSERT might be useful in catching future defect in this function |
851 __SQLASSERT(aConfig != NULL, ESqlPanicInternalError); |
859 __ASSERT_DEBUG(aConfig != NULL, __SQLPANIC(ESqlPanicInternalError)); |
852 arg3Ptr.Append(*aConfig); |
860 arg3Ptr.Append(*aConfig); |
853 } |
861 } |
854 ipcArgs.Set(3, &arg3Ptr); |
862 ipcArgs.Set(3, &arg3Ptr); |
855 } |
863 } |
856 TInt err = SendReceive(aFunction, ipcArgs); |
864 TInt err = SendReceive(aFunction, ipcArgs); |