Exemplo n.º 1
0
        internal bool SetCredentialAttributes(OciErrorHandle error)
        {
            errorHandle = error;

            int status;

            status = OciCalls.OCIAttrSetString(this,
                                               OciHandleType.Session,
                                               username,
                                               (uint)username.Length,
                                               OciAttributeType.Username,
                                               errorHandle);

            if (status != 0)
            {
                return(false);
            }

            status = OciCalls.OCIAttrSetString(this,
                                               OciHandleType.Session,
                                               password,
                                               (uint)password.Length,
                                               OciAttributeType.Password,
                                               errorHandle);

            if (status != 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool BeginSession(OciCredentialType credentialType, OciSessionMode mode, OciErrorHandle error)
        {
            errorHandle = error;

            int status = 0;

            if (credentialType == OciCredentialType.RDBMS)
            {
                status = OciCalls.OCIAttrSetString(this,
                                                   OciHandleType.Session,
                                                   username,
                                                   (uint)username.Length,
                                                   OciAttributeType.Username,
                                                   errorHandle);

                if (status != 0)
                {
                    return(false);
                }

                status = OciCalls.OCIAttrSetString(this,
                                                   OciHandleType.Session,
                                                   password,
                                                   (uint)password.Length,
                                                   OciAttributeType.Password,
                                                   errorHandle);

                if (status != 0)
                {
                    return(false);
                }
            }

            status = OciCalls.OCISessionBegin(Service,
                                              errorHandle,
                                              Handle,
                                              credentialType,
                                              mode);

            if (status != 0)
            {
                return(false);
            }

            begun = true;

            return(true);
        }
Exemplo n.º 3
0
        internal void SetAttributeString(string attribute, OciAttributeType attrType, OciErrorHandle errorHandle)
        {
            int status = 0;

            status = OciCalls.OCIAttrSetString(Handle,
                                               HandleType,
                                               attribute,
                                               (uint)attribute.Length,
                                               attrType,
                                               errorHandle);

            if (status != 0)
            {
                OciErrorInfo info = errorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }
        }