Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. \r\n ignored when executing queryies using ADO

\r\n ignored when executing queryies using ADO

Scheduled Pinned Locked Moved Database
databasehelpc++oraclesysadmin
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fayu
    wrote on last edited by
    #1

    Hi, I am having an issue executing a create procedure query to Oracle 10g. I am building the query in C++ (Exhibit A) and executing it using ADO (Exhibit B). In most systems, which I do not manage, the query is build and executed on oracle correctly (see Exhibit D). However, I have this one Oracle server that is, for some odd reason, ignoring the new line feeds (\r\n) (see Exhibit C). Is there a setting in Oracle that I am over looking? Your help is appreciated. Thanks in advance. Let me know if you need any more info. EXHIBIT A - Code in C++ to build query:

    CString cstrTmp;cstrTmp =
    "CREATE OR REPLACE PROCEDURE \"DoSomething\" \r\n"
    "(\r\n" " pTxt nvarchar2\r\n" ")\r\n"
    "as\r\n"
    "\r\n"
    "vXml XmlType;\r\n"
    "vTempCounter int;\r\n"
    "\r\n" "begin\r\n"
    " --my comment\r\n"
    " dbms_output.put_line('test');
    "end;\r\n"

    EXHIBIT B - This is the code that executes the query above to the database (in c++):

    //where cBuffer is the query above
    if(pCommand == NULL)
    {
    pCommand.CreateInstance(__uuidof(Command));
    pCommand->CommandType = adCmdText;
    }
    pCommand->CommandText= _bstr_t(*cBuffer);
    pCommand->CommandTimeout = m_pConn->CommandTimeout;
    pCommand->ActiveConnection = m_pConn;
    pCommand->Execute(NULL, NULL, adExecuteNoRecords);
    pCommand = NULL;

    EXHIBIT C - This is how the query is seen in the procedure - In one single line. \r\n is ignored:

    CREATE OR REPLACE PROCEDURE "DoSomething"(pTxt nvarchar2)asvXml XmlType;vTempCounter int;BEGIN --myComment dbms_utput.put_line('test');END;

    EXHIBIT D - It should show up like this after it is created on the database:

    CREATE OR REPLACE PROCEDURE "DoSomething"
    (pTxt nvarchar2)
    asv
    Xml XmlType;
    vTempCounter int;
    BEGIN
    -- my comment
    dbms_output.put_line('test');
    END;

    C 1 Reply Last reply
    0
    • F Fayu

      Hi, I am having an issue executing a create procedure query to Oracle 10g. I am building the query in C++ (Exhibit A) and executing it using ADO (Exhibit B). In most systems, which I do not manage, the query is build and executed on oracle correctly (see Exhibit D). However, I have this one Oracle server that is, for some odd reason, ignoring the new line feeds (\r\n) (see Exhibit C). Is there a setting in Oracle that I am over looking? Your help is appreciated. Thanks in advance. Let me know if you need any more info. EXHIBIT A - Code in C++ to build query:

      CString cstrTmp;cstrTmp =
      "CREATE OR REPLACE PROCEDURE \"DoSomething\" \r\n"
      "(\r\n" " pTxt nvarchar2\r\n" ")\r\n"
      "as\r\n"
      "\r\n"
      "vXml XmlType;\r\n"
      "vTempCounter int;\r\n"
      "\r\n" "begin\r\n"
      " --my comment\r\n"
      " dbms_output.put_line('test');
      "end;\r\n"

      EXHIBIT B - This is the code that executes the query above to the database (in c++):

      //where cBuffer is the query above
      if(pCommand == NULL)
      {
      pCommand.CreateInstance(__uuidof(Command));
      pCommand->CommandType = adCmdText;
      }
      pCommand->CommandText= _bstr_t(*cBuffer);
      pCommand->CommandTimeout = m_pConn->CommandTimeout;
      pCommand->ActiveConnection = m_pConn;
      pCommand->Execute(NULL, NULL, adExecuteNoRecords);
      pCommand = NULL;

      EXHIBIT C - This is how the query is seen in the procedure - In one single line. \r\n is ignored:

      CREATE OR REPLACE PROCEDURE "DoSomething"(pTxt nvarchar2)asvXml XmlType;vTempCounter int;BEGIN --myComment dbms_utput.put_line('test');END;

      EXHIBIT D - It should show up like this after it is created on the database:

      CREATE OR REPLACE PROCEDURE "DoSomething"
      (pTxt nvarchar2)
      asv
      Xml XmlType;
      vTempCounter int;
      BEGIN
      -- my comment
      dbms_output.put_line('test');
      END;

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      For the one Oracle server that produces your Exhibit C, is that a Windows server or some other flavour OS that is hosting Oracle.

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

      F 1 Reply Last reply
      0
      • C Chris Meech

        For the one Oracle server that produces your Exhibit C, is that a Windows server or some other flavour OS that is hosting Oracle.

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        F Offline
        F Offline
        Fayu
        wrote on last edited by
        #3

        Its a Windows 2008 machine.

        C 1 Reply Last reply
        0
        • F Fayu

          Its a Windows 2008 machine.

          C Offline
          C Offline
          Chris Meech
          wrote on last edited by
          #4

          Since it is Windows, it's more probable that it is not dropping your escape characters. I was just wanting to see if some flavour of Unix was involved and somehow along with translating the characters, it was also dropping them. Not sure what else you can look at, though. Sorry. :)

          Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

          F 1 Reply Last reply
          0
          • C Chris Meech

            Since it is Windows, it's more probable that it is not dropping your escape characters. I was just wanting to see if some flavour of Unix was involved and somehow along with translating the characters, it was also dropping them. Not sure what else you can look at, though. Sorry. :)

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

            F Offline
            F Offline
            Fayu
            wrote on last edited by
            #5

            My first thought was unix as well. The user swears that it's a windows. Is there a query I can run to figure out what is the server is running on?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups