2006-08-18 07:09:03 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2006 Mike McCormack
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "msi.h"
|
|
|
|
#include "msiquery.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "objidl.h"
|
|
|
|
#include "msipriv.h"
|
|
|
|
|
|
|
|
#include "query.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msidb);
|
|
|
|
|
|
|
|
typedef struct tagMSIALTERVIEW
|
|
|
|
{
|
|
|
|
MSIVIEW view;
|
|
|
|
MSIDATABASE *db;
|
2007-07-19 03:21:00 +02:00
|
|
|
MSIVIEW *table;
|
2007-07-20 23:01:13 +02:00
|
|
|
column_info *colinfo;
|
2007-07-19 03:21:00 +02:00
|
|
|
INT hold;
|
2006-08-18 07:09:03 +02:00
|
|
|
} MSIALTERVIEW;
|
|
|
|
|
|
|
|
static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val )
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %d %p\n", av, row, col, val );
|
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %d %p\n", av, row, col, stm );
|
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
2007-10-23 10:07:54 +02:00
|
|
|
UINT ref;
|
2006-08-18 07:09:03 +02:00
|
|
|
|
2007-07-19 03:21:00 +02:00
|
|
|
TRACE("%p %p\n", av, record);
|
|
|
|
|
2020-06-30 05:40:25 +02:00
|
|
|
if (av->colinfo)
|
2020-06-30 05:40:41 +02:00
|
|
|
return av->table->ops->add_column(av->table, av->colinfo->column,
|
2020-06-30 05:40:46 +02:00
|
|
|
av->colinfo->type, av->hold == 1);
|
2020-06-30 05:40:25 +02:00
|
|
|
|
2007-07-19 03:21:00 +02:00
|
|
|
if (av->hold == 1)
|
|
|
|
av->table->ops->add_ref(av->table);
|
|
|
|
else if (av->hold == -1)
|
2007-10-23 10:07:54 +02:00
|
|
|
{
|
|
|
|
ref = av->table->ops->release(av->table);
|
|
|
|
if (ref == 0)
|
|
|
|
av->table = NULL;
|
|
|
|
}
|
2007-07-21 03:41:16 +02:00
|
|
|
|
2006-08-18 07:09:03 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_close( struct tagMSIVIEW *view )
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p\n", av );
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols )
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %p %p\n", av, rows, cols );
|
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
2011-07-27 10:53:10 +02:00
|
|
|
static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
|
|
|
|
UINT *type, BOOL *temporary, LPCWSTR *table_name )
|
2006-08-18 07:09:03 +02:00
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
2009-10-18 18:41:41 +02:00
|
|
|
TRACE("%p %d %p %p %p %p\n", av, n, name, type, temporary, table_name );
|
2006-08-18 07:09:03 +02:00
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
|
2007-07-27 02:40:38 +02:00
|
|
|
MSIRECORD *rec, UINT row )
|
2006-08-18 07:09:03 +02:00
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %p\n", av, eModifyMode, rec );
|
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ALTER_delete( struct tagMSIVIEW *view )
|
|
|
|
{
|
|
|
|
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p\n", av );
|
2007-10-23 10:07:54 +02:00
|
|
|
if (av->table)
|
|
|
|
av->table->ops->delete( av->table );
|
2007-10-01 18:07:49 +02:00
|
|
|
msi_free( av );
|
2006-08-18 07:09:03 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const MSIVIEWOPS alter_ops =
|
|
|
|
{
|
|
|
|
ALTER_fetch_int,
|
|
|
|
ALTER_fetch_stream,
|
2006-10-26 10:08:43 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2007-06-18 22:49:31 +02:00
|
|
|
NULL,
|
2019-01-26 23:58:58 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2019-01-29 05:11:08 +01:00
|
|
|
NULL,
|
2006-08-18 07:09:03 +02:00
|
|
|
ALTER_execute,
|
|
|
|
ALTER_close,
|
|
|
|
ALTER_get_dimensions,
|
|
|
|
ALTER_get_column_info,
|
|
|
|
ALTER_modify,
|
|
|
|
ALTER_delete,
|
2007-07-19 03:21:00 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2007-07-20 23:01:13 +02:00
|
|
|
NULL,
|
2007-07-21 03:41:16 +02:00
|
|
|
NULL,
|
2007-12-18 02:35:31 +01:00
|
|
|
NULL,
|
2006-08-18 07:09:03 +02:00
|
|
|
};
|
|
|
|
|
2007-07-20 23:01:13 +02:00
|
|
|
UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold )
|
2006-08-18 07:09:03 +02:00
|
|
|
{
|
2006-10-31 06:33:20 +01:00
|
|
|
MSIALTERVIEW *av;
|
2007-07-19 03:21:00 +02:00
|
|
|
UINT r;
|
2006-08-18 07:09:03 +02:00
|
|
|
|
2007-07-21 03:41:16 +02:00
|
|
|
TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold );
|
2006-08-18 07:09:03 +02:00
|
|
|
|
|
|
|
av = msi_alloc_zero( sizeof *av );
|
|
|
|
if( !av )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2007-07-19 03:21:00 +02:00
|
|
|
r = TABLE_CreateView( db, name, &av->table );
|
2009-05-28 15:04:17 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
msi_free( av );
|
2007-07-19 03:21:00 +02:00
|
|
|
return r;
|
2009-05-28 15:04:17 +02:00
|
|
|
}
|
2007-07-19 03:21:00 +02:00
|
|
|
|
2007-07-20 23:01:13 +02:00
|
|
|
if (colinfo)
|
|
|
|
colinfo->table = name;
|
|
|
|
|
2006-08-18 07:09:03 +02:00
|
|
|
/* fill the structure */
|
|
|
|
av->view.ops = &alter_ops;
|
|
|
|
av->db = db;
|
2007-07-19 03:21:00 +02:00
|
|
|
av->hold = hold;
|
2007-07-20 23:01:13 +02:00
|
|
|
av->colinfo = colinfo;
|
2006-08-18 07:09:03 +02:00
|
|
|
|
|
|
|
*view = &av->view;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|