PA_SendDocumentToServer

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_SendDocumentToServer (docName; data; dataSize; docType; docCreator)

ParameterTypeDescription
docNamechar *Name of the file to send
datachar *Content of the document
dataSizelongSize of data in bytes
docTypeunsigned long4 bytes FileType of the file to create
docCreatorunsigned long4 bytes FileCreator of the file to create

Description

While running under 4D Client, the routine PA_SendDocumentToServer allows the 4D plug-in to save a document on the server machine.

NOTE:

This routine is available only with 4D Client. To detect if the 4D plug-in is running on 4D Client, use PA_Is4DClient.

Before the call the 4D plug-in passes in docName the name of the document to save. The 4D plug-in MUST pass the short name of the document, NOT the pathname to the document. The document will be located in the same folder/directory than the structure.

NOTE:

4D Server creates the document or replaces an existing document with the same name if it exists.

Before the call the 4D plug-in also passes:

The File Type in docType, and File Creator in docCreator for the document. Under Windows this information is mapped to the Windows file Extensions declared within the database using the 4D command MAP FILE TYPES or by a ExtW resource located in the .RSR file of a 4D plug-in available for the database.

A pointer in data to a memory block holding the contents of the document.

The size in dataSize of the data referenced by data.

IMPORTANT NOTE:

PA_SendDocumentToServer or PA_SendDocumentToServer deal only with the data fork of a document when used on a Macintosh platform.

NOTE:

Documents stored on a server machine and accessed using PA_SendDocumentToServer or PA_SendDocumentToServer are sent over the network and must fit into the memory of the workstation. It is therefore a good idea to refrain from using these entry points in small or medium size documents.

If it is the developer's goal to make large documents available to all 4D Clients connected to a particular server the developer may want to choose an alternative solution such as combining 4D Server with a File Server which the developer can access using the 4D command such as Open Document.

Example

Saving a private preference structure on the server.

   typedef struct
   {
      long   something;
      char   otherThing[256];
      short   someMore;
   } MyPrefs;

   void SavePrefToServer(MyPrefs *prefs, char *prefsFileName)
   {
      PA_SendDocumentToServer(prefsFileName, prefs, sizeof(MyPrefs), 'TITI', 'TOTO');
   }

See Also

PA_DocumentExistOnServer, PA_receiveDocumentFromServer.

Error Handling

Use PA_GetLastError to see if an error occurred


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next