• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • CDP Linux
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • DBInterface C++ Classes
  • IDatabaseBulkInserter
  • 5.1.1

IDatabaseBulkInserter Class

(CDP2SQL::IDatabaseBulkInserter)

Abstract interface for batch inserting rows into a database table. More...

Header: #include <IDatabaseBulkInserter>
  • List of all members, including inherited members

Public Types

enum TypeHint { UNSPECIFIED, BLOB }

Public Functions

virtual ~IDatabaseBulkInserter()
virtual void AddRow(const std::vector<Utils::Variant> &values) = 0
virtual void Cancel() = 0
virtual void Commit() = 0
virtual void SetColumnTypeHint(int column, int type) = 0

Detailed Description

Abstract interface for batch inserting rows into a database table.

This interface is created by IDatabaseConnection::CreateBulkInserter when the backend supports an optimized bulk insert path (e.g. COPY FROM for PostgreSQL). It provides a generic row-oriented API:

  • AddRow - supply one row of values in column order.
  • Commit - finalize the current batch, flushing all pending rows.
  • Cancel - abort the current batch.

The object must be reusable: after Commit or Cancel, it must be possible to start a new batch by calling AddRow again.

Member Type Documentation

enum IDatabaseBulkInserter::TypeHint

Optional per-column type hints for bulk insert implementations.

ConstantValueDescription
CDP2SQL::IDatabaseBulkInserter::UNSPECIFIED0No explicit hint; the driver may infer the type from the provided Utils::Variant values.
CDP2SQL::IDatabaseBulkInserter::BLOB1Column contains binary/blob data.

Backend-specific/custom hints may use integer values greater than 100.

Member Function Documentation

[virtual] IDatabaseBulkInserter::~IDatabaseBulkInserter()

Destroys the instance of IDatabaseBulkInserter. The destructor is virtual.

[pure virtual] void IDatabaseBulkInserter::AddRow(const std::vector<Utils::Variant> &values)

Adds a single row to the current batch. The number of values must match the number of columns passed when creating the inserter.

A Utils::Variant with type Utils::eUNDEFINED (or !isValid()) is treated as SQL NULL.

Throws CDP2SQL::SQLException on errors (e.g. mismatched row size, conversion errors, driver errors).

[pure virtual] void IDatabaseBulkInserter::Cancel()

Aborts and discards the current batch.

This function should not throw.

After Cancel returns, the inserter must be ready to accept a new batch via AddRow.

[pure virtual] void IDatabaseBulkInserter::Commit()

Finalizes and flushes the current batch.

After Commit returns, the inserter must be ready to accept a new batch via AddRow.

[pure virtual] void IDatabaseBulkInserter::SetColumnTypeHint(int column, int type)

Set a per-column type hint.

The column is the 0-based column index within the columns list used to create the inserter.

The type is an implementation-defined integer value; callers should use values from CDP2SQL::IDatabaseBulkInserter::TypeHint for portable hints.

Backend-specific/custom hints may use integer values greater than 100.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2026 CDP Technologies. Privacy and cookie policy.

Return to top