Delphi and Lazarus Programming Languages

Delphi DuckDB Library

$899 USD
Please specify valid quantity number from 1 to 99.
Please specify at least one platform.
Please specify at least one SDK.
 
Use DuckDB Library with Delphi and Free Pascal on perpetual basis with 1 year of included free updates.
Seat(s)
Qty
Platform

Introducing DuckDB Library

The DuckDB library is an embeddable analytical database system that aims to provide the capability of a fully featured SQL database system, while keeping the overhead of the system low. It is designed to be used as an embedded database, and it is built with a focus on analytical workloads and vectorized query execution. The library is designed for fast and efficient query processing, making it an ideal choice for applications that require high performance and low latency.



DuckDB Examples in Pascal

{
  Example: Creating a Database, Adding Data, and Querying Results with Different
           Data Types.

  This example demonstrates:

  - Inserting specific values for UUID, DATE, TIME, and TIMESTAMP into a
    DuckDB table.
  - Extracting and converting components from date, time, and timestamp.
  - Displaying the results in a readable format.
}

program DuckDBExample;

{$IFDEF MSWINDOWS}
  {$APPTYPE CONSOLE}
{$ENDIF}

uses
  SysUtils,
  ddb;

var
  db           : DuckDB;
  con          : Connection;
  res          : MaterializedQueryResult;
  iter         : QueryResultIterator;
  row          : QueryResultRow;
  uuidval      : string;
  dateval      : date_t;
  timeval      : dtime_t;
  timestampval : timestamp_t;
  year, month, day            : Integer;
  hour, minute, second, millisecond : Integer;

begin


  // Initialize a new DuckDB database and create a connection
  db.Init(nil);
  con.Init(db);

  // Create a table with UUID, date, time, and timestamp columns
  con.Query('CREATE TABLE mixed_data (uuid_col UUID, date_col DATE, ' +
            'time_col TIME, timestamp_col TIMESTAMP)');

  // Insert data into the table
  con.Query(
    'INSERT INTO mixed_data (uuid_col, date_col, time_col, timestamp_col) ' +
    'VALUES (gen_random_uuid(), CAST(''2022-01-10'' AS DATE), ' +
    'CAST(''13:00:17.250'' AS TIME), ' +
    'CAST(''2023-01-10 14:00:17'' AS TIMESTAMP))');

  // Fetch the data and extract UUID, date, time, and timestamp values
  res := con.Query('SELECT uuid_col, date_col, time_col, timestamp_col ' +
                   'FROM mixed_data');
  iter := res.MakeIterator();

  if not iter.IsEnd() then
  begin
    row := iter.current_row;

    // Extract and display UUID value
    uuidval := string(row.GetValueStr(0));
    WriteLn('UUID Value: ', uuidval);

    // Extract and convert date components
    dateval := row.GetValueDate(1);
    ddb.Date.Convert(dateval, @year, @month, @day);
    WriteLn('Date Conversion - Year: ', year, ' Month: ', month, ' Day: ', day);

    // Extract and convert time components
    timeval := row.GetValueTime(2);
    ddb.Time.Convert(timeval, @hour, @minute, @second, @millisecond);
    WriteLn(
      'Time Conversion - Hour: ', hour, ' Minute: ', minute, 
      ' Second: ', second, ' Millisecond: ', millisecond);

    // Extract and convert timestamp to date and time
    timestampval := row.GetValueTimestamp(3);
    ddb.Timestamp.Convert(timestampval, dateval, timeval);
    ddb.Date.Convert(dateval, @year, @month, @day);
    ddb.Time.Convert(timeval, @hour, @minute, @second, @millisecond);

    WriteLn(
      'Timestamp Conversion - Year: ', year, ' Month: ', month, 
      ' Day: ', day);
    WriteLn(
      'Time Conversion - Hour: ', hour, ' Minute: ', minute, 
      ' Second: ', second, ' Millisecond: ', millisecond);

    // Move to the next row (if any)
    iter.Next();
  end;

end.

Using DuckDB Library with Delphi® and Free Pascal

The DuckDB library can now be used with Delphi and Free Pascal (Lazarus) with the help of custom bindings to the original library provided by BuyLibs. BuyLibs provides a wrapper that enables developers to utilize the original version of the DuckDB library from its authors, in compliance with the library's license terms.

Custom Wrappers in Object Pascal for DuckDB Library

Delphi 12 Athens
Delphi 11 Alexandria
Delphi 10.4 Sydney
Delphi 10.3 Rio
Delphi 10.2 Tokyo
Delphi 10.1 Berlin
Delphi 10 Seattle
Delphi XE8
Delphi XE7
Delphi Community Edition
Lazarus 2.2.6 and FPC 3.2.2
DuckDB Library

Get Quote

Full compatibility with Object Pascal Development Tools

Unified Performance Across Devices

All licenses include:

Perpetual License: Your license code ensures indefinite access to your purchased library version.
Free Updates: Enjoy one year of updates for the latest features and enhancements.
Unlimited Usage: Utilize the BuyLibs library across multiple computers or servers without limitations.
Royalty-Free Redistributables: Include library redistributables in deployment packages without additional royalties.
Flexible API Usage: Utilize the API across multiple applications and distribute freely to end-users.
Permanent License Codes: Your codes never expire, ensuring perpetual access to your library version.

Ready to get started?

Get in touch or purchase your license key today.

Error Message