Troubleshooting Case5a

Go back to: Code Samples
// Assume at this point that a SELECT * FROM tabletoinsert 
// WHERE 0 = 1 has been prepared to get information to do bindings
 
for (counter = 1; counter <= NumColumns; counter++) {
   rc = SQLColAttributes (hstmt,counter,SQL_COLUMN_TYPE,
              NULL, 0, &rgblen, &ptype);
   rc = SQLColAttributes (hstmt,counter,SQL_COLUMN_PRECISION,
              NULL, 0, &rgblen2, &prec);
   rc = SQLColAttributes (hstmt,counter,SQL_COLUMN_SCALE,
              NULL, 0, &rgblen3, &scale);
   switch(counter){
   case 1: rc = SQLBindParameter (hstmt, counter,
              SQL_PARAM_INPUT, SQL_C_CHAR, (SWORD) ptype,
              (UDWORD) prec, (SWORD) scale,
              pa_col1, sizeof(pa_col1[0]), cbValue);
       // pa_col1 is an array of character strings
       break;
   case 2: rc = SQLBindParameter (hstmt, counter,
              SQL_PARAM_INPUT, SQL_C_CHAR, (SWORD) ptype,
              (UDWORD) prec, (SWORD) scale,
              pa_col2, sizeof(pa_col2[0]), cbValue2);
       // pa_col2 is an array of character strings
       break;
   case 3: rc = SQLBindParameter (hstmt, counter,
              SQL_PARAM_INPUT, SQL_C_CHAR, (SWORD) ptype,
              (UDWORD) prec, (SWORD) scale,
              pa_col3, sizeof(pa_col3[0]), cbValue3);
       // pa_col3 is an array of character strings
       break;
   ...
   default: break;
   }




Like what you see? Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis

Book Content Copyright © 2009 by Prentice Hall PTR. All rights reserved. | Corporate Sponsor DataDirect Technologies.