Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for table join #452

Merged
merged 3 commits into from
Apr 1, 2013
Merged

Some fixes for table join #452

merged 3 commits into from
Apr 1, 2013

Conversation

minorua
Copy link
Contributor

@minorua minorua commented Mar 2, 2013

Fix

  • shift of joined fields (7068-1)
  • restoring joined fields from project files (7068-2)

Also fix

  • refreshing field names after encoding is changed (6840)

@wonder-sk
Copy link
Member

@minorua thanks for the fixes. Regarding the implementation, I think that updateFields() method should not become a part of public interface of QgsVectorLayer, instead it should be called only internally when the update is necessary. This function is really just an implementation detail that other classes should not need to care about.

The refresh of field names should be done in a different way (again to avoid calling updateFields() from outside). I would suggest adding a "fieldsChanged" signal to QgsVectorDataProvider. It would be emitted when the encoding has been changed and later could be used also for other occasions where the provider needs to tell layer that its fields have been changed. QgsVectorLayer should have a private slot that would trigger the update of fields (maybe directly updateFields() could become a private slot).

Could you please update your pull request?

@minorua
Copy link
Contributor Author

minorua commented Mar 3, 2013

@wonder-sk Thank you for your advice. I realized that my idea was a bit shortsighted.
I don't want to dirty your elegant design by my lack of technical abilities. For a quick fix, it is undesirable to keep you waiting for my inexperienced job to finish. So, please allow me to withdraw this request.

@minorua minorua closed this Mar 3, 2013
@minorua
Copy link
Contributor Author

minorua commented Mar 5, 2013

Updated commits with new ones (old ones were moved to here).
I agreed to add fieldsChanged signal, but I could not find a good way to avoid making updateFields public, to update fieldnames after all layers loaded. If there is a better way, dismissing this request is fine for me.

@minorua minorua reopened this Mar 5, 2013
@nirvn
Copy link
Contributor

nirvn commented Mar 5, 2013

@minorua , @wonder-sk , I've filed http://hub.qgis.org/issues/7271 yesterday before seeing work done here. It might be that your work will fix the underlying issue(s) raised in issue 7271. Might be good for you to test out patched build for the problems raised in 7271.

@minorua
Copy link
Contributor Author

minorua commented Mar 5, 2013

@nirvn Additional fix seems to be necessary for 7271.

@nirvn
Copy link
Contributor

nirvn commented Mar 5, 2013

@minorua , oh :/ was hoping it wouldn't require additional efforts. the two problems raised there - namely column index shift when sorting and when doing symbology classification - are pretty big. The classification one is especially problematic as a user might not be aware he/she is classifying with data from the wrong column.

@minorua
Copy link
Contributor Author

minorua commented Mar 6, 2013

The issues should be fixed together with 7271 (part of sort), since they are related.

@nirvn Thanks for your advice!

@minorua
Copy link
Contributor Author

minorua commented Mar 6, 2013

Modified commits so that correct indexOffset is calculated even if SubsetOfAttributes is specified in feature request (fix for 7271).

@nirvn
Copy link
Contributor

nirvn commented Mar 6, 2013

@minorua , no problem, I'm the one who needs to thank you for all of your hard work!

@ghost ghost assigned wonder-sk Mar 7, 2013
@minorua
Copy link
Contributor Author

minorua commented Mar 7, 2013

@wonder-sk While reviewing commits, I thought that a way of calling updateFields() from QgsVectorLayer::setProviderEncoding() is more simple.
Updated commits (old ones were moved to here). Any opinions welcome.

@posikifi
Copy link

Maybe stupid question: but when this bug correction will be part of master? I need this fix, not only to master but also 1.8.

@minorua
Copy link
Contributor Author

minorua commented Mar 20, 2013

Sorry, I've realized that the above commits do not completely fix the issue 7068-2.
joinField/targetField attributes of join element in project file were changed to joinFieldName/targetFieldName. Due to this change, field joins of projects created in 1.8 are not restored in master. Fixing this broken compatibility is required.

@posikifi
Copy link

I see. I do hope you can fix those sooner than later. Sorry, but I can't really help. Unless testing is helping ;-)

@minorua
Copy link
Contributor Author

minorua commented Mar 21, 2013

Added a commit to keep the backward compatibility of table join in project file. Please consider these commits.

@nirvn
Copy link
Contributor

nirvn commented Apr 1, 2013

@wonder-sk , would be great to merge this when you have some free time. A QGIS 2.0 release with fixed table joins would be fantastic :)

NathanW2 added a commit that referenced this pull request Apr 1, 2013
Some fixes for table join. Merged for wider testing.
@NathanW2 NathanW2 merged commit 5c028f8 into qgis:master Apr 1, 2013
@posikifi
Copy link

posikifi commented Apr 2, 2013

I briefly tested this. Still some odd features:

  • Some values are only NULL
  • Sometimes last joined column is not available

I hope I can give you sample data and better report tomorrow.

@posikifi
Copy link

posikifi commented Apr 5, 2013

Well,

It seems that you fix code before I can test ;-) I made some tests with shapefile and csv file: no problems. Then I made thest with Spatialite and csv-file: I can join csv to spatialite layer/view. I can see value in "Attribute table", but when I try to make thematic maps: Qgis will crash.

I found log-message: "FAILURE: Field 4 not found". Field 4 seems to be first joined field: I have 4 field in my Spatialite view.

QGIS code revision 9b83d1a
Windows 7

If you need test data or other debug files, please ask.

P

@minorua
Copy link
Contributor Author

minorua commented Apr 9, 2013

@posikifi I have just tested PhilippeDorelon's pull request (#509). It fixes the issue!

@posikifi
Copy link

posikifi commented Apr 9, 2013

@minorua Great, I just wait when it has been merged

@minorua minorua deleted the tablejoin branch April 26, 2013 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants