"Initial Catalog" should use property DBPROP_INIT_CATALOG instead of DBPROP_CATALOGLOCATION.
Fix PowerPivot for Excel not able to query embedded data sources.
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/oledb32/tests/database.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index 26e3ebf2186..d5bea2a67d7 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -158,10 +158,24 @@ if (propsets->cProperties == 2) { ok(propsets->rgProperties[0].dwStatus == 0, "got status[0] %lu\n", propsets->rgProperties[0].dwStatus); ok(V_VT(&propsets->rgProperties[0].vValue) == VT_BSTR, "got vartype[0] %u\n", V_VT(&propsets->rgProperties[0].vValue));
- ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_PROVIDERSTRING, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID); - ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions); - ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus); - ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue)); + if (!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"dummy")) + { + ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_PROVIDERSTRING, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID); + ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions); + ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus); + ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue)); + } + else if (!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"initial_catalog_test")) + { + todo_wine + ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_CATALOG, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID); + todo_wine + ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions); + ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus); + ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue)); + ok(!wcscmp(V_BSTR(&propsets->rgProperties[1].vValue), L"dummy_catalog"), "got initial catalog %s\n", + wine_dbgstr_variant(&propsets->rgProperties[1].vValue)); + } } return S_OK; } @@ -293,6 +307,9 @@ static void test_database(void) static WCHAR initstring_lower[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';',0}; static WCHAR customprop[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';', 'c','u','s','t','o','m','p','r','o','p','=','1','2','3','.','4',';',0}; + static WCHAR initial_catalog_prop[] = {'D','a','t','a',' ','S','o','u','r','c','e','=', + 'i','n','i','t','i','a','l','_','c','a','t','a','l','o','g','_','t','e','s','t',';', + 'I','n','i','t','i','a','l',' ','C','a','t','a','l','o','g','=','d','u','m','m','y','_','c','a','t','a','l','o','g',0}; static WCHAR extended_prop[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';', 'E','x','t','e','n','d','e','d',' ','P','r','o','p','e','r','t','i','e','s','=','"','D','R','I','V','E','R','=','A', ' ','W','i','n','e',' ','O','D','B','C',' ','d','r','i','v','e','r',';','U','I','D','=','w','i','n','e',';','"',';',0}; @@ -314,6 +331,7 @@ static void test_database(void) test_GetDataSource(initstring_default); test_GetDataSource(initstring_lower); test_GetDataSource2(customprop); + test_GetDataSource2(initial_catalog_prop); test_GetDataSource2(extended_prop); test_GetDataSource2(extended_prop2); }
From: Zhiyi Zhang zzhang@codeweavers.com
"Initial Catalog" should use property DBPROP_INIT_CATALOG instead of DBPROP_CATALOGLOCATION.
Fix PowerPivot for Excel not able to query embedded data sources. --- dlls/oledb32/datainit.c | 2 +- dlls/oledb32/tests/database.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 4281e5f9e1c..87a05638ffe 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -360,7 +360,7 @@ static const struct dbproperty dbproperties[] = { L"Encrypt Password", DBPROP_AUTH_ENCRYPT_PASSWORD, DBPROPOPTIONS_REQUIRED, VT_BOOL }, { L"General Timeout", DBPROP_INIT_GENERALTIMEOUT, DBPROPOPTIONS_OPTIONAL, VT_I4 }, { L"Impersonation Level", DBPROP_INIT_IMPERSONATION_LEVEL, DBPROPOPTIONS_OPTIONAL, VT_I4 }, - { L"Initial Catalog", DBPROP_CATALOGLOCATION, DBPROPOPTIONS_OPTIONAL, VT_BSTR }, + { L"Initial Catalog", DBPROP_INIT_CATALOG, DBPROPOPTIONS_REQUIRED, VT_BSTR }, { L"Integrated Security", DBPROP_AUTH_INTEGRATED, DBPROPOPTIONS_OPTIONAL, VT_BSTR }, { L"Locale Identifier", DBPROP_INIT_LCID, DBPROPOPTIONS_OPTIONAL, VT_I4 }, { L"Location", DBPROP_INIT_LOCATION, DBPROPOPTIONS_OPTIONAL, VT_BSTR }, diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index d5bea2a67d7..12b11dd1bdc 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -167,9 +167,7 @@ if (propsets->cProperties == 2) { } else if (!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"initial_catalog_test")) { - todo_wine ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_CATALOG, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID); - todo_wine ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions); ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus); ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue));
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/oledb32/tests/database.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index 12b11dd1bdc..1da4e41ab54 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -150,6 +150,7 @@ static HRESULT WINAPI dbprops_SetProperties(IDBProperties *iface, ULONG set_coun ok(set_count == 1, "got %lu\n", set_count);
ok(IsEqualIID(&propsets->guidPropertySet, &DBPROPSET_DBINIT), "set guid %s\n", wine_dbgstr_guid(&propsets->guidPropertySet)); + todo_wine_if(!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"provider_prop_test")) ok(propsets->cProperties == 2, "got propcount %lu\n", propsets->cProperties);
if (propsets->cProperties == 2) { @@ -174,6 +175,15 @@ if (propsets->cProperties == 2) { ok(!wcscmp(V_BSTR(&propsets->rgProperties[1].vValue), L"dummy_catalog"), "got initial catalog %s\n", wine_dbgstr_variant(&propsets->rgProperties[1].vValue)); } + else if (!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"provider_prop_test")) + { + ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_PROVIDERSTRING, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID); + ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions); + ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus); + ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue)); + ok(!wcscmp(V_BSTR(&propsets->rgProperties[1].vValue), L"a=1;b=2;c=3"), "got provider string %s\n", + wine_dbgstr_variant(&propsets->rgProperties[1].vValue)); + } } return S_OK; } @@ -313,6 +323,9 @@ static void test_database(void) ' ','W','i','n','e',' ','O','D','B','C',' ','d','r','i','v','e','r',';','U','I','D','=','w','i','n','e',';','"',';',0}; static WCHAR extended_prop2[] = {'d','a','t','a',' ','s','o','u','r','c','e','=',''','d','u','m','m','y',''',';', 'c','u','s','t','o','m','p','r','o','p','=',''','1','2','3','.','4',''',';',0}; + static WCHAR multi_provider_prop_test[] = {'D','a','t','a',' ','S','o','u','r','c','e','=', + 'p','r','o','v','i','d','e','r','_','p','r','o','p','_','t','e','s','t',';', + 'a','=','1',';','b','=','2',';','c','=','3',';',0}; IDataInitialize *datainit = NULL; HRESULT hr;
@@ -332,6 +345,7 @@ static void test_database(void) test_GetDataSource2(initial_catalog_prop); test_GetDataSource2(extended_prop); test_GetDataSource2(extended_prop2); + test_GetDataSource2(multi_provider_prop_test); }
static void free_dispparams(DISPPARAMS *params)
From: Zhiyi Zhang zzhang@codeweavers.com
Put provider initialization properties in a single DBPROP_INIT_PROVIDERSTRING for IDBProperties::SetProperties(). Otherwise, according to MSDN for IDBProperties::SetProperties(), if the same property is specified more than once, the value used is provider-specific. So it won't be consider as an initialization property.
Fix PowerPivot for Excel not connecting to embedded data sources. --- dlls/oledb32/datainit.c | 52 +++++++++++++++++++++++------------ dlls/oledb32/tests/database.c | 1 - 2 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 87a05638ffe..325de558584 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -518,6 +518,7 @@ static const struct dbproperty *get_known_dprop_descr(BSTR name)
static HRESULT get_dbpropset_from_proplist(struct dbprops *props, DBPROPSET **propset) { + BSTR provider_string = NULL; struct dbprop_pair *pair; int i = 0; HRESULT hr; @@ -535,6 +536,7 @@ static HRESULT get_dbpropset_from_proplist(struct dbprops *props, DBPROPSET **pr }
(*propset)->cProperties = 0; + (*propset)->guidPropertySet = DBPROPSET_DBINIT; LIST_FOR_EACH_ENTRY(pair, &props->props, struct dbprop_pair, entry) { const struct dbproperty *descr = get_known_dprop_descr(pair->name); @@ -542,25 +544,26 @@ static HRESULT get_dbpropset_from_proplist(struct dbprops *props, DBPROPSET **pr
if (!descr) { - BSTR str; int len;
- /* provider specific property is always VT_BSTR */ - len = SysStringLen(pair->name) + SysStringLen(pair->value) + 1 /* for '=' */; - str = SysAllocStringLen(NULL, len); - lstrcpyW(str, pair->name); - lstrcatW(str, L"="); - lstrcatW(str, pair->value); - - (*propset)->cProperties++; - (*propset)->guidPropertySet = DBPROPSET_DBINIT; - (*propset)->rgProperties[i].dwPropertyID = DBPROP_INIT_PROVIDERSTRING; - (*propset)->rgProperties[i].dwOptions = DBPROPOPTIONS_REQUIRED; - (*propset)->rgProperties[i].dwStatus = 0; - memset(&(*propset)->rgProperties[i].colid, 0, sizeof(DBID)); - V_VT(&(*propset)->rgProperties[i].vValue) = VT_BSTR; - V_BSTR(&(*propset)->rgProperties[i].vValue) = str; - i++; + len = SysStringLen(pair->name) + SysStringLen(pair->value) + 1; /* for '=' */ + if (!provider_string) + { + provider_string = SysAllocStringLen(NULL, len); + } + else + { + BSTR old_string = provider_string; + + len += SysStringLen(provider_string) + 1; /* for ';' separator */ + provider_string = SysAllocStringLen(NULL, len); + lstrcpyW(provider_string, old_string); + lstrcatW(provider_string, L";"); + SysFreeString(old_string); + } + lstrcatW(provider_string, pair->name); + lstrcatW(provider_string, L"="); + lstrcatW(provider_string, pair->value); continue; }
@@ -581,7 +584,6 @@ static HRESULT get_dbpropset_from_proplist(struct dbprops *props, DBPROPSET **pr }
(*propset)->cProperties++; - (*propset)->guidPropertySet = DBPROPSET_DBINIT; (*propset)->rgProperties[i].dwPropertyID = descr->id; (*propset)->rgProperties[i].dwOptions = descr->options; (*propset)->rgProperties[i].dwStatus = 0; @@ -590,6 +592,20 @@ static HRESULT get_dbpropset_from_proplist(struct dbprops *props, DBPROPSET **pr i++; }
+ /* Provider specific property is always VT_BSTR */ + /* DBPROP_INIT_PROVIDERSTRING should be specified only once. Otherwise, it will be considered as + * provider-specific rather than an initialization property */ + if (provider_string) + { + (*propset)->cProperties++; + (*propset)->rgProperties[i].dwPropertyID = DBPROP_INIT_PROVIDERSTRING; + (*propset)->rgProperties[i].dwOptions = DBPROPOPTIONS_REQUIRED; + (*propset)->rgProperties[i].dwStatus = 0; + memset(&(*propset)->rgProperties[i].colid, 0, sizeof(DBID)); + V_VT(&(*propset)->rgProperties[i].vValue) = VT_BSTR; + V_BSTR(&(*propset)->rgProperties[i].vValue) = provider_string; + } + return S_OK; }
diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index 1da4e41ab54..c0a4fbd4005 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -150,7 +150,6 @@ static HRESULT WINAPI dbprops_SetProperties(IDBProperties *iface, ULONG set_coun ok(set_count == 1, "got %lu\n", set_count);
ok(IsEqualIID(&propsets->guidPropertySet, &DBPROPSET_DBINIT), "set guid %s\n", wine_dbgstr_guid(&propsets->guidPropertySet)); - todo_wine_if(!wcscmp(V_BSTR(&propsets->rgProperties[0].vValue), L"provider_prop_test")) ok(propsets->cProperties == 2, "got propcount %lu\n", propsets->cProperties);
if (propsets->cProperties == 2) {