From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
Stores a PostgreSQL large object.
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, like this:
After you have performed your last large object operation, you should close the transaction, like this:
Most large object operations will be performed using an instance of the PostgreSQLLargeObject class, which you will obtain by calling the OpenLargeObject method of the PostgreSQLDatabase class. There is no reason to ever create your own PostgreSQLLargeObject instance using New.
The PostgreSQLLargeObject class works similarly to BinaryStream. As with BinaryStreams, PostgreSQLLargeObjects are always positioned at a certain location in the large object. Whenever you read or write to the large object, the position moves to just after the read or write. You can also set the position using the Position property. You can have more control over the position by using the Seek method.
For example, if you wanted to position a large object at its end, you could call Seek as follows:
The following Seek positions the large object at its beginning:
Offsets can be negative as well, For example, the following call of Seek positions the large object 10 bytes before its current position:
Read the data in a large object:
// objectID is an integer referring to a previously created large object
Var largeObject As PostgreSQLLargeObject
largeObject = db.OpenLargeObject(objectID)
Var data As String = largeObject.Read(largeObject.Length)