DBC.cs :  » Database » Berkeley-DB » BerkeleyDb » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Database » Berkeley DB 
Berkeley DB » BerkeleyDb » DBC.cs
/*
 * This software is licensed according to the "Modified BSD License",
 * where the following substitutions are made in the license template:
 * <OWNER> = Karl Waclawek
 * <ORGANIZATION> = Karl Waclawek
 * <YEAR> = 2005, 2006
 * It can be obtained from http://opensource.org/licenses/bsd-license.html.
 */

using System;
using System.Security;
using System.Runtime.InteropServices;

namespace BerkeleyDb{
  /*******************************************************
  * Access method cursors.
  *******************************************************/
  [StructLayout(LayoutKind.Sequential, Pack = Compile.PackSize), CLSCompliant(false)]
  public unsafe struct DBC
  {
    #region Private Fields (to calculate offset to API function pointers)

    public readonly DB* dbp;          /* Related DB access method. */
    public readonly DB_TXN* txn;      /* Associated transaction. */

    /*
    * Active/free cursor queues.
    *
    * !!!
    * Explicit representations of structures from queue.h.
    * TAILQ_ENTRY(__dbc) links;
    */
    [StructLayout(LayoutKind.Sequential, Pack = Compile.PackSize)]
    public struct LINKS
    {
      DBC* tqe_next;
      DBC** tqe_prev;
    }
    LINKS links;

    /*
    * The DBT *'s below are used by the cursor routines to return
    * data to the user when DBT flags indicate that DB should manage
    * the returned memory.  They point at a DBT containing the buffer
    * and length that will be used, and "belonging" to the handle that
    * should "own" this memory.  This may be a "my_*" field of this
    * cursor--the default--or it may be the corresponding field of
    * another cursor, a DB handle, a join cursor, etc.  In general, it
    * will be whatever handle the user originally used for the current
    * DB interface call.
    */
    DBT* rskey;           /* Returned secondary key. */
    DBT* rkey;            /* Returned [primary] key. */
    DBT* rdata;           /* Returned data. */

    DBT my_rskey;         /* Space for returned secondary key. */
    DBT my_rkey;          /* Space for returned [primary] key. */
    DBT my_rdata;         /* Space for returned data. */

#if BDB_4_3_29
    UInt32 lid;           /* Default process' locker id. */
#endif
#if BDB_4_5_20
    void* lref;           /* Reference to default locker. */
#endif
    UInt32 locker;        /* Locker for this operation. */
    DBT lock_dbt;         /* DBT referencing lock. */
    DB_LOCK_ILOCK @lock;   /* Object to be locked. */
    DB_LOCK mylock;       /* CDB lock held on this cursor. */

    uint cl_id;           /* Remote client id. */

    DbType dbtype;        /* Cursor type. */

    struct DBC_INTERNAL
    {
      // dummy declaration, to have a type for the pointer
    }  
    DBC_INTERNAL* @internal;    /* Access method private. */

    #endregion

    #region API Methods

    IntPtr c_close;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal CloseFcn(DBC* DBcursor);
    public CloseFcn Close {
      get { return (CloseFcn)Marshal.GetDelegateForFunctionPointer(c_close, typeof(CloseFcn)); }
    }

    IntPtr c_count;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal CountFcn(DBC* DBcursor, out UInt32 count, UInt32 flags);
    public CountFcn Count {
      get { return (CountFcn)Marshal.GetDelegateForFunctionPointer(c_count, typeof(CountFcn)); }
    }

    IntPtr c_del;
    // flags currently unused, must be 0
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal DelFcn(DBC* DBcursor, UInt32 flags);
    public DelFcn Del {
      get { return (DelFcn)Marshal.GetDelegateForFunctionPointer(c_del, typeof(DelFcn)); }
    }

    IntPtr c_dup;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal DupFcn(DBC* DBcursor, out DBC* cursor, UInt32 flags);
    public DupFcn Dup {
      get { return (DupFcn)Marshal.GetDelegateForFunctionPointer(c_dup, typeof(DupFcn)); }
    }
  
    IntPtr c_get;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal GetFcn(DBC* DBcursor, ref DBT key, ref DBT data, UInt32 flags);
    public GetFcn Get {
      get { return (GetFcn)Marshal.GetDelegateForFunctionPointer(c_get, typeof(GetFcn)); }
    }

    IntPtr c_pget;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal PGetFcn(DBC* DBcursor, ref DBT key, ref DBT pkey, ref DBT data, UInt32 flags);
    public PGetFcn PGet {
      get { return (PGetFcn)Marshal.GetDelegateForFunctionPointer(c_pget, typeof(PGetFcn)); }
    }
    
    IntPtr c_put;
    [UnmanagedFunctionPointer(Compile.CallConv), SuppressUnmanagedCodeSecurity]
    public delegate DbRetVal PutFcn(DBC* DBcursor, ref DBT key, ref DBT data, UInt32 flags);
    public PutFcn Put {
      get { return (PutFcn)Marshal.GetDelegateForFunctionPointer(c_put, typeof(PutFcn)); }
    }

    /* Methods: private. */
    IntPtr c_am_bulk;
    IntPtr c_am_close;
    IntPtr c_am_del;
    IntPtr c_am_destroy;
    IntPtr c_am_get;
    IntPtr c_am_put;
    IntPtr c_am_writelock;

    #endregion

    UInt32 flags;
  }

  /*
  * DB_LOCK_ILOCK --
  *  Internal DB access method lock.
  */
  [StructLayout(LayoutKind.Sequential, Pack = Compile.PackSize)]
  unsafe struct DB_LOCK_ILOCK
  {
    UInt32 pgno;      /* Page being locked. (typedef  u_int32_t  db_pgno_t;) */
    fixed byte fileid[DbConst.DB_FILE_ID_LEN];  /* File id. */

    public const UInt32 DB_HANDLE_LOCK = 1;
    public const UInt32 DB_RECORD_LOCK = 2;
    public const UInt32 DB_PAGE_LOCK = 3;
    UInt32 type;                            /* Type of lock. */
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.