Skip to content

Commit

Permalink
"NOW()" is like any other function like "XYZ()"
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 13, 2024
1 parent d1ac84a commit 63e22c4
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ final class Tokenizer
'NATURAL',
'NO OTHERS',
'NOT',
'NOW()',
'NULL',
'OFFSET',
'ON',
Expand Down Expand Up @@ -563,6 +562,7 @@ final class Tokenizer
'MULTIPOLYGONFROMTEXT',
'MULTIPOLYGONFROMWKB',
'NAME_CONST',
'NOW',
'NTH_VALUE',
'NTILE',
'NULLIF',
Expand Down
69 changes: 50 additions & 19 deletions tests/clihighlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,15 @@
---
INSERT INTO `PREFIX_cms_category`
VALUES
(1, 0, 0, 1, NOW(), NOW(), 0)
(
1,
0,
0,
1,
NOW(),
NOW(),
0
)
---
UPDATE
`PREFIX_cms_category`
Expand Down Expand Up @@ -571,39 +579,62 @@
(
'PS_SPECIFIC_PRICE_PRIORITIES',
'id_shop;id_currency;id_country;id_group',
NOW(), NOW()
NOW(),
NOW()
),
(
'PS_TAX_DISPLAY',
0,
NOW(),
NOW()
),
('PS_TAX_DISPLAY', 0, NOW(), NOW()),
(
'PS_SMARTY_FORCE_COMPILE', 1, NOW(),
NOW()
'PS_SMARTY_FORCE_COMPILE',
1,
NOW(),
NOW()
),
(
'PS_DISTANCE_UNIT', 'km', NOW(), NOW()
'PS_DISTANCE_UNIT',
'km',
NOW(),
NOW()
),
(
'PS_STORES_DISPLAY_CMS', 0, NOW(),
NOW()
'PS_STORES_DISPLAY_CMS',
0,
NOW(),
NOW()
),
(
'PS_STORES_DISPLAY_FOOTER', 0, NOW(),
NOW()
'PS_STORES_DISPLAY_FOOTER',
0,
NOW(),
NOW()
),
(
'PS_STORES_SIMPLIFIED', 0, NOW(),
NOW()
'PS_STORES_SIMPLIFIED',
0,
NOW(),
NOW()
),
(
'PS_STATSDATA_CUSTOMER_PAGESVIEWS',
1, NOW(), NOW()
1,
NOW(),
NOW()
),
(
'PS_STATSDATA_PAGESVIEWS', 1, NOW(),
NOW()
'PS_STATSDATA_PAGESVIEWS',
1,
NOW(),
NOW()
),
(
'PS_STATSDATA_PLUGINS', 1, NOW(),
NOW()
'PS_STATSDATA_PLUGINS',
1,
NOW(),
NOW()
)
---
INSERT INTO `PREFIX_configuration` (
Expand All @@ -623,8 +654,8 @@
),
0
),
[37mNOW()[0m,[0m
[37mNOW()[0m
[37mNOW[0m(),[0m
[37mNOW[0m()
)
---
CREATE TEMPORARY TABLE `PREFIX_configuration_tmp` (`value` text)
Expand Down
69 changes: 50 additions & 19 deletions tests/format-highlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,15 @@
---
<pre style="color: black; background-color: white;"><span style="font-weight:bold;">INSERT</span> <span style="font-weight:bold;">INTO</span> <span style="color: purple;">`PREFIX_cms_category`</span>
<span style="font-weight:bold;">VALUES</span>
(<span style="color: green;">1</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span> <span style="color: green;">0</span>)</pre>
(
<span style="color: green;">1</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="color: green;">1</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="color: green;">0</span>
)</pre>
---
<pre style="color: black; background-color: white;"><span style="font-weight:bold;">UPDATE</span>
<span style="color: purple;">`PREFIX_cms_category`</span>
Expand Down Expand Up @@ -571,39 +579,62 @@
(
<span style="color: blue;">'PS_SPECIFIC_PRICE_PRIORITIES'</span><span >,</span>
<span style="color: blue;">'id_shop;id_currency;id_country;id_group'</span><span >,</span>
<span style="font-weight:bold;">NOW()</span><span >,</span> <span style="font-weight:bold;">NOW()</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_TAX_DISPLAY'</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(<span style="color: blue;">'PS_TAX_DISPLAY'</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span> <span style="font-weight:bold;">NOW()</span>)<span >,</span>
(
<span style="color: blue;">'PS_SMARTY_FORCE_COMPILE'</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_SMARTY_FORCE_COMPILE'</span><span >,</span>
<span style="color: green;">1</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_DISTANCE_UNIT'</span><span >,</span> <span style="color: blue;">'km'</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span> <span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_DISTANCE_UNIT'</span><span >,</span>
<span style="color: blue;">'km'</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STORES_DISPLAY_CMS'</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_STORES_DISPLAY_CMS'</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STORES_DISPLAY_FOOTER'</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_STORES_DISPLAY_FOOTER'</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STORES_SIMPLIFIED'</span><span >,</span> <span style="color: green;">0</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_STORES_SIMPLIFIED'</span><span >,</span>
<span style="color: green;">0</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STATSDATA_CUSTOMER_PAGESVIEWS'</span><span >,</span>
<span style="color: green;">1</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span> <span style="font-weight:bold;">NOW()</span>
<span style="color: green;">1</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STATSDATA_PAGESVIEWS'</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_STATSDATA_PAGESVIEWS'</span><span >,</span>
<span style="color: green;">1</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)<span >,</span>
(
<span style="color: blue;">'PS_STATSDATA_PLUGINS'</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="color: blue;">'PS_STATSDATA_PLUGINS'</span><span >,</span>
<span style="color: green;">1</span><span >,</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)</pre>
---
<pre style="color: black; background-color: white;"><span style="font-weight:bold;">INSERT</span> <span style="font-weight:bold;">INTO</span> <span style="color: purple;">`PREFIX_configuration`</span> (
Expand All @@ -623,8 +654,8 @@
)<span >,</span>
<span style="color: green;">0</span>
)<span >,</span>
<span style="font-weight:bold;">NOW()</span><span >,</span>
<span style="font-weight:bold;">NOW()</span>
<span style="font-weight:bold;">NOW</span>()<span >,</span>
<span style="font-weight:bold;">NOW</span>()
)</pre>
---
<pre style="color: black; background-color: white;"><span style="font-weight:bold;">CREATE</span> <span style="font-weight:bold;">TEMPORARY</span> <span style="font-weight:bold;">TABLE</span> <span style="color: purple;">`PREFIX_configuration_tmp`</span> (<span style="color: purple;">`value`</span> <span style="color: #333;">text</span>)</pre>
Expand Down
53 changes: 42 additions & 11 deletions tests/format.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,15 @@
---
INSERT INTO `PREFIX_cms_category`
VALUES
(1, 0, 0, 1, NOW(), NOW(), 0)
(
1,
0,
0,
1,
NOW(),
NOW(),
0
)
---
UPDATE
`PREFIX_cms_category`
Expand Down Expand Up @@ -571,38 +579,61 @@
(
'PS_SPECIFIC_PRICE_PRIORITIES',
'id_shop;id_currency;id_country;id_group',
NOW(), NOW()
NOW(),
NOW()
),
(
'PS_TAX_DISPLAY',
0,
NOW(),
NOW()
),
('PS_TAX_DISPLAY', 0, NOW(), NOW()),
(
'PS_SMARTY_FORCE_COMPILE', 1, NOW(),
'PS_SMARTY_FORCE_COMPILE',
1,
NOW(),
NOW()
),
(
'PS_DISTANCE_UNIT', 'km', NOW(), NOW()
'PS_DISTANCE_UNIT',
'km',
NOW(),
NOW()
),
(
'PS_STORES_DISPLAY_CMS', 0, NOW(),
'PS_STORES_DISPLAY_CMS',
0,
NOW(),
NOW()
),
(
'PS_STORES_DISPLAY_FOOTER', 0, NOW(),
'PS_STORES_DISPLAY_FOOTER',
0,
NOW(),
NOW()
),
(
'PS_STORES_SIMPLIFIED', 0, NOW(),
'PS_STORES_SIMPLIFIED',
0,
NOW(),
NOW()
),
(
'PS_STATSDATA_CUSTOMER_PAGESVIEWS',
1, NOW(), NOW()
1,
NOW(),
NOW()
),
(
'PS_STATSDATA_PAGESVIEWS', 1, NOW(),
'PS_STATSDATA_PAGESVIEWS',
1,
NOW(),
NOW()
),
(
'PS_STATSDATA_PLUGINS', 1, NOW(),
'PS_STATSDATA_PLUGINS',
1,
NOW(),
NOW()
)
---
Expand Down
Loading

0 comments on commit 63e22c4

Please sign in to comment.