private EnvOpenDatabase ( |
||
handle | ||
dbhandle | ||
name | short | |
flags | int | |
parameters | ||
Результат | int |
/// <summary> /// Opens a Database in this Environment /// </summary> /// <remarks> /// This method wraps the native ups_env_open_db function. /// </remarks> /// <param name="name">The name of the Database. If a Database /// with this name does not exist, the function will throw /// <see cref="UpsConst.UPS_DATABASE_NOT_FOUND"/>.</param> /// <param name="flags">Optional flags for this operation, combined /// with bitwise OR. Possible flags are: /// <list type="bullet"> /// <item><see cref="UpsConst.UPS_READ_ONLY" /> /// Opens the database for reading.</item> /// </list> /// </param> /// <param name="parameters">An array of <see cref="Parameter" /> /// structures. The following parameters are available:<br /> /// <list type="bullet"> /// </list> /// </param> /// <exception cref="DatabaseException"> /// <list type="bullet"> /// <item><see cref="UpsConst.UPS_INV_PARAMETER"/> /// if an invalid combination of flags was specified</item> /// <item><see cref="UpsConst.UPS_DATABASE_NOT_FOUND"/> /// if a Database with this name does not exist</item> /// <item><see cref="UpsConst.UPS_DATABASE_ALREADY_OPEN"/> /// if this Database was already opened</item> /// <item><see cref="UpsConst.UPS_OUT_OF_MEMORY"/> /// if memory could not be allocated</item> /// <item><see cref="UpsConst.UPS_WOULD_BLOCK"/> /// if another process has locked the file</item> /// </list> /// </exception> /// <returns>The new Database object</returns> public Database OpenDatabase(short name, int flags, Parameter[] parameters) { int st; IntPtr dbh = new IntPtr(0); if (parameters != null) { parameters = AppendNullParameter(parameters); } lock (this) { st = NativeMethods.EnvOpenDatabase(handle, out dbh, name, flags, parameters); } if (st != 0) { throw new DatabaseException(st); } Database db = new Database(dbh); databases.Add(db); return(db); }