2003-08-13 03:27:48 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
2004-06-30 20:18:27 +02:00
|
|
|
* Copyright 2002-2004 Mike McCormack for CodeWeavers
|
2003-08-13 03:27:48 +02:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-08-13 03:27:48 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
#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 "winnls.h"
|
|
|
|
|
|
|
|
#include "query.h"
|
|
|
|
|
2005-11-02 15:24:21 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msidb);
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* below is the query interface to a table */
|
|
|
|
|
|
|
|
typedef struct tagMSISELECTVIEW
|
|
|
|
{
|
|
|
|
MSIVIEW view;
|
|
|
|
MSIDATABASE *db;
|
|
|
|
MSIVIEW *table;
|
|
|
|
UINT num_cols;
|
|
|
|
UINT max_cols;
|
|
|
|
UINT cols[1];
|
|
|
|
} MSISELECTVIEW;
|
|
|
|
|
|
|
|
static UINT SELECT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val )
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %d %p\n", sv, row, col, val );
|
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !col || col > sv->num_cols )
|
2003-08-13 03:27:48 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
col = sv->cols[ col - 1 ];
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !col )
|
|
|
|
{
|
|
|
|
*val = 0;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2003-08-13 03:27:48 +02:00
|
|
|
return sv->table->ops->fetch_int( sv->table, row, col, val );
|
|
|
|
}
|
|
|
|
|
2004-07-06 20:56:12 +02:00
|
|
|
static UINT SELECT_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %d %p\n", sv, row, col, stm );
|
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !col || col > sv->num_cols )
|
2004-07-06 20:56:12 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
col = sv->cols[ col - 1 ];
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !col )
|
|
|
|
{
|
|
|
|
*stm = NULL;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 20:56:12 +02:00
|
|
|
return sv->table->ops->fetch_stream( sv->table, row, col, stm );
|
|
|
|
}
|
|
|
|
|
2007-07-27 02:40:38 +02:00
|
|
|
static UINT SELECT_get_row( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec )
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW *)view;
|
|
|
|
|
|
|
|
TRACE("%p %d %p\n", sv, row, rec );
|
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
return msi_view_get_row(sv->db, view, row, rec);
|
|
|
|
}
|
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
static UINT SELECT_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask )
|
2004-06-30 20:18:27 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
2006-10-26 10:09:47 +02:00
|
|
|
UINT i, expanded_mask = 0, r = ERROR_SUCCESS, col_count = 0;
|
|
|
|
MSIRECORD *expanded;
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
TRACE("%p %d %p %08x\n", sv, row, rec, mask );
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
if ( !sv->table )
|
2004-06-30 20:18:27 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
/* test if any of the mask bits are invalid */
|
|
|
|
if ( mask >= (1<<sv->num_cols) )
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
/* find the number of columns in the table below */
|
|
|
|
r = sv->table->ops->get_dimensions( sv->table, NULL, &col_count );
|
|
|
|
if( r )
|
|
|
|
return r;
|
|
|
|
|
|
|
|
/* expand the record to the right size for the underlying table */
|
|
|
|
expanded = MSI_CreateRecord( col_count );
|
|
|
|
if ( !expanded )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-10-26 10:09:47 +02:00
|
|
|
/* move the right fields across */
|
|
|
|
for ( i=0; i<sv->num_cols; i++ )
|
|
|
|
{
|
|
|
|
r = MSI_RecordCopyField( rec, i+1, expanded, sv->cols[ i ] );
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
break;
|
|
|
|
expanded_mask |= (1<<(sv->cols[i]-1));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the row in the underlying table */
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
r = sv->table->ops->set_row( sv->table, row, expanded, expanded_mask );
|
|
|
|
|
|
|
|
msiobj_release( &expanded->hdr );
|
|
|
|
return r;
|
2004-06-30 20:18:27 +02:00
|
|
|
}
|
|
|
|
|
2009-03-02 06:41:22 +01:00
|
|
|
static UINT SELECT_insert_row( struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary )
|
2004-06-30 20:18:27 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
2006-08-31 10:05:45 +02:00
|
|
|
UINT i, table_cols, r;
|
|
|
|
MSIRECORD *outrec;
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2005-08-24 13:10:23 +02:00
|
|
|
TRACE("%p %p\n", sv, record );
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-08-31 10:05:45 +02:00
|
|
|
if ( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
/* rearrange the record to suit the table */
|
|
|
|
r = sv->table->ops->get_dimensions( sv->table, NULL, &table_cols );
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
outrec = MSI_CreateRecord( table_cols + 1 );
|
|
|
|
|
|
|
|
for (i=0; i<sv->num_cols; i++)
|
|
|
|
{
|
|
|
|
r = MSI_RecordCopyField( record, i+1, outrec, sv->cols[i] );
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2009-03-02 06:41:22 +01:00
|
|
|
r = sv->table->ops->insert_row( sv->table, outrec, row, temporary );
|
2006-08-31 10:05:45 +02:00
|
|
|
|
|
|
|
fail:
|
|
|
|
msiobj_release( &outrec->hdr );
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2006-08-31 10:05:45 +02:00
|
|
|
return r;
|
2004-06-30 20:18:27 +02:00
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT SELECT_execute( struct tagMSIVIEW *view, MSIRECORD *record )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
TRACE("%p %p\n", sv, record);
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
return sv->table->ops->execute( sv->table, record );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT SELECT_close( struct tagMSIVIEW *view )
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p\n", sv );
|
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
return sv->table->ops->close( sv->table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT SELECT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols )
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p %p %p\n", sv, rows, cols );
|
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
if( cols )
|
|
|
|
*cols = sv->num_cols;
|
|
|
|
|
|
|
|
return sv->table->ops->get_dimensions( sv->table, rows, NULL );
|
|
|
|
}
|
|
|
|
|
2011-07-27 10:53:10 +02:00
|
|
|
static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
|
|
|
|
UINT *type, BOOL *temporary, LPCWSTR *table_name )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
2009-10-18 18:41:41 +02:00
|
|
|
TRACE("%p %d %p %p %p %p\n", sv, n, name, type, temporary, table_name );
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !n || n > sv->num_cols )
|
2003-08-13 03:27:48 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
n = sv->cols[ n - 1 ];
|
2011-12-23 13:54:26 +01:00
|
|
|
if( !n )
|
|
|
|
{
|
|
|
|
if (name) *name = szEmpty;
|
|
|
|
if (type) *type = MSITYPE_UNKNOWN | MSITYPE_VALID;
|
|
|
|
if (temporary) *temporary = FALSE;
|
|
|
|
if (table_name) *table_name = szEmpty;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2009-03-02 06:41:39 +01:00
|
|
|
return sv->table->ops->get_column_info( sv->table, n, name,
|
2009-10-18 18:41:41 +02:00
|
|
|
type, temporary, table_name );
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2007-07-27 02:40:38 +02:00
|
|
|
static UINT msi_select_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row)
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
UINT r, i, num_columns, col, type, val;
|
|
|
|
LPCWSTR str;
|
|
|
|
MSIRECORD *mod;
|
|
|
|
|
|
|
|
r = SELECT_get_dimensions(view, NULL, &num_columns);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
|
2019-01-24 07:07:33 +01:00
|
|
|
r = sv->table->ops->get_row(sv->table, row, &mod);
|
2007-07-27 02:40:38 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
for (i = 0; i < num_columns; i++)
|
|
|
|
{
|
|
|
|
col = sv->cols[i];
|
|
|
|
|
2011-07-27 10:53:10 +02:00
|
|
|
r = SELECT_get_column_info(view, i + 1, NULL, &type, NULL, NULL);
|
2007-07-27 02:40:38 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Failed to get column information: %d\n", r);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MSITYPE_IS_BINARY(type))
|
|
|
|
{
|
|
|
|
ERR("Cannot modify binary data!\n");
|
|
|
|
r = ERROR_FUNCTION_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
else if (type & MSITYPE_STRING)
|
|
|
|
{
|
2012-10-29 12:14:19 +01:00
|
|
|
int len;
|
|
|
|
str = msi_record_get_string( rec, i + 1, &len );
|
|
|
|
r = msi_record_set_string( mod, col, str, len );
|
2007-07-27 02:40:38 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = MSI_RecordGetInteger(rec, i + 1);
|
|
|
|
r = MSI_RecordSetInteger(mod, col, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Failed to modify record: %d\n", r);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
r = sv->table->ops->modify(sv->table, MSIMODIFY_UPDATE, mod, row);
|
|
|
|
|
|
|
|
done:
|
|
|
|
msiobj_release(&mod->hdr);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2005-02-08 14:44:25 +01:00
|
|
|
static UINT SELECT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
|
2007-07-27 02:40:38 +02:00
|
|
|
MSIRECORD *rec, UINT row )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
2007-07-27 02:40:38 +02:00
|
|
|
TRACE("%p %d %p %d\n", sv, eModifyMode, rec, row );
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
if( !sv->table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2007-07-27 02:40:38 +02:00
|
|
|
if (eModifyMode == MSIMODIFY_UPDATE)
|
|
|
|
return msi_select_update(view, rec, row);
|
|
|
|
|
|
|
|
return sv->table->ops->modify( sv->table, eModifyMode, rec, row );
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT SELECT_delete( struct tagMSIVIEW *view )
|
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
|
|
|
|
|
|
|
TRACE("%p\n", sv );
|
|
|
|
|
|
|
|
if( sv->table )
|
|
|
|
sv->table->ops->delete( sv->table );
|
2005-09-26 12:55:18 +02:00
|
|
|
sv->table = NULL;
|
2003-08-13 03:27:48 +02:00
|
|
|
|
2005-09-20 13:57:19 +02:00
|
|
|
msi_free( sv );
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-06-10 12:02:39 +02:00
|
|
|
static const MSIVIEWOPS select_ops =
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
SELECT_fetch_int,
|
2004-07-06 20:56:12 +02:00
|
|
|
SELECT_fetch_stream,
|
2007-07-27 02:40:38 +02:00
|
|
|
SELECT_get_row,
|
2006-10-26 10:09:47 +02:00
|
|
|
SELECT_set_row,
|
2004-06-30 20:18:27 +02:00
|
|
|
SELECT_insert_row,
|
2007-06-18 22:49:31 +02:00
|
|
|
NULL,
|
2003-08-13 03:27:48 +02:00
|
|
|
SELECT_execute,
|
|
|
|
SELECT_close,
|
|
|
|
SELECT_get_dimensions,
|
|
|
|
SELECT_get_column_info,
|
|
|
|
SELECT_modify,
|
2006-03-18 17:12:15 +01:00
|
|
|
SELECT_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,
|
2011-10-20 14:22:25 +02:00
|
|
|
NULL,
|
2003-08-13 03:27:48 +02:00
|
|
|
};
|
|
|
|
|
2009-11-10 02:41:43 +01:00
|
|
|
static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name,
|
|
|
|
LPCWSTR table_name )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2011-12-23 13:54:26 +01:00
|
|
|
UINT r, n;
|
2003-08-13 03:27:48 +02:00
|
|
|
MSIVIEW *table;
|
|
|
|
|
2009-11-10 02:41:43 +01:00
|
|
|
TRACE("%p adding %s.%s\n", sv, debugstr_w( table_name ),
|
|
|
|
debugstr_w( name ));
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
if( sv->view.ops != &select_ops )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
table = sv->table;
|
|
|
|
if( !table )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
if( !table->ops->get_dimensions )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
if( !table->ops->get_column_info )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
if( sv->num_cols >= sv->max_cols )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2011-12-23 13:54:26 +01:00
|
|
|
if ( !name[0] ) n = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r = VIEW_find_column( table, name, table_name, &n );
|
|
|
|
if( r != ERROR_SUCCESS )
|
|
|
|
return r;
|
|
|
|
}
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
sv->cols[sv->num_cols] = n;
|
|
|
|
TRACE("Translating column %s from %d -> %d\n",
|
|
|
|
debugstr_w( name ), sv->num_cols, n);
|
|
|
|
|
|
|
|
sv->num_cols++;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2007-06-12 22:51:36 +02:00
|
|
|
static int select_count_columns( const column_info *col )
|
2006-01-10 12:10:19 +01:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
for (n = 0; col; col = col->next)
|
|
|
|
n++;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2004-06-30 20:18:27 +02:00
|
|
|
UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
|
2007-06-12 22:51:36 +02:00
|
|
|
const column_info *columns )
|
2004-06-30 20:18:27 +02:00
|
|
|
{
|
|
|
|
MSISELECTVIEW *sv = NULL;
|
2006-01-10 12:10:19 +01:00
|
|
|
UINT count = 0, r = ERROR_SUCCESS;
|
2004-06-30 20:18:27 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", sv );
|
|
|
|
|
2006-01-10 12:10:19 +01:00
|
|
|
count = select_count_columns( columns );
|
2004-06-30 20:18:27 +02:00
|
|
|
|
2012-11-12 10:28:39 +01:00
|
|
|
sv = msi_alloc_zero( FIELD_OFFSET( MSISELECTVIEW, cols[count] ));
|
2004-06-30 20:18:27 +02:00
|
|
|
if( !sv )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
/* fill the structure */
|
|
|
|
sv->view.ops = &select_ops;
|
|
|
|
sv->db = db;
|
|
|
|
sv->table = table;
|
|
|
|
sv->num_cols = 0;
|
|
|
|
sv->max_cols = count;
|
|
|
|
|
|
|
|
while( columns )
|
|
|
|
{
|
2009-11-10 02:41:43 +01:00
|
|
|
r = SELECT_AddColumn( sv, columns->column, columns->table );
|
2004-06-30 20:18:27 +02:00
|
|
|
if( r )
|
|
|
|
break;
|
|
|
|
columns = columns->next;
|
|
|
|
}
|
|
|
|
|
2005-09-26 12:55:18 +02:00
|
|
|
if( r == ERROR_SUCCESS )
|
|
|
|
*view = &sv->view;
|
|
|
|
else
|
|
|
|
msi_free( sv );
|
2004-06-30 20:18:27 +02:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|