예제 #1
0
        private Message GetInboxMessage(string mailID, string mailAccount)
        {
            Message msg = null;

            using (OracleCommand oCmd = base.CurrentConnection.CreateCommand())
            {
                oCmd.CommandText = "SELECT ID_MAIL, MAIL_FILE,FOLDERID,FOLDERTIPO FROM MAIL_INBOX WHERE MAIL_SERVER_ID = :p_server_id AND MAIL_ACCOUNT = :p_account";
                oCmd.BindByName  = true;
                oCmd.Parameters.Add("p_server_id", mailID);
                oCmd.Parameters.Add("p_account", mailAccount);
                oCmd.InitialLOBFetchSize = BUFFER_SIZE;
                try
                {
                    using (OracleDataReader r = oCmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess))
                    {
                        if (r.HasRows)
                        {
                            msg = new Message();
                            while (r.Read())
                            {
                                if (!r.IsDBNull("ID_MAIL"))
                                {
                                    // msg.Id = idMail = (int)r.GetInt64(0);
                                    //  msgText = r.GetString(1);
                                    //  msg.Uid = mailID;
                                    long   lobSize = r.GetChars(r.GetOrdinal("MAIL_FILE"), 0, null, 0, 0);
                                    char[] file    = new char[lobSize];
                                    r.GetChars(r.GetOrdinal("MAIL_FILE"), 0, file, 0, (int)lobSize);
                                    msg.OriginalData = Encoding.UTF8.GetBytes(file);
                                    //  msg = Parser.ParseMessage(new string(file));
                                    msg.Uid          = mailID;
                                    msg.Id           = (int)r.GetInt64("ID_MAIL");
                                    msg.FolderId     = r.GetDecimal("FOLDERID");
                                    msg.FolderTipo   = r.GetString("FOLDERTIPO");
                                    msg.ParentFolder = "1";
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message);
                    throw;
                }
            }
            return(msg);
        }
예제 #2
0
        public void run()
        {
            Exception exp        = null;
            long      rdrResults = 0;

            OracleCommand    cmd = new OracleCommand("Select LastName From Employees Where EmployeeID = 100", con);
            OracleDataReader rdr = cmd.ExecuteReader();

            rdr.Read();

            //LastName should be "Last100"

            try
            {
                BeginCase("check result length");
                rdrResults = rdr.GetChars(0, 0, Result, 0, Result.Length);
                Compare(rdrResults, (long)"Last100".Length);
            }
            catch (Exception ex)
            {
                exp = ex;
            }
            finally
            {
                EndCase(exp);
                exp = null;
            }

            try
            {
                BeginCase("check result - char[0]");
                Compare(Result[0], 'L');
            }
            catch (Exception ex)
            {
                exp = ex;
            }
            finally
            {
                EndCase(exp);
                exp = null;
            }

            try
            {
                BeginCase("check result - char[last char index]");
                Compare(Result["Last100".Length - 1], '0');
            }
            catch (Exception ex)
            {
                exp = ex;
            }
            finally
            {
                EndCase(exp);
                exp = null;
            }
        }
예제 #3
0
 public static char GetChar(string strNomeCampo, OracleDataReader objDataReader)
 {
     try
     {
         char[] Caracter = new char[1];
         objDataReader.GetChars(_IndexCampo(strNomeCampo, objDataReader), 0, Caracter, 0, 1);
         return(Caracter[0]);
     }
     catch { }
     return((char)0);
 }
 public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
 {
     return(reader.GetChars(i, fieldoffset, buffer, bufferoffset, length));
 }
예제 #5
0
 public override long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length)
 {
     return(source.GetChars(ordinal, dataOffset, buffer, bufferOffset, length));
 }