Example #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         CloseOperation();
         m_LastSchema = null;
         m_Client     = null;
         m_Session    = null;
     }
 }
Example #2
0
        public void Read(TProtocol iprot)
        {
            bool   isset_status = false;
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Struct)
                    {
                        Status = new TStatus();
                        Status.Read(iprot);
                        isset_status = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        Schema = new TTableSchema();
                        Schema.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_status)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Example #3
0
        public void Execute(string statement)
        {
            CloseOperation();
            var execReq = new TExecuteStatementReq()
            {
                SessionHandle = m_Session,
                Statement     = statement,
            };

            m_LastSchema = null;
            var execResp = m_Client.ExecuteStatement(execReq);

            execResp.Status.CheckStatus();
            m_Operation = execResp.OperationHandle;
        }
Example #4
0
 public TTableSchema GetSchema()
 {
     if (m_Operation == null || !m_Operation.HasResultSet)
     {
         return(null);
     }
     else if (m_LastSchema == null)
     {
         var req  = new TGetResultSetMetadataReq(m_Operation);
         var resp = m_Client.GetResultSetMetadata(req);
         resp.Status.CheckStatus();
         m_LastSchema = resp.Schema;
     }
     return(m_LastSchema);
 }