Exemple #1
0
void pgOperator::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Owner"), GetOwner());
		properties->AppendItem(_("Kind"), GetKind());
		if (!leftType.IsNull())
			properties->AppendItem(_("Left type"), GetLeftType());
		if (!rightType.IsNull())
			properties->AppendItem(_("Right type"), GetRightType());
		properties->AppendItem(_("Result type"), GetResultType());
		properties->AppendItem(_("Operator function"), GetOperatorFunction());
		properties->AppendItem(_("Commutator"), GetCommutator());
		properties->AppendItem(_("Negator"), GetNegator());
		properties->AppendItem(_("Join function"), GetJoinFunction());
		properties->AppendItem(_("Restrict function"), GetRestrictFunction());

		if (!GetDatabase()->BackendMinimumVersion(8, 3))
		{
			properties->AppendItem(_("Left Sort operator"), GetLeftSortOperator());
			properties->AppendItem(_("Right Sort operator"), GetRightSortOperator());
			properties->AppendItem(_("Less Than operator"), GetLessOperator());
			properties->AppendItem(_("Greater than operator"), GetGreaterOperator());
		}

		properties->AppendYesNoItem(_("Supports hash?"), GetHashJoins());
		properties->AppendYesNoItem(_("Supports merge?"), GetMergeJoins());
		properties->AppendYesNoItem(_("System operator?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Exemple #2
0
FeatureID const & Result::GetFeatureID() const
{
#if defined(DEBUG)
  auto const type = GetResultType();
  ASSERT(type == RESULT_FEATURE, (type));
#endif
  return m_id;
}
Exemple #3
0
bool SymProc::ValidateParams(SymProc* src)
{
    if (GetResultType() != src->GetResultType()) return false;
    if (params.size() != src->params.size()) return false;
    for (int i = 0; i < params.size(); ++i)
        if (params[i]->GetVarType() != src->params[i]->GetVarType()
            || strcmp(params[i]->GetName(), src->params[i]->GetName())) return false;
    return true;
}
Exemple #4
0
void SymProc::GenerateDeclaration(AsmCode& asm_code)
{
    if (IsDummyProc()) return;
    asm_code.AddLabel(label);
    asm_code.AddCmd(ASM_PUSH, REG_EBP);
    asm_code.AddCmd(ASM_MOV, REG_ESP, REG_EBP);
    if (sym_table->GetLocalsSize()) asm_code.AddCmd(ASM_SUB, sym_table->GetLocalsSize(), REG_ESP);
    body->Generate(asm_code);
    asm_code.AddLabel(exit_label);
    asm_code.AddCmd(ASM_MOV, REG_EBP, REG_ESP);
    asm_code.AddCmd(ASM_POP, REG_EBP);
    asm_code.AddCmd(ASM_RET, sym_table->GetParamsSize() - GetResultType()->GetSize());
}
Exemple #5
0
std::vector<fuzzy_obj> LuaWrap::GenerateListFromLuaTable()
{
    /*If I read the documentation correctly, lua_next empties the table and I end up cleaning the pushed key-value
    pairs, so I will flag this method as a single use method that calls clean stack and resets the state of result!
    Make sure you limit your script-engine communication such that this method is called once or the spawning
    script function is called multiple times!
    */
    std::vector<fuzzy_obj> tmp;
    lua_gettable(Lua, LUA_TOPITEM);//index of table
    size_t t = lua_tointeger(Lua, 2);
    if(lua_isnil(Lua, LUA_TOPITEM))//check the table is valid
        return tmp;

    lua_pushnil(Lua);//Push top key? http://pgl.yoyo.org/luai/i/lua_next //http://eliasdaler.wordpress.com/2013/10/20/lua_and_cpp_pt2/
    while(lua_next(Lua, t))//Obtain key-value pairs
    {
        fuzzy_obj obj;
        obj.flag = GetResultType(Lua);
        switch(obj.flag)
        {
        case 'i':
            obj.number = lua_extractInt(Lua);
            break;
        case 'd':
            obj.decimal = lua_extractDouble(Lua);
            break;
        case 'b':
            obj.answer = lua_extractBool(Lua);
            break;
        case 'c':
            obj.c = lua_extractChar(Lua);
            break;
        case 's':
            obj.str = lua_extractStr(Lua);
            break;
        case 'v':
            obj.ptr = lua_extractPtr(Lua);
            break;
        default:
            std::cout << "Error: Argument from array returned by script function is not a valid type! "
            << "Wow, the cake is a lie!" << std::endl;
        }
        tmp.push_back(obj);
    }

    //Let's clean the stack from the new items
    ClearResult();
    hasResult = false;//Flag the result as destroyed
    //Return copy of the vector!
    return tmp;
}
Exemple #6
0
unsigned
XPath_Expression::GetPredicateExpressionFlags ()
{
  unsigned flags = GetExpressionFlags ();

  switch (GetResultType ())
    {
    case XP_VALUE_NUMBER:
    case XP_VALUE_INVALID:
      flags |= XPath_Expression::FLAG_CONTEXT_POSITION;
    }

  return flags;
}
Exemple #7
0
XPath_Value *
XPath_Expression::EvaluateL (XPath_Context *context, BOOL initial, const XPath_ValueType *types, XPath_ValueType known_resulttype)
{
  unsigned resulttype = known_resulttype == XP_VALUE_INVALID ? GetResultType () : static_cast<unsigned> (known_resulttype);
  XPath_Value *value;

  if (resulttype == XP_VALUE_INVALID)
    {
      value = EvaluateToValueL (context, initial);
      resulttype = value->type;
    }
  else
    value = 0;

  WhenType when;

  switch (resulttype)
    {
    case XP_VALUE_NUMBER: when = WHEN_NUMBER; break;
    case XP_VALUE_BOOLEAN: when = WHEN_BOOLEAN; break;
    case XP_VALUE_STRING: when = WHEN_STRING; break;
    default: when = WHEN_NODESET;
    }

  unsigned targettype = types ? static_cast<unsigned> (types[when]) : resulttype;

  if (resulttype == targettype)
    return value ? value : EvaluateToValueL (context, initial);
  else if (targettype == XP_VALUE_NUMBER || targettype == XP_VALUE_BOOLEAN || targettype == XP_VALUE_STRING)
    {
      if (!value)
        value = EvaluateToValueL (context, initial);

      XP_ANCHOR_VALUE (context, value);

      if (targettype == XP_VALUE_NUMBER)
        return value->ConvertToNumberL (context);
      else if (targettype == XP_VALUE_BOOLEAN)
        return value->ConvertToBooleanL (context);
      else
        return value->ConvertToStringL (context);
    }
  else
    {
      XPATH_EVALUATION_ERROR ("expected node-set", this);
      return 0;
    }
}
Exemple #8
0
int Pywrap::GenerateListFromPyTuple(PyObject* obj, std::vector<fuzzy_obj>& response)
{
    /*Works like the method in the Lua API, but does not imply the destruction of the result data.
    It's one of the differences between the underlying APIs of Python and Lua!
    */
    size_t s = GetSizeOfResult(obj);
    int status = 0;
    std::vector<fuzzy_obj> tmp;
    for(size_t i = 0; i < s; i++)
    {
        fuzzy_obj n;
        n.flag = GetResultType(GetItemFromResultList(obj, i));
        switch(n.flag)
        {
        case 'i':
            n.number = py_extractIntFromList(obj, i);
            break;
        case 'd':
            n.decimal = py_extractDoubleFromList(obj, i);
            break;
        case 'b':
            n.answer = py_extractBoolFromList(obj, i);
            break;
        case 'c':
            n.c = py_extractCharFromList(obj, i);
            break;
        case 's':
            n.str = py_extractStrFromList(obj, i);
            break;
        case 'v':
            n.ptr = py_extractPtrFromList(obj, i);
            break;
        default:
            std::cout << "Error: Argument from array returned by script function is not a valid type! "
            << "Wow, the cake is a lie!" << std::endl;
            status = 1;
        }
        tmp.push_back(n);
    }
    response = tmp;
    return status;
}
Exemple #9
0
bool Result::HasPoint() const
{
  return (GetResultType() != RESULT_SUGGEST_PURE);
}