ExportDatabaseMemory()

Syntax

*Buffer = ExportDatabaseMemory(#Database)
Description
Exports the full content of the specified database to a new memory buffer.

Parameters

#Database The database to export.

Return value

A new memory buffer internally allocated with AllocateMemory() containing the database content as binary form, or zero if it failed. Once the buffer is no more needed FreeMemory() must be called to release the memory.

Example

  ; Create a new empty database in memory
  If OpenDatabase(0) 
  
    ; Add new table in it
    DatabaseUpdate(0, "CREATE TABLE food (name CHAR(50), weight REAL, image BLOB)")
    
    ; Add some records
    DatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('apple', '10.5')")
    DatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('pear', '5')")
    
    ; Export it as a memory buffer
    *Buffer = ExportDatabaseMemory(0)
    If *Buffer
      Debug "Export success (size: " + MemorySize(*Buffer) + ") bytes"
    Else
      Debug "Export failed"
    EndIf
  EndIf

Supported OS

All

<- ExportDatabase() - Database Index - FinishDatabaseQuery() ->

See Also

ExportDatabase()