in src/odbc/rsodbc/ModifyMsi/ModifyMsi.cpp [167:318]
BOOL SetBannerTextWidthAndHeight(MSIHANDLE hDatabase, char *table, char *dialog, char *width,char *height, char *control)
{
try
{
MSIHANDLE hView = NULL;
char szSelect[TEMP_BUF_SIZE];
MSIHANDLE hRec = NULL;
UINT rc;
snprintf(szSelect, TEMP_BUF_SIZE,"SELECT `Width`, `Height` FROM %s WHERE `Dialog_`='%s' and `Control` = '%s'",
table,dialog, control);
// Open and view table
if(!OpenTableAndViewWithCondition(hDatabase,szSelect,&hView,FALSE))
{
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
return TRUE;
}
rc = MsiViewFetch(hView,&hRec);
if(rc != ERROR_SUCCESS)
{
cout<<"Error in fetching record of the View"<<"\t"<<GetLastError()<<endl;
// Close record
if(hRec)
{
MsiCloseHandle(hRec);
hRec = NULL;
}
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
return FALSE;
}
// Change width
rc = MsiRecordSetString(hRec,1,width);
if (rc != ERROR_SUCCESS)
{
DisplayDatabaseError();
cout<<"Error in MsiRecordSetString[" << (2) <<"]:rc = "<<rc<<"\t"<<GetLastError()<<endl;
// Close record
if(hRec)
{
MsiCloseHandle(hRec);
hRec = NULL;
}
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
return FALSE;
}
// Change height
rc = MsiRecordSetString(hRec,2,height);
if (rc != ERROR_SUCCESS)
{
DisplayDatabaseError();
cout<<"Error in MsiRecordSetString[" << (2) <<"]:rc = "<<rc<<"\t"<<GetLastError()<<endl;
// Close record
if(hRec)
{
MsiCloseHandle(hRec);
hRec = NULL;
}
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
return FALSE;
}
rc = MsiViewModify(hView,MSIMODIFY_REPLACE,hRec);
if (rc != ERROR_SUCCESS)
{
DisplayDatabaseError();
cout<<"Error in MsiViewModify:rc = "<<rc<<"\t"<<GetLastError()<<endl;
// Close record
if(hRec)
{
MsiCloseHandle(hRec);
hRec = NULL;
}
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
return FALSE;
}
// Close record
if(hRec)
{
MsiCloseHandle(hRec);
hRec = NULL;
}
// Close view
if(hView)
{
MsiViewClose(hView);
MsiCloseHandle(hView);
hView = NULL;
}
}
catch(...)
{
return FALSE;
}
return TRUE;
}