Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Today we like to connect to a DuckDB database from FileMaker using the SQL functions in MBS FileMaker Plugin. For that we need the client libraries for DuckDB, but where to get them?

macOS with homebrew

For macOS you can use homebrew to install the duckdb package. Then you get the duckdb library installed.

You find the library on an Apple Silicon Mac:

/opt/homebrew/Cellar/duckdb/1.2.1/lib/libduckdb.dylib

For an Intel Mac, you find it in the /usr/local folder in a sunfolder.

All platforms

Just got to the DuckDB installation website: Installation

There you can click

  • Version: Stable Release
  • Environment: C/C++
  • Platform: Pick yours
  • Download method: Direct Download
  • Architecture: Pick x86_64 for Intel or arm64 for Apple Silicon

Then you can download the dylib/dll/so file and point the plugin to it.

Connect

To connect, we then define a connection string with host, port and database name. Or for a local file, we just pass the file path. 

Set Variable [ $Connection ; Value: MBS("SQL.NewConnection") ]
# Tell plugin where PostgreSQL library is
Set Variable [ $result ; Value: MBS("SQL.SetConnectionOption"; $Connection; "DUCKDB.LIBS"; "/opt/homebrew/Cellar/duckdb/1.2.1/lib/libduckdb.dylib") ]
# Connect to database
Set Variable [ $result ; Value: MBS("SQL.Connect"; $Connection; "/Users/cs/Desktop/test.duckdb"; ""; ""; "DuckDB") ]
If [ $result ≠ "OK" ]
    Show Custom Dialog [ "Error: " & $result ]
    Set Variable [ $result ; Value: MBS("SQL.FreeConnection"; $Connection) ]
Else
    # do something here
End If
# Cleanup
Set Variable [ $result2 ; Value: MBS("SQL.FreeConnection"; $Connection) ]

Once connected, you can do whatever queries you like to like the ones below:

// create command
$Command = MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test")
// run select
$result2 = MBS("SQL.Execute"; $Command)
// go to first row
$result3 = MBS("SQL.FetchNext"; $Command)
// result 3 is 1 if we got a record
// read first name field from result:
$firstname = MBS("SQL.GetFieldAsText"; $command; "FirstName")
// later release command
MBS("SQL.FreeCommand"; $Command)

Let us know if you have questions

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.