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

handle NULL TDates #116

Closed
ghost opened this issue Mar 7, 2017 · 8 comments
Closed

handle NULL TDates #116

ghost opened this issue Mar 7, 2017 · 8 comments

Comments

@ghost
Copy link

ghost commented Mar 7, 2017

Should the nil date be pretty as plain text or as date?
0 as plain Text would be 30.12.1899 as date
-693594 as plain text would be 00.00.0000 as date

@bvorak
Copy link
Contributor

bvorak commented Mar 7, 2017

Is there any chance the user get's to see this date? It's about the return date right?
If so I'd opt for the second proposal.
Even though the GUI could handle those "not yet set" return dates and display them in an user friendly way.

@cnmicha
Copy link
Member

cnmicha commented Mar 7, 2017

nil just means "no date set", so e.g. for the return date, that the book was not returned yet, so replacing it by 0 or minus somewhat would lead to wrong values...

@cnmicha cnmicha changed the title Which DateTime is nill ? Which DateTime is nil? Mar 7, 2017
@ghost
Copy link
Author

ghost commented Mar 7, 2017

No the user should not see this date if we do everything rigth. Yes the return date.
Yes I also guess the second one is better.
Yes @cnmicha but nil is a Object from the type Pointer. The TDate type is an alias for the Double type that does not allow the nil pointer as valid value. So Lazarus gives a compile error back when we try to pass the nil pointer as TDate object.
When this is right I see no other way than these two options also it are "wrong values".

@ghost ghost added GUI management labels Mar 7, 2017
@cnmicha cnmicha added this to the Version 1.0 milestone Mar 7, 2017
@cnmicha
Copy link
Member

cnmicha commented Mar 8, 2017

There is a "Null" value for doubles, I'll check if there is anything compareable for TDate..

@cnmicha
Copy link
Member

cnmicha commented Mar 8, 2017

There is not, so the database group will consider every date that is =-1, so =30.12.1899 as NULL value.

cnmicha added a commit that referenced this issue Mar 8, 2017
cnmicha added a commit that referenced this issue Mar 8, 2017
@cnmicha
Copy link
Member

cnmicha commented Mar 8, 2017

Please use uDBConstants and null check like this:
if TDateVar = SQLNull then
working with all integer/float like types
so the -1 value can be changed at one place anytime when neccessary

cnmicha added a commit that referenced this issue Mar 8, 2017
@cnmicha cnmicha changed the title Which DateTime is nil? handle NULL TDates Mar 8, 2017
@cnmicha cnmicha removed the database label Mar 8, 2017
frcroth added a commit that referenced this issue Mar 10, 2017
* #106 Identify by school username

* #116 Which DateTime is nil?

* outsourced SQL Null constant into DBConstants class

#116 Which DateTime is nil?

* addition to 9207b8e
@ghost
Copy link
Author

ghost commented Mar 10, 2017

-693594 is the final value

@ghost ghost closed this as completed Mar 10, 2017
@cnmicha
Copy link
Member

cnmicha commented Mar 10, 2017

I will apply to code...

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

No branches or pull requests

2 participants