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