wcLoadLO( )

Syntax . . Returns . . Rules . . Program Example . . Related Topics . . A-Z Index . . Home

Loads a large object (BLOB) such as an image, audio, or video file.

Example

returnCode = wcLoadLO(cntrlHandle, pageID);

Syntax

int wcLoadLO(void *controlHandle, 
             char *pageID)
controlHandleThe handle to the control structure.
pageIDThe page ID.

Returns

0Success.
Error codeFailure or exception. For a list of possible error codes, see Error Messages.

Rules

  • Before using wcLoadLO( ), you must first use wcDBOpen( ) to open the AppPages repository database connection, or your own user database connections.
  • wcLoadLO() uses MItabObj, MInamObj, and MIcolObj to determine the object that will be loaded from the database. See Configuration File Parameters.
  • If you want to load objects from database other than the AppPages repository, you have to use MIconnObj to specify the database connection name. See Retrieving Large Objects.

    Program Example

    The following code shows how wcLoadLO( ) is used in an application. The following portion of the application calls wcLoadLO( ) if the URL contains the variable MIvalObj.

    int handleRequest(wcp)
        void	*wcp;
    {
        char    *pagePtr;
        char    *pageId;
        int     ret;
    
        wcGetVariable(wcp, "MIvalObj", &pageId);
    	
        if (pageId!=NULL)
        {
            if((ret = wcLoadLO(wcp, pageId)) < 0)
                return wcTraceErr(wcp, ret);
        }
    
        return (ret);
    }
    

    The following user-defined tag, APB_IMG, places an image in an AppPage. It contains a setting for the variable LO. Therefore, the application calls wcLoadLo( ) whenever the user-defined tag APB_IMG is exploded.

    <?MISQL SQL="select height, width, description, mime_type
     from webImages where ID='@ID@';">
    <IMG BORDER=0 $(IF,$(!=,$1,0),HEIGHT=$1,)
     $(IF,$(!=,$2,0),WIDTH=$2,)
     ALT="$3"
     SRC="$WEB_HOME?MIvalObj=@ID@&filename=@ID@&MItypeObj=$4">
    <?/MISQL>
    

    This user-defined tag makes extensive use of variable functions, which are explained in Using Variables and Functions in AppPages.

    The following is example HTML generated when this tag is exploded:

    <IMG BORDER=0 HEIGHT=40 WIDTH=335 ALT="APB Logo"
     SRC="$WEB_HOME?MIvalObj=apb_logo&filename=apb_logo&MItypeObj=image/gif">
    

    Related Topics

    wcAppPageConnName( )
    wcLoad( )


    Top of Page . . Syntax . . Returns . . Rules . . Program Example . . A-Z Index . . Home