EinhugurDuckDB.Database Class (console safe)
Database object representing a DuckDB database.
Object
Database
class EinhugurDuckDB.Database
Constructors
Methods
Connect | Creates connection to a database. |
shared CreateInMemory | Creates database in memory. |
shared Open | Opens or creates database. |
Examples
Simple example, creating in memory duckdb database:
var db as EinhugurDuckDB.Database = EinhugurDuckDB.Database.CreateInMemory()
var connection as EinhugurDuckDB.Connection = db.Connect()
connection.SQLExecute("CREATE TABLE integers(i INTEGER, j INTEGER)")
connection.SQLExecute("INSERT INTO integers VALUES (3, 4), (5, 6), (7, NULL)")
if connection.Error then
MessageBox(connection.ErrorMessage)
end if
var records as EinhugurDuckDB.Recordset = connection.SQLSelect("SELECT * FROM integers")
if connection.Error then
MessageBox connection.ErrorMessage
return
end if
for row as Integer = 0 to records.RowCount - 1
MessageBox("i = " + records.Int32Value(0,row).ToString() + ", j = " + records.Int32Value(1,row).ToString())
next
Simple example creating file database:
var f as FolderItem = FolderItem.ShowSaveFileDialog("*","test.duckdb")
if f = nil then
return
end if
var db as EinhugurDuckDB.Database = EinhugurDuckDB.Database.Open(f)
var connection as EinhugurDuckDB.Connection = db.Connect()
connection.SQLExecute("CREATE TABLE integers(i INTEGER, j INTEGER)")
connection.SQLExecute("INSERT INTO integers VALUES (3, 4), (5, 6), (7, NULL)")
if connection.Error then
MessageBox(connection.ErrorMessage)
end if
var records as EinhugurDuckDB.Recordset = connection.SQLSelect("SELECT * FROM integers")
if connection.Error then
MessageBox connection.ErrorMessage
return
end if
for row as Integer = 0 to records.RowCount - 1
MessageBox("i = " + records.Int32Value(0,row).ToString() + ", j = " + records.Int32Value(1,row).ToString())
next
Supported Platforms:
macOS Intel 32 bitmacOS Intel 64 bitmacOS Apple SiliconWindows 32 bitWindows 64 bitWindows ARM 64 bitLinux 32 bitLinux 64 bitLinux ARM 32 bit