Otclient  14/8/2020
DBInsert Class Reference

#include <database.h>

Collaboration diagram for DBInsert:

Public Member Functions

 DBInsert (const DatabasePtr &db)
 
 ~DBInsert ()
 
void setQuery (const std::string &query)
 
bool addRow (const std::string &row)
 
bool addRow (std::stringstream &row)
 
bool execute ()
 

Protected Attributes

DatabasePtr m_db
 
uint32 m_rows
 
std::string m_query
 
std::string m_buf
 

Detailed Description

INSERT statement.

Gives possibility to optimize multiple INSERTs on databases that support multiline INSERTs.

Definition at line 222 of file database.h.

Constructor & Destructor Documentation

◆ DBInsert()

DBInsert::DBInsert ( const DatabasePtr db)
inline

Associates with given database handler.

Parameters
DatabasePtrdatabase wrapper

Definition at line 230 of file database.h.

◆ ~DBInsert()

DBInsert::~DBInsert ( )
inline

Definition at line 231 of file database.h.

Member Function Documentation

◆ addRow() [1/2]

bool DBInsert::addRow ( const std::string &  row)

Adds new row to INSERT statement.

On databases that doesn't support multiline INSERTs it simply execute INSERT for each row.

Parameters
std::string&row data

Definition at line 43 of file database.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addRow() [2/2]

bool DBInsert::addRow ( std::stringstream &  row)

Allows to use addRow() with stringstream as parameter.

Definition at line 62 of file database.cpp.

Here is the call graph for this function:

◆ execute()

bool DBInsert::execute ( )

Executes current buffer.

Definition at line 69 of file database.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuery()

void DBInsert::setQuery ( const std::string &  query)

Sets query prototype.

Parameters
std::string&INSERT query

Definition at line 36 of file database.cpp.

Member Data Documentation

◆ m_buf

std::string DBInsert::m_buf
protected

Definition at line 264 of file database.h.

◆ m_db

DatabasePtr DBInsert::m_db
protected

Definition at line 260 of file database.h.

◆ m_query

std::string DBInsert::m_query
protected

Definition at line 263 of file database.h.

◆ m_rows

uint32 DBInsert::m_rows
protected

Definition at line 262 of file database.h.


The documentation for this class was generated from the following files: