⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fastdbcli.cs

📁 嵌入式数据库软件 嵌入式数据库软件 嵌入式数据库软件
💻 CS
📖 第 1 页 / 共 4 页
字号:
          case (int)ErrorCode.cli_empty_query                : return "Query SQL text is not assigned";          case (int)ErrorCode.cli_item_already_defined       : return "Field/Variable is already defined";          case (int)ErrorCode.cli_wrong_inverse_reference    : return "Wrong inverse reference";          case (int)ErrorCode.cli_no_fields_defined          : return "No fields defined";          case (int)ErrorCode.cli_access_violation           : return "Access Violation";          default:						                                 return String.Format("({0})", Code);        }    }    [Flags]      public enum CliOpenAttribute : int {      oaReadWrite      = 0x00, //cli_open_default      oaReadOnly			 = 0x01, //cli_open_readonly      oaTruncate       = 0x02, //cli_open_truncate      oaOpenConcurrent = 0x04  //cli_open_concurrent    };    /*=====================================================================     * cli_open     *     Establish connection with the server     * Parameters:     *     server_url - zero terminated string with server address and port,     *                  for example "localhost:5101", "195.239.208.240:6100",...     *     max_connect_attempts  - number of attempts to establish connection     *     reconnect_timeout_sec - timeput in seconds between connection attempts     *  Gigabase users:     *  ===============     *  user_name - user name for login     *  password  - password for login     *  pooled_connection - if not 0, then connection will be allocated from the connection pool     *     * Returns:     *     >= 0 - connectiondescriptor to be used in all other cli calls     *     <  0 - error code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_open(      string ServerURL,      int MaxConnectAttempts,      int ReconnectTimeoutSec#if GIGABASE        , string UserName        , string Password        , bool PooledConnection#endif      );    /*=====================================================================     * cli_create     *     Create connection to the local database     * Parameters:     *     databaseName - name of the database     *     fileName - path to the database file     *     transactionCommitDelay - trasnaction commit delay (specify 0 to disable)     *     openAttr - mask of cli_open_attributes     *     initDatabaseSize - initial size of the database     *     extensionQuantum - database extension quantum     *     initIndexSize - initial size of object index     *     fileSizeLimit - limit for file size (0 - unlimited)     * Returns:     *     >= 0 - connection descriptor to be used in all other cli calls     *     <  0 - error code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_create(#if GIGABASE      uint TransactionCommitDelay: Word=0;      int  openAttr;      int  PoolSize#else      string databaseName,   //[MarshalAs(UnmanagedType.LPStr)] string databaseName,      string filePath,       //[MarshalAs(UnmanagedType.LPStr)] string filePath,      uint   transactionCommitDelay,      int    openAttr,      int    initDatabaseSize,      int    extensionQuantum,      int    initIndexSize,      int    fileSizeLimit#endif      );    /*=====================================================================     * cli_create_replication_node     *     Create connection to the local database with support of replication     * Parameters:     *     nodeId - node identifier: 0 <= nodeId < nServers     *     nServers - number of replication nodes (primary + standby)     *     nodeNames - array with URLs of the nodes (address:port)     *     databaseName - name of the database     *     fileName - path to the database file     *     transactionCommitDelay - trasnaction commit delay (specify 0 to disable)     *     openAttr - mask of cli_open_attributes (to allow concurrent read access to replication node,     *                cli_open_concurrent attribute should be set)     *     initDatabaseSize - initial size of the database     *     extensionQuantum - database extension quantum     *     initIndexSize - initial size of object index     *     fileSizeLimit - limit for file size (0 - unlimited)     * Returns:     *     >= 0 - connection descriptor to be used in all other cli calls     *     <  0 - error code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_create_replication_node(      int                nodeId,      int                nServers,      [In, Out] String[] nodeNames,      string             databaseName,      string             filePath,      int                openAttr,      int                initDatabaseSize,      int                extensionQuantum,      int                initIndexSize,      int                fileSizeLimit);    /*=====================================================================      * cli_close      *     Close session      * Parameters:      *     session - session descriptor returned by cli_open      * Returns:      *     result code as described in cli_result_code enum      */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_close(int session);    /*=====================================================================     * cli_statement     *     Specify SubSQL statement to be executed at server     *     Binding to the parameters and columns can be established     * Parameters:     *     session - session descriptor returned by cli_open     *     stmt    - zero terminated string with SubSQL statement     * Returns:     *     >= 0 - statement descriptor     *     <  0 - error code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_statement(int session, string stmt);    /*=====================================================================     * cli_parameter     *     Bind parameter to the statement     * Parameters:     *     statement  - statememt descriptor returned by cli_statement     *     param_name - zero terminated string with parameter name     *                  Paramter name should start with '%'     *     var_type   - type of variable as described in CliVarType enum.     *                  Only scalar and zero terminated string types are supported.     *     var_ptr    - pointer to the variable     * Returns:     *     result code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal static extern int cli_parameter(      int       statement,      string    param_name,      int       var_type,      IntPtr    var_ptr);    /*=====================================================================     * cli_column     *     Bind extracted column of select or insert statement     * Parameters:     *     statement   - statememt descriptor returned by cli_statement     *     column_name - zero terminated string with column name     *     var_type    - type of variable as described in CliVarType enum     *     var_len     - pointer to the variable to hold length of array variable.     *                   This variable should be assigned the maximal length     *                   of the array/string buffer, pointed by var_ptr.     *                   After the execution of the statement it is assigned the     *                   real length of the fetched array/string. If it is large     *                   than length of the buffer, then only part of the array     *                   will be placed in the buffer, but var_len still will     *                   contain the actual array length.     *     var_ptr     - pointer to the variable     * Returns:     *     result code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    public static extern int cli_column(       int       statement,       string    column_name,       int       var_type,       ref int   var_len,       IntPtr var_data);    [ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]    public struct UnmanagedBuffer {      public int    type;      public int    capacity;      public int    size;      public bool   fetch_data;      public IntPtr data;    }    /* The C# does not allow you to specify the calling convention of the callback.     * It is just one of the C# limitations. IL, managed C++ and the runtime itself     * supports the cdecl calling convention for delegates through     * modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) on the     * internal Invoke method of the delegate. Run ildasm on a small example in     * managed C++ if you want to know the exact syntax.     */    internal unsafe delegate IntPtr CliColumnSetEx(      int       var_type,       IntPtr    var_ptr,      int       len,       [MarshalAs(UnmanagedType.LPStr)]       string    column_name,       int       statement,       IntPtr    source_ptr,      void* buffer);    internal unsafe delegate IntPtr CliColumnGetEx(      int     var_type,       IntPtr  var_ptr,      ref int len,       string column_name, int statement,      void* buffer);    /*=====================================================================     * cli_array_column     *     Specify get/set functions for the array column     * Parameters:     *     statement   - statememt descriptor returned by cli_statement     *     column_name - zero terminated string with column name       *     var_type    - type of variable as described in CliVarType enum     *     var_ptr     - pointer to the variable     *     set         - function which will be called to construct fetched      *                   field. It receives pointer to the variable,      *                   length of the fetched array and returns pointer to th      *                   array's elements     *     get         - function which will be called to update the field in the      *                   database. Given pointer to the variable, it should return      *                   pointer to the array elements and store length of the     *                   array to the variable pointer by len parameter     * Returns:     *     result code as described in cli_result_code enum     */    [DllImport(libname,       CharSet           = CharSet.Ansi,  // We want ANSI String       CallingConvention = CallingConvention.Cdecl)]    internal unsafe static extern int cli_array_column_ex(      int            statement,      string         column_name,       int            var_type,      IntPtr         var_ptr,      CliColumnSetEx SetCallback,      CliColumnGetEx GetCallback,      void* user_data);    public enum QueryType: int {      cli_view_only  = 0,       cli_for_update = 1    }    /*=====================================================================     * cli_fetch     *     Execute select statement.     * Parameters:     *     statement    - statememt descriptor returned by cli_statement     *     queryType - not zero if fetched rows will be updated      * Returns:     *     >= 0 - success, for select statements number of fetched rows is returned     *     <  0 - error code as described in cli_result_code enum     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -