示例#1
0
void Validate::on_valFix_clicked()
{
    if(!doMessageBox("Set clients balance to expected?"))
        return;
    double dif = fixBal - curBal;
    QString type = "Payment";
    if(dif > 0){
        type = "Refund";
    }
    else{
        dif *= -1;
    }



    if(!dbManager->updateBalance(fixBal, clientId)){
        return;
    }



    //if(!dbManager->escapePayment(clientId, QDate::currentDate().toString(Qt::ISODate), QString::number(dif, 'f', 2), "FIX", "Fixing Balance", "", "", "", type, "", employee, shift, QTime::currentTime().toString()))
      //  return;
    close();
}
示例#2
0
void reportLoadResults(UdrGlobals *UdrGlob, SPInfo *sp, LmRoutine *lmr_)
{
  const char *moduleName = "reportLoadResults";
  
  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
               UdrGlob->showLoad_, moduleName);
  
  if (UdrGlob->verbose_ &&
      UdrGlob->traceLevel_ >= TRACE_DETAILS &&
      UdrGlob->showLoad_ )
  {
    ServerDebug("");
    ServerDebug("[UdrServ (%s)] LOAD message results:", moduleName);
    ServerDebug("  LOAD Udr Handle     : " INT64_SPEC ,
                (Int64) sp->getUdrHandle());
    ServerDebug("  LM result parameter : %d", (Int32) sp->getNumParameters());
    if (sp->getReturnValue() != NULL)
    {
      dumpLmParameter(*sp->getReturnValue(), 0, "    ");
    }
    if (lmr_)
    {
      ServerDebug("  LM routine          : ");
      dumpBuffer((unsigned char *)lmr_, sizeof(LmRoutine));
    }
    ServerDebug("");
  }

} // reportLoadResults
示例#3
0
/*****************************************************
**
**   AtlasAliasDialog   ---   OnDelete
**
******************************************************/
void AtlasAliasDialog::OnDelete( wxCommandEvent& )
{
	int sel = list->GetSelection();
	if ( sel != wxNOT_FOUND )
	{
		wxString message = wxString::Format( _( "Do you want to delete the item %s?" ), list->GetString( sel ).c_str());
		list->Delete( sel );
	}
	else
	{
		doMessageBox( this, wxT( "No entry selected" ));
	}
}
示例#4
0
/*****************************************************
**
**   AtlasAliasDialog   ---   OnEdit
**
******************************************************/
void AtlasAliasDialog::OnEdit( wxCommandEvent& )
{
	const int sel = list->GetSelection();
	if ( sel != wxNOT_FOUND )
	{
		wxTextEntryDialog dialog( this, _( "Edit Entry" ), _( "Alias" ), list->GetString( sel ) );
		if ( dialog.ShowModal() == wxID_OK )
		{
			list->SetString( sel, dialog.GetValue());
		}
	}
	else
	{
		doMessageBox( this, wxT( "No entry selected" ));
	}
}
示例#5
0
/*****************************************************
**
**   Document   ---   save
**
******************************************************/
bool Document::save()
{
	if ( ! wxStrcmp( dataSet->getFilename(), wxT( "" ))) return saveAs();

	FileConfig::get()->backupFile( dataSet->getFilename() );
	if ( ! Horoscope::save() )
	{
		doMessageBox( mainwindow,
			wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), dataSet->getFilename().c_str()),
			wxOK | wxICON_ERROR | wxCENTRE );
		return false;
	}
	dirty = false;

	DocumentManager::get()->documentSaved( this );
	return true;
}
示例#6
0
/*****************************************************
**
**   Document   ---   queryClose
**
******************************************************/
bool Document::queryClose()
{
	if ( ! dirty ) return true;
	int i = doMessageBox( mainwindow,
		wxString::Format( wxT( "%s: %s ?" ), _( "Do you want to save the chart" ), getHName().c_str()),
		wxYES_NO | wxCANCEL | wxCENTRE );
	if ( i == wxID_CANCEL ) return false;
	else if ( i == wxID_YES )
	{
		return save();
	}
	else
	{
		dirty = false;
		return true;
	}
}
示例#7
0
/*****************************************************
**
**   Document   ---   save
**
******************************************************/
bool Document::save()
{
	if ( ! wxStrcmp( dataSet->getFilename(), wxT( "" ))) return saveAs();

	FileConfig::get()->backupFile( dataSet->getFilename() );
	if ( ! Horoscope::save() )
	{
		doMessageBox( mainwindow,
		              wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), (const wxChar*)dataSet->getFilename()),
		              wxOK | wxICON_ERROR | wxCENTRE );
		return false;
	}
	dirty = false;
	wxCommandEvent event( DOC_SAVED, mainwindow->GetId() );
	event.SetEventObject( this );
	wxPostEvent( mainwindow->GetParent(), event );
	return true;
}
/*****************************************************
**
**   YogaEditorPanel   ---   OnYogaListDeleteItem
**
******************************************************/
void YogaEditorPanel::OnYogaListDeleteItem( wxCommandEvent &event )
{
	long item = -1;
	item = list_yogas->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
	if ( item < 0 ) return;

	YogaConfig *cfg = (YogaConfig*)list_yogas->GetItemData( item );
	int ret = doMessageBox( this, wxString::Format( _( "Do you want to delete the Yoga %s?" ),
		(const wxChar*)cfg->description ), wxYES_NO  | wxCENTRE );

	if ( ret == wxID_YES )
	{
		list_yogas->DeleteItem( item );
		list_yogas->SetItemState( item - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
		list_yogas->EnsureVisible( item - 1 );
		delete cfg;
		propagateDirtyEvent();
	}
}
示例#9
0
NABoolean allocateReplyRowAndEOD(UdrGlobals *UdrGlob,
                                 SqlBuffer &replyBuffer,
                                 queue_index parentIndex,
                                 char *&replyData,
                                 Int32 rowLen,
                                 ControlInfo *&newControlInfo)
{
  const char *moduleName = "allocateReplyRowAndEOD";

  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
               UdrGlob->showInvoke_, moduleName);

  NABoolean ok = allocateReplyRow(UdrGlob, replyBuffer, parentIndex, rowLen,
                              replyData, newControlInfo, ex_queue::Q_OK_MMORE);

  if (ok)
    ok = allocateEODRow(UdrGlob, replyBuffer, parentIndex);

  return ok;
}
示例#10
0
/*****************************************************
**
**   Document   ---   saveAs
**
******************************************************/
bool Document::saveAs()
{
	wxString filename = dataSet->getName();
	if ( filename == wxT( "" ))
	{
		filename = wxString::Format( wxT( "%s.mtx" ), (const wxChar*)getHName() );
	}
	wxString filetypes = _( "Maitreya text (*.mtx)|*.mtx| All files (*.*)|*.*" );

	wxFileDialog saveFileDialog( mainwindow, _("Save file as" ), config->defSavePath, filename,
	                             filetypes, wxFD_SAVE, wxDefaultPosition );

	if ( saveFileDialog.ShowModal() == wxID_OK )
	{
		// Bugfix 7.0.3 GetDirectory returns home directory on some Linux distros instead of selected dir
		//filename.Clear();
		//filename << saveFileDialog.GetDirectory() << wxFileName::GetPathSeparator()
		//<< saveFileDialog.GetFilename();
		filename = saveFileDialog.GetPath();

		if ( ! Horoscope::saveAs( (const wxChar*)filename ))
		{
			doMessageBox( mainwindow, wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), (const wxChar*)filename ),
			              wxOK | wxICON_ERROR | wxCENTRE );
			return false;
		}
		dirty = false;
		wxCommandEvent event( DOC_SAVED, mainwindow->GetId() );
		event.SetEventObject( this );
		wxPostEvent( mainwindow->GetParent(), event );
		config->defSavePath = saveFileDialog.GetDirectory();
	}
	else
	{
		return false;
	}
	return true;
}
示例#11
0
/*****************************************************
**
**   Document   ---   saveAs
**
******************************************************/
bool Document::saveAs()
{
	wxString filename = dataSet->getName();
	if ( filename == wxT( "" ))
	{
		filename = wxString::Format( wxT( "%s.mtx" ), getHName().c_str() );
	}
	wxString filetypes = _( "Maitreya text (*.mtx)|*.mtx| All files (*.*)|*.*" );

	wxFileDialog saveFileDialog( mainwindow, _("Save file as" ), config->viewprefs->defSavePath, filename, filetypes, wxFD_SAVE, wxDefaultPosition );

	if ( saveFileDialog.ShowModal() == wxID_OK )
	{
		// Bugfix 7.0.3 GetDirectory returns home directory instead of selected dir
		//filename.Clear();
		//filename << saveFileDialog.GetDirectory() << wxFileName::GetPathSeparator()
		//<< saveFileDialog.GetFilename();
		filename = saveFileDialog.GetPath();
		if ( ! Horoscope::saveAs( filename ))
		{
			doMessageBox( mainwindow,
				wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), filename.c_str() ),
				wxOK | wxICON_ERROR | wxCENTRE );
			return false;
		}
		dirty = false;

		DocumentManager::get()->documentSaved( this );
		config->viewprefs->defSavePath = saveFileDialog.GetDirectory();
	}
	else
	{
		return false;
	}
	return true;
}
示例#12
0
/*****************************************************
**
**   BasicWidget   ---   doExport
**
******************************************************/
void BasicWidget::doExport()
{
	int exporttype;
	wxString filename, e;

	GetExportSize( &xsize, &ysize );

	if ( config->showGraphicSizeDialog )
	{
		ExportDialog dialog( this, xsize, ysize );
		if ( dialog.ShowModal() != wxID_OK ) return;
		dialog.getSizes( xsize, ysize );
		config->showGraphicSizeDialog = ! dialog.getCheckShowDialog();
	}

	const static wxString filetypes =
	    wxT( "PNG (*.png)|*.png|JPG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|PCX (*pcx)|*pcx|PNM (*.pnm)|*.pnm|TIFF (*.tif)|*.tif|All files (*)| *.*" );

	switch ( config->defGraphicExportType )
	{
	case 1:
		filename = wxT( "out.jpg"  );
		break;
	case 2:
		filename = wxT( "out.bmp"  );
		break;
	case 3:
		filename = wxT( "out.pcx"  );
		break;
	case 4:
		filename = wxT( "out.pnm"  );
		break;
	case 5:
		filename = wxT( "out.tif"  );
		break;
	default:
		filename = wxT( "out.png"  );
		break;
	}
	int style = wxFD_SAVE;
	if ( config->exportAskOnOverwrite ) style |= wxFD_OVERWRITE_PROMPT;

	wxFileDialog exportFileDialog( this, _("Export Picture" ), config->defExportPath, filename,
	                               filetypes, style, wxDefaultPosition );
	exportFileDialog.SetFilterIndex( config->defGraphicExportType );

	if ( exportFileDialog.ShowModal() == wxID_OK )
	{
		filename = exportFileDialog.GetDirectory() + wxFileName::GetPathSeparator() + exportFileDialog.GetFilename();
		e = exportFileDialog.GetFilename().Right(3).MakeLower();
		if ( e == wxT( "png" ))
		{
			exporttype = wxBITMAP_TYPE_PNG;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "jpg" ))
		{
			exporttype = wxBITMAP_TYPE_JPEG;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "jpeg" ))
		{
			exporttype = wxBITMAP_TYPE_JPEG;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "bmp" ))
		{
			exporttype = wxBITMAP_TYPE_BMP;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "pnm" ))
		{
			exporttype = wxBITMAP_TYPE_PNM;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "pcx" ))
		{
			exporttype = wxBITMAP_TYPE_PCX;
			config->defGraphicExportType = 0;
		}
		else if ( e == wxT( "tif" ))
		{
			exporttype = wxBITMAP_TYPE_TIF;
			config->defGraphicExportType = 0;
		}
		else
		{
			doMessageBox( this, wxString::Format( _( "Can't determine image handler for extension \"%s\", using default (PNG)" ), (const wxChar*)e));
			filename.Append( wxT ( ".png" ));
			exporttype = wxBITMAP_TYPE_PNG;
			config->defGraphicExportType = 0;
		}
		config->defExportPath = exportFileDialog.GetDirectory();
		wxBitmap bitmap( xsize, ysize );
		wxMemoryDC dc;
		dc.SelectObject( bitmap );
		painter = new DcPainter( &dc );
		exportMode = true;
		doPaint();
		exportMode = false;
		delete painter;
		painter = 0;
		if ( bitmap.SaveFile( filename, (wxBitmapType)exporttype ))
		{
			doMessageBox( this, wxString::Format( _("Picture exported to %s"), (const wxChar*)filename));
		}
	}
}
示例#13
0
void processALoadMessage(UdrGlobals *UdrGlob,
                         UdrServerReplyStream &msgStream,
                         UdrLoadMsg &request,
                         IpcEnvironment &env)
{
  const char *moduleName = "processALoadMessage";
  char errorText[MAXERRTEXT];

  ComDiagsArea *diags = ComDiagsArea::allocate(UdrGlob->getIpcHeap());

  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
               UdrGlob->showLoad_, moduleName);

  NABoolean showLoadLogic = (UdrGlob->verbose_ &&
                             UdrGlob->traceLevel_ >= TRACE_IPMS &&
                             UdrGlob->showLoad_);

  if (showLoadLogic)
  {
    ServerDebug("[UdrServ (%s)] Processing load request", moduleName);
  }

  // UDR_LOAD message always comes with transaction and they are out
  // side Enter Tx and Exit Tx pair. Make sure we are under correct
  // transaction.
  msgStream.activateCurrentMsgTransaction();

  //
  // Check to see if the incoming UDR handle has already been seen
  //
  NABoolean handleAlreadyExists = FALSE;
  SPInfo *sp = UdrGlob->getSPList()->spFind(request.getHandle());
  if (sp)
  {
    handleAlreadyExists = TRUE;
    if (showLoadLogic)
    {
      ServerDebug("    Duplicate handle arrived");
      ServerDebug("    SPInfoState is %s", sp->getSPInfoStateString());
    }

    if (sp->getSPInfoState() != SPInfo::UNLOADING)
    {
      //
      // An SPInfo exists but it is not one of the token instances to
      // represent an out-of-sequence LOAD/UNLOAD. This is an internal
      // error. Something has been botched in the message protocol.
      //
      char buf[100];
      convertInt64ToAscii(request.getHandle(), buf);
      *diags << DgSqlCode(-UDR_ERR_DUPLICATE_LOADS);
      *diags << DgString0(buf);
    }
    else
    {
      // The LOAD/UNLOAD requests for this handle arrived
      // out-of-sequence. Nothing to do at this point. An empty reply
      // will be generated later in this function.
    }
  }

  if (!handleAlreadyExists)
  {
    if (!UdrHandleIsValid(request.getHandle()))
    {
      *diags << DgSqlCode(-UDR_ERR_MISSING_UDRHANDLE);
      *diags << DgString0("Load Message");
    }
    else
    {
      //
      // First process the metadata in the LOAD requests and then
      // contact Language Manager to load the SP.
      //
      sp = processLoadParameters(UdrGlob, request, *diags);
      
      if (showLoadLogic)
      {
        ServerDebug("[UdrServ (%s)]  About to call LM::getRoutine",
                    moduleName);
      }
      
      if (sp == NULL)
      {
        *diags << DgSqlCode(-UDR_ERR_UNABLE_TO_ALLOCATE_MEMORY);
        *diags << DgString0("SPInfo");
      }
      else
      {
        UdrGlob->setCurrSP(sp);
        LmRoutine *lmRoutine;
        LmResult lmResult;
        LmLanguageManager *lm =
          UdrGlob->getOrCreateLM(lmResult, sp->getLanguage(), diags);
        LmHandle emitRowFuncPtr;

        if (sp->getParamStyle() == COM_STYLE_CPP_OBJ)
          emitRowFuncPtr = (LmHandle)&SpInfoEmitRowCpp;
        else
          emitRowFuncPtr = (LmHandle)&SpInfoEmitRow;
        
        if (lm)
        {
          if (sp->getParamStyle() == COM_STYLE_JAVA_OBJ ||
              sp->getParamStyle() == COM_STYLE_CPP_OBJ)
            {
              lmResult = lm->getObjRoutine(
                   request.getUDRSerInvocationInfo(),
                   request.getUDRSerInvocationInfoLen(),
                   request.getUDRSerPlanInfo(),
                   request.getUDRSerPlanInfoLen(),
                   sp->getLanguage(),
                   sp->getParamStyle(),
                   sp->getExternalName(),
                   sp->getContainerName(),
                   sp->getExternalPathName(),
                   sp->getLibrarySqlName(),
                   &lmRoutine,
                   diags);

              if (lmRoutine)
                {
                  LmRoutineCppObj *objRoutine =
                    static_cast<LmRoutineCppObj *>(lmRoutine);

                  if (sp->getParamStyle() == COM_STYLE_CPP_OBJ)
                    // set function pointers for functions provided
                    // by tdm_udrserv
                    objRoutine->setFunctionPtrs(SpInfoGetNextRow,
                                                SpInfoEmitRowCpp);

                  // add items to the UDRInvocationInfo that are not
                  // known at compile time (total # of instances is
                  // kind of known, but we want to give the executor a
                  // chance to change it)
                  lmRoutine->setRuntimeInfo(request.getParentQid(),
                                            request.getNumInstances(),
                                            request.getInstanceNum());

#ifndef NDEBUG
                  int debugLoop = 2;

                  if (objRoutine->getInvocationInfo()->getDebugFlags() &
                      tmudr::UDRInvocationInfo::DEBUG_LOAD_MSG_LOOP)
                    debugLoop = 1;
                  // go into a loop to allow the user to attach a debugger,
                  // if requested, set debugLoop = 2 in the debugger to get out
                  while (debugLoop < 2)
                    debugLoop = 1-debugLoop;
#endif

                }
            }
          else
            lmResult = lm->getRoutine(sp->getNumParameters(),
                                      sp->getLmParameters(),
                                      sp->getNumTables(),
                                      sp->getLmTables(),
                                      sp->getReturnValue(),
                                      sp->getParamStyle(),
                                      sp->getTransactionAttrs(),
                                      sp->getSQLAccessMode(),
                                      sp->getParentQid(),
                                      sp->getRequestRowSize(),
                                      sp->getReplyRowSize(),
                                      sp->getSqlName(),
                                      sp->getExternalName(),
                                      sp->getRoutineSig(),
                                      sp->getContainerName(),
                                      sp->getExternalPathName(),
                                      sp->getLibrarySqlName(),
                                      UdrGlob->getCurrentUserName(),
                                      UdrGlob->getSessionUserName(),
                                      sp->getExternalSecurity(),
                                      sp->getRoutineOwnerId(),
                                      &lmRoutine,
                                      (LmHandle)&SpInfoGetNextRow,
                                      emitRowFuncPtr,
                                      sp->getMaxNumResultSets(),
                                      diags);
        }
        
        if (lmResult == LM_OK)
        {
          if (lmRoutine == NULL)
          {
            *diags << DgSqlCode(-UDR_ERR_MISSING_LMROUTINE);
            *diags << DgString0("error: returned a null LM handle");
            *diags << DgInt1((Int32)0);
          }
          else
          {
            sp->setLMHandle(lmRoutine);

	    // Retrieve any optional data from UdrLoadMsg.
	    copyRoutineOptionalData(request, sp);

            reportLoadResults(UdrGlob, sp, lmRoutine);
            sp->setSPInfoState(SPInfo::LOADED);
          }

        } // lmResult == LM_OK

        if (showLoadLogic)
        {
          if (lmResult == LM_OK)
          {
            sprintf(errorText,
                    "[UdrServ (%.30s)]  LM::getRoutine was successful.",
                    moduleName);
          }
          else
          {
            sprintf(errorText,
                    "[UdrServ (%.30s)]  LM::getRoutine resulted in error.",
                    moduleName);
          }
          ServerDebug(errorText);
          doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
                       UdrGlob->showMain_, errorText);
        }

        if (sp && !(sp->isLoaded()))
        {
          sp->setSPInfoState(SPInfo::LOAD_FAILED);
        }

      } // if (sp == NULL) else ...
    } // if (handle is not valid) else ...
  } // !handleAlreadyExists

  // build a reply and send it
  msgStream.clearAllObjects();

  UdrLoadReply *reply = new (UdrGlob->getIpcHeap())
    UdrLoadReply(UdrGlob->getIpcHeap());

  if (reply == NULL)
  {  // no reply buffer build...
    controlErrorReply(UdrGlob, msgStream, UDR_ERR_MESSAGE_PROCESSING,
                      INVOKE_ERR_NO_REPLY_BUFFER, NULL);
    return;
  }

  // Only return a valid UDR Handle if diagnostics are not present and
  // no LM errors occurred. We also return a valid handle if this LOAD
  // arrived out-of-sequence after the UNLOAD and no diagnostics have
  // been generated yet.
  if (diags && diags->getNumber() > 0)
  {
    reply->setHandle(INVALID_UDR_HANDLE);
  }
  else if (sp)
  {
    if (sp->isLoaded() || handleAlreadyExists)
    {
      reply->setHandle(sp->getUdrHandle());
    }
    else
    {
      reply->setHandle(INVALID_UDR_HANDLE);
    }
  }

  msgStream << *reply;

  if (diags && diags->getNumber() > 0)
  {
    msgStream << *diags;
    UdrGlob->numErrUDR_++;
    UdrGlob->numErrSP_++;
    UdrGlob->numErrLoadSP_++;
    if (showLoadLogic)
      dumpDiagnostics(diags, 2);
  }

  if (showLoadLogic)
  {
    ServerDebug("[UdrServ (%s)] About to send LOAD reply", moduleName);
  }

