Pages  [ 1  2  3  4 ]

Database Operation Services (continued)

MultiValue Database Objects

If you are limiting your database choices to a MultiValue (PICK) Database System and will exclusively be using stored procedures to access and update data within the database, then you will want to use the MultiValue Database Object server (VPMvdb20.dll) rather than the generic Database object server (VPDb20.dll). In many ways this object is much simpler to use, but at the same time, has a number of properties and methods that expands the options and flexibility when working with stored procedures. A MultiValue Database object acts as a “Wrapper” object that internally instantiates and works through a generic Database object. This process is known as containment and delegation and is totally transparent to the programmer using a MultiValue Database object.

Some of the more important properties and methods of the MultiValue Database object include the following:

Method Description
VddName Returns or sets the name of the Virtual Database Definition object file to use when making a connection to a database source. Can pass a fully qualified path and file name or just the file name. If only the file name is assigned to this property the Load method of the VDD object created will use the system registry and the default location defined by dbObjects. If that is not defined the file location will default to the same directory where the client program is executing.
MsdName Returns or sets the name of the MultiValue Server Definition object file to use when making a connection to a database source. Normally a MSD object reference is embedded in a given VDD object and this property can be null. You would use this property to override the MSD object reference in the VDD object as an alternative.
SessionID Returns or assigns the override name for the session. Used by Web server or Multiplexer operations instead of the Network User name or Workstation Id if not null. Primarily used for Web client applications.
ShowLogin Returns or assigns a Boolean property that determines if a Login form is displayed at the time a database connection is attempted. For non-VB clients this property is usually set to False.
ShowSplash Returns or assigns a Boolean property that determines if a Splash form is displayed at the time a database connection is attempted. Splash form characteristics are based on the App object passed using the Connect method. For non-VB clients this property is usually set to False.
Logo Assign a picture image reference used to customize the splash form.
UnAttended Returns or assigns a Boolean property that determines if the Database object should be restricted to unattended operations. In other words, no operations will result in the display of any UI elements.
Connect A method that establishes a connection to a MultiValue (Pick) database source. This method internally uses a VDD object and the generic Database operations server object (VPDb20.dll) of dbObjects. In one step it accomplishes the following: shows an application splash screen form (if ShowSplash property is set to True), overrides the App objects OLE Server properties, creates a VDD object, executes the Load method of the VDD object based on the VDDName property, Creates a Database Session object, Adds a new Database object to the Databases collection, Attaches the VDD object to the Database object, sets the Database object’s sessionID (if defined in the SessionID property), executes the OpenDatabase method of the Database object, and shows the Login dialog (if ShowLogin property is set to True) and calls the Login Store Procedure to validate the user.
CloseConnection A method that closes a connection to a MultiValue (Pick) database source. It also destroys the internal Database, DbSession, and VDD objects.
Connected Returns a Boolean property that indicates if a Database connection has made and is currently open.
LoginCancelled Return a Boolean property that indicates if the user cancelled login procedure.
UserName Returns the network login user name or operational user name associated with the current database connection.
SendData Returns or assigns the any parameter data to be used by a stored procedure executed with the Execute method.
ReturnData Returns or assigns the data returned from the last stored procedure executed with the Execute method. If any data is assigned using this property, it will overwrite the actual data returned by the last execution of the Execute Method.
Execute This method executes a stored procedure (MultiValue Pick/Basic subroutine) on the connected Database system. There are two parameters associated with this method. The first is the name of the stored procedure on the Pick host system, the second is the optional CheckCondition Boolean flag (default value is True). This Execute method returns a Boolean value to indicate if the execution of the stored procedure was successful or not. Before using this method, assign any parameter data you want to pass to the stored procedure to the SendData property. After execution, any returned results are assigned to the ReturnData property. If the ExecuteProc method of the VPDb20 Database Object does not raise an error the returned data will either be assumed to be valid returned data or will be subjected to further evaluation if the CheckCondition option flag argument is set to True. If the CheckCondition flag is set to True this method checks for errors in a special condition flag as the first record of the returned data from the stored procedure (delimited by a record mark (Char 255), and displays an error message box with any error messages. If the UnAttended operations property is set to true then an error message box is not displayed, but any errors are raised to the UI client. The possible Condition Flag are as follows: 0 = Returned data assigned to ReturnData property, no errors, the Execute method returns a True; 1 = Returned data assigned to ReturnData property, errors encountered during stored procedure execution, the Execute method returns a false; 2 = No returned data assigned to ReturnData property, fatal errors encountered during stored procedure execution, any returned error messages are handled based on UnAttended operations flag. If UnAttended flag is set, error messages are raised to the Client UI. If the UnAttended flag is not set, any error messages are shown in a message box, the Execute method returns a false; 3 = No return data assigned to ReturnData property, fatal errors encountered during stored procedure execution, any returned error messages are raised to the Client UI, the Execute method returns a false; 99 = Returned data is large enough to be broken into batches, the GetBatchData function is called to retrieve the "batched" data and assigned to ReturnData property, no errors, the Execute method returns a True. If the CheckCondition flag is set to False then it is assumed that the MultiValue Stored Procedure does not return a condition flag and the success or failure of the procedure is determined only by the ExecuteProc method of the VPDb20 Database Object raising an error. If an error is raised then this error is either displayed in a message box or further raised to the Client UI depending on the UnAttended operations flag setting. In either case a null is assigned to the ReturnData property. If no error is encountered any returned data is assigned to the ReturnData property.
mvBeginTrans This method executes This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method begins a Transaction context for any future updates to the database through the mvWrite or mvUpdate methods. It creates a new Transaction handle and returns generated ID value. If the new transaction context is to be nested within an existing transaction context the current transaction handle should be passed to this method.
mvCommitTrans This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method commits a Transaction context associated with any updates to the database through the mvWrite or mvDelete methods. It transfers updates from the VSSTAGE file to the actual database files. The transaction context is also released and the parent transaction handle is returned by this method.
mvRollbackTrans This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method rolls back a Transaction context associated with any updates to the database through the mvWrite or mvDelete methods. It removes updates from the VSSTAGE file without update to database files. The transaction context is also released and the parent transaction handle is returned by this method.
mvRead This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will read either an Item (Record) or an attribute (Field) from an Item. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is READ and is ARGS 1 to the called stored procedure. Parameters passed to this method include: FileName (ARGS 2) = Name of file to open or get already opened file variable, ItemId (ARGS 3) = Item id to use in read, Attr (ARGS 4) = Optional attribute to read for READV operation - If left null then normal full item read will be executed, and UseItemLocking (ARGS 5) Flag to indicate that record locking should be employed. If the stored procedure executes successfully, this method returns the read item or attribute, or, if a failure occurs, then a null string is returned and any errors are raised.
mvWrite This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will Write either an Item (record) or an attribute (field) to an Item. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is WRITE and is ARGS 1 to the called stored procedure. Parameters passed to this method include: FileName (ARGS 2) = Name of file to open or get already opened file variable, ItemId (ARGS 3) = Item id to use in write, Attr (ARGS 4) = Optional attribute to read for WRITEV operation - If left null then normal full item write will be executed, Lock (ARGS 5) = Optional flag to tell if an Item Lock should be kept after the write, Trans (ARGS 6) = Optional transaction id handle to use with write, NewData (ARGS 7) = Data to be used in updating item or attribute, OldData (ARGS 8) = Optional original item or attribute for comparison at update time - used to determine if underlying Item or attribute has changed since the item or attribute was originally read. If the stored procedure executes successfully, this method returns a null string, or, if a failure occurs, an error code is returned, and depending on the nature of the failure, an error description is returned or the current item or attribute if the underlying item has changed since last read.
mvWriteItemThis method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will Write a full, complete Item (record) to the file. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is WRITEITEM and is ARGS 1 to the called stored procedure. Parameters passed to this method include: FileName (ARGS 2) = Name of file to open or get already opened file variable, ItemId (ARGS 3) = Item id to use in write, Lock (ARGS 4) = Optional flag to tell if an Item Lock should be kept after the write, Trans (ARGS 5) = Optional transaction id handle to use with write, NewData (ARGS 6) = Data to be used in updating item or attribute, OldData (ARGS 7) = Optional original item or attribute for comparison at update time - used to determine if underlying Item or attribute has changed since the item or attribute was originally read. If the stored procedure executes successfully, this method returns a null string, or, if a failure occurs, an error code is returned, and depending on the nature of the failure, an error description is returned or the current item or attribute if the underlying item has changed since last read.
mvDelete This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will Delete an Item (record). The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is DELETE and is ARGS 1 to the called stored procedure. Parameters passed to this method include: FileName (ARGS 2) = Name of file to open or get already opened file variable, ItemId (ARGS 3) = Item id to use in delete, Trans (ARGS 4) = Optional transaction ID handle to use with delete, OldData (ARGS 5) = Optional original item for comparison at time of delete - used to determine if underlying item has changed since the item was originally read. If the stored procedure executes successfully, this method returns a null string or if a failure occurs an error code is returned and depending on the nature of the failure a error description is returned or the current item if the underlying item has changed since last read.
mvRelease This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will execute a lock release, which can be either a release for a given item, all items for a given file, or a general release of all locks. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is RELEASE and is ARGS 1 to the called stored procedure. Parameters passed to this method include: FileName (ARGS 2) = Name of file to limit the scope of a release, and ItemId (ARGS 3)_ = Item id used to limit a release to a specific item. If no FileName or ItemID is passed a general release is executed. If the stored procedure executes successfully, the method returns a null string, or, if a failure occurs, an error code is returned.
mvCapture This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will execute an Access/Recall List or Sort command sentence and capture the result. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is CAPTURE and is ARGS 1 to the called stored procedure. Parameters passed to this method include: Command (ARGS 2) = TCL List or Sort command to execute, and HeadingCount = ARGS 3 the number of column heading lines the report will be generating (default = 2). If the stored procedure executes successfully, this method returns any captured data from the executed List or Sort command, or if a failure occurs an error is raised.
mvSelect This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will Select all the records from a given file and make them available as a server-side select list. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is CAPTURE and is ARGS 1 to the called stored procedure. A single parameter is passed to this method: FileName (ARGS 2) = Name of file to select from. This method is used in conjunction with the mvReadNext method. If the stored procedure executes successfully, this method returns a null string, or, if a failure occurs, an error code is returned.
mvReadNext This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will read the next item from the last created select list. The only parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is READNEXT and is ARGS 1 to the called stored procedure. There are no parameters associated with this method. This method returns the next item from the select list or a null string if the select list is exhausted or has not been previously created. If the select list is exhausted or an error occurs an error condition is raised. This method is used in conjunction with the mvSelect method.
mvExecuteTcl This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method will execute a TCL command sentence. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is EXECUTE and is ARGS 1 to the called stored procedure. Parameters passed to this method include: Sentence (ARGS 2) = a TCL command sentence to execute, DataStmts (ARGS 3) = an optional multivalued list of data values to pass to any execute process, Capture (ARGS 4) = a flag to instruct server to capture any results, and SelReadNext (ARGS 5) = a flag to indicate if any select list generated by the TCL command should be redirected to a save list for later use with the mvReadNext method. If the stored procedure executes successfully, and if the Capture option is set to True, this method returns any captured data from the Execute, or, if a failure occurs, an error is raised. This method can be used in conjunction with the mvReadNext method.
mvTime This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method returns the current Time in Pick internal format. The only parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is TIME and is ARGS 1 to the called stored procedure. There are no parameters associated with this method. If the stored procedure executes successfully, this method returns the current time value, or, if a failure occurs, an error is raised.
mvDate This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method returns the current Date in Pick internal format. The only parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is DATE and is ARGS 1 to the called stored procedure. There are no parameters associated with this method. If the stored procedure executes successfully, this method returns the current date value, or, if a failure occurs, an error is raised.
mvIConv This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method executes an ICONV conversion on any data passed to it. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is ICONV and is ARGS 1 to the called stored procedure. Parameters passed to this method include: Data (ARGS 2) = Data to be "input" converted, and Conversion (ARGS 3) = the Pick input conversion to be performed. If the stored procedure executes successfully, this method returns the converted data, or, if a failure occurs, an error is raised.
mvOConv This method executes a predefined stored procedure called VSSP.PROCEDURE that is part of the MVSERVER account software. This method executes an OCONV conversion on any data passed to it. The first parameter passed to the called stored procedure is the type of operation to be performed. In this case the type is OCONV and is ARGS 1 to the called stored procedure. Parameters passed to this method include: Data (ARGS 2) = Data to be "output" converted, and Conversion (ARGS 3) = the Pick output conversion to be performed. If the stored procedure executes successfully, this method returns the converted data, or, if a failure occurs, an error is raised.

 


Previous Page    Next Page                                    Pages  [ 1  2  3  4 ]

Back to Objects and Services Overview

 


For additional information or to order a copy of mvComponents Suite 2.0 and arrange for a consultant, please send an E-mail to:

info@vpsoft.com

For VAR requirements and pricing please send E-mail to:

support@vpsoft.com