Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SQLDBC_IRuntime.h

Go to the documentation of this file.
00001 
00034 #ifndef SQLDBC_IRUNTIME_H
00035 #define SQLDBC_IRUNTIME_H
00036 
00037 // For encoding
00038 #include "Interfaces/SQLDBC/SQLDBC_Types.h"
00039 #include "SAPDBCommon/SAPDB_Types.h"
00040 #include "SAPDBCommon/SAPDB_ReuseLib.h"
00041 
00042 // #include "SAPDBCommon/MemoryManagement/SAPDBMem_IRawAllocator.hpp"
00043 
00044 class SAPDBMem_IRawAllocator;
00045 class SAPDBErr_MessageList;
00046 
00047   
00091 class SQLDBC_IRuntime
00092 {
00093 public:
00097     typedef void *MutexHandle;
00098 
00102     typedef void *SemaphoreHandle;
00103 
00107     typedef void *CounterHandle;
00108 
00112     struct TaskTraceContext
00113     {
00114         void           *currentEntry;   
00115         // -- further settings, used by the trace stream abstraction.
00116         SAPDB_Bool  hex;               
00117         SAPDB_UInt4 inputlength;       
00118         SQLDBC_StringEncoding encoding;
00119         SAPDB_UInt4 indent;            
00120         SAPDB_UInt4 flags;             
00121         SAPDB_UInt4 traceableLimit;    
00122         SAPDB_UInt4 pos;               
00123     };
00124         
00125 
00129     typedef SAPDB_UInt4 TaskID;
00130 
00134     virtual ~SQLDBC_IRuntime() {}
00135 
00141     virtual const char *getIdentfier() const { return ""; }
00142     
00153     virtual SAPDBMem_IRawAllocator& getGlobalAllocator() = 0;
00154 
00155     // Packet and Session Handling
00156 
00194     virtual SAPDB_Bool getSession(const char *connectUrl,
00195                                   const char *connectCommand,
00196                                   const char *password,
00197                                   SAPDB_Int4  passwordLength,
00198                                   const SQLDBC_StringEncoding commandEncoding,
00199                                   SAPDB_Int8&  sessionID,
00200                                   SAPDB_UInt4& packetSize,
00201                                   SAPDB_Int4& packetListSize,
00202                                   void **packetList,  
00203                                   void **sessionInfoReply,
00204                                   SAPDBErr_MessageList& errorMessages,
00205                                   SAPDBMem_IRawAllocator* allocator = 0) = 0;
00206 
00215     virtual SAPDB_Bool releaseSession(SAPDB_Int8 sessionID,
00216                                       SAPDBErr_MessageList& errorMessages) = 0;
00217     
00228     virtual SAPDB_Bool request(SAPDB_Int8  sessionID,
00229                                void       *requestData,
00230                                SAPDB_UInt4 requestDataLength,
00231                                SAPDBErr_MessageList& errorMessages) = 0; 
00232 
00242     virtual SAPDB_Bool receive(SAPDB_Int8 sessionID,
00243                                void **replyData,
00244                                SAPDB_Int4& replyDataLength,
00245                                SAPDBErr_MessageList& errorMessages) = 0;
00246 
00254     virtual SAPDB_Bool cancelCurrentCommand(SAPDB_Int8 sessionID,
00255                                             SAPDBErr_MessageList& errorMessages) = 0;
00256 
00257     // -- synchronization primitives
00267     virtual SAPDB_Bool createMutex(MutexHandle& mutexHandle, 
00268                                    SAPDBMem_IRawAllocator& allocator,
00269                                    SAPDBErr_MessageList& errorMessages)  = 0;
00270 
00277     virtual SAPDB_Bool lockMutex(MutexHandle mutexHandle) = 0;
00278     
00285     virtual SAPDB_Bool releaseMutex(MutexHandle mutexHandle) = 0;
00286     
00295     virtual SAPDB_Bool destroyMutex(MutexHandle& mutexHandle, 
00296                                     SAPDBMem_IRawAllocator& allocator,
00297                                     SAPDBErr_MessageList& errorMessages) = 0;
00298     
00307     virtual SAPDB_Bool  createCounter(CounterHandle& counterHandle,
00308                                       SAPDBMem_IRawAllocator& allocator,
00309                                       SAPDBErr_MessageList& errorMessages)  = 0;
00310 
00311     
00317     virtual SAPDB_UInt4 nextCounter(CounterHandle counterHandle) = 0;
00318     
00328     virtual SAPDB_Bool  destroyCounter(CounterHandle counterHandle,
00329                                       SAPDBMem_IRawAllocator& allocator,
00330                                       SAPDBErr_MessageList& errorMessages)  = 0;
00331            
00338     virtual TaskID getCurrentTaskID() = 0;                                      
00339                                       
00349     virtual SAPDB_Bool createSemaphore(SemaphoreHandle& semaphoreHandle,
00350                                        SAPDB_Int4 initialValue,
00351                                        SAPDBMem_IRawAllocator& allocator,
00352                                        SAPDBErr_MessageList errorMessages) = 0;
00353 
00361     virtual SAPDB_Bool waitSemaphore(SemaphoreHandle semaphoreHandle) =0;
00362 
00369     virtual SAPDB_Bool signalSemaphore(SemaphoreHandle semaphoreHandle) =0;
00370     
00380     virtual SAPDB_Bool destroySemaphore(SemaphoreHandle& semaphoreHandle,
00381                                         SAPDBMem_IRawAllocator& allocator,
00382                                         SAPDBErr_MessageList& errorMessages)  = 0;
00383     
00384     // -- Tracing 
00385     
00393     virtual TaskTraceContext* getTaskTraceContext() = 0;
00394     
00401     virtual void write(const char *s, SAPDB_Int4 size) = 0;
00402     
00409     virtual void writeln(const char *s, SAPDB_Int4 size) = 0;
00410     
00411 };
00412 
00413 #endif
00414