コード例 #1
0
void InputStmt::syntaxErrorOnMissingQuote(char * str)
{
  if (!str)
    str = getPackedString();

  SqlciError (SQLCI_INPUT_MISSING_QUOTE, (ErrorParam *) 0);
  size_t quote_pos = 0;
  findEnd(str, quote_pos);

  // subtract one from quote_pos to convert 1-based offset to 0-based
#pragma nowarn(1506)   // warning elimination 
  StoreSyntaxError(str, --quote_pos, sqlci_DA);
#pragma warn(1506)  // warning elimination 
  sqlci_parser_syntax_error_cleanup(NULL,sqlci_env);
}	// syntaxErrorOnMissingQuote
コード例 #2
0
static void CmpSPERROR2Diags(const SP_ERROR_STRUCT* spError, 
                             ComDiagsArea* diags)
{
  if ( !diags )
    return;

  if (spError[0].error == arkcmpErrorISPMergeCatDiags)
  {
    // Special error message to indicate that errors should really be
    // merged in from the catalog manager diags area.
    // not supported, raise unsupported error instead
    *diags << DgSqlCode(-4222)
           << DgString0("CmpSPERROR2Diags");
    return;
  }

  for ( Int32 i=0; i< SP_MAX_ERROR_STRUCTS; i++)
  {
    const SP_ERROR_STRUCT* pSET = &(spError[i]);
    if (pSET->error)
    {
      *diags << DgSqlCode(pSET->error);
      if(pSET->error == -20067) { //IDS_UTILITIES_BADSYNTAX = 20067
	// If utilities parser returned syntax error for syntax based 
	// utilities, error IDS_UTILITIES_BADSYNTAX is returned by 
	// utilities code to mxmcp.   
	// pSET->optionalString[1] has the utilities command from command line.
	// pSET->optionalInteger[0] has the approximate position of error in
	// the syntax of the utilities command given by user in command line.
	// The approximate error position is returned by utilities parser.

	// Function  StoreSyntaxError(.....) takes the information to put a 
	// caret (^) in the approximate position of the command and the 
	// information is saved in diags.
 
        StoreSyntaxError(pSET->optionalString[1],  // const char *      input_str
                         pSET->optionalInteger[0], // Int32             input_pos
                         *diags,                   // ComDiagsArea &    diagsArea
                         0,                        // Int32             dgStrNum
                         CharInfo::UTF8,           // CharInfo::CharSet input_str_cs
                         CharInfo::UTF8);          // CharInfo::CharSet terminal_cs
      }
      else{
      if ( pSET->optionalString[0] && 
           pSET->optionalString[0] != (char *) ComDiags_UnInitialized_Int )
        *diags << DgString0(pSET->optionalString[0]);
      if ( pSET->optionalString[1] &&
           pSET->optionalString[1] != (char *)ComDiags_UnInitialized_Int )
        *diags << DgString1(pSET->optionalString[1]);
      if ( pSET->optionalString[2] &&
           pSET->optionalString[2] != (char *)ComDiags_UnInitialized_Int )
        *diags << DgString2(pSET->optionalString[2]);
      if ( pSET->optionalString[3] &&
           pSET->optionalString[3] != (char *)ComDiags_UnInitialized_Int )
        *diags << DgString3(pSET->optionalString[3]);
      if ( pSET->optionalString[4] &&
           pSET->optionalString[4] != (char *)ComDiags_UnInitialized_Int )
        *diags << DgString4(pSET->optionalString[4]);
      if ( pSET->optionalInteger[0] != ComDiags_UnInitialized_Int )
        *diags << DgInt0(pSET->optionalInteger[0]);
      if ( pSET->optionalInteger[1] != ComDiags_UnInitialized_Int )
        *diags << DgInt1(pSET->optionalInteger[1]);
      if ( pSET->optionalInteger[2] != ComDiags_UnInitialized_Int )
        *diags << DgInt2(pSET->optionalInteger[2]);
      if ( pSET->optionalInteger[3] != ComDiags_UnInitialized_Int )
        *diags << DgInt3(pSET->optionalInteger[3]);
      if ( pSET->optionalInteger[4] != ComDiags_UnInitialized_Int )
        *diags << DgInt4(pSET->optionalInteger[4]);
      }
    }
    else if ( i==0 )
    {
      // this is the case that ISP implementation does not return any
      // SP_ERROR_STRUCT info back, but does return with error status.
      *diags << DgSqlCode(arkcmpErrorISPNoSPError);
      break;
    }
    else
      // no more SP_ERROR_STRUCT.
      break;
  }
}