\r\n ignored when executing queryies using ADO
-
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; -
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;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]
-
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]
-
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]
-
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]