-
Notifications
You must be signed in to change notification settings - Fork 1
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
Null values in registration #8
Comments
Proposal:
Consider of a table "SRT" with the following structure: The prepared statement we use now is: SELECT * FROM SRT WHERE X<=? AND X>=? AND Y LIKE ? AND Z<=? AND Z>=? And note that z is a self-referencing column. This prepared statement will never return those entries that have z=NULL. So, I think the problem is solved if we modify the prepared statement in the following way: SELECT * FROM SRT WHERE X<=? AND X>=? AND Y LIKE ? AND Z<=? AND Z>=? OR Z IS NULL Note also that the columns X and Y will never be NULL. One the one hand because X is a primary key for SRT and because of #3 in the proposal. |
Plan B: public abstract T searchPrototype(); which returns a T (subclass of component) with all field values set to the corresponding WhatEver-value :-) Allow for NULL foreign key values but on startup create the corresponding pseudo-nulls and write them in the database (These should be never be deleted unless one invokes the method DeciBell.reset() )... Well we have more way to go to the next milestone... |
The general format of a prepared statement does not allow for null values lookup using the equals (=) or LIKE operator. So, if one registers a null value in the database, it will not be ever returned using the method SearchEngine.search(DeciBell db).
The same happens with the numeric values. If one registers a value which is equal to the NumericNull value of a field, it will RUIN the whole database, as no other component will be able to be retrieved! Is such a case, an Exception should be thrown and users should be discouraged to use the value reserved for NumericNull in a registration.
The same schema can be exploited when registering string values in the database. We can introduce a Java Annotation, called @whatever which will generalize the annotation @NumericNull to both numerics (int, long etc) and Strings!
The text was updated successfully, but these errors were encountered: