Home » U++ Library support » U++ SQL » error in example/SQLApp [FIXED]
Re: error in example/SQLApp [message #13755 is a reply to message #13733] |
Fri, 25 January 2008 23:16   |
 |
mirek
Messages: 14266 Registered: November 2005
|
Ultimate Member |
|
|
sergeynikitin wrote on Fri, 25 January 2008 05:00 | Thanks. And Sorry for my English.
Now (this time) I try to understand technique (or technology) of life with UPP and I have additional time to analize expamples.
I found this TOOL is interest and powerful.
And I found one more strange thing in this example.
File borrow.cpp, lines from 14 to 27 - Function
Value DateIntConvertCls::Scan(const Value& text) const
{
String txt = text;
if(IsNull(txt))
return Null;
Date d;
if(StrToDate(d, txt)) {
const char *s = txt;
while(*s == ' ') s++;
if(*s == '\0')
return d - Date(1970, 1, 1);
}
return ErrorValue("Invalid date!");
}
I add there one string return d - Date(1970, 1, 1);.
Value DateIntConvertCls::Scan(const Value& text) const
{
String txt = text;
if(IsNull(txt))
return Null;
Date d;
if(StrToDate(d, txt)) {
const char *s = txt;
while(*s == ' ') s++;
if(*s == '\0')
return d - Date(1970, 1, 1);
}
return d - Date(1970, 1, 1);
// ^^^^^^^^^^^^^^^^^^^^^^^^^
return ErrorValue("Invalid date!");
}
Without this string, I can't to edit Date fields, when I add borrow records. I can add only empty dates.
This may be my mistake or mistake of program.
SQLApp - is a complex example, because many of newbies see to this application and this application is face of system.
And this app must be a exapmle of stability ( ).
|
Stupid me. That is the price to pay when you are overengineering the code, and not test it enough in the same time...
Value DateIntConvertCls::Scan(const Value& text) const
{
String txt = text;
if(IsNull(txt))
return Null;
Date d;
if(StrToDate(d, txt))
return d - Date(1970, 1, 1);
return ErrorValue("Invalid date!");
}
Thanks!
Mirek
|
|
|
Goto Forum:
Current Time: Fri Jul 18 11:06:26 CEST 2025
Total time taken to generate the page: 0.03988 seconds
|