Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie odbc/oracle-procedure-questions

Re: Newbie odbc/oracle-procedure-questions

From: Harp <hmetu_at_gmx.net>
Date: 18 Feb 2005 07:06:55 -0800
Message-ID: <1108739214.993171.259540@o13g2000cwo.googlegroups.com>


Thanks Rauf!
The user writes sth. like this: "select * from table1". I'll get this as a string and then pass it via odbc to db, parse the results and send them back to user. If he wants to call a procedure, he does for e.g. "proc1(str1,str2,str3,int1)" as a string and forwards it to me delivering also whether they are in,out or inout. The problem is this, if I have to bind the parameters and to do this, I need the information about the types, values, columnposition. I was hoping that I could achieve these with these:
rc = SQLProcedureColumns(hstmt,NULL,0,(unsigned char *)colSchemaNamePattern,len,(unsigned char *)"test",len,(char *)colNamePattern,len); /* all columns */
//colSchemaNamePattern gives NULL. I can't figure out why
SQLSMALLINT numCols,colNameLen,coltype,scale; SQLCHAR colName[50]; rc = SQLNumResultCols(hstmt,&numCols);
//numCols gives 1 here, instead of 4

    SQLUINTEGER collen[50] ;
    SQLINTEGER displaysize ;
if(rc == SQL_SUCCESS){

      for(int i = 1; i < numCols; i++){
         //numCols gives 19 - I can't say why (num of columns should be
4
        rc = SQLDescribeCol(hstmt, (SQLSMALLINT)i, colName,
sizeof(colName), &colNameLen,&coltype, &collen[i], &scale,0);
//colName gives sth. like PROCEDURE_SHEMA, or PROCEDURE_CAT, etc.

        rc = SQLColAttribute(hstmt, i, SQL_DESC_DISPLAY_SIZE, NULL, 0, NULL,&displaysize);

      }
    }
I suppose that this is suppose to work, otherwise I do not find other options.
Are there any?

Must I have to parse the syntax? I only need the information which I have to push via odbc.
Much regards,
Harp Received on Fri Feb 18 2005 - 09:06:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US