Ejemplo n.º 1
0
void CxDlgTablePrimaryKey::OnOK() 
{
	CDialog::OnOK();
	ASSERT (m_pKeyParam);
	if (!m_pKeyParam)
		return;
	if (!m_bAlter)
	{
		m_strKeyName.TrimLeft();
		m_strKeyName.TrimRight();
		lstrcpy (m_pKeyParam->tchszPKeyName, m_strKeyName);
	}
	//
	// Get the list of column of primary key:
	if (!m_bAlter)
	{
		m_pKeyParam->pListKey = StringList_Done (m_pKeyParam->pListKey);
		CString strItem;
		int i, nCount = m_cListKey.GetCount();
		for (i=0; i<nCount; i++)
		{
			m_cListKey.GetText (i, strItem);
			m_pKeyParam->pListKey = StringList_Add (m_pKeyParam->pListKey, strItem);
		}
	}
	if (m_bAlter)
		m_pKeyParam->nMode = m_nDelMode;
}
Ejemplo n.º 2
0
BOOL VDBA20xGetDetailPKeyInfo (LPTABLEPARAMS lpTS, LPTSTR lpVnode)
{
    int ires, hdl;
    TCHAR tchszConnection [100];
    wsprintf (tchszConnection,"%s::%s", lpVnode, lpTS->DBName);
    ires = Getsession (tchszConnection, SESSION_TYPE_CACHENOREADLOCK, &hdl);
    if (ires != RES_SUCCESS)
    {
        ires = ReleaseSession(hdl, RELEASE_COMMIT);
        return FALSE;
    }
    lpTS->lpPrimaryColumns = StringList_Done (lpTS->lpPrimaryColumns);
    ires = VDBA2xGetTablePrimaryKeyInfo (lpTS);
    if (ires != RES_SUCCESS)
    {
        ires = ReleaseSession(hdl, RELEASE_COMMIT);
        return FALSE;
    }
    ires = ReleaseSession(hdl, RELEASE_COMMIT);
    return TRUE;
}
Ejemplo n.º 3
0
void CxDlgObjectComment::OnOK()
{
	CString csTempo,csNameCol,csSyntaxObject,csVNodeName,csSQLSyntax;
	LPCOMMENTCOLUMN lpCommentCol;
	LPSTRINGLIST lpStrList = NULL;
	BOOL bGenerate;
	int i,iret,nCount = m_cListCtrl.GetItemCount();
	csVNodeName = (LPTSTR)GetVirtNodeName(m_nNodeHandle);
	csSyntaxObject.Empty();

	m_cListCtrl.HideProperty(TRUE);

	m_cEditTableComment.GetWindowText(m_csCommentObject);

	if (!m_tcObjComment && !m_csCommentObject.IsEmpty()) // new comment on general object
		GenerateSyntaxComment4Object(csSyntaxObject);
	else if (m_tcObjComment && (x_strcmp(m_csCommentObject,m_tcObjComment)!=0) ) // comment exist 
		GenerateSyntaxComment4Object(csSyntaxObject);

	for (i=0; i<nCount; i++)
	{
		csSQLSyntax.Empty();
		bGenerate = FALSE;
		csNameCol = m_cListCtrl.GetItemText (i,0);
		csTempo   = m_cListCtrl.GetItemText (i,1);

		lpCommentCol = FindCurrentColumn(csNameCol);
		ASSERT(lpCommentCol != NULL);

		if (lpCommentCol->lpszComment)
		{
			if (x_strcmp(lpCommentCol->lpszComment,(LPTSTR)(LPCTSTR)csTempo)!=0)
				bGenerate = TRUE;
		}
		else
		{
			if (!csTempo.IsEmpty())
				bGenerate = TRUE;
		}
		if (bGenerate)
		{
			csSQLSyntax.Format("comment on column %s.%s.%s is '%s'",
			QuoteIfNeeded((LPTSTR)(LPCTSTR)m_csObjectOwner), 
			QuoteIfNeeded((LPTSTR)(LPCTSTR)m_csObjectName), 
			QuoteIfNeeded((LPTSTR)lpCommentCol->szColumnName), 
			(LPCTSTR)csTempo);
			lpStrList = StringList_Add  (lpStrList, (LPTSTR)(LPCTSTR)csSQLSyntax);
		}
	}

	// execute the SQL statements
	iret =  VDBA20xGenCommentObject ( (LPSTR)(LPCTSTR)csVNodeName,(LPSTR)(LPCTSTR)m_csDBName,
	                                  (LPSTR)(LPCTSTR)csSyntaxObject, lpStrList);

	if (lpStrList)
		lpStrList = StringList_Done (lpStrList);

	if (iret != RES_SUCCESS)
	{
		ErrorMessage ((UINT) IDS_E_COMMENT_ON_FAILED, RES_ERR);
		return;
	}

	CDialog::OnOK();
}