Patch level : 12.0 972
Files correlati : ba8.exe f90.exe Commento : Corretta classe record sqlite: i datatype erano sempre sbagliati perche' presi dalla prima riga del set e quasi sempre i campi erano considerati real per i TVariant solitamente dovuto a un guessing di campi vuoti.
This commit is contained in:
parent
4d7d204fee
commit
658c6e9081
@ -432,7 +432,7 @@ int TSQL_recordset::on_get_items(int argc, char** values, char** columns)
|
||||
info->_width = 1;
|
||||
info->_type = _alfafld;
|
||||
|
||||
const char* fldtype = columns[argc+i];
|
||||
/*const char* fldtype = columns[argc+i];
|
||||
if (fldtype != NULL)
|
||||
{
|
||||
if (xvt_str_same(fldtype, "DATE"))
|
||||
@ -449,36 +449,36 @@ int TSQL_recordset::on_get_items(int argc, char** values, char** columns)
|
||||
info->_type = _memofld;
|
||||
info->_width = 50;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
_column.add(info);
|
||||
}
|
||||
}
|
||||
if (_items < _pagesize)
|
||||
{
|
||||
// Aggiusta le lunghezze dei campi testo e numerici
|
||||
for (int i = 0; i < argc; i++) if (values[i] && *values[i])
|
||||
{
|
||||
TRecordset_column_info& info = (TRecordset_column_info&)_column[i];
|
||||
if (info._type == _alfafld || info._type == _realfld)
|
||||
{
|
||||
const int len = strlen(values[i]);
|
||||
if (len > info._width)
|
||||
{
|
||||
info._width = len;
|
||||
if (info._type == _alfafld)
|
||||
{
|
||||
if (len == 8 && atol(values[i]) > 19000000)
|
||||
{
|
||||
info._type = _datefld;
|
||||
info._width = 10;
|
||||
} else
|
||||
if (real::is_real(values[i]))
|
||||
info._type = _realfld;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (_items < _pagesize)
|
||||
//{
|
||||
// // Aggiusta le lunghezze dei campi testo e numerici
|
||||
// for (int i = 0; i < argc; i++) if (values[i] && *values[i])
|
||||
// {
|
||||
// TRecordset_column_info& info = (TRecordset_column_info&)_column[i];
|
||||
// if (info._type == _alfafld || info._type == _realfld)
|
||||
// {
|
||||
// const int len = strlen(values[i]);
|
||||
// if (len > info._width)
|
||||
// {
|
||||
// info._width = len;
|
||||
// if (info._type == _alfafld)
|
||||
// {
|
||||
// if (len == 8 && atol(values[i]) > 19000000)
|
||||
// {
|
||||
// info._type = _datefld;
|
||||
// info._width = 10;
|
||||
// } else
|
||||
// if (real::is_real(values[i]))
|
||||
// info._type = _realfld;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
_items++;
|
||||
return SQLITE_OK;
|
||||
@ -502,9 +502,9 @@ TRecnotype TSQL_recordset::items() const
|
||||
{
|
||||
TString sql; parsed_text(sql);
|
||||
TPerformance_profiler prof("SQL query");
|
||||
_TheDataBase.exec("PRAGMA show_datatypes=ON;", NULL, NULL);
|
||||
//_TheDataBase.exec("PRAGMA show_datatypes=ON;", NULL, NULL);
|
||||
_TheDataBase.exec(sql, query_get_items, (TSQL_recordset*)this);
|
||||
_TheDataBase.exec("PRAGMA show_datatypes=OFF;", NULL, NULL);
|
||||
//_TheDataBase.exec("PRAGMA show_datatypes=OFF;", NULL, NULL);
|
||||
}
|
||||
return _items;
|
||||
}
|
||||
@ -634,4 +634,3 @@ TSQL_recordset::TSQL_recordset(const char* sql)
|
||||
{
|
||||
set(sql);
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ public:
|
||||
void add(int n, int pos = -1);
|
||||
// @cmember Aggiunge un reale
|
||||
void add(const real r, int pos = -1);
|
||||
// @cmember Aggiunge un reale
|
||||
// @cmember Aggiunge una data
|
||||
void add(const TDate d, int pos = -1);
|
||||
// @cmember Aggiunge un booleano
|
||||
void add(bool on, int pos = -1) { add(on ? "X" : ""); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user