[pywin32-bugs] [ pywin32-Bugs-3495033 ] Incorrect Handling of adGUID
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2012-02-28 13:49:18
|
Bugs item #3495033, was opened at 2012-02-27 08:06 Message generated for change (Comment added) made by alkamo You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3495033&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: adodbapi Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Allan (alkamo) Assigned to: Vernon Cole (kf7xm) Summary: Incorrect Handling of adGUID Initial Comment: When a GUID value is written to a SQL Server database, it is truncated to 16 characters. This means that when you try to write "{71A4F49E-39F3-42B1-A41E-48FF154996E6}", only "{71A4F49E-39F3-4" is actually passed to the database (which, naturally, raises an error). This seems that it may be an issue with the ADO interface: when the parameters are refreshed from the "ADODB.Command" object, the size is returned as 16 and that is used to format the parameters later. I have worked around this by creating changing the _buildADOparameterList procedure of the cursor class to set the size of UUID fields after the parameter list is refreshed, as demonstrated in the attached code. The size is set to 38, to account for the 32-character UUID with 2 curly braces and four dashes, which is the format returned by a SQL Server database. ---------------------------------------------------------------------- >Comment By: Allan (alkamo) Date: 2012-02-28 05:49 Message: Vernon's recommendation of moving adGUID from adoStringTypes to adoRemainingTypes resolves this issue. ---------------------------------------------------------------------- Comment By: Vernon Cole (kf7xm) Date: 2012-02-27 19:48 Message: It seems that the solution might be as simple as changing the definition of how adGUID is handled. Around line 1237, change adoStringTypes=(adc.adBSTR,adc.adChar,adc.adLongVarChar,adc.adLongVarWChar, adc.adVarChar,adc.adVarWChar,adc.adWChar,adc.adGUID) to adoStringTypes=(adc.adBSTR,adc.adChar,adc.adLongVarChar,adc.adLongVarWChar, adc.adVarChar,adc.adVarWChar,adc.adWChar) and near line 1241 change adoRemainingTypes=(adc.adEmpty,adc.adIDispatch,adc.adIUnknown, adc.adPropVariant,adc.adArray,adc.adUserDefined, adc.adVariant) to adoRemainingTypes=(adc.adEmpty,adc.adIDispatch,adc.adIUnknown, adc.adPropVariant,adc.adArray,adc.adUserDefined, adc.adVariant,adc.adGUID) -- Hopefully that will avoid explicit code in _configure_parameter which truncates some strings. Please try it and tell me if it works. I have never mucked with GUIDs so have no idea how to create one to test with. [Feel free to add a test to the suite.] -- Vernon ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3495033&group_id=78018 |