Esempio n. 1
0
        /// <summary>
        /// Return an array of string pointers to the individual fields.
        /// A zero is returned upon encountering end of sequence or error.
        /// This can be analyzed in using mapi\_error().
        /// </summary>
        /// <param name="hdl"></param>
        /// <returns></returns>
        public static string[] MapiFetchFieldArray(MapiHdl hdl)
        {
            var pptr     = CMapiLib.mapi_fetch_field_array(hdl.Ptr);
            var ptr      = Marshal.ReadIntPtr(pptr);
            var exploded = new List <string>();

            do
            {
                exploded.Add(Marshal.PtrToStringAnsi(ptr));
                pptr = new IntPtr((int)pptr + IntPtr.Size);
                ptr  = Marshal.ReadIntPtr(pptr);
            } while (ptr != IntPtr.Zero);
            return(exploded.ToArray());
        }
Esempio n. 2
0
        /// <summary>
        /// Return a list of accessible tables fields. This can also be obtained by
        /// inspecting the field descriptor returned by mapi_fetch_field().
        /// </summary>
        /// <param name="mid"></param>
        /// <returns></returns>
        public static string[] MapiFields(MapiConnection mid)
        {
            var pptr     = CMapiLib.mapi_fields(mid.Ptr);
            var ptr      = Marshal.ReadIntPtr(pptr);
            var exploded = new List <string>();

            do
            {
                exploded.Add(Marshal.PtrToStringAnsi(ptr));
                pptr = new IntPtr((int)pptr + IntPtr.Size);
                ptr  = Marshal.ReadIntPtr(pptr);
            } while (ptr != IntPtr.Zero);
            return(exploded.ToArray());
        }
Esempio n. 3
0
 /// <summary>
 /// All rows are cached at the client side first. Subsequent calls to mapi_fetch_row() will take
 /// the row from the cache. The number or rows cached is returned.
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static long MapiFetchAllRows(MapiHdl hdl)
 {
     return(CMapiLib.mapi_fetch_all_rows(hdl.Ptr));
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mid"></param>
 /// <returns></returns>
 public static string MapiGetMotd(MapiConnection mid)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_get_motd(mid.Ptr)));
 }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="fnr"></param>
 /// <returns></returns>
 public static int MapiGetlen(MapiConnection mid, int fnr)
 {
     return(CMapiLib.mapi_get_len(mid.Ptr, fnr));
 }
Esempio n. 6
0
 /// <summary>
 /// Log the interaction between the client and server for offline inspection.
 /// Beware that the log file overwrites any previous log. It is not intended for recovery.
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="filename"></param>
 /// <returns></returns>
 public static MapiMsg MapiTraceLog(MapiConnection mid, string filename)
 {
     return(new MapiMsg(CMapiLib.mapi_trace_log(mid.Ptr, filename)));
 }
Esempio n. 7
0
 /// <summary>
 /// Set the trace flag to monitor interaction with the server.
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="flag"></param>
 /// <returns></returns>
 public static MapiMsg MapiTrace(MapiConnection mid, int flag)
 {
     return(new MapiMsg(CMapiLib.mapi_trace(mid.Ptr, flag)));
 }
Esempio n. 8
0
 /// <summary>
 /// Escape special characters such as \n, \t in str with backslashes.
 /// The returned value is a newly allocated string which should be freed by the caller.
 /// </summary>
 /// <param name="str"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public static string MapiQuote(string str, int size)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_quote(str, size)));
 }
Esempio n. 9
0
 /// <summary>
 /// Make room in the cache by shuffling percentage tuples out of the cache.
 /// It is sometimes handy to do so, for example, when your application is stream-based
 /// and you process each tuple as it arrives and still need a limited look-back.
 /// This percentage can be set between 0 to 100. Making shuffle= 100% (default)
 /// leads to paging behavior, while shuffle==1 leads to a sliding window over a
 /// tuple stream with 1% refreshing.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="percentage"></param>
 /// <returns></returns>
 public static MapiMsg MapiCacheShuffle(MapiHdl hdl, int percentage)
 {
     return(new MapiMsg(CMapiLib.mapi_cache_shuffle(hdl.Ptr, percentage)));
 }
