예제 #1
0
BOOL CSortListCtrl::GetSubItemRect(int nItem, int nSubItem, int nArea, CRect &rect)
{

	ASSERT(nItem >= 0);
	ASSERT(nItem < GetItemCount());
	if ((nItem < 0) || nItem >= GetItemCount())
		return FALSE;
	ASSERT(nSubItem >= 0);
	ASSERT(nSubItem < GetColumns());
	if ((nSubItem < 0) || nSubItem >= GetColumns())
		return FALSE;
	
	BOOL bRC = CListCtrl::GetSubItemRect(nItem, nSubItem, nArea, rect);
	
	// if nSubItem == 0, the rect returned by CListCtrl::GetSubItemRect
	// is the entire row, so use left edge of second subitem
	
	if (nSubItem == 0)
	{
		if (GetColumns() > 1)
		{
			CRect rect1;
			bRC = GetSubItemRect(nItem, 1, LVIR_BOUNDS, rect1);
			rect.right = rect1.left;
		}
	}
	
	return bRC;

}
예제 #2
0
void CSortListCtrl::SetItemColor(int nItem, int nSubItem, COLORREF clrText, COLORREF clrBkgnd)
{
	ASSERT(nItem >= 0);
	ASSERT(nItem < GetItemCount());
	if ((nItem < 0) || nItem >= GetItemCount())
		return ;
	ASSERT(nSubItem >= 0);
	ASSERT(nSubItem < GetColumns());
	if ((nSubItem < 0) || nSubItem >= GetColumns())
		return ;
	
	
	if (nItem < 0)
		return ;
	
	
	ItemData *pid = (ItemData *) CListCtrl::GetItemData(nItem);
	if (pid)
	{
		(pid->crText)[nSubItem]		 = (clrText == -1) ? crWindowText : clrText;
		(pid->crBak)[nSubItem]		 = (clrBkgnd == -1) ? crWindow : clrBkgnd;
	}
	
	UpdateSubItem(nItem, nSubItem);

}
예제 #3
0
void CSortListCtrl::UpdateSubItem(int nItem, int nSubItem)
{
	ASSERT(nItem >= 0);
				ASSERT(nItem < GetItemCount());
				if ((nItem < 0) || nItem >= GetItemCount())
					return;
				ASSERT(nSubItem >= 0);
				ASSERT(nSubItem < GetColumns());
				if ((nSubItem < 0) || nSubItem >= GetColumns())
					return;
				
				CRect rect;
				if (nSubItem == -1)
				{
					GetItemRect(nItem, &rect, LVIR_BOUNDS);
				}
				else
				{
					GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);
				}
				
				InvalidateRect(&rect);
				UpdateWindow();
				
				
}
예제 #4
0
void CReportCtrl::Initialize(const CReportCtrl::ColInfo cols[], int nColCount, UINT nOpFlag)
{
	m_nOpFlag = nOpFlag;
	m_cols = cols;
	m_nColCount = nColCount;

	AllowEdit(nOpFlag != 0);
	SetGridStyle(FALSE,xtpReportGridSolid);
	GetPaintManager()->SetColumnStyle(xtpReportColumnResource);
	GetPaintManager()->m_strNoItems.Empty();

	for (int i=0; i<nColCount; ++i)
	{
		const ColInfo &c = cols[i];
		if (c.fmt != FmtIdOnly)
		{
			CXTPReportColumn *pCol = new CXTPReportColumn(GetColumns()->GetCount(),c.caption,c.width,
			!c.fixed,XTP_REPORT_NOICON,c.sortable);
			pCol->AllowRemove(FALSE);
			pCol->SetAllowDrag(FALSE);
			AddColumn(pCol);
		}
	}

	if (nOpFlag & OpModify)
		m_pSubmitOpCol = AddOpCol(IndexModify);
	if (nOpFlag & OpReset)
		m_pResetOpCol = AddOpCol(IndexReset);
	if (nOpFlag & OpDelete)
		m_pDeleteOpCol = AddOpCol(IndexDelete);
 

}
예제 #5
0
Matrix Matrix::operator*(Matrix oper)
{
	float *B = oper.GetMatrix();
	int RB = oper.GetRows();
	int CB = oper.GetColumns();
	Matrix C(oper.GetColumns(), GetColumns());
	int CSize = C.GetColumns()*C.GetRows();
	int Columns = C.GetColumns();
	float *Result = C.GetMatrix();

	Result[0] = A[0]*B[0] + A[1]*B[3] + A[2]*B[6]; 
	Result[1] = A[0]*B[1] + A[1]*B[4] + A[2]*B[7]; 
	Result[2] = A[0]*B[2] + A[1]*B[5] + A[2]*B[8]; 

	Result[3] = A[3]*B[0] + A[4]*B[3] + A[5]*B[6]; 
	Result[4] = A[3]*B[1] + A[4]*B[4] + A[5]*B[7]; 
	Result[5] = A[3]*B[2] + A[4]*B[5] + A[5]*B[8]; 

	Result[6] = A[6]*B[0] + A[7]*B[3] + A[8]*B[6]; 
	Result[7] = A[6]*B[1] + A[7]*B[4] + A[8]*B[7]; 
	Result[8] = A[6]*B[2] + A[7]*B[5] + A[8]*B[8]; 
	

	return C;
}
예제 #6
0
파일: Table.cpp 프로젝트: Zhalfyr/Box
void Table::AlignFields()
{
	RemoveSpaces();
	int l_Columns = GetColumns();
	Content l_Content = GetContent();
	Content l_ResultContent = l_Content;

	for (int l_Itr = 0; l_Itr < l_Columns; ++l_Itr)
	{
		int l_FieldSize = 0;
		for (Row l_Row : l_ResultContent)
			l_FieldSize = l_Row[l_Itr].size() > l_FieldSize ? l_Row[l_Itr].size() : l_FieldSize;

		l_FieldSize += 3;

		for (Row& l_Row : l_ResultContent)
		{
			int l_WhitespaceNumber = l_FieldSize - l_Row[l_Itr].size();
			for (int l_ThirdItr = 0; l_ThirdItr < l_WhitespaceNumber; ++l_ThirdItr)
			{
				if (!l_Itr && GetStructure(true) && !(l_ThirdItr < 2))
					l_Row[l_Itr] = " " + l_Row[l_Itr];
				else
					l_Row[l_Itr] += " ";
			}
		}
	}
	SetContent(l_ResultContent);
}
예제 #7
0
void CopyExecutor::InitParamColIds() {

  // If we're going to deserialize prepared statement, get the column ids for
  // the varbinary columns first
  auto catalog = catalog::Catalog::GetInstance();
  try {
    auto query_metric_table =
        catalog->GetTableWithName(CATALOG_DATABASE_NAME, QUERY_METRIC_NAME);
    auto schema = query_metric_table->GetSchema();
    auto &cols = schema->GetColumns();
    for (unsigned int i = 0; i < cols.size(); i++) {
      auto col_name = cols[i].column_name.c_str();
      if (std::strcmp(col_name, QUERY_PARAM_TYPE_COL_NAME) == 0) {
        param_type_col_id = i;
      } else if (std::strcmp(col_name, QUERY_PARAM_FORMAT_COL_NAME) == 0) {
        param_format_col_id = i;
      } else if (std::strcmp(col_name, QUERY_PARAM_VAL_COL_NAME) == 0) {
        param_val_col_id = i;
      } else if (std::strcmp(col_name, QUERY_NUM_PARAM_COL_NAME) == 0) {
        num_param_col_id = i;
      }
    }
  }
  catch (Exception &e) {
    e.PrintStackTrace();
  }
}
예제 #8
0
bool RegionOfRows::operator==(const RegionOfRows& Other) const
{
    if (!IsDefined()) return !Other.IsDefined();			// I'm not defined, we are equal if the other is not defined too

    // Both are defined

    const ClosedInterval<unsigned int>* OtherRows = Other.GetRows();
    if (*OtherRows != Rows) return false;	// Difference in rows => not equal

    // Same rows defined => check all columns

    const ClosedInterval<unsigned int>* OtherColumns = Other.GetColumns();
    const ClosedInterval<unsigned int>* MyColumns = GetColumns();

    unsigned int RowStart = Rows.GetStart();
    unsigned int RowEnd = Rows.GetEnd();
    for (unsigned int i=RowStart;i<=RowEnd;i++)
    {
        if (*OtherColumns++ != *MyColumns++) return false;
    }

    // Regions are equal

    return true;
}
예제 #9
0
파일: Sql.cpp 프로젝트: ultimatepp/mirror
ValueMap Sql::GetRowMap() const
{
	ValueMap m;
	int n = GetColumns();
	for(int i = 0; i < n; i++)
		m.Add(GetColumnInfo(i).name, (*this)[i]);
	return m;
}
예제 #10
0
파일: Sql.cpp 프로젝트: ultimatepp/mirror
Vector<Value> Sql::GetRow() const {
	Vector<Value> row;
	int n = GetColumns();
	row.SetCount(n);
	for(int i = 0; i < n; i++)
		row[i] = (*this)[i];
	return row;
}
예제 #11
0
int CXTPReportColumn::GetNormAlignment(int nAlignment) const
{
	if (!GetColumns()->GetReportHeader()->GetPaintManager()->m_bRevertAlignment)
		return nAlignment;

	return nAlignment & DT_RIGHT ? (nAlignment - DT_RIGHT) : (nAlignment + DT_RIGHT);

}
예제 #12
0
CXTPReportColumn* CReportCtrl::AddOpCol(int i)
{ 
	const ColInfo &c = s_EditCols[i];
	CXTPReportColumn *pCol = new CXTPReportColumn(GetColumns()->GetCount(),c.caption,c.width,FALSE,XTP_REPORT_NOICON,FALSE);
	pCol->AllowRemove(FALSE);
	pCol->SetAllowDrag(FALSE);
	AddColumn(pCol);
	return pCol;
}
예제 #13
0
// FIXME: Should remove when the simple_optimizer tears down
//  Initializes the update plan without adding any child nodes and
//  retrieves column ids for the child scan plan.
void UpdatePlan::BuildInitialUpdatePlan(
    const parser::UpdateStatement *parse_tree, std::vector<oid_t> &column_ids) {
  LOG_TRACE("Creating an Update Plan");
  auto t_ref = parse_tree->table;
  auto table_name = std::string(t_ref->GetTableName());
  auto database_name = t_ref->GetDatabaseName();
  LOG_TRACE("Update database %s table %s", database_name, table_name.c_str());
  target_table_ = catalog::Catalog::GetInstance()->GetTableWithName(
      database_name, table_name);
  PL_ASSERT(target_table_ != nullptr);

  for (auto update_clause : *parse_tree->updates) {
    updates_.push_back(update_clause->Copy());
  }
  TargetList tlist;
  DirectMapList dmlist;
  oid_t col_id;
  auto schema = target_table_->GetSchema();

  for (auto update : updates_) {
    // get oid_t of the column and push it to the vector;
    col_id = schema->GetColumnID(std::string(update->column));
    column_ids.push_back(col_id);
    auto *update_expr = update->value->Copy();
    expression::ExpressionUtil::TransformExpression(target_table_->GetSchema(),
                                                    update_expr);

    planner::DerivedAttribute attribute{update_expr};
    attribute.attribute_info.name = update->column;
    tlist.emplace_back(col_id, attribute);
  }

  auto &schema_columns = schema->GetColumns();
  for (uint i = 0; i < schema_columns.size(); i++) {
    bool is_in_target_list = false;
    for (auto col_id : column_ids) {
      if (schema_columns[i].column_name == schema_columns[col_id].column_name) {
        is_in_target_list = true;
        break;
      }
    }
    if (is_in_target_list == false)
      dmlist.emplace_back(i, std::pair<oid_t, oid_t>(0, i));
  }

  std::unique_ptr<const planner::ProjectInfo> project_info(
      new planner::ProjectInfo(std::move(tlist), std::move(dmlist)));
  project_info_ = std::move(project_info);

  if (parse_tree->where != nullptr)
    where_ = parse_tree->where->Copy();
  else
    where_ = nullptr;
  expression::ExpressionUtil::TransformExpression(target_table_->GetSchema(),
                                                  where_);
}
예제 #14
0
int CXTPReportColumn::GetFooterAlignment() const
{
	if (m_nFooterAlignment != -1)
		return m_nFooterAlignment;

	if (GetColumns()->GetReportHeader()->GetPaintManager()->m_bUseColumnTextAlignment)
		return GetAlignment();

	return GetNormAlignment(DT_LEFT);
}
/*
* Returns value of given attribute.
*/
int CGXDLMSProfileGeneric::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArgs& e)
{
    if (e.GetIndex() == 1)
    {
        int ret;
        CGXDLMSVariant tmp;
        if ((ret = GetLogicalName(this, tmp)) != 0)
        {
            return ret;
        }
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 2)
    {
        CGXByteBuffer tmp;
        tmp.Set(e.GetValue().byteArr, e.GetValue().size);
        int ret = GetProfileGenericData(e.GetSelector(), e.GetParameters(), tmp);
        e.SetValue(tmp);
        return ret;
    }
    if (e.GetIndex() == 3)
    {
        CGXByteBuffer data;
        int ret = GetColumns(data);
        e.SetValue(data);
        return ret;
    }
    if (e.GetIndex() == 4)
    {
        e.SetValue(GetCapturePeriod());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        e.SetValue(GetSortMethod());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    if (e.GetIndex() == 7)
    {
        e.SetValue(GetEntriesInUse());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 8)
    {
        e.SetValue(GetProfileEntries());
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
예제 #16
0
wxDataViewItem TreeModelFilter::FindString(const std::string& needle, int column)
{
	return FindRecursiveUsingRows(getRootNode(), [&] (Row& row)->bool
	{
        if (!ItemIsVisible(row))
		{
			return false; // skip filtered items
		}

		return static_cast<std::string>(row[GetColumns()[column]]) == needle;
	});
}
예제 #17
0
wxDataViewItem TreeModelFilter::FindInteger(long needle, int column)
{
	return FindRecursiveUsingRows(getRootNode(), [&] (Row& row)->bool
	{
        if (!ItemIsVisible(row))
		{
			return false; // skip filtered items
		}

		return row[GetColumns()[column]].getInteger() == needle;
	});
}
예제 #18
0
//--------------------------------------------------------------------
// @mfunc Retrieve the data associated with a particular column. 
//
//
// @rdesc BOOL
//      @flag TRUE | Succeeded
//      @flag FALSE | Failed
//
BOOL CParseInitFile::ParseColumnInfo()
{
    HRESULT hr = S_OK;
	CHAR* pszStart = NULL;
	
	TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseColumnInfo.\n");

	// If Column data has not been retrieved,
    if(m_ColData.IsEmpty())
	{
		//Skip over any lines, until the [COLUMN] section is reached...
		if(FAILED(hr = FindSection("[COLUMN]")))
			return FALSE;

		//Get the NextLine {ColName(iOrdinal, TYPE, ulColumnSize, bPrecision, bScale, dwFlags)} 
		if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)
		{
			odtLog << "ERROR:  Unable to find Columns in INI <File:" << m_pszFileName << ">" << ENDL;
			odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;
			return FALSE;
		}

		//Now parse the Columns
		m_ColData.RemoveAll();
			    
		// Parse the records
		while(hr==S_OK)
		{	
			pszStart = strstr(m_pvInput, START_OF_TYPE);
			if(pszStart)
			{
				// if we have reached [DATA] part bail out
				pszStart++;
				if(strncmp(pszStart, szDATA, 6) ==0)
					return TRUE;
			
				// parse the column metadata info
				if(!GetColumns(pszStart))
					break;
			}
			
			//Retrieve the next row
			if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)
			{
				odtLog << "ERROR:  Unable to finding ColumnInfo for Column " << m_ColData.GetCount() << " in INI <File:" << m_pszFileName << ">" << ENDL;
				odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;
				return FALSE;
			}
		}
    }

	return FALSE;
}
예제 #19
0
TCHAR * OdbcRecordset::Read(bool bAllowEmptyTable /*= false*/)
{
	static TCHAR szError[128] = {0};

	// Build statement
	tstring szSQL = _T("SELECT ");
	tstring szWhereClause = GetWhereClause();

	szSQL += GetColumns();
	szSQL += _T(" FROM ");
	szSQL += GetTableName();

	// Do we have a where clause? Include it.
	if (!szWhereClause.empty())
	{
		szSQL += _T(" WHERE ");
		szSQL += szWhereClause;
	}

	// Attempt to execute the statement.
	if (!_dbCommand->Execute(szSQL))
		return _dbCommand->GetError();

	// Does the table have any rows?
	// Make sure we allow for tables that can be empty.
	if (!_dbCommand->hasData())
	{
		if (bAllowEmptyTable)
			return nullptr;

		_stprintf(szError, _T("%s la tabla esta vacia."), GetTableName().c_str());
		return szError;
	}

	do
	{
		// This extra result/check potentially slows things down. 
		// It's also not very informative, so this could really use a bit of a rewrite
		// to better allow for this scenario.
		if (!Fetch())
		{
			_stprintf(szError, _T("No se han podido selecionar columnas en la tabla %s."), GetTableName().c_str());
			return szError;
		}
	} while (_dbCommand->MoveNext());

	return nullptr;
}
예제 #20
0
void pgTrigger::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids && GetLanguage() != wxT("edbspl"))
	{
		ReadColumnDetails();

		if (browser)
		{
			// if no browser present, function will not be appended to tree
			expandedKids = true;
		}
		if (triggerFunction)
			delete triggerFunction;

		// append function here
		triggerFunction = functionFactory.AppendFunctions(this, GetSchema(), browser, wxT(
		                      "WHERE pr.oid=") + NumToStr(functionOid) + wxT("::oid\n"));
		if (triggerFunction)
		{
			iSetFunction(triggerFunction->GetQuotedFullIdentifier());
		}
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		if (GetConnection()->BackendMinimumVersion(8, 2))
			properties->AppendYesNoItem(_("Constraint?"), GetIsConstraint());
		properties->AppendItem(_("Fires"), GetFireWhen());
		properties->AppendItem(_("Event"), GetEvent());
		if (!GetQuotedColumns().IsEmpty())
		{
			properties->AppendItem(_("Columns"), GetColumns());
		}
		properties->AppendItem(_("For each"), GetForEach());
		if (GetLanguage() != wxT("edbspl"))
			properties->AppendItem(_("Function"), GetFunction() + wxT("(") + GetArguments() + wxT(")"));
		if (GetConnection()->BackendMinimumVersion(8, 5))
			properties->AppendItem(_("When?"), GetWhen());
		properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System trigger?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
예제 #21
0
unsigned int RegionOfRows::GetNumberOfColumnsOnLargestRow() const
{
    if (!IsDefined()) return 0;
    unsigned int MaximumNumberofColumns = 0;
    const ClosedInterval<unsigned int>* MyColumns = GetColumns();
    unsigned int NumberOfRows = Rows.GetSpan() + 1;

    for (unsigned int i=0; i < NumberOfRows;++i)
    {
        unsigned int ColumnsOnRow = MyColumns->GetSpan() + 1;
        if (ColumnsOnRow > MaximumNumberofColumns)  MaximumNumberofColumns = ColumnsOnRow;

        MyColumns++;
    }

    return MaximumNumberofColumns;
}
예제 #22
0
int CSortListCtrl::AddItemColor(LPCTSTR pszText, COLORREF crText, COLORREF crBak)
{
	//insert item at the last
	const int iIndex = InsertItem( GetItemCount(), pszText );
	ItemData *m_pSortItemData=new ItemData[GetColumns()];
/*
	m_pSortItemData[0].crText=crText;
	m_pSortItemData[0].crBak=crBak;
*/
	
	SetItemData(iIndex,(DWORD) m_pSortItemData);

	//no sort function
	
	return iIndex;


}
예제 #23
0
UCHAR ImageArray::GetUCharAtLCDMem(UINT x, UINT y)
{
    UCHAR val = 0;

    if (x < GetColumns() && y < GetRows()) {
        Points points;
        m_packer->GetPoints(points, x, y);
        Points::iterator point = points.begin();
        while (point != points.end()) {
            Color c;
            m_img->GetPixel((*point).GetX(), (*point).GetY(), &c);
            UCHAR gray = Gray(c.GetR(), c.GetG(), c.GetB());
            val |= (m_packer->Pack(gray, (*point).GetPackOffset(), m_invert));
            point++;
        }
    }
    return val;
}
예제 #24
0
	bool Statement::GetColumnIndex(const std::string &ColumnName, unsigned int &Out)
	{
		std::vector<std::string> Columns;
		if (!GetColumns(Columns))
			return false;

		for (unsigned int x = 0; x < Columns.size(); x++)
		{
			if (Columns[x] == ColumnName)
			{
				Out = x;
				return true;
			}
		}

		LogError("Could not find column with name \"" + ColumnName + "\".");
		return false;
	}
예제 #25
0
bool RegionOfRows::GetIntersection(const RegionOfRows& RegionOI,RegionOfRows& Intersection) const
{
    Intersection.Reset();

    // Regions are defined ?

    if (!IsDefined()) return false;
    if (!RegionOI.IsDefined()) return false;

    // Regions are defined, do the have common rows ?

    const ClosedInterval<unsigned int>* Region1Rows = GetRows();
    const ClosedInterval<unsigned int>* Region2Rows = RegionOI.GetRows();
    ClosedInterval<unsigned int> RowsOI;
    if (!Region1Rows->GetOverlap(*Region2Rows,RowsOI)) return false;		// no rows in common
    unsigned int RowStart = RowsOI.GetStart();
    unsigned int RowEnd = RowsOI.GetEnd();

    const ClosedInterval<unsigned int>* Columns1 = GetColumns();
    const ClosedInterval<unsigned int>* Columns2 = RegionOI.GetColumns();

    // Adjust offets

    Columns1 += RowStart - GetFirstRow();
    Columns2 += RowStart - RegionOI.GetFirstRow();

    for (unsigned int Row = RowStart;Row <= RowEnd;Row++)
    {
        ClosedInterval<unsigned int> ColumnsOI;
        if (Columns1->GetOverlap(*Columns2,ColumnsOI))
        {
            // Rows and columns in common => intersection

            Intersection.Add(Row,ColumnsOI.GetStart(),ColumnsOI.GetEnd());
        } else if (Intersection.IsDefined()) break;			// Convex region !

        Columns1++;
        Columns2++;
    }

    // Any intersection ?

    return Intersection.IsDefined();
}
예제 #26
0
 /*
 * Returns value of given attribute.
 */    
int CGXDLMSProfileGeneric::GetValue(int index, int selector, CGXDLMSVariant& parameters, CGXDLMSVariant& value)   
{
    if (index == 1)
    {
        GXHelpers::AddRange(value.byteArr, m_LN, 6);
		value.vt = DLMS_DATA_TYPE_OCTET_STRING;
		return ERROR_CODES_OK;
    }
    if (index == 2)
    {
		vector<unsigned char> vArr;
		int ret = GetProfileGenericData(selector, parameters, vArr);
		value = CGXDLMSVariant(vArr);
		return ret;
    }        
    if (index == 3)
    {
		vector<unsigned char> data;
		int ret = GetColumns(data);
		value = CGXDLMSVariant(data);
        return ret;
    }
    if (index == 4)
    {
        value = GetCapturePeriod();
		return ERROR_CODES_OK;
    }
    if (index == 5)
    {            
        value = GetSortMethod();
		return ERROR_CODES_OK;
    }
    if (index == 7)
    {
        value = GetEntriesInUse();
		return ERROR_CODES_OK;
    }
    if (index == 8)
    {
        value = GetProfileEntries();
		return ERROR_CODES_OK;
    }
    return ERROR_CODES_INVALID_PARAMETER;
}
예제 #27
0
bool FdoSmPhSqsIndex::Add()
{
    FdoSmPhDbObjectP dbObject = GetDbObject();

    FdoStringP sqlStmt = FdoStringP::Format(
        L"create %lsindex %ls on %ls ( %ls )",
        GetIsUnique() ? L"unique " : L"",
        (FdoString*) GetDbName(),
        (FdoString*) dbObject->GetDbQName(),
        (FdoString*) GetKeyColsSql(GetColumns())->ToString( L", " )
    );

    // SqlServer does not allow qualified name for index to create.
    // Therefore, must switch to the index's owning database before creating
    // it.
    ActivateOwnerAndExecute( sqlStmt );

    return true;
}
예제 #28
0
unsigned int RegionOfRows::GetMostRightColumn() const
{
    if (!IsDefined()) return 0;     // invalid returned result!

    // Start with the 1st row

    const ClosedInterval<unsigned int>* MyColumns = GetColumns();

    unsigned int NumberOfRows = Rows.GetSpan() + 1;
    unsigned int GetMostRightColumn = MyColumns->GetEnd();
    MyColumns++;

    for (unsigned int i=1; i < NumberOfRows;++i)
    {
        unsigned int Column = MyColumns->GetEnd();
        if (Column > GetMostRightColumn) GetMostRightColumn = Column;
        MyColumns++;
    }

    return GetMostRightColumn;
}
예제 #29
0
void CDataGridEx::OnSortDesc()
{
	CString strTemp;
	_RecordsetPtr IRecordset;
	LPUNKNOWN pUnknown;
	HRESULT hr;

	try
	{
		pUnknown=this->GetDataSource();

		hr=pUnknown->QueryInterface(__uuidof(_RecordsetPtr),(void**)&IRecordset);

		if(FAILED(hr))
		{
			pUnknown->Release();
			AfxMessageBox(_com_error(hr).ErrorMessage());
			return;
		}

		pUnknown->Release();

		strTemp=GetColumns().GetItem(_variant_t(m_SelectCol)).GetCaption();

		strTemp+=_T(" DESC");
		IRecordset->Sort=_bstr_t(strTemp);
	}
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
	}

	
	return;
}
예제 #30
0
wxString dlgIndexConstraint::GetDefinition()
{
	wxString sql = wxEmptyString;

	if (cbIndex->GetCurrentSelection() > 0)
	{
		sql += wxT(" USING INDEX ") + qtIdent(cbIndex->GetValue());
	}
	else
	{
		if (cbType->GetCurrentSelection() > 0)
			AppendIfFilled(sql, wxT(" USING "), cbType->GetValue());

		sql += wxT("(") + GetColumns() + wxT(")");

		if (txtFillFactor)
		{
			if (connection->BackendMinimumVersion(8, 2) && txtFillFactor->GetValue().Length() > 0)
				sql += wxT("\n  WITH (FILLFACTOR=") + txtFillFactor->GetValue() + wxT(")");
		}

		if (cbTablespace->GetOIDKey() > 0)
			sql += wxT(" USING INDEX TABLESPACE ") + qtIdent(cbTablespace->GetValue());

		if (chkDeferrable->GetValue())
		{
			sql += wxT(" DEFERRABLE");
			if (chkDeferred->GetValue())
				sql += wxT(" INITIALLY DEFERRED");
		}

		if (txtWhere->GetValue().Length() > 0)
			sql += wxT(" WHERE (") + txtWhere->GetValue() + wxT(")");
	}

	return sql;
}