IAdgObject.Create Method

Use Create to create a new database object reflecting the current state of IAdgObject.

        [C#]
 Public void IAdgObject Create();
      
        [Visual Basic] 
 Public Sub Create() As System.Void
      
        [Visual RPG]
  BegSr Create Access(*Public) Type(System.Void)
      
Parameters
None.
Exceptions
Exception Type Condition

dgException

See table below.

ASNA.DataGate.Common.dgException is thrown to signal normal procedural conditions, in addition to error conditions. The following table summarizes these conditions, and the corresponding value of the dgException.Error property.


Value of dgException.Error Condition

dgEgNOFDEF

Create is invoked to create a file, but there is no file definition. The file definition may be set during IAdgObject construction (with AdgFactory.ReadXml) or with the IFileObject.ReadDefinition method. See also IFileObject.WriteDefinition, IAdgObject.WriteXml, and Remarks below.

dgEgNOATTR

Create is invoked to create a file, but there are no creation attributes. Creation attributes may be set during IAdgObject construction (with AdgFactory.ReadXml) or with the IFileObject.ReadCreationAttributes method. See also IFileObject.WriteCreationAttributes, IAdgObject.WriteXml, and Remarks below.

dgErBADSRC

Create is invoked to create a logical file, but no base files have been specified. Base files may be specified at IAdgObject construction (with AdgFactory.ReadXml) or with the IAdgObject.Bases property. See also IAdgObject.WriteXml and Remarks below.

dgEINVARG

The path name of the database object specified when IAdgObject was created is invalid.

dgEmDUPOBJ

The path name of the database object specified when IAdgObject was created references an existing database object.

dgEsAS400ERROR

The database provider encountered a system-level error. Details provided in the dgException.Message property.

dgEmNODIRADD

Create is invoked to create a library or file, but the session does not have one of the requisite authorities to the parent library:

  • For creating files, both "add" and "execute" authority.
  • For creating libraries, "add" authority.

dgEmBUSYOBJ

The attempt to obtain an exclusive-read lock on the new object's parent failed.

dgEmBASENOTPH

Create is invoked to create a logical file but one or more of the base files is not a physical file.

dgEmNOBASEAUTH

Create is invoked to create a logical file but the current session is lacking one or more of the following authorities:

  • "Operational" authority to one or more of the base files.
  • If the file to be created defines a key, "alter" or "management" authority to one or more of the base files.

dgEmNOPERMINTEMP

Create is invoked to create a logical file but one or more of the base files is a temporary object.

dgEmBADFRMTID

Create is invoked to create a logical file but one or more of the base format identifiers of the file definition do not match the base files specified.

dgEmNOMEMADD

Create is invoked to create a member but the current session is lacking one or more of the following authorities:

  • "Operational" authority to the parent file.
  • "Alter" or "management" authority to the parent file.

dgEgBADREL, dgEgBADFARM, dgEgBADGROVE, dgEgBADGROVE, or dgEINTERNAL

Create is invoked to create a file member but an internal database exception was raised. The database should be repaired.

dgENOMEM

The database provider raised an out-of-memory exception.

Remarks

To create a database object, first create an instance of IAdgObject using one of the methods of AdgFactory (NewFile, NewDirectory, NewMember, or ReadXml). The IAdgObject created this way must not refer to an existing database object, or Create will raise an exception. If IAdgObject was created via ReadXml , then no further definition of the object may be necessary since the provided XML description contains all non-security details (see WriteXml). Also note that ReadXml provides the option of invoking Create automatically as the XML description is read and validated from the stream (see XmlOptions.CreateObjects enumeration). Instantiating IAdgObject in any other way may require the use of appropriate IAdgObject properties and methods to fully define the object.

A "bare" IAdgObject instance, created with NewFile, NewDirectory, or NewMember, defines the path name and database connection used. But depending on the object type, further embellishment may be required using the methods and properties listed below. The list details whether the property or method should be used before or after Create. Note that except for security-related details, using these properties and methods may not be necessary when AdgFactory.ReadXml is used to create IAdgObject. Also, many of these methods and properties are optional and/or provider-dependent.


Database object to create AdgFactory method IAdgObject implementation Methods and properties defining the object before and after Create

Library

NewDirectory

IDirectory

Text, AuthorityEntries, GrantAuthority, and RevokeAuthority, afterCreate.

File

NewFile

IFileObject

ReadDefinition (required), ReadCreationAttributes (required), and Bases (required for logical files only) prior to Create.
Text, AuthorityEntries, GrantAuthority, and RevokeAuthority, afterCreate.

Member

NewMember

IMember

For logical members, Bases(required) prior to Create.
Extension, AuthorityEntries, GrantAuthority, RevokeAuthorityand Text, afterCreate.

Requirements