[source/native] fix sqlserver pattern matcher for unique constraints (closes #3227593)
The matcher is used to parse the low-level error message and extract
meaningful information for the end users.
If broken, the users see an alarming and bewildering message.
A full & definitive fix is scheduled for CubicWeb 3.18.
fromcubicwebimportUnknownEidsource,=__args__sql("DELETE FROM entities WHERE type='Int'")ecnx=session.cnxset.connection(source)foreinrql('Any X WHERE X cw_source S, S name %(name)s',{'name':source}).entities():meta=e.cw_metainformation()assertmeta['source']['uri']==sourcetry:suri=ecnx.describe(meta['extid'])[1]exceptUnknownEid:print'cant describe',e.cw_etype,e.eid,metacontinueifsuri!='system':try:print'deleting',e.cw_etype,e.eid,suri,e.dc_title().encode('utf8')repo.delete_info(session,e,suri,scleanup=e.eid)exceptUnknownEid:print' cant delete',e.cw_etype,e.eid,metacommit()