PostgreSQLDatabase.CreateLargeObject

From Xojo Documentation

Method

PostgreSQLDatabase.CreateLargeObject() As Integer

Supported for all project types and targets.

Creates a PostgreSQLLargeObject and returns its ID. Legal IDs are positive integers. Therefore, if CreateLargeObject returns 0 or less, then there was an error creating the large object. Use ErrorMessage to determine what the error was.

Notes

PostgreSQL requires that all large object operations be performed inside of a transaction. Therefore, you must start a transaction before you perform your first large object operation:

db.ExecuteSQL("BEGIN TRANSACTION")

After you have performed your last large object operation, you should close the transaction, like this:

db.ExecuteSQL("END TRANSACTION")

Please see the PostgreSQLLargeObject class for information on how to work with large objects.

Example

Create a large object:

// db is an existing PostgreSQLDatabase connection
Try
Var objectID As Integer = db.CreateLargeObject
Catch error As DatabaseException
MessageBox("Couldn't create large object: " + db.ErrorMessage)
Return
End Try