cid#1607171 Data race condition
[LibreOffice.git] / connectivity / source / inc / file / FDateFunctions.hxx
blobe8eb12d0cf24818d52e72b1f96f25b2b836c881d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <file/fcode.hxx>
24 namespace connectivity::file
26 /** DAYOFWEEK(date)
27 Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard.
29 > SELECT DAYOFWEEK('1998-02-03');
30 -> 3
32 class OOp_DayOfWeek : public OUnaryOperator
34 protected:
35 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
38 /** DAYOFMONTH(date)
39 Returns the day of the month for date, in the range 1 to 31:
41 > SELECT DAYOFMONTH('1998-02-03');
42 -> 3
44 class OOp_DayOfMonth : public OUnaryOperator
46 protected:
47 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
50 /** DAYOFYEAR(date)
51 Returns the day of the year for date, in the range 1 to 366:
53 > SELECT DAYOFYEAR('1998-02-03');
54 -> 34
57 class OOp_DayOfYear : public OUnaryOperator
59 protected:
60 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
63 /** MONTH(date)
64 Returns the month for date, in the range 1 to 12:
66 > SELECT MONTH('1998-02-03');
67 -> 2
69 class OOp_Month : public OUnaryOperator
71 protected:
72 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
75 /** DAYNAME(date)
76 Returns the name of the weekday for date:
78 > SELECT DAYNAME('1998-02-05');
79 -> 'Thursday'
82 class OOp_DayName : public OUnaryOperator
84 protected:
85 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
88 /** MONTHNAME(date)
89 Returns the name of the month for date:
91 > SELECT MONTHNAME('1998-02-05');
92 -> 'February'
95 class OOp_MonthName : public OUnaryOperator
97 protected:
98 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
101 /** QUARTER(date)
102 Returns the quarter of the year for date, in the range 1 to 4:
104 > SELECT QUARTER('98-04-01');
105 -> 2
108 class OOp_Quarter : public OUnaryOperator
110 protected:
111 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
114 /** WEEK(date)
115 WEEK(date,first)
116 With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range 0-53 or 1-52. Here is a table for how the second argument works:
117 Value Meaning
118 0 Week starts on Sunday and return value is in range 0-53
119 1 Week starts on Monday and return value is in range 0-53
120 2 Week starts on Sunday and return value is in range 1-53
121 3 Week starts on Monday and return value is in range 1-53 (ISO 8601)
123 > SELECT WEEK('1998-02-20');
124 -> 7
125 > SELECT WEEK('1998-02-20',0);
126 -> 7
127 > SELECT WEEK('1998-02-20',1);
128 -> 8
129 > SELECT WEEK('1998-12-31',1);
130 -> 53
133 class OOp_Week : public ONthOperator
135 protected:
136 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
139 /** YEAR(date)
140 Returns the year for date, in the range 1000 to 9999:
142 > SELECT YEAR('98-02-03');
143 -> 1998
145 class OOp_Year : public OUnaryOperator
147 protected:
148 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
151 /** HOUR(time)
152 Returns the hour for time, in the range 0 to 23:
154 > SELECT HOUR('10:05:03');
155 -> 10
157 class OOp_Hour : public OUnaryOperator
159 protected:
160 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
163 /** MINUTE(time)
164 Returns the minute for time, in the range 0 to 59:
166 > SELECT MINUTE('98-02-03 10:05:03');
167 -> 5
170 class OOp_Minute : public OUnaryOperator
172 protected:
173 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
176 /** SECOND(time)
177 Returns the second for time, in the range 0 to 59:
179 > SELECT SECOND('10:05:03');
180 -> 3
182 class OOp_Second : public OUnaryOperator
184 protected:
185 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
188 /** CURDATE()
189 CURRENT_DATE
190 Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context:
192 > SELECT CURDATE();
193 -> '1997-12-15'
195 class OOp_CurDate : public ONthOperator
197 protected:
198 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
201 /** CURTIME()
202 CURRENT_TIME
203 Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context:
205 > SELECT CURTIME();
206 -> '23:50:26'
208 class OOp_CurTime : public ONthOperator
210 protected:
211 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
214 /** NOW()
215 Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context:
217 > SELECT NOW();
218 -> '1997-12-15 23:50:26'
220 class OOp_Now : public ONthOperator
222 protected:
223 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */