1 | /* |
2 | * Legal Notice |
3 | * |
4 | * This document and associated source code (the "Work") is a part of a |
5 | * benchmark specification maintained by the TPC. |
6 | * |
7 | * The TPC reserves all right, title, and interest to the Work as provided |
8 | * under U.S. and international laws, including without limitation all patent |
9 | * and trademark rights therein. |
10 | * |
11 | * No Warranty |
12 | * |
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION |
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE |
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER |
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, |
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, |
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR |
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF |
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. |
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, |
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT |
23 | * WITH REGARD TO THE WORK. |
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO |
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE |
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS |
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, |
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, |
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT |
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD |
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. |
32 | * |
33 | * Contributors: |
34 | * Gradient Systems |
35 | */ |
36 | #include "config.h" |
37 | #include "porting.h" |
38 | #include <stdio.h> |
39 | #include <time.h> |
40 | #include "dbgen_version.h" |
41 | #include "columns.h" |
42 | #include "build_support.h" |
43 | #include "tables.h" |
44 | #include "misc.h" |
45 | #include "release.h" |
46 | |
47 | struct DBGEN_VERSION_TBL g_dbgen_version; |
48 | |
49 | /* |
50 | * Routine: |
51 | * Purpose: |
52 | * Algorithm: |
53 | * Data Structures: |
54 | * |
55 | * Params: |
56 | * Returns: |
57 | * Called By: |
58 | * Calls: |
59 | * Assumptions: |
60 | * Side Effects: |
61 | * TODO: None |
62 | */ |
63 | int mk_dbgen_version(void *pDest, ds_key_t kIndex) { |
64 | static int bInit = 0; |
65 | struct DBGEN_VERSION_TBL *r; |
66 | time_t ltime; |
67 | struct tm *pTimeStamp; |
68 | |
69 | if (pDest == NULL) |
70 | r = &g_dbgen_version; |
71 | else |
72 | r = pDest; |
73 | |
74 | if (!bInit) { |
75 | memset(&g_dbgen_version, 0, sizeof(struct DBGEN_VERSION_TBL)); |
76 | bInit = 1; |
77 | } |
78 | |
79 | time(<ime); /* Get time in seconds */ |
80 | pTimeStamp = localtime(<ime); /* Convert time to struct */ |
81 | |
82 | sprintf(r->szDate, "%4d-%02d-%02d" , pTimeStamp->tm_year + 1900, pTimeStamp->tm_mon + 1, pTimeStamp->tm_mday); |
83 | sprintf(r->szTime, "%02d:%02d:%02d" , pTimeStamp->tm_hour, pTimeStamp->tm_min, pTimeStamp->tm_sec); |
84 | sprintf(r->szVersion, "%d.%d.%d%s" , VERSION, RELEASE, MODIFICATION, PATCH); |
85 | strcpy(r->szCmdLineArgs, "--this_table_is_rather_pointless" ); |
86 | |
87 | return (0); |
88 | } |
89 | // |
90 | ///* |
91 | // * Routine: |
92 | // * Purpose: |
93 | // * Algorithm: |
94 | // * Data Structures: |
95 | // * |
96 | // * Params: |
97 | // * Returns: |
98 | // * Called By: |
99 | // * Calls: |
100 | // * Assumptions: |
101 | // * Side Effects: |
102 | // * TODO: None |
103 | // */ |
104 | // int pr_dbgen_version(void *pSrc) { |
105 | // struct DBGEN_VERSION_TBL *r; |
106 | // |
107 | // if (pSrc == NULL) |
108 | // r = &g_dbgen_version; |
109 | // else |
110 | // r = pSrc; |
111 | // |
112 | // print_start(DBGEN_VERSION); |
113 | // print_varchar(DV_VERSION, r->szVersion, 1); |
114 | // print_varchar(DV_CREATE_DATE, r->szDate, 1); |
115 | // print_varchar(DV_CREATE_TIME, r->szTime, 1); |
116 | // print_varchar(DV_CMDLINE_ARGS, r->szCmdLineArgs, 0); |
117 | // print_end(DBGEN_VERSION); |
118 | // |
119 | // return (0); |
120 | //} |
121 | |