# hybridse::vm::RunSession

`#include <engine.h>`

A [RunSession](https://tobe.gitbook.io/hybridsql/hybridse/shi-yong-wen-dang/c++-api-wen-dang/classes/classhybridse_1_1vm_1_1_run_session) maintain SQL running context, including compile information, procedure name.

## Summary

| Public functions                                                                                                                                                                                                                                  |                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**RunSession**](#function-runsession)([EngineMode](https://tobe.gitbook.io/hybridsql/hybridse/shi-yong-wen-dang/namespaces/namespacehybridse_1_1vm#enum-enginemode) engine\_mode)                                                                |                                                                                                                                                      |
| [**\~RunSession**](#function-~runsession)()                                                                                                                                                                                                       |                                                                                                                                                      |
| [**GetSchema**](#function-getschema)() const                                                                                                                                                                                                      | <p>const Schema &<br>Return query result schema.</p>                                                                                                 |
| [**GetEncodedSchema**](#function-getencodedschema)() const                                                                                                                                                                                        | <p>const std::string &<br>Return query schema string.</p>                                                                                            |
| [**GetCompileInfo**](#function-getcompileinfo)()                                                                                                                                                                                                  | <p>std::shared\_ptr< <a href="classhybridse_1_1vm_1_1_compile_info">hybridse::vm::CompileInfo</a> ><br>Return query related compile information.</p> |
| [**SetCompileInfo**](#function-setcompileinfo)(const std::shared\_ptr< [hybridse::vm::CompileInfo](https://tobe.gitbook.io/hybridsql/hybridse/shi-yong-wen-dang/c++-api-wen-dang/classes/classhybridse_1_1vm_1_1_compile_info) > & compile\_info) | <p>bool<br>Update query related compile information.</p>                                                                                             |
| [**EnableDebug**](#function-enabledebug)()                                                                                                                                                                                                        | <p>void<br>Enable printing debug information while running a query.</p>                                                                              |
| [**DisableDebug**](#function-disabledebug)()                                                                                                                                                                                                      | <p>void<br>Disable printing debug information while running a query.</p>                                                                             |
| [**IsDebug**](#function-isdebug)()                                                                                                                                                                                                                | <p>bool<br>Return if this run session support printing debug information.</p>                                                                        |
| [**SetSpName**](#function-setspname)(const std::string & sp\_name)                                                                                                                                                                                | <p>void<br>Bind this run session with specific procedure.</p>                                                                                        |
| [**engine\_mode**](#function-engine_mode)() const                                                                                                                                                                                                 | <p><a href="../../namespaces/namespacehybridse_1_1vm#enum-enginemode">EngineMode</a><br>Return the engine mode of this run session.</p>              |

| **Protected attributes**                       |                                                                                                                                                                             |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**compile\_info\_**](#variable-compile_info_) | std::shared\_ptr< [hybridse::vm::CompileInfo](https://tobe.gitbook.io/hybridsql/hybridse/shi-yong-wen-dang/c++-api-wen-dang/classes/classhybridse_1_1vm_1_1_compile_info) > |
| [**engine\_mode\_**](#variable-engine_mode_)   | [hybridse::vm::EngineMode](https://tobe.gitbook.io/hybridsql/hybridse/shi-yong-wen-dang/namespaces/namespacehybridse_1_1vm#enum-enginemode)                                 |
| [**is\_debug\_**](#variable-is_debug_)         | bool                                                                                                                                                                        |
| [**sp\_name\_**](#variable-sp_name_)           | std::string                                                                                                                                                                 |
| [**Engine**](#variable-engine)                 | friend                                                                                                                                                                      |

## Public Functions

#### function RunSession

```cpp
explicit RunSession(
    EngineMode engine_mode
)
```

#### function \~RunSession

```cpp
virtual ~RunSession()
```

#### function GetSchema

```cpp
inline virtual const Schema & GetSchema() const
```

Return query result schema.

#### function GetEncodedSchema

```cpp
inline virtual const std::string & GetEncodedSchema() const
```

Return query schema string.

#### function GetCompileInfo

```cpp
inline virtual std::shared_ptr< hybridse::vm::CompileInfo > GetCompileInfo()
```

Return query related compile information.

#### function SetCompileInfo

```cpp
bool SetCompileInfo(
    const std::shared_ptr< hybridse::vm::CompileInfo > & compile_info
)
```

Update query related compile information.

#### function EnableDebug

```cpp
inline void EnableDebug()
```

Enable printing debug information while running a query.

#### function DisableDebug

```cpp
inline void DisableDebug()
```

Disable printing debug information while running a query.

#### function IsDebug

```cpp
inline bool IsDebug()
```

Return if this run session support printing debug information.

#### function SetSpName

```cpp
inline void SetSpName(
    const std::string & sp_name
)
```

Bind this run session with specific procedure.

#### function engine\_mode

```cpp
inline EngineMode engine_mode() const
```

Return the engine mode of this run session.

## Protected Attributes

### variable compile\_info\_

```cpp
std::shared_ptr< hybridse::vm::CompileInfo > compile_info_;
```

### variable engine\_mode\_

```cpp
hybridse::vm::EngineMode engine_mode_;
```

### variable is\_debug\_

```cpp
bool is_debug_;
```

### variable sp\_name\_

```cpp
std::string sp_name_;
```

### variable Engine

```cpp
friend Engine;
```
