On 08/09/2013 05:09 PM, Ricardo Aráoz wrote:
El 09/08/13 20:58, Ricardo Aráoz escribió:
It is probably broken.
This is my input :
>>> dsDict = {"carg" : cargarDS}
>>> ds = tjtasDS.execute("""
... select carg.NroTarjeta
... , ifnull(nullif(carg.Apellido, ''), dataset.Apellido)
... , ifnull(nullif(carg.Nombre, ''), dataset.Nombre)
... , ifnull(nullif(carg.Ubicacion, ''), dataset.Ubicacion)
... , ifnull(nullif(carg.Observaciones, ''),
dataset.Observaciones)
... from carg, dataset
... where carg.NroTarjeta = dataset.NroTarjeta
... union all
... select NroTarjeta, Apellido, Nombre, Ubicacion, Observaciones
... from carg
... where carg.NroTarjeta not in (select NroTarjeta from
dataset)
... union all
... select NroTarjeta, Apellido, Nombre, Ubicacion, Observaciones
... from dataset
... where dataset.NroTarjeta not in (select NroTarjeta from
carg)
... """, cursorDict=dsDict)
>>> print ds
>>> dsDict
>>> cargarDS
>>> tjtasDS
This is the output :
None
{'carg': ({'Apellido': u'', 'pkId': 1, 'Observaciones': u'',
'NroTarjeta': 3817748544L, 'Ubicacion': u'', 'Nombre': u''},
{'Apellido': u'', 'pkId': 2, 'Observaciones': u'', 'NroTarjeta': 206,
'Ubicacion': u'', 'Nombre': u''}, {'Apellido': u'', 'pkId': 3,
'Observaciones': u'', 'NroTarjeta': 839974912, 'Ubicacion': u'',
'Nombre': u''})}
({'Apellido': u'', 'pkId': 1, 'Observaciones': u'', 'NroTarjeta':
3817748544L, 'Ubicacion': u'', 'Nombre': u''}, {'Apellido': u'',
'pkId': 2, 'Observaciones': u'', 'NroTarjeta': 206, 'Ubicacion': u'',
'Nombre': u''}, {'Apellido': u'', 'pkId': 3, 'Observaciones': u'',
'NroTarjeta': 839974912, 'Ubicacion': u'', 'Nombre': u''})
()
As you can see the resulting ds is None (it should at least be an
empty tuple just like tjtasDS).
The expected result of the select statement is the data set that
appears inside the dsDict dictionary!!! Which shouldn't have changed
at all.
The last two data sets are there so you can see the data I'm working
with and reproduce the issue. tjtasDS is an empty data set.
When tjtasDS is not empty it works correctly though.
Is this a bug? I think it is as there may always be an empty data set
participating in a query.
I don't use sqlite very often. If you create two tables - with tjtasDS
empty - does still do the same thing?
Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]