Ejemplo n.º 1
0
        public void ExecuteSQLExtension(HttpContext ctx)
        {
            string connString = ConfigurationManager.AppSettings["strConn"];

            connString += "User Id=" + _dbuser + ";Password="******"|!" };
            string           procName;
            XmlTextWriter    xw = new XmlTextWriter(ctx.Response.OutputStream, new System.Text.UTF8Encoding(true));
            XmlNodeList      xinputs;
            OracleConnection connection = new OracleConnection(connString);

            connection.Open();
            OracleCommand     command = connection.CreateCommand();
            OracleTransaction transaction;

            transaction         = connection.BeginTransaction();
            command.Transaction = transaction;
            try
            {
                if (_dsoType == "process")
                {
                    //get input parameter listt
                    xinputs = _clientXMLDoc.SelectNodes("//input");

                    procName      = "Call " + _procedure + "( ";
                    _exeStatement = procName;
                    _parameter    = xinputs[0].InnerText;
                    parameter     = _parameter.Split(CDelimeter, System.StringSplitOptions.None);

                    command.CommandText = "select data from esys.tes_dxf_file where pk = '" + parameter[0] + "'";
                    //SaveLogData();
                    //string s = (string) command.ExecuteOracleScalar();
                    OracleDataReader reader = command.ExecuteReader();
                    reader.Read();
                    OracleLob    blob           = reader.GetOracleLob(0);
                    StreamReader myStreamReader = new StreamReader(blob, System.Text.Encoding.Default);
                    string       s         = myStreamReader.ReadToEnd();
                    string       file_name = "temp/tmp" + DateTime.Now.ToString("yymmdd-hh24miss") + ".dxf";
                    CtlLib.EmptyFolder("temp");
                    CtlLib.CreateFile(file_name, s);
                    _p_rtn_value = file_name;
                }
                transaction.Commit();
                ExecuteSQLSelect(ctx);
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                _errorno  = "1";
                _errormsg = ex.Message;
                SaveLogData();
                BuildErrorXML(xw);
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
        }