From fdc9d4c8debf306c1cb1e2df09dcec2ba7e73383 Mon Sep 17 00:00:00 2001 From: bonazzi Date: Sat, 25 Jun 2016 12:29:59 +0000 Subject: [PATCH] Patch level : 10.0 270 Files correlati : ca2.exe ca2500a.msk Ricompilazione Demo : [ ] Commento : Aggiunto programma di invio a Board. Ripristinate funzioni di visualizzazione e salvataggio ripartizione temporale delle righe nella modifica movimenti analitici git-svn-id: svn://10.65.10.50/branches/R_10_00@23205 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 13 ++++++++++++- include/odbcrset.cpp | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/date.cpp b/include/date.cpp index 38f771a7f..386a1602e 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -83,13 +83,24 @@ TDate::TDate(const char* s) const int y = atoi(&s[6]); _val = makedata(d, m, y); } + else + if (s[4] == s[7] && !isdigit(s[4])) + { + const int y = atoi(s); + const int m = atoi(&s[5]); + const int d = atoi(&s[8]); + _val = makedata(d, m, y); + } + } #ifdef DBG if (day() < 1 || day() > 31 || month() < 1 || month() > 12 || year() < 0) yesnofatal_box("Lamentati con Guy se la data '%s' non viene accettata!", s); #endif - + if (_val == 19000101L) + _val = NULLDATE; // sql nulldate 1900-01-01 + } TDate::TDate(int day, int month, int year) diff --git a/include/odbcrset.cpp b/include/odbcrset.cpp index 1d3edabd1..beb82aef2 100755 --- a/include/odbcrset.cpp +++ b/include/odbcrset.cpp @@ -451,9 +451,38 @@ int TODBC_recordset::compare_key(const TISAM_recordset& dbfset) { const int nfield = keydes.FieldSeq[f] % MaxFields; const char* fname = recdes.Fd[nfield].Name; - cmp = dbfset.get(fname).compare(get(fname)); + const bool upper = keydes.FieldSeq[f] > MaxFields; + switch (recdes.Fd[f].TypeF) + { + case _alfafld: + case _memofld: + if (upper) + cmp = xvt_str_compare_ignoring_case(dbfset.get(fname).as_string(), get(fname).as_string()); + else + cmp = dbfset.get(fname).compare(get(fname)); + break; + case _realfld: + { + const real dbfnum = dbfset.get(fname).as_real(); + const real sqlnum = get(fname).as_real(); + if (dbfnum != sqlnum) + cmp = dbfnum < sqlnum ? -1 : +1; + } + break; + case _datefld: + { + const TDate dbfdate = dbfset.get(fname).as_date(); + const TDate sqldate = get(fname).as_date(); + if (dbfdate != sqldate) + cmp = dbfdate < sqldate ? -1 : +1; + } + break; + default: + cmp = dbfset.get(fname).as_int() - get(fname).as_int(); + break; + } } - return cmp; + return cmp; } int TODBC_recordset::compare_rec(const TISAM_recordset& dbfset) @@ -471,8 +500,8 @@ int TODBC_recordset::compare_rec(const TISAM_recordset& dbfset) { case _alfafld: case _memofld: - cmp = xvt_str_compare_ignoring_case(dbffld.as_string(), sqlfld.as_string()); - break; + cmp = dbffld.compare(sqlfld); + break; case _realfld: { const real dbfnum = dbffld.as_real(); @@ -484,7 +513,7 @@ int TODBC_recordset::compare_rec(const TISAM_recordset& dbfset) case _datefld: { const TDate dbfdate = dbffld.as_date(); - const TDate sqldate = dbffld.as_date(); + const TDate sqldate = sqlfld.as_date(); if (dbfdate != sqldate) cmp = dbfdate < sqldate ? -1 : +1; }