mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 05:31:39 +00:00
msdasql: Return all initialization properties if no property ID is specified in dbprops_GetProperties().
This commit is contained in:
parent
fd2a2d3842
commit
f0bad1ec37
|
@ -357,18 +357,19 @@ static HRESULT WINAPI dbprops_GetProperties(IDBProperties *iface, ULONG cPropert
|
|||
struct msdasql *provider = impl_from_IDBProperties(iface);
|
||||
int i, j, k;
|
||||
DBPROPSET *propset;
|
||||
BOOL no_prop_id;
|
||||
|
||||
TRACE("(%p)->(%ld %p %p %p)\n", provider, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
|
||||
|
||||
*pcPropertySets = 1;
|
||||
|
||||
if (cPropertyIDSets != 1)
|
||||
if (cPropertyIDSets > 1)
|
||||
{
|
||||
FIXME("Currently only 1 property set supported.\n");
|
||||
FIXME("Currently only 0 or 1 property set are supported.\n");
|
||||
cPropertyIDSets = 1;
|
||||
}
|
||||
|
||||
propset = CoTaskMemAlloc(cPropertyIDSets * sizeof(DBPROPSET));
|
||||
propset = CoTaskMemAlloc(max(cPropertyIDSets, 1) * sizeof(DBPROPSET));
|
||||
|
||||
if (IsEqualGUID(&rgPropertyIDSets[0].guidPropertySet, &DBPROPSET_DATASOURCEINFO))
|
||||
{
|
||||
|
@ -391,6 +392,33 @@ static HRESULT WINAPI dbprops_GetProperties(IDBProperties *iface, ULONG cPropert
|
|||
|
||||
propset->guidPropertySet = DBPROPSET_DBINIT;
|
||||
|
||||
no_prop_id = TRUE;
|
||||
for (i = 0; i < cPropertyIDSets; i++)
|
||||
{
|
||||
if (rgPropertyIDSets[i].cPropertyIDs)
|
||||
{
|
||||
no_prop_id = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If no property ID is specified then return all currently set properties */
|
||||
if (no_prop_id)
|
||||
{
|
||||
propset->cProperties = ARRAY_SIZE(provider->properties);
|
||||
propset->rgProperties = CoTaskMemAlloc(propset->cProperties * sizeof(DBPROP));
|
||||
for(i = 0; i < ARRAY_SIZE(provider->properties); i++)
|
||||
{
|
||||
propset->rgProperties[i].dwPropertyID = provider->properties[i].id;
|
||||
V_VT(&propset->rgProperties[i].vValue) = VT_EMPTY;
|
||||
VariantCopy(&propset->rgProperties[i].vValue, &provider->properties[i].value);
|
||||
}
|
||||
|
||||
*prgPropertySets = propset;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* Return property info for properties in the specified property ID sets */
|
||||
for (i=0; i < cPropertyIDSets; i++)
|
||||
{
|
||||
TRACE("Property id %d (count %ld, set %s)\n", i, rgPropertyIDSets[i].cPropertyIDs,
|
||||
|
|
|
@ -201,10 +201,8 @@ static void test_Properties(void)
|
|||
/* Test when cPropertyIDSets is zero, all initialization properties should be returned */
|
||||
hr = IDBProperties_GetProperties(props, 0, &propidlist, &propcnt, &propset);
|
||||
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||
todo_wine
|
||||
ok(propset->cProperties == ARRAY_SIZE(properties), "got %lu\n", propset->cProperties);
|
||||
for (i = 0; i < propset->cProperties; i++)
|
||||
todo_wine_if(i > 0)
|
||||
ok(propset->rgProperties[i].dwPropertyID == properties[i],
|
||||
"%ld %ld, got %ld\n", i, properties[i], propset->rgProperties[i].dwPropertyID);
|
||||
free_dbpropset(propcnt, propset);
|
||||
|
@ -217,9 +215,7 @@ static void test_Properties(void)
|
|||
|
||||
hr = IDBProperties_GetProperties(props, 1, &propidlist, &propcnt, &propset);
|
||||
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||
todo_wine
|
||||
ok(propset->cProperties == ARRAY_SIZE(properties), "got %lu\n", propset->cProperties);
|
||||
todo_wine
|
||||
for (i = 0; i < propset->cProperties; i++)
|
||||
ok(propset->rgProperties[i].dwPropertyID == properties[i],
|
||||
"%ld %ld, got %ld\n", i, properties[i], propset->rgProperties[i].dwPropertyID);
|
||||
|
|
Loading…
Reference in a new issue