Exemplo n.º 1
0
MySQLPreparedStatement::~MySQLPreparedStatement()
{
    // delete all params
    clearParameters();
    mysql_stmt_close(stmt);
    delete[] bind;
}
Exemplo n.º 2
0
void
IB_Statement::describeInput (const IB_SSHORT16 suggestedInputCols)
{
  // If sqldaIn_ is already allocated, reuse it.
  // Otherwise, allocate space for a suggestedInputCols parameter list.
  // If more space is needed, allocate more later.
  if (!sqldaIn_)
    sqldaIn_ = (XSQLDA *) malloc (XSQLDA_LENGTH (suggestedInputCols));
  if (!sqldaIn_)
    throw new IB_SQLException (IB_SQLException::outOfMemory__,
			       IB_SQLException::outOfMemoryException__);
  sqldaIn_->sqln = suggestedInputCols;
  sqldaIn_->version = sqldaVersion__;
    
  dsqlDescribeBind ();

  IB_SSHORT16 actualInputCols = sqldaIn_->sqld;
  if (actualInputCols > sqldaIn_->sqln) {
    sqldaIn_ = (XSQLDA *) realloc (sqldaIn_, 
				   XSQLDA_LENGTH (actualInputCols));
    sqldaIn_->version = sqldaVersion__;
    sqldaIn_->sqln = actualInputCols;
    dsqlDescribeBind ();
  }

  // Its harmless to delete a NULL pointer.
  // !!! future enhancement - make this a realloc
  delete inputBuffer_;
  inputBuffer_ = new IB_InputBuffer (this);
  
  // !!! do we really need to call clearParameters() here?
  clearParameters ();
}
Exemplo n.º 3
0
void TFunction::swapParameters(const TFunction &parametersSource)
{
    clearParameters();
    for (auto parameter : parametersSource.parameters)
    {
        addParameter(parameter);
    }
}
Exemplo n.º 4
0
 void Statement::finilize() {
     if (!_stmt) {
         return;
     }
     
     sqlite3_finalize(_stmt);
     _stmt = nullptr;
     if (!_db.expired()) {
         _db.lock()->unregisterStatement(this);
     }
     
     clearColumnInfo();
     clearParameters();
 }
Exemplo n.º 5
0
bool CEvaluationNodeCall::compile(const CEvaluationTree * pTree)
{
  bool success = true;
  clearParameters(mpCallParameters, mCallNodes);

  switch (mType & 0x00FFFFFF)
    {
      case FUNCTION:
        mpFunction =
          dynamic_cast<CFunction *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));

        if (!mpFunction) return false;

        // We need to check whether the provided arguments match the on needed by the
        // function;
        if (!verifyParameters(mCallNodes, mpFunction->getVariables())) return false;

        mpCallParameters = buildParameters(mCallNodes);
        break;

      case EXPRESSION:
        mpExpression =
          dynamic_cast<CExpression *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));

        if (!mpExpression)
          {
            // We may have a function with no arguments the parser is not able to distinguish
            // between that and an expression.
            mpFunction =
              dynamic_cast<CFunction *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));

            if (!mpFunction) return false;

            mType = (CEvaluationNode::Type)(CEvaluationNode::CALL | FUNCTION);
            success = compile(pTree);
          }
        else
          {
            success = mpExpression->compile(static_cast<const CExpression *>(pTree)->getListOfContainer());
          }

        break;

      default:
        success = false;
        break;
    }

  return success;
}
MultiAgentEnvironment::~MultiAgentEnvironment()
{
    saveParameters();

    if (m_Layout)
    {
        clearParameters();

        delete m_LayoutStatistics;
        delete m_GroupBoxGeneralParameters;

        m_PcMAE.free();
        delete m_GroupBoxSpecificParameters;
        delete m_GroupBoxDisturbanceParameters;

        delete m_Layout;
    }
}
Exemplo n.º 7
0
 void Statement::initParameters() {
     if (!_stmt) {
         return;
     }
     
     clearParameters();
     
     _parametersCount = sqlite3_bind_parameter_count(_stmt);
     if (_parametersCount <= 0) {
         return;
     }
     
     for (int i = 1; i <= _parametersCount; ++i) {
         const char *name = sqlite3_bind_parameter_name(_stmt, i);
         if (name && name[0]) {
             _nameParameters[name] = i;
         }
     }
 }
Exemplo n.º 8
0
void processParameters(char *parameterString)
{
	clearParameters();

	if (NULL != parameterString && strlen(parameterString))
	{
		uint8_t i = 0;
		const char delimiter[] = " ";
		char *token;

		// break up remaining strings into parameters
		token = strtok(parameterString, delimiter);

		while (NULL != token)
		{
			// copy parameters into the global parameter variables
			strcpy(gParameters[i++], token);
			token = strtok(NULL, delimiter);
		}
	}
}
Exemplo n.º 9
0
 Result Statement::prepare() {
     if (_stmt) {
         return Result::success();
     }
     
     clearParameters();
     
     if (_db.expired()) {
         return Result::error();
     }
     
     auto ptr = _db.lock();
     sqlite3 *db = ptr->db();
     Result ret(sqlite3_prepare_v2(db, _command.c_str(), static_cast<int>(_command.size() + 1), &_stmt, nullptr), _db);
     if (ret) {
         ptr->registerStatement(this);
         initParameters();
     }
     
     return ret;
 }
Exemplo n.º 10
0
void
CEvaluationNodeCall::clearParameters(CCallParameters< C_FLOAT64 > * pCallParameters,
                                     const std::vector<CEvaluationNode *> & vector)
{
  if (!pCallParameters) return;

  std::vector<CEvaluationNode *>::const_iterator it = vector.begin();
  std::vector<CEvaluationNode *>::const_iterator end = vector.end();

  size_t i;

  for (i = 0; it != end; ++it, i++)
    {
      if ((*it)->mainType() == CEvaluationNode::T_VECTOR)
        clearParameters((*pCallParameters)[i].vector,
                        static_cast<const CEvaluationNodeVector *>(*it)->getNodes());
    }

  delete pCallParameters;
  return;
}
Exemplo n.º 11
0
//
// Functions have buried pointers to delete.
//
TFunction::~TFunction()
{
    clearParameters();
}
Exemplo n.º 12
0
 ClientStub::~ClientStub()
 {
     disconnect();
     clearParameters();        
 }
Exemplo n.º 13
0
OptimizableGraph::~OptimizableGraph()
{
    clear();
    clearParameters();
}
Exemplo n.º 14
0
bool CEvaluationNodeCall::compile(const CEvaluationTree * pTree)
{
  bool success = true;
  clearParameters(mpCallParameters, mCallNodes);

  CObjectInterface * pObjectInterface = NULL;

  if (mRegisteredFunctionCN != "")
    {
      pObjectInterface = const_cast< CObjectInterface * >(CCopasiRootContainer::getRoot()->getObject(mRegisteredFunctionCN));
    }

  switch (mSubType)
    {
      case S_FUNCTION:

        if (pObjectInterface != NULL)
          {
            mpFunction = dynamic_cast< CFunction * >(pObjectInterface);
          }
        else
          {
            mpFunction =
              dynamic_cast<CFunction *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));
          }

        if (!mpFunction) return false;

        mRegisteredFunctionCN = mpFunction->getCN();

        // We need to check whether the provided arguments match the on needed by the
        // function;
        if (!verifyParameters(mCallNodes, mpFunction->getVariables())) return false;

        mpCallParameters = buildParameters(mCallNodes);
        break;

      case S_EXPRESSION:

        if (pObjectInterface != NULL)
          {
            mpExpression = dynamic_cast<CExpression *>(pObjectInterface);
          }
        else
          {
            mpExpression =
              dynamic_cast<CExpression *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));
          }

        if (!mpExpression)
          {
            // We may have a function with no arguments the parser is not able to distinguish
            // between that and an expression.
            if (pObjectInterface != NULL)
              {
                mpFunction = dynamic_cast< CFunction * >(pObjectInterface);
              }
            else
              {
                mpFunction =
                  dynamic_cast<CFunction *>(CCopasiRootContainer::getFunctionList()->findFunction(mData));
              }

            if (!mpFunction) return false;

            mRegisteredFunctionCN = mpFunction->getCN();

            mMainType = T_CALL;
            mSubType = S_FUNCTION;

            success = compile(pTree);
          }
        else
          {
            mRegisteredFunctionCN = mpExpression->getCN();

            success = mpExpression->compile(static_cast<const CExpression *>(pTree)->getListOfContainer());
          }

        break;

      default:
        success = false;
        break;
    }

  return success;
}