Esempio n. 10
0
 /// <summary>
 /// Return the last error code or 0 if there is no error.
 /// </summary>
 /// <param name="mid"></param>
 /// <returns></returns>
 public static MapiMsg MapiError(MapiConnection mid)
 {
     return(new MapiMsg(CMapiLib.mapi_error(mid.Ptr)));
 }
Esempio n. 11
0
 /// <summary>
 /// Go to the next result set, discarding the rest of the output of the current result set.
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static MapiMsg MapiNextResult(MapiHdl hdl)
 {
     return(new MapiMsg(CMapiLib.mapi_next_result(hdl.Ptr)));
 }
Esempio n. 12
0
 /// <summary>
 /// Return a pointer a C-string representation of the value returned.
 /// A zero is returned upon encountering an error or when the database value is NULL;
 /// this can be analyzed in using mapi\_error().
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="fnr"></param>
 /// <returns></returns>
 public static string MapiFetchField(MapiHdl hdl, int fnr)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_fetch_field(hdl.Ptr, fnr)));
 }
Esempio n. 13
0
 /// <summary>
 /// Reset the row pointer to the first line in the cache. This need not be a tuple.
 /// This is mostly used in combination with fetching all tuples at once.
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static MapiMsg MapiFetchReset(MapiHdl hdl)
 {
     return(new MapiMsg(CMapiLib.mapi_fetch_reset(hdl.Ptr)));
 }
Esempio n. 14
0
 /// <summary>
 /// Reset the row pointer to the requested row number. If whence is MAPI_SEEK_SET (0),
 /// rownr is the absolute row number (0 being the first row); if whence is
 /// MAPI_SEEK_CUR (1), rownr is relative to the current row; if whence is
 /// MAPI\_SEEK\_END (2), rownr is relative to the last row.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="rownr"></param>
 /// <param name="whence"></param>
 /// <returns></returns>
 public static MapiMsg MapiSeekRow(MapiHdl hdl, long rownr, int whence)
 {
     return(new MapiMsg(CMapiLib.mapi_seek_row(hdl.Ptr, rownr, whence)));
 }
Esempio n. 15
0
 /// <summary>
 /// Read the answer to a query and pass the results verbatim to a stream.
 /// The result is not analyzed or cached.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="fs"></param>
 /// <returns></returns>
 public static int MapiQuickResponse(MapiHdl hdl, FileStream fs)
 {
     return(CMapiLib.mapi_quick_response(hdl.Ptr, fs.SafeFileHandle));
 }
Esempio n. 16
0
 /// <summary>
 /// Set the autocommit flag (default is on).
 /// This only has an effect when the language is SQL.
 /// In that case, the server commits after each statement sent to the server.
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="autocommit"></param>
 /// <returns></returns>
 public static MapiMsg MapiSetAutocommit(MapiConnection mid, int autocommit)
 {
     return(new MapiMsg(CMapiLib.mapi_setAutocommit(mid.Ptr, autocommit)));
 }
Esempio n. 17
0
 /// <summary>
 /// A limited number of tuples are pre-fetched after each execute().
 /// If maxrows is negative, all rows will be fetched before the application is
 /// permitted to continue. Once the cache is filled, a number of tuples are shuffled to
 /// make room for new ones, but taking into account non-read elements.
 /// Filling the cache quicker than reading leads to an error.
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="maxrows"></param>
 /// <returns></returns>
 public static MapiMsg MapiCacheLimit(MapiConnection mid, int maxrows)
 {
     return(new MapiMsg(CMapiLib.mapi_cache_limit(mid.Ptr, maxrows)));
 }
Esempio n. 18
0
 /// <summary>
 /// Return a pointer to the last error message.
 /// </summary>
 /// <param name="mid"></param>
 /// <returns></returns>
 public static string MapiErrorString(MapiConnection mid)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_error_str(mid.Ptr)));
 }