#ifdef NA_DEBUG_C_RUNTIME
  if (UdrGlob && UdrGlob->getJavaLM())
  {
    sleepIfPropertySet(*(UdrGlob->getJavaLM()),
                       "MXUDR_LOAD_DELAY", diags);
  }
#endif // NA_DEBUG_C_RUNTIME

  sendControlReply(UdrGlob, msgStream, sp);

  if (diags)
  {
    diags->decrRefCount();
  }

  reply->decrRefCount();

} // processALoadMessage
示例#14
0
SPInfo *processLoadParameters(UdrGlobals *UdrGlob,
                              UdrLoadMsg &request,
                              ComDiagsArea &d)
{
  const char *moduleName = "processLoadParameters";
  Lng32 oldDiags = 0;
  Lng32 newDiags = 0;
  
  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
               UdrGlob->showLoad_, moduleName);
  // check for test mode processing...
  
  SPInfo *sp = NULL;
  int numRetries = 0;
  
  // process message parameters...
  
  if (UdrGlob->traceLevel_ >= TRACE_DETAILS &&
      UdrGlob->showLoad_)
  {
    displayLoadParameters(request);
  }
  
  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS,
               UdrGlob->showLoad_, "create SPInfo");
  
  oldDiags = d.getNumber();

  while (sp == NULL && numRetries < 1)
    {
      sp = new (UdrGlob->getUdrHeap()) SPInfo(UdrGlob, UdrGlob->getUdrHeap(),
                                          request.getHandle(),
                                          (char *)request.getSqlName(),
                                          (char *)request.getRoutineName(),
                                          (char *)request.getSignature(),
                                          (char *)request.getContainerName(),
                                          (char *)request.getExternalPath(),
                                          (char *)request.getLibrarySqlName(),
                                          request.getNumParameters(),
                                          request.getNumInValues(),
                                          request.getNumOutValues(),
                                          request.getMaxResultSets(),
                                          request.getTransactionAttrs(),
                                          request.getSqlAccessMode(),
                                          request.getLanguage(),
                                          request.getParamStyle(),
                                          request.isIsolate(),
                                          request.isCallOnNull(),
                                          request.isExtraCall(),
                                          request.isDeterministic(),
                                          request.getExternalSecurity(),
                                          request.getRoutineOwnerId(),
                                          request.getInBufferSize(),
                                          request.getOutBufferSize(),
                                          request.getInputRowSize(),
                                          request.getOutputRowSize(),
                                          /* ComDiagsArea */ d,
                                          (char *)request.getParentQid());
      if (sp == NULL)
        {  // memory problem
          UdrGlob->getSPList()->releaseOldestSPJ(/* ComDiagsArea */ d);
          numRetries++;
        }
    }

  if (sp == NULL)
    {
      return NULL;
    }
  
  newDiags = d.getNumber();
  
  if (oldDiags != newDiags)
  {
    // diagnostics generated in ctor for SPInfo
    // something bad has happened. Bail out.
    delete sp;
    return NULL;
  }
  
  // Process IN/INOUT parameters
  ComUInt32 i;
  for (i = 0; i < sp->getNumInParameters(); i++)
  {
    UdrParameterInfo &pi = (UdrParameterInfo &)request.getInParam(i);

    // Copy information from the UdrParameterInfo into the spinfo. The
    // spinfo will initialize an LmParameter instance for this
    // parameter.
    sp->setInParam(i, pi);
  }
  
  // Process OUT/INOUT parameters
  for (ComUInt32 j = 0; j < sp->getNumOutParameters(); j++)
  {
    UdrParameterInfo &po = (UdrParameterInfo &)request.getOutParam(j);

    // Copy information from the UdrParameterInfo into the spinfo. The
    // spinfo will initialize an LmParameter instance for this
    // parameter. Note for INOUT parameters, the LmParameter will not
    // be completely re-initialized. It was partially initialized in
    // the loop above for input parameters. This setOutParam call
    // completes the LmParameter initialization.
    sp->setOutParam(j, po);
  }

  // Process table input info if any
  if(sp->getParamStyle() == COM_STYLE_SQLROW_TM ||
     sp->getParamStyle() == COM_STYLE_CPP_OBJ ||
     sp->getParamStyle() == COM_STYLE_JAVA_OBJ)
  {
    sp->setNumTableInfo(request.getNumInputTables());
    sp->setTableInputInfo(request.getInputTables()); 
  }

  if (UdrGlob->verbose_ &&
      UdrGlob->traceLevel_ >= TRACE_DETAILS &&
      UdrGlob->showLoad_)
  {
    sp->displaySPInfo(2);
  }
  
  if (UdrGlob->verbose_ &&
      UdrGlob->traceLevel_ >= TRACE_DATA_AREAS &&
      UdrGlob->showLoad_)
  {
    ServerDebug("  LmParameter array:");
    for (ComUInt32 i = 0; i < sp->getNumParameters(); i++)
    {
      dumpLmParameter(sp->getLmParameter(i), i, "    ");
    }
  }

  if (UdrGlob->verbose_ &&
      UdrGlob->traceLevel_ >= TRACE_DATA_AREAS &&
      UdrGlob->showLoad_)
    ServerDebug("");
  
  return sp;
} // processLoadParameters
示例#15
0
NABoolean allocateReplyRow(UdrGlobals *UdrGlob,
  SqlBuffer &replyBuffer,       // [IN]  A reply buffer
  queue_index parentIndex,      // [IN]  Identifies the request queue entry
  Int32 replyRowLen,              // [IN]  Length of reply row
  char *&newReplyRow,           // [OUT] The allocated reply row
  ControlInfo *&newControlInfo, // [OUT] The allocated ControlInfo entry
  ex_queue::up_status upStatus  // [IN]  Q_OK_MMORE, Q_NO_DATA, Q_SQLERROR
  )
{
  const char *moduleName = "allocateReplyRow";

  doMessageBox(UdrGlob, TRACE_SHOW_DIALOGS, UdrGlob->showInvoke_, moduleName);

  NABoolean result = FALSE;
  SqlBufferBase::moveStatus status;
  up_state upState;
  upState.parentIndex = parentIndex;
  upState.downIndex = 0;
  upState.setMatchNo(0);

  upState.status = upStatus;

  tupp_descriptor *tdesc = NULL, **tuppDesc;
  ControlInfo **ctrlInfo;
  NABoolean moveCtrlInfo, moveDataInfo;

  switch (upStatus)
  {
    case ex_queue::Q_OK_MMORE :
    {
      ctrlInfo = &newControlInfo;
      moveCtrlInfo = TRUE;
      moveDataInfo = TRUE;
      tuppDesc = &tdesc;
      break;
    }

    case ex_queue::Q_SQLERROR :
    {
      ctrlInfo = &newControlInfo;
      moveCtrlInfo = TRUE;
      moveDataInfo = FALSE;
      tuppDesc = NULL;
      break;
    }

    case ex_queue::Q_NO_DATA :
    {
      ctrlInfo = NULL;
      moveCtrlInfo = TRUE;
      moveDataInfo = FALSE;
      tuppDesc = NULL;
      break;
    }

    default:
    {
      UDR_ASSERT(FALSE, "Unknown ex_queue::up_status value.");
      return FALSE;
    }
  }

  status = replyBuffer.moveInSendOrReplyData(
    FALSE,                           // [IN] sending? (vs. replying)
    moveCtrlInfo,                    // [IN] force move of ControlInfo?
    moveDataInfo,                    // [IN] move data?
    (void *) &upState,               // [IN] queue state
    sizeof(ControlInfo),             // [IN] length of ControlInfo
    ctrlInfo,                        // [OUT] new ControlInfo
    replyRowLen,                     // [IN] data row length
    tuppDesc,                        // [OUT] new data tupp_desc
    NULL,                            // [IN] diags area
    0                                // [OUT] new diags tupp_desc
    );

  if (status == SqlBufferBase::MOVE_SUCCESS)
  {
    if (upStatus == ex_queue::Q_OK_MMORE)
    {
       newReplyRow = tdesc->getTupleAddress();
       memset(newReplyRow, 0, replyRowLen);
    }
    result = TRUE;
  }
  else
  {
    result = FALSE;
  }
  return result;
}