Patch level : 10.0
Files correlati : ve1 ba8 Ricompilazione Demo : [ ] Commento : Corretto ordinamento date nelle espressioni BY delle query. Portato limite di lunghezza dei nomi dei file temporanei da 42 a 260 caratteri. git-svn-id: svn://10.65.10.50/trunk@19764 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
edebc36b52
commit
d77c676749
@ -35,14 +35,14 @@ static char *init_sptr;
|
|||||||
static unsigned rcds_seq;
|
static unsigned rcds_seq;
|
||||||
/* @(:) 2.3.00.112 */
|
/* @(:) 2.3.00.112 */
|
||||||
static FILE *fp1, *fp2;
|
static FILE *fp1, *fp2;
|
||||||
static char fdname [42];
|
static char fdname [_MAX_PATH];
|
||||||
static char f2name [42];
|
static char f2name [_MAX_PATH];
|
||||||
|
|
||||||
//static int sortcomp(char **, char **);
|
//static int sortcomp(char **, char **);
|
||||||
static int sortcomp(const void*, const void*);
|
static int sortcomp(const void*, const void*);
|
||||||
static char *appr_mem(unsigned *);
|
static char *appr_mem(unsigned *);
|
||||||
/* @(!) 2.3.00.112 */
|
/* @(!) 2.3.00.112 */
|
||||||
static FILE *wopen(char *);
|
static FILE *wopen(char *, int);
|
||||||
/* @(:) 2.3.00.112 */
|
/* @(:) 2.3.00.112 */
|
||||||
static void dumpbuff(void);
|
static void dumpbuff(void);
|
||||||
static void merge(void);
|
static void merge(void);
|
||||||
@ -90,9 +90,7 @@ int init_sort(struct s_prm *prms)
|
|||||||
@(FN)
|
@(FN)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sort(s_rcd)
|
void sort(const char* s_rcd) /* buffer contenente il record da ordinare */
|
||||||
char *s_rcd; /* buffer contenente il record da ordinare */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
/* @(!) 2.3.00.112 */
|
/* @(!) 2.3.00.112 */
|
||||||
if (inbf == nrcds) { /* if the sort buffer is full */
|
if (inbf == nrcds) { /* if the sort buffer is full */
|
||||||
@ -159,9 +157,9 @@ static void prep_merge()
|
|||||||
while (rcds_seq < 2) {
|
while (rcds_seq < 2) {
|
||||||
FILE *hd;
|
FILE *hd;
|
||||||
/* @(!) 2.3.00.112 */
|
/* @(!) 2.3.00.112 */
|
||||||
char wname[42]; /* sort work name */
|
char wname[_MAX_PATH]; /* sort work name */
|
||||||
|
|
||||||
fp2 = wopen(f2name); /* open a sort work file */
|
fp2 = wopen(f2name, sizeof(wname)); /* open a sort work file */
|
||||||
/* @(:) 2.3.00.112 */
|
/* @(:) 2.3.00.112 */
|
||||||
merge(); /* binary merge */
|
merge(); /* binary merge */
|
||||||
hd = fp1; /* swap fds */
|
hd = fp1; /* swap fds */
|
||||||
@ -353,7 +351,7 @@ static void dumpbuff()
|
|||||||
|
|
||||||
if (fp1 == NULL)
|
if (fp1 == NULL)
|
||||||
/* @(!) 2.3.00.112 */
|
/* @(!) 2.3.00.112 */
|
||||||
fp1 = wopen(fdname);
|
fp1 = wopen(fdname, sizeof(fdname));
|
||||||
/* @(:) 2.3.00.112 */
|
/* @(:) 2.3.00.112 */
|
||||||
sptr = (char **) init_sptr;
|
sptr = (char **) init_sptr;
|
||||||
for (i = 0; i < inbf; i++) {
|
for (i = 0; i < inbf; i++) {
|
||||||
@ -382,17 +380,17 @@ static void dumpbuff()
|
|||||||
@(FSV)
|
@(FSV)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static FILE *wopen(char* name) /* nome del file temporaneo */
|
static FILE *wopen(char* name, int size) /* nome del file temporaneo */
|
||||||
{
|
{
|
||||||
FILE* fp = NULL;
|
FILE* fp = NULL;
|
||||||
char* tmp = _tempnam(".", "srt");
|
char* tmp = _tempnam(".", "srt");
|
||||||
if (tmp != NULL)
|
if (tmp != NULL)
|
||||||
{
|
{
|
||||||
strcpy(name, tmp);
|
strncpy(name, tmp, size);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmpnam(name);
|
tmpnam_s(name, size);
|
||||||
fp = fopen(name, "wb+");
|
fp = fopen(name, "wb+");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
xvt_dm_post_fatal_exit("Can't open SORT file");
|
xvt_dm_post_fatal_exit("Can't open SORT file");
|
||||||
|
@ -26,7 +26,7 @@ extern "C" {
|
|||||||
/*----------------------- FUNZIONI VISIBILI PRIMA PARTE ---------------------*/
|
/*----------------------- FUNZIONI VISIBILI PRIMA PARTE ---------------------*/
|
||||||
|
|
||||||
int init_sort(struct s_prm *); /* Initialize the sort */
|
int init_sort(struct s_prm *); /* Initialize the sort */
|
||||||
void sort(char *); /* Pass records to Sort */
|
void sort(const char *); /* Pass records to Sort */
|
||||||
char *sort_op(void); /* Retrieve sorted records */
|
char *sort_op(void); /* Retrieve sorted records */
|
||||||
void sort_stats(void); /* Display sort statistics */
|
void sort_stats(void); /* Display sort statistics */
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ extern "C" {
|
|||||||
void CPutPref(const char *);
|
void CPutPref(const char *);
|
||||||
char *CInsPref(char *, int);
|
char *CInsPref(char *, int);
|
||||||
int init_sort(struct s_prm *);
|
int init_sort(struct s_prm *);
|
||||||
void sort(char *);
|
void sort(const char *);
|
||||||
char *sort_op(void);
|
char *sort_op(void);
|
||||||
void sort_stats(void);
|
void sort_stats(void);
|
||||||
|
|
||||||
|
@ -1917,7 +1917,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
|
|||||||
const TRectype& r = relation()->lfile(id).curr();
|
const TRectype& r = relation()->lfile(id).curr();
|
||||||
const int flen = f.len(r);
|
const int flen = f.len(r);
|
||||||
|
|
||||||
if (!id.empty())
|
if (id.full())
|
||||||
{
|
{
|
||||||
_sort_update = true;
|
_sort_update = true;
|
||||||
const int file_id = relation()->name2ind(id);
|
const int file_id = relation()->name2ind(id);
|
||||||
@ -2024,22 +2024,24 @@ const char* TSorted_cursor::fill_sort_key(TString& k)
|
|||||||
if (fld_type == _datefld || (f.is_subfield() && TDate::isdate(sf)))
|
if (fld_type == _datefld || (f.is_subfield() && TDate::isdate(sf)))
|
||||||
{
|
{
|
||||||
const TDate d(sf);
|
const TDate d(sf);
|
||||||
sf = d.string(ANSI);
|
sf.format("%08ld", d.date2ansi());
|
||||||
fld_type = _datefld;
|
fld_type = _datefld;
|
||||||
fld_len = 10;
|
fld_len = 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_up)
|
if (is_up)
|
||||||
sf.upper();
|
sf.upper();
|
||||||
}
|
}
|
||||||
|
switch (fld_type)
|
||||||
TString8 fmt;
|
{
|
||||||
if (fld_type == _alfafld || fld_type == _datefld)
|
case _boolfld:
|
||||||
fmt.format("%%-%ds", fld_len);
|
case _charfld:
|
||||||
else
|
case _alfafld: sf.left_just(fld_len); break;
|
||||||
fmt.format("%%%ds", fld_len);
|
case _datefld: break; // Gia' lungo 8!
|
||||||
k << format(fmt, (const char*)sf);
|
default : sf.right_just(fld_len); break;
|
||||||
|
}
|
||||||
|
k << sf;
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ void TSort::sort(const char* record)
|
|||||||
|
|
||||||
{
|
{
|
||||||
CHECK(record != NULL, "Bad record to sort");
|
CHECK(record != NULL, "Bad record to sort");
|
||||||
::sort((char*)record);
|
::sort(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user