Esempio n. 19
0
 /// <summary>
 /// Forcefully shuffle the cache making room for new rows. It ignores the read counter, so rows may be lost.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="percentage"></param>
 /// <returns></returns>
 public static MapiMsg MapiCacheFreeup(MapiHdl hdl, int percentage)
 {
     return(new MapiMsg(CMapiLib.mapi_cache_freeup(hdl.Ptr, percentage)));
 }
Esempio n. 20
0
 /// <summary>
 /// Return a pointer to the last error message from the server.
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static string MapiResultError(MapiHdl hdl)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_result_error(hdl.Ptr)));
 }
Esempio n. 21
0
 /// <summary>
 /// The reverse action of mapi_quote(), turning the database representation into a C-representation.
 /// The storage space is dynamically created and should be freed after use.
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static string MapiUnquote(string str)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_unquote(str)));
 }
Esempio n. 22
0
 /// <summary>
 /// Write the error message obtained from mserver to a file.
 /// </summary>
 /// <param name="mid"></param>
 /// <param name="fs"></param>
 /// <returns></returns>
 public static MapiMsg MapiExplain(MapiConnection mid, FileStream fs)
 {
     return(new MapiMsg(CMapiLib.mapi_explain(mid.Ptr, fs.SafeFileHandle)));
 }
Esempio n. 23
0
 /// <summary>
 /// Return the current value of the trace flag.
 /// </summary>
 /// <param name="mid"></param>
 /// <returns></returns>
 public static int MapiGetTrace(MapiConnection mid)
 {
     return(CMapiLib.mapi_get_trace(mid.Ptr));
 }
Esempio n. 24
0
 /// <summary>
 /// Write the error message obtained from mserver to a file.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="fs"></param>
 /// <returns></returns>
 public static MapiMsg MapiExplainResult(MapiHdl hdl, FileStream fs)
 {
     return(new MapiMsg(CMapiLib.mapi_explain_result(hdl.Ptr, fs.SafeFileHandle)));
 }
Esempio n. 25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="fnr"></param>
 /// <returns></returns>
 public static string MapiGetTable(MapiHdl hdl, int fnr)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_get_table(hdl.Ptr, fnr)));
 }
Esempio n. 26
0
 /// <summary>
 /// Bind a string variable with a field in the return table.
 /// Upon a successful subsequent mapi_fetch_row() the indicated field
 /// is stored in the space pointed to by val. Returns an error if
 /// the field identified does not exist.
 /// </summary>
 /// <param name="hdl"></param>
 /// <param name="fldnr"></param>
 /// <param name="val"></param>
 /// <returns></returns>
 public static MapiMsg MapiBind(MapiHdl hdl, int fldnr, string[] val)
 {
     return(new MapiMsg(CMapiLib.mapi_bind(hdl.Ptr, fldnr, val)));
 }
Esempio n. 27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mid"></param>
 /// <returns></returns>
 public static string MapiGetDbName(MapiConnection mid)
 {
     return(Marshal.PtrToStringAnsi(CMapiLib.mapi_get_dbname(mid.Ptr)));
 }
Esempio n. 28
0
 /// <summary>
 /// Clear all field bindings.
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static MapiMsg MapiClearBindings(MapiHdl hdl)
 {
     return(new MapiMsg(CMapiLib.mapi_clear_bindings(hdl.Ptr)));
 }
Esempio n. 29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static MapiMsg MapiClearParams(MapiHdl hdl)
 {
     return(new MapiMsg(CMapiLib.mapi_clear_params(hdl.Ptr)));
 }
Esempio n. 30
0
 /// <summary>
 /// Retrieve a row from the server. The text retrieved is kept around in a buffer linked with the
 /// query handle from which selective fields can be extracted. It returns the number of fields
 /// recognized. A zero is returned upon encountering end of sequence or error. This can be
 /// analyzed in using mapi_error().
 /// </summary>
 /// <param name="hdl"></param>
 /// <returns></returns>
 public static int MapiFetchRow(MapiHdl hdl)
 {
     return(CMapiLib.mapi_fetch_row(hdl.Ptr));
 }