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

Clean up OPFUpdateQuery #40

Open
3 of 6 tasks
jesjos opened this issue May 13, 2013 · 4 comments
Open
3 of 6 tasks

Clean up OPFUpdateQuery #40

jesjos opened this issue May 13, 2013 · 4 comments
Assignees
Labels

Comments

@jesjos
Copy link
Contributor

jesjos commented May 13, 2013

Issues:

Test code is still in master and there are no specs.

Also, objects are serialized by hand instead of using the MTL-serialization that we actually get for free.

Also, we are generating our own ID, which should be done by the database. Additionally: we're doing multiple queries to check that we didn't select an existing ID.

Also, we're building the query using NSString stringWithFormat, which isn't correct. We should use executeQuery: withParametersInArray or executeQuery: withParameterDictionary, from FMDatabase.

Preferrably, model classes should construct their own update queries, rather than having this hardcoded into OPFUpdateQuery.

Tasks

Important

  • Remove test code form actual classes
  • Write specs
  • Use safe method of inserting query values
  • Use db to generate IDs

Optional

  • Use MTL-serialization
  • Refactor class-specific update queries to the responsible model class
@ghost ghost assigned makxan May 13, 2013
@jesjos
Copy link
Contributor Author

jesjos commented May 16, 2013

@makxan I added a task to use db-generated ids

@jesjos
Copy link
Contributor Author

jesjos commented May 16, 2013

@makxan I'm rewriting OPFUpdateQuery to use safe insert and also writing code to generate the id.

@makxan
Copy link
Contributor

makxan commented May 16, 2013

@jesjos Cool 👍 I guess you haven't pushed it to master yet, but I will clean up OPFUpdateQuery later, because just now it looks terrible and has many inconsistencies. The reason for the messiness is some debugging I did yesterday.

@jesjos
Copy link
Contributor Author

jesjos commented May 16, 2013

I just pushed fixes for safe insertion and id-generation. As we said earlier, the db isn't configured correctly, so we have to do a separate query to find the next id :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants