NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
sql_interface.h
Go to the documentation of this file.
1 #ifndef SDK_BASE_SQL_INTERFACE_H_
11 #define SDK_BASE_SQL_INTERFACE_H_
12 
13 #include <base/inc/platform.h>
14 #include <base/inc/base_types.h>
16 #include <base/inc/sdk_ref_ptr.h>
18 
19 namespace sdk {
20 namespace sql {
21 
22 // Classes declared in this file
23 FWD_DECL_INTERFACE(IConnection);
24 FWD_DECL_INTERFACE(IRowSet);
25 
28 class IConnection : public ISDKComponent {
29 public:
31  virtual SDKResult SDK_CALLTYPE Open(
32  const SDKString& connection_string) throw() = 0;
33 
35  virtual SDKResult SDK_CALLTYPE Close() throw() = 0;
36 
37  SDK_IMPLEMENT_IID(IConnection)
38  SDK_END_INTERFACE(IConnection)
39 };
40 SDK_DECLARE_IID(IConnection)
41 
42 class IRowSet : public ISDKComponent {
46 public:
48  virtual SDKResult SDK_CALLTYPE Rows(SDKUInt64& rows) throw() = 0;
50  virtual SDKResult SDK_CALLTYPE Move(SDKUInt64 row) throw() = 0;
52  virtual SDKResult SDK_CALLTYPE MoveNext() throw() = 0;
54  virtual SDKResult SDK_CALLTYPE MoveFirst() throw() = 0;
57  virtual SDKResult SDK_CALLTYPE GetValue(SDKUInt32 col,
58  SDKAny& value) const throw() = 0;
61  virtual SDKResult SDK_CALLTYPE GetValueByColumnName(const char* col,
62  SDKAny& value) const throw() = 0;
63 
64  template<typename T>
65  SDKResult GetValueT(SDKUInt32 col, T& out_value) throw() {
66  SDK_NAMESPACE::ScopedAny value;
67  SDKResult res = GetValue(col, value);
68  if (SDK_FAILED(res))
69  return res;
70  return value.GetAs< T >(out_value) ?
72  }
73 
74  SDK_IMPLEMENT_IID(IRowSet)
75  SDK_END_INTERFACE(IRowSet)
76 };
77 SDK_DECLARE_IID(IRowSet)
78 
79 } // namespace sql
80 } // namespace sdk
81 
82 #endif // SDK_BASE_SQL_INTERFACE_H_
sdk::sql::IConnection::Open
virtual SDKResult SDK_CALLTYPE Open(const SDKString &connection_string)=0
Opens connection.
sdk::sql::IRowSet::MoveNext
virtual SDKResult SDK_CALLTYPE MoveNext()=0
Moves the cursor down one row from its current position.
base_types.h
SDK base types.
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::sql::IRowSet
Provides method for fetching rows sequentially, getting data from those rows and managing rows.
Definition: sql_interface.h:45
sdk::sql::IRowSet::MoveFirst
virtual SDKResult SDK_CALLTYPE MoveFirst()=0
Moves the cursor to the first in the RowSet.
kSDKResult_Succeeded
static const SDKResult kSDKResult_Succeeded
Operation completed successfully.
Definition: sdk_results.h:22
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::sql::IRowSet::GetValueByColumnName
virtual SDKResult SDK_CALLTYPE GetValueByColumnName(const char *col, SDKAny &value) const =0
Gets the value of the designated column in the current row of this RowSet object as an Any.
sdk::sql::IRowSet::Rows
virtual SDKResult SDK_CALLTYPE Rows(SDKUInt64 &rows)=0
Returns number of rows in the row set.
sdk_component_interface.h
Common base SDK interfaces.
SDK_FAILED
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
platform.h
Describes the platform constants.
ISDKComponent
Base interface for all SDK interfaces.
Definition: sdk_component_interface.h:41
sdk::sql::IConnection::Close
virtual SDKResult SDK_CALLTYPE Close()=0
Closes connection.
sdk::sql::IConnection
Interface associated with the SQL database connection object.
Definition: sql_interface.h:28
kSDKResult_InvalidArgument
static const SDKResult kSDKResult_InvalidArgument
Wrong argument passed to function.
Definition: sdk_results.h:55
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
sdk::sql::IRowSet::Move
virtual SDKResult SDK_CALLTYPE Move(SDKUInt64 row)=0
Moves the cursor to the given row number.
sdk_any_handler.h
Wrappers for work with SDKAny instance.
sdk::sql::IRowSet::GetValue
virtual SDKResult SDK_CALLTYPE GetValue(SDKUInt32 col, SDKAny &value) const =0
Gets the value of the designated column in the current row of this RowSet object as an Any.