Commit d1b20585 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Make the column and table name parameters of get_column_info const.

parent d38ace6d
......@@ -185,9 +185,8 @@ static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *col
return ERROR_FUNCTION_FAILED;
}
static UINT ALTER_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIALTERVIEW *av = (MSIALTERVIEW*)view;
......
......@@ -91,9 +91,8 @@ static UINT CREATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
return ERROR_FUNCTION_FAILED;
}
static UINT CREATE_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT CREATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSICREATEVIEW *cv = (MSICREATEVIEW*)view;
......
......@@ -126,9 +126,8 @@ static UINT DELETE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
return dv->table->ops->get_dimensions( dv->table, NULL, cols );
}
static UINT DELETE_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT DELETE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view;
......
......@@ -204,9 +204,8 @@ static UINT DISTINCT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *
return dv->table->ops->get_dimensions( dv->table, NULL, cols );
}
static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view;
......
......@@ -109,23 +109,16 @@ err:
*/
static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count)
{
LPWSTR a, b = NULL;
LPCWSTR a, b;
UINT i;
int res;
for (i = 1; i <= col_count; i++)
{
iv->sv->ops->get_column_info(iv->sv, i, &a, NULL, NULL, NULL);
iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL, NULL);
res = strcmpW( a, b );
msi_free(a);
msi_free(b);
if (res != 0)
return FALSE;
if (strcmpW( a, b )) return FALSE;
}
return TRUE;
}
......@@ -137,8 +130,7 @@ static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values)
MSIRECORD *padded;
UINT col_count, val_count;
UINT r, i, colidx;
LPWSTR a, b = NULL;
int res;
LPCWSTR a, b;
r = iv->table->ops->get_dimensions(iv->table, NULL, &col_count);
if (r != ERROR_SUCCESS)
......@@ -169,22 +161,15 @@ static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values)
if (r != ERROR_SUCCESS)
goto err;
res = strcmpW( a, b );
msi_free(b);
if (res == 0)
if (!strcmpW( a, b ))
{
MSI_RecordCopyField(*values, colidx, padded, i);
break;
}
}
msi_free(a);
}
msiobj_release(&(*values)->hdr);
*values = padded;
return ERROR_SUCCESS;
err:
......@@ -293,9 +278,8 @@ static UINT INSERT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
return sv->ops->get_dimensions( sv, rows, cols );
}
static UINT INSERT_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT INSERT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view;
MSIVIEW *sv;
......
......@@ -194,9 +194,8 @@ static UINT JOIN_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols
return ERROR_SUCCESS;
}
static UINT JOIN_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name )
static UINT JOIN_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIJOINVIEW *jv = (MSIJOINVIEW*)view;
JOINTABLE *table;
......@@ -213,7 +212,6 @@ static UINT JOIN_get_column_info( struct tagMSIVIEW *view,
return table->view->ops->get_column_info(table->view, n - cols,
name, type, temporary,
table_name);
cols += table->columns;
}
......
......@@ -261,11 +261,10 @@ typedef struct tagMSIVIEWOPS
/*
* get_column_info - returns the name and type of a specific column
*
* The name and tablename is HeapAlloc'ed by this function and should be
* freed by the caller.
* The column information can be queried at any time.
*/
UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPWSTR *name, UINT *type, BOOL *temporary, LPWSTR *tableName);
UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type,
BOOL *temporary, LPCWSTR *table_name );
/*
* modify - not yet implemented properly
......@@ -1158,6 +1157,8 @@ static const WCHAR szInstallLevel[] = {'I','N','S','T','A','L','L','L','E','V','
static const WCHAR szCostInitialize[] = {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
static const WCHAR szAppDataFolder[] = {'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
static const WCHAR szRollbackDisabled[] = {'R','o','l','l','b','a','c','k','D','i','s','a','b','l','e','d',0};
static const WCHAR szName[] = {'N','a','m','e',0};
static const WCHAR szData[] = {'D','a','t','a',0};
/* memory allocation macro functions */
static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
......
......@@ -58,8 +58,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg )
UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, LPCWSTR table_name, UINT *n )
{
LPWSTR col_name;
LPWSTR haystack_table_name;
LPCWSTR col_name, haystack_table_name;
UINT i, count, r;
r = table->ops->get_dimensions( table, NULL, &count );
......@@ -70,7 +69,6 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, LPCWSTR table_name, UINT *n
{
INT x;
col_name = NULL;
r = table->ops->get_column_info( table, i, &col_name, NULL,
NULL, &haystack_table_name );
if( r != ERROR_SUCCESS )
......@@ -78,15 +76,12 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, LPCWSTR table_name, UINT *n
x = strcmpW( name, col_name );
if( table_name )
x |= strcmpW( table_name, haystack_table_name );
msi_free( col_name );
msi_free( haystack_table_name );
if( !x )
{
*n = i;
return ERROR_SUCCESS;
}
}
return ERROR_INVALID_PARAMETER;
}
......@@ -536,7 +531,7 @@ UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec )
UINT r = ERROR_FUNCTION_FAILED, i, count = 0, type;
MSIRECORD *rec;
MSIVIEW *view = query->view;
LPWSTR name;
LPCWSTR name;
BOOL temporary;
if( !view )
......@@ -558,17 +553,14 @@ UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec )
for( i=0; i<count; i++ )
{
name = NULL;
r = view->ops->get_column_info( view, i+1, &name, &type, &temporary,
NULL );
r = view->ops->get_column_info( view, i+1, &name, &type, &temporary, NULL );
if( r != ERROR_SUCCESS )
continue;
if (info == MSICOLINFO_NAMES)
MSI_RecordSetStringW( rec, i+1, name );
else
msi_set_record_type_string( rec, i+1, type, temporary );
msi_free( name );
}
*prec = rec;
return ERROR_SUCCESS;
}
......
......@@ -208,9 +208,8 @@ static UINT SELECT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
return sv->table->ops->get_dimensions( sv->table, rows, NULL );
}
static UINT SELECT_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
......@@ -232,7 +231,6 @@ static UINT msi_select_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row)
{
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
UINT r, i, num_columns, col, type, val;
LPWSTR name;
LPCWSTR str;
MSIRECORD *mod;
......@@ -248,8 +246,7 @@ static UINT msi_select_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row)
{
col = sv->cols[i];
r = SELECT_get_column_info(view, i + 1, &name, &type, NULL, NULL);
msi_free(name);
r = SELECT_get_column_info(view, i + 1, NULL, &type, NULL, NULL);
if (r != ERROR_SUCCESS)
{
ERR("Failed to get column information: %d\n", r);
......
......@@ -280,16 +280,9 @@ static UINT STORAGES_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *c
return ERROR_SUCCESS;
}
static UINT STORAGES_get_column_info(struct tagMSIVIEW *view, UINT n,
LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT STORAGES_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
LPCWSTR name_ptr = NULL;
static const WCHAR Name[] = {'N','a','m','e',0};
static const WCHAR Data[] = {'D','a','t','a',0};
static const WCHAR _Storages[] = {'_','S','t','o','r','a','g','e','s',0};
TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary,
table_name);
......@@ -299,35 +292,17 @@ static UINT STORAGES_get_column_info(struct tagMSIVIEW *view, UINT n,
switch (n)
{
case 1:
name_ptr = Name;
if (type) *type = MSITYPE_STRING | MAX_STORAGES_NAME_LEN;
if (name) *name = szName;
if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MAX_STORAGES_NAME_LEN;
break;
case 2:
name_ptr = Data;
if (name) *name = szData;
if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MSITYPE_NULLABLE;
break;
}
if (name)
{
*name = strdupW(name_ptr);
if (!*name) return ERROR_FUNCTION_FAILED;
}
if (table_name)
{
*table_name = strdupW(_Storages);
if (!*table_name)
{
msi_free(name);
return ERROR_FUNCTION_FAILED;
}
}
if (temporary)
*temporary = FALSE;
if (table_name) *table_name = szStorages;
if (temporary) *temporary = FALSE;
return ERROR_SUCCESS;
}
......
......@@ -267,16 +267,9 @@ static UINT STREAMS_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *co
return ERROR_SUCCESS;
}
static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n,
LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT STREAMS_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
LPCWSTR name_ptr = NULL;
static const WCHAR Name[] = {'N','a','m','e',0};
static const WCHAR Data[] = {'D','a','t','a',0};
static const WCHAR _Streams[] = {'_','S','t','r','e','a','m','s',0};
TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary,
table_name);
......@@ -286,35 +279,17 @@ static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n,
switch (n)
{
case 1:
name_ptr = Name;
if (name) *name = szName;
if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MAX_STREAM_NAME_LEN;
break;
case 2:
name_ptr = Data;
if (name) *name = szData;
if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MSITYPE_NULLABLE;
break;
}
if (name)
{
*name = strdupW(name_ptr);
if (!*name) return ERROR_FUNCTION_FAILED;
}
if (table_name)
{
*table_name = strdupW(_Streams);
if (!*table_name)
{
msi_free(name);
return ERROR_FUNCTION_FAILED;
}
}
if (temporary)
*temporary = FALSE;
if (table_name) *table_name = szStreams;
if (temporary) *temporary = FALSE;
return ERROR_SUCCESS;
}
......
......@@ -85,7 +85,6 @@ struct tagMSITABLE
/* information for default tables */
static const WCHAR szTables[] = {'_','T','a','b','l','e','s',0};
static const WCHAR szTable[] = {'T','a','b','l','e',0};
static const WCHAR szName[] = {'N','a','m','e',0};
static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0};
static const WCHAR szNumber[] = {'N','u','m','b','e','r',0};
static const WCHAR szType[] = {'T','y','p','e',0};
......@@ -1502,8 +1501,8 @@ static UINT TABLE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *col
}
static UINT TABLE_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name )
UINT n, LPCWSTR *name, UINT *type, BOOL *temporary,
LPCWSTR *table_name )
{
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
......@@ -1514,14 +1513,14 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view,
if( name )
{
*name = strdupW( tv->columns[n-1].colname );
*name = tv->columns[n-1].colname;
if( !*name )
return ERROR_FUNCTION_FAILED;
}
if( table_name )
{
*table_name = strdupW( tv->columns[n-1].tablename );
*table_name = tv->columns[n-1].tablename;
if( !*table_name )
return ERROR_FUNCTION_FAILED;
}
......
......@@ -154,9 +154,8 @@ static UINT UPDATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
return wv->ops->get_dimensions( wv, rows, cols );
}
static UINT UPDATE_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR* table_name )
static UINT UPDATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view;
MSIVIEW *wv;
......
......@@ -496,9 +496,8 @@ static UINT WHERE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *col
return wv->table->ops->get_dimensions( wv->table, NULL, cols );
}
static UINT WHERE_get_column_info( struct tagMSIVIEW *view,
UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
LPWSTR *table_name)
static UINT WHERE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment