#ifndef _SQL_BATCH_EXEC_H_
#define _SQL_BATCH_EXEC_H_


#include "cppdbc_public_interface.h"
#include <cppconn/statement.h>
#include <cppconn/connection.h>
#include <sigc++/sigc++.h>
#include <list>
#include <string>


namespace sql
{


class CPPDBC_PUBLIC_FUNC SqlBatchExec
{
public:
  void operator()(sql::Statement *stmt, std::list<std::string> &statements);

public:
  typedef sigc::slot<int, long long, const std::string&, const std::string&> Error_cb;
  typedef sigc::slot<int, float> Batch_exec_progress_cb;
  typedef sigc::slot<int, long, long> Batch_exec_stat_cb;

  Error_cb _error_cb;
  Batch_exec_progress_cb _batch_exec_progress_cb;
  Batch_exec_stat_cb _batch_exec_stat_cb;

  void error_cb(const Error_cb &cb) { _error_cb= cb; };
  void batch_exec_progress_cb(const Batch_exec_progress_cb &cb) { _batch_exec_progress_cb= cb; };
  void batch_exec_stat_cb(const Batch_exec_stat_cb &cb) { _batch_exec_stat_cb= cb; };

private:
  long _batch_exec_success_count;
  long _batch_exec_err_count;
  float _batch_exec_progress_state;
  float _batch_exec_progress_inc;
};


} // namespace sql


#endif // _SQL_BATCH_EXEC_H_
