@@ -634,6 +634,7 @@ void TDBDIR::Init(void)
634
634
{
635
635
iFile = 0 ;
636
636
#if defined(__WIN__)
637
+ Dvalp = NULL ;
637
638
memset (&FileData, 0 , sizeof (_finddata_t ));
638
639
hSearch = INVALID_HANDLE_VALUE;
639
640
*Drive = ' \0 ' ;
@@ -662,37 +663,6 @@ TDBDIR::TDBDIR(PSZ fpat) : TDBASE((PTABDEF)NULL)
662
663
Init ();
663
664
} // end of TDBDIR constructor
664
665
665
- TDBDIR::TDBDIR (PTDBDIR tdbp) : TDBASE(tdbp)
666
- {
667
- To_File = tdbp->To_File ;
668
- iFile = tdbp->iFile ;
669
- #if defined(__WIN__)
670
- FileData = tdbp->FileData ;
671
- hSearch = tdbp->hSearch ;
672
- strcpy (Drive, tdbp->Drive );
673
- #else // !__WIN__
674
- Fileinfo = tdbp->Fileinfo ;
675
- Entry = tdbp->Entry ;
676
- Dir = tdbp->Dir ;
677
- Done = tdbp->Done ;
678
- strcpy (Pattern, tdbp->Pattern );
679
- #endif // !__WIN__
680
- strcpy (Direc, tdbp->Direc );
681
- strcpy (Fname, tdbp->Fname );
682
- strcpy (Ftype, tdbp->Ftype );
683
- } // end of TDBDIR copy constructor
684
-
685
- // Method
686
- PTDB TDBDIR::Clone (PTABS t)
687
- {
688
- PTDB tp;
689
- PGLOBAL g = t->G ; // Is this really useful ???
690
-
691
- tp = new (g) TDBDIR (this );
692
- tp->SetColumns (Columns);
693
- return tp;
694
- } // end of Clone
695
-
696
666
/* **********************************************************************/
697
667
/* Initialize/get the components of the search file pattern. */
698
668
/* **********************************************************************/
@@ -958,6 +928,7 @@ DIRCOL::DIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ)
958
928
} // endif cprec
959
929
960
930
// Set additional DIR access method information for column.
931
+ Tdbp = (PTDBDIR)tdbp;
961
932
N = cdp->GetOffset ();
962
933
} // end of DIRCOL constructor
963
934
@@ -967,48 +938,73 @@ DIRCOL::DIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ)
967
938
/* **********************************************************************/
968
939
DIRCOL::DIRCOL (DIRCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
969
940
{
970
- N = col1->N ;
941
+ Tdbp = (PTDBDIR)tdbp;
942
+ N = col1->N ;
971
943
} // end of DIRCOL copy constructor
972
944
945
+ #if defined(__WIN__)
946
+ /* **********************************************************************/
947
+ /* Retrieve time information from FileData. */
948
+ /* **********************************************************************/
949
+ void DIRCOL::SetTimeValue (PGLOBAL g, FILETIME& ftime)
950
+ {
951
+ char tsp[24 ];
952
+ SYSTEMTIME stp;
953
+
954
+ if (FileTimeToSystemTime (&ftime, &stp)) {
955
+ sprintf (tsp, " %04d-%02d-%02d %02d:%02d:%02d" ,
956
+ stp.wYear , stp.wMonth , stp.wDay , stp.wHour , stp.wMinute , stp.wSecond );
957
+
958
+ if (Value->GetType () != TYPE_STRING) {
959
+ if (!Tdbp->Dvalp )
960
+ Tdbp->Dvalp = AllocateValue (g, TYPE_DATE, 20 , 0 , false ,
961
+ " YYYY-MM-DD hh:mm:ss" );
962
+
963
+ Tdbp->Dvalp ->SetValue_psz (tsp);
964
+ Value->SetValue_pval (Tdbp->Dvalp );
965
+ } else
966
+ Value->SetValue_psz (tsp);
967
+
968
+ } else
969
+ Value->Reset ();
970
+
971
+ } // end of SetTimeValue
972
+ #endif // __WIN__
973
+
973
974
/* **********************************************************************/
974
975
/* ReadColumn: what this routine does is to access the information */
975
976
/* corresponding to this column and convert it to buffer type. */
976
977
/* **********************************************************************/
977
978
void DIRCOL::ReadColumn (PGLOBAL g)
978
- {
979
- PTDBDIR tdbp = (PTDBDIR)To_Tdb;
980
- #if defined(__WIN__)
981
- // PSYSTEMTIME stp = NULL;
982
- #endif // !__WIN__
983
-
979
+ {
984
980
if (trace)
985
981
htrc (" DIR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n " ,
986
- Name, tdbp ->GetTdb_No (), ColUse, Status, Buf_Type, N);
982
+ Name, Tdbp ->GetTdb_No (), ColUse, Status, Buf_Type, N);
987
983
988
984
/* ********************************************************************/
989
985
/* Retrieve the information corresponding to the column number. */
990
986
/* ********************************************************************/
991
987
switch (N) {
992
988
#if defined(__WIN__)
993
- case 0 : Value->SetValue_psz (tdbp ->Drive ); break ;
989
+ case 0 : Value->SetValue_psz (Tdbp ->Drive ); break ;
994
990
#endif // __WIN__
995
- case 1 : Value->SetValue_psz (tdbp ->Direc ); break ;
996
- case 2 : Value->SetValue_psz (tdbp ->Fname ); break ;
997
- case 3 : Value->SetValue_psz (tdbp ->Ftype ); break ;
991
+ case 1 : Value->SetValue_psz (Tdbp ->Direc ); break ;
992
+ case 2 : Value->SetValue_psz (Tdbp ->Fname ); break ;
993
+ case 3 : Value->SetValue_psz (Tdbp ->Ftype ); break ;
998
994
#if defined(__WIN__)
999
- case 4 : Value->SetValue ((int )tdbp ->FileData .dwFileAttributes ); break ;
1000
- case 5 : Value->SetValue ((int )tdbp ->FileData .nFileSizeLow ); break ;
1001
- case 6 : SetTimeValue (g, tdbp ->FileData .ftLastWriteTime ); break ;
1002
- case 7 : SetTimeValue (g, tdbp ->FileData .ftCreationTime ); break ;
1003
- case 8 : SetTimeValue (g, tdbp ->FileData .ftLastAccessTime ); break ;
995
+ case 4 : Value->SetValue ((int )Tdbp ->FileData .dwFileAttributes ); break ;
996
+ case 5 : Value->SetValue ((int )Tdbp ->FileData .nFileSizeLow ); break ;
997
+ case 6 : SetTimeValue (g, Tdbp ->FileData .ftLastWriteTime ); break ;
998
+ case 7 : SetTimeValue (g, Tdbp ->FileData .ftCreationTime ); break ;
999
+ case 8 : SetTimeValue (g, Tdbp ->FileData .ftLastAccessTime ); break ;
1004
1000
#else // !__WIN__
1005
- case 4 : Value->SetValue ((int )tdbp ->Fileinfo .st_mode ); break ;
1006
- case 5 : Value->SetValue ((int )tdbp ->Fileinfo .st_size ); break ;
1007
- case 6 : Value->SetValue ((int )tdbp ->Fileinfo .st_mtime ); break ;
1008
- case 7 : Value->SetValue ((int )tdbp ->Fileinfo .st_ctime ); break ;
1009
- case 8 : Value->SetValue ((int )tdbp ->Fileinfo .st_atime ); break ;
1010
- case 9 : Value->SetValue ((int )tdbp ->Fileinfo .st_uid ); break ;
1011
- case 10 : Value->SetValue ((int )tdbp ->Fileinfo .st_gid ); break ;
1001
+ case 4 : Value->SetValue ((int )Tdbp ->Fileinfo .st_mode ); break ;
1002
+ case 5 : Value->SetValue ((int )Tdbp ->Fileinfo .st_size ); break ;
1003
+ case 6 : Value->SetValue ((int )Tdbp ->Fileinfo .st_mtime ); break ;
1004
+ case 7 : Value->SetValue ((int )Tdbp ->Fileinfo .st_ctime ); break ;
1005
+ case 8 : Value->SetValue ((int )Tdbp ->Fileinfo .st_atime ); break ;
1006
+ case 9 : Value->SetValue ((int )Tdbp ->Fileinfo .st_uid ); break ;
1007
+ case 10 : Value->SetValue ((int )Tdbp ->Fileinfo .st_gid ); break ;
1012
1008
#endif // !__WIN__
1013
1009
default :
1014
1010
sprintf (g->Message , MSG (INV_DIRCOL_OFST), N);
@@ -1023,25 +1019,6 @@ void DIRCOL::ReadColumn(PGLOBAL g)
1023
1019
1024
1020
/* ------------------------- Class TDBSDR ---------------------------- */
1025
1021
1026
- /* **********************************************************************/
1027
- /* TABSDR copy constructors. */
1028
- /* **********************************************************************/
1029
- TDBSDR::TDBSDR (PTDBSDR tdbp) : TDBDIR(tdbp)
1030
- {
1031
- Sub = tdbp->Sub ;
1032
- } // end of TDBSDR copy constructor
1033
-
1034
- // Method
1035
- PTDB TDBSDR::Clone (PTABS t)
1036
- {
1037
- PTDB tp;
1038
- PGLOBAL g = t->G ; // Is this really useful ???
1039
-
1040
- tp = new (g) TDBSDR (this );
1041
- tp->SetColumns (Columns);
1042
- return tp;
1043
- } // end of Clone
1044
-
1045
1022
/* **********************************************************************/
1046
1023
/* SDR GetMaxSize: returns the number of retrieved files. */
1047
1024
/* **********************************************************************/
0 commit comments