• 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
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • DBInterface C++ Classes
  • IDatabaseQuery
  • 5.0.0

IDatabaseQuery Class

(CDP2SQL::IDatabaseQuery)

Abstract interface base for queries. More...

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

Public Functions

virtual ~IDatabaseQuery()
virtual void Close() = 0
virtual void ExecuteQuery(const std::string &sqlString) = 0
virtual void ExecuteQuery(IDatabaseStatement *st) = 0
virtual std::string FieldName(int field) const = 0
virtual std::string FieldType(int field) const = 0
virtual const unsigned char *FieldValueBlob(int field, int &len) const = 0
virtual bool FieldValueBool(int field) const = 0
virtual double FieldValueDouble(int field) const = 0
virtual int64_t FieldValueInt64(int field) const = 0
virtual int FieldValueInt(int field) const = 0
virtual std::string FieldValueStr(int field) const = 0
virtual bool IsEof() = 0
virtual bool IsFieldValueNull(int field) const = 0
virtual bool NextRow() = 0
virtual unsigned int NumFields() const = 0

Detailed Description

Abstract interface base for queries.

Concrete implementations are created (and destroyed) by IDatabaseConnection.

Member Function Documentation

[virtual] IDatabaseQuery::~IDatabaseQuery()

Should have virtual destructor for all abstract classes. Must close query if open.

[pure virtual] void IDatabaseQuery::Close()

Finalizes the query. Should do any major cleanup on the query.

[pure virtual] void IDatabaseQuery::ExecuteQuery(const std::string &sqlString)

Executes an SQL query string.

[pure virtual] void IDatabaseQuery::ExecuteQuery(IDatabaseStatement *st)

Executes an SQL query using the given IDatabaseStatement.

The IDatabaseStatement must be ready for use (unused or Reset, and any placeholder binded)

[pure virtual] std::string IDatabaseQuery::FieldName(int field) const

Name of field in column field.

[pure virtual] std::string IDatabaseQuery::FieldType(int field) const

Type of field in column field.

[pure virtual] const unsigned char *IDatabaseQuery::FieldValueBlob(int field, int &len) const

Gets blob value and length. Pointer is valid until calling NextRow(), Close() or ExecuteQuery().

[pure virtual] bool IDatabaseQuery::FieldValueBool(int field) const

Gets value in column field as boolean.

Returns false if field is NULL or 0. Otherwise true.

[pure virtual] double IDatabaseQuery::FieldValueDouble(int field) const

Gets value in column field as floating point.

[pure virtual] int64_t IDatabaseQuery::FieldValueInt64(int field) const

Gets value in column field as int64_t.

[pure virtual] int IDatabaseQuery::FieldValueInt(int field) const

Gets value in column field as integer.

[pure virtual] std::string IDatabaseQuery::FieldValueStr(int field) const

Gets value in column field as string.

[pure virtual] bool IDatabaseQuery::IsEof()

Returns true if we have reached the End-Of-File for the results.

[pure virtual] bool IDatabaseQuery::IsFieldValueNull(int field) const

Returns true if the field value is a SQL NULL.

[pure virtual] bool IDatabaseQuery::NextRow()

Goes to the next row. Returns false if there is no next row in the result.

[pure virtual] unsigned int IDatabaseQuery::NumFields() const

Returns how many fields (columns) does the result have.

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 2025 CDP Technologies. Privacy and cookie policy.

Return to top