#', '\\n', $descr);
+ $descr = strip_tags($descr);
+ $descr = preg_replace('#\s+#', ' ', $descr);
+ $entry['description'] = trim($descr);
+ //var_dump($entry);
+ //break(2);
+ $iniEntries[] = $entry;
+ }
+ }
+ //break;
+ }
+
+ /*
+ * non-parsable date functions:
+ date(time-value, modifier, modifier, ...)
+ time(time-value, modifier, modifier, ...)
+ datetime(time-value, modifier, modifier, ...)
+ julianday(time-value, modifier, modifier, ...)
+ strftime(format, time-value, modifier, modifier, ...)
+ */
+ $iniEntries[] = [
+ 'name'=>'DATE',
+ 'declaration'=>'time-value, modifier, modifier, ...',
+ 'category'=>'Date And Time Functions',
+ 'description'=>'All five date and time functions take a time value as an argument. The time value is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument.',
+ ];
+ $iniEntries[] = [
+ 'name'=>'TIME',
+ 'declaration'=>'time-value, modifier, modifier, ...',
+ 'category'=>'Date And Time Functions',
+ 'description'=>'All five date and time functions take a time value as an argument. The time value is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument.',
+ ];
+ $iniEntries[] = [
+ 'name'=>'DATETIME',
+ 'declaration'=>'time-value, modifier, modifier, ...',
+ 'category'=>'Date And Time Functions',
+ 'description'=>'All five date and time functions take a time value as an argument. The time value is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument.',
+ ];
+ $iniEntries[] = [
+ 'name'=>'JULIANDAY',
+ 'declaration'=>'time-value, modifier, modifier, ...',
+ 'category'=>'Date And Time Functions',
+ 'description'=>'All five date and time functions take a time value as an argument. The time value is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument.',
+ ];
+ $iniEntries[] = [
+ 'name'=>'STRFTIME',
+ 'declaration'=>'format, time-value, modifier, modifier, ...',
+ 'category'=>'Date And Time Functions',
+ 'description'=>'All five date and time functions take a time value as an argument. The time value is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument.',
+ ];
+
+ return finalizeEntries($iniEntries, true);
+}
+
+
+function gen_mysql(int $port)
+{
+ // Insert your custom password and port
+ $mysqli = mysqli_connect('localhost', 'root', null, null, $port);
+ $query = mysqli_query($mysqli, "SELECT t.name, t.description, c.name AS categ
+ FROM mysql.help_topic t, mysql.help_category c
+ WHERE
+ t.help_category_id = c.help_category_id
+ AND c.name NOT LIKE 'Internal%'
+ -- and t.name like 'CURRENT_TIMESTAMP'
+ ORDER BY t.name");
+ if(mysqli_errno($mysqli)) {
+ die ('MySQL connection error: '.mysqli_error($mysqli));
+ }
+ $iniEntries = [];
+
+ while($row = mysqli_fetch_object($query)) {
+ $name = $row->name;
+ // Exclude function names with spaces, or other non-word characters:
+ if(!preg_match('#^\w+$#', $name)) {
+ //echo "10\n";
+ continue;
+ }
+ #echo $name."\n";
+ $matchCount = preg_match(
+ '#\b'.preg_quote($row->name).'\s?\[?\(([^\)]*)\)[^\r\n]*[\r\n](.*)$#is',
+ $row->description,
+ $matches);
+ if(!$matchCount) {
+ //echo "20\n";
+ continue;
+ }
+ $declaration = trim($matches[1]);
+ $declaration = preg_replace('#[\r\n]#', ' ', $declaration);
+
+ $description = trim($matches[2]);
+ if(preg_match('#Description\s+\-+[\r\n](.+)#is', $description, $matchesD)) {
+ $description = trim($matchesD[1]);
+ }
+ //$description = preg_replace('#[\r\n]#', ' ', $description);
+ #echo $row->name."\n".$matches[2]."\n".$matches[3]."\n\n";
+ $iniEntries[] = [
+ 'name'=>$row->name,
+ 'declaration'=>$declaration,
+ 'category'=>$row->categ,
+ 'description'=>$description,
+ ];
+
+ }
+ return finalizeEntries($iniEntries, false);
+}
+
+
+function gen_pg(): string
+{
+ /*
+ * https://www.postgresql.org/docs/current/functions-string.html
+ *
+ *
+
+
ascii ( text ) → integer
+
Returns the numeric code of the first character of the argument. In UTF8 encoding, returns the Unicode code point of the character. In other multibyte encodings, the argument must be an ASCII character.
]*\>\]*\>(\w+)\#i', $htmlList, $matches);
+ //var_dump($matches);
+ $keywords = [];
+ foreach ($matches[1] as $kw) {
+ $kw = strtoupper($kw);
+ if(!in_array($kw, $funcs)) {
+ $keywords[] = $kw;
+ }
+ }
+ $keywords = array_unique($keywords);
+ asort($keywords);
+ $keywords = implode(' ', $keywords);
+ $keywords = wordwrap($keywords, 73, "\r\n");
+ $keywords = str_replace(' ', ',', $keywords);
+ $keywords = str_replace("\r\n", ",' +\r\n '", $keywords);
+ return $keywords;
+}
+
+echo gen_mysql();
\ No newline at end of file
diff --git a/out/VC_redist.x64.exe b/out/VC_redist.x64.exe
deleted file mode 100644
index ddf6f79fa..000000000
Binary files a/out/VC_redist.x64.exe and /dev/null differ
diff --git a/out/VC_redist.x86.exe b/out/VC_redist.x86.exe
deleted file mode 100644
index 9c83de901..000000000
Binary files a/out/VC_redist.x86.exe and /dev/null differ
diff --git a/out/fbclient-4.0-32.dll b/out/fbclient-4.0-32.dll
deleted file mode 100644
index 9b578a346..000000000
Binary files a/out/fbclient-4.0-32.dll and /dev/null differ
diff --git a/out/functions-mariadb.ini b/out/functions-mariadb.ini
index 5cd6f9079..f01db1b6d 100644
--- a/out/functions-mariadb.ini
+++ b/out/functions-mariadb.ini
@@ -1,1573 +1,1632 @@
[ABS]
declaration=X
category=Numeric Functions
-description=Returns the absolute (non-negative) value of X. If X is not\na number, it is converted to a numeric type.\n \n\nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n \nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n \nSELECT ABS(DATE ''1994-01-01'');\n+------------------------+\n| ABS(DATE ''1994-01-01'') |\n+------------------------+\n| 19940101 |\n+------------------------+
+description=Returns the absolute (non-negative) value of X. If X is not a number, it is\nconverted to a numeric type.\n\nExamples\n--------\n\nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n\nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n\nSELECT ABS(DATE '1994-01-01');\n+------------------------+\n| ABS(DATE '1994-01-01') |\n+------------------------+\n| 19940101 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/abs/
[ACOS]
declaration=X
category=Numeric Functions
-description=Returns the arc cosine of X, that is, the value whose cosine\nis X.\nReturns NULL if X is not in the range -1 to 1.\n \n\nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n \nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+
-[ADDDATE1]
-name=ADDDATE
+description=Returns the arc cosine of X, that is, the value whose cosine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n\nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n\nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/acos/
+[ADDDATE]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument,\nADDDATE()\nis a synonym for DATE_ADD(). The related function\nSUBDATE() is a synonym for DATE_SUB(). For\ninformation on the INTERVAL unit argument, see the\ndiscussion for\nDATE_ADD().\n \nWhen invoked with the days form of the second argument,\nMariaDB treats it as an\ninteger number of days to be added to expr.\n \n\nSELECT DATE_ADD(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n \nSELECT ADDDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n \nSELECT ADDDATE(''2008-01-02'', 31);\n+---------------------------+\n| ADDDATE(''2008-01-02'', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, ADDDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;\n \n+---------------------+------------------------------+\n| d | ADDDATE(d, INTERVAL 10 HOUR) |\n+---------------------+------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |\n+---------------------+------------------------------+
-[ADDDATE2]
-name=ADDDATE
-declaration=expr,days
-category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument,\nADDDATE()\nis a synonym for DATE_ADD(). The related function\nSUBDATE() is a synonym for DATE_SUB(). For\ninformation on the INTERVAL unit argument, see the\ndiscussion for\nDATE_ADD().\n \nWhen invoked with the days form of the second argument,\nMariaDB treats it as an\ninteger number of days to be added to expr.\n \n\nSELECT DATE_ADD(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n \nSELECT ADDDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n \nSELECT ADDDATE(''2008-01-02'', 31);\n+---------------------------+\n| ADDDATE(''2008-01-02'', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, ADDDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;\n \n+---------------------+------------------------------+\n| d | ADDDATE(d, INTERVAL 10 HOUR) |\n+---------------------+------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |\n+---------------------+------------------------------+
+description=When invoked with the INTERVAL form of the second argument, ADDDATE() is a\nsynonym for DATE_ADD(). The related function SUBDATE() is a synonym for\nDATE_SUB(). For information on the INTERVAL unit argument, see the discussion\nfor DATE_ADD().\n\nWhen invoked with the days form of the second argument, MariaDB treats it as\nan integer number of days to be added to expr.\n\nExamples\n--------\n\nSELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD('2008-01-02', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n\nSELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE('2008-01-02', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n\nSELECT ADDDATE('2008-01-02', 31);\n+---------------------------+\n| ADDDATE('2008-01-02', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d, ADDDATE(d, 10) from t1;\n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n ...
[ADDTIME]
declaration=expr1,expr2
category=Date and Time Functions
-description=ADDTIME() adds expr2 to expr1 and returns the result. expr1\nis a time\nor datetime expression, and expr2 is a time expression.\n \n\nSELECT ADDTIME(''2007-12-31 23:59:59.999999'', ''1\n1:1:1.000002'');\n+---------------------------------------------------------+\n| ADDTIME(''2007-12-31 23:59:59.999999'', ''1\n1:1:1.000002'') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001 |\n+---------------------------------------------------------+\n \nSELECT ADDTIME(''01:00:00.999999'', ''02:00:00.999998'');\n+-----------------------------------------------+\n| ADDTIME(''01:00:00.999999'', ''02:00:00.999998'') |\n+-----------------------------------------------+\n| 03:00:01.999997 |\n+-----------------------------------------------+
+description=ADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time or\ndatetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT ADDTIME('2007-12-31 23:59:59.999999', '1 1:1:1.000002');\n+---------------------------------------------------------+\n| ADDTIME('2007-12-31 23:59:59.999999', '1 1:1:1.000002') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001 |\n+---------------------------------------------------------+\n\nSELECT ADDTIME('01:00:00.999999', '02:00:00.999998');\n+-----------------------------------------------+\n| ADDTIME('01:00:00.999999', '02:00:00.999998') |\n+-----------------------------------------------+\n| 03:00:01.999997 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/addtime/
+[ADD_MONTHS]
+declaration=date, months
+category=Date and Time Functions
+description=ADD_MONTHS adds an integer months to a given date (DATE, DATETIME or\nTIMESTAMP), returning the resulting date.\n\nmonths can be positive or negative. If months is not a whole number, then it\nwill be rounded to the nearest whole number (not truncated).\n\nThe resulting day component will remain the same as that specified in date,\nunless the resulting month has fewer days than the day component of the given\ndate, in which case the day will be the last day of the resulting month.\n\nReturns NULL if given an invalid date, or a NULL argument.\n\nExamples\n--------\n\nSELECT ADD_MONTHS('2012-01-31', 2);\n+-----------------------------+\n| ADD_MONTHS('2012-01-31', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\nSELECT ADD_MONTHS('2012-01-31', -5);\n+------------------------------+\n| ADD_MONTHS('2012-01-31', -5) |\n+------------------------------+\n| 2011-08-31 |\n+------------------------------+\n\nSELECT ADD_MONTHS('2011-01-31', 1);\n+-----------------------------+\n| ADD_MONTHS('2011-01-31', 1) |\n+-----------------------------+\n| 2011-02-28 |\n+-----------------------------+\n\nSELECT ADD_MONTHS('2012-01-31', 1);\n+-----------------------------+\n| ADD_MONTHS('2012-01-31', 1) |\n+-----------------------------+\n| 2012-02-29 |\n+-----------------------------+\n\nSELECT ADD_MONTHS('2012-01-31', 2);\n+-----------------------------+\n| ADD_MONTHS('2012-01-31', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\n ...
[AES_DECRYPT]
declaration=crypt_str,key_str
category=Encryption Functions
-description=This function allows decryption of data using the official\nAES\n(Advanced Encryption Standard) algorithm. For more\ninformation, see\nthe description of AES_ENCRYPT().
+description=This function allows decryption of data using the official AES (Advanced\nEncryption Standard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nMariaDB starting with 11.2\n--------------------------\nFrom MariaDB 11.2, the function supports an initialization vector, and control\nof the block encryption mode. The default mode is specified by the\nblock_encryption_mode system variable, which can be changed when calling the\nfunction with a mode. mode is aes-{128,192,256}-{ecb,cbc,ctr} for example:\n"AES-128-cbc".\n\nFor modes that require it, the initialization_vector iv should be 16 bytes (it\ncan be longer, but the extra bytes are ignored). A shorter iv, where one is\nrequired, results in the function returning NULL. Calling RANDOM_BYTES(16)\nwill generate a random series of bytes that can be used for the iv.\n\nExamples\n--------\n\nFrom MariaDB 11.2.0:\n\nSELECT HEX(AES_ENCRYPT('foo', 'bar', '0123456789abcdef', 'aes-128-ctr')) AS x; \n+--------+\n| x |\n+--------+\n| C57C4B |\n+--------+\n\nSELECT AES_DECRYPT(x'C57C4B', 'bar', '0123456789abcdef', 'aes-128-ctr'); \n+------------------------------------------------------------------+\n| AES_DECRYPT(x'C57C4B', 'bar', '0123456789abcdef', 'aes-128-ctr') |\n+------------------------------------------------------------------+\n| foo |\n+------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/aes_decrypt/
[AES_ENCRYPT]
declaration=str,key_str
category=Encryption Functions
-description=AES_ENCRYPT() and AES_DECRYPT() allow encryption and\ndecryption of\ndata using the official AES (Advanced Encryption Standard)\nalgorithm,\npreviously known as "Rijndael." Encoding with a 128-bit\nkey length is\nused, but you can extend it up to 256 bits by modifying the\nsource. We\nchose 128 bits because it is much faster and it is secure\nenough for\nmost purposes.\n \nAES_ENCRYPT() encrypts a string str using the key key_str,\nand returns a binary string.\n \nAES_DECRYPT() decrypts the encrypted string and returns the\noriginal\nstring.\n \nThe input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n \nBecause AES is a block-level algorithm, padding is used to\nencode\nuneven length strings and so the result string length may be\ncalculated using this formula:\n \n16 x (trunc(string_length / 16) + 1)\n \nIf AES_DECRYPT() detects invalid data or incorrect padding,\nit returns\nNULL. However, it is possible for AES_DECRYPT() to return a\nnon-NULL\nvalue (possibly garbage) if the input data or the key is\ninvalid.\n \n\nINSERT INTO t VALUES\n(AES_ENCRYPT(''text'',SHA2(''password'',512)));
+description=AES_ENCRYPT() and AES_DECRYPT() allow encryption and decryption of data using\nthe official AES (Advanced Encryption Standard) algorithm, previously known as\n"Rijndael." Encoding with a 128-bit key length is used (from MariaDB 11.2.0,\nthis is the default, and can be changed). 128 bits is much faster and is\nsecure enough for most purposes.\n\nAES_ENCRYPT() encrypts a string str using the key key_str, and returns a\nbinary string.\n\nAES_DECRYPT() decrypts the encrypted string and returns the original string.\n\nThe input arguments may be any length. If either argument is NULL, the result\nof this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode uneven\nlength strings and so the result string length may be calculated using this\nformula:\n\n16 x (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL.\nHowever, it is possible for AES_DECRYPT() to return a non-NULL value (possibly\ngarbage) if the input data or the key is invalid.\n\nMariaDB starting with 11.2\n--------------------------\nFrom MariaDB 11.2, the function supports an initialization vector, and control\nof the block encryption mode. The default mode is specified by the\nblock_encryption_mode system variable, which can be changed when calling the\nfunction with a mode. mode is aes-{128,192,256}-{ecb,cbc,ctr} for example:\n"AES-128-cbc".\n\nAES_ENCRYPT(str, key) can no longer be used in persistent virtual columns (and\nthe like).\n\nExamples\n--------\n\nINSERT INTO t VALUES (AES_ENCRYPT('text',SHA2('password',512)));\n\nFrom MariaDB 11.2.0:\n\nSELECT HEX(AES_ENCRYPT('foo', 'bar', '0123456789abcdef', 'aes-256-cbc')) AS x;\n+----------------------------------+\n| x |\n+----------------------------------+\n| 42A3EB91E6DFC40A900D278F99E0726E |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/aes_encrypt/
[ASCII]
declaration=str
category=String Functions
-description=Returns the numeric ASCII value of the leftmost character of\nthe string argument. Returns 0 if the given string is empty\nand NULL if it is NULL.\n \nASCII() works for 8-bit characters.\n \n\nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n| 57 |\n+----------+\n \nSELECT ASCII(''9'');\n+------------+\n| ASCII(''9'') |\n+------------+\n| 57 |\n+------------+\n \nSELECT ASCII(''abc'');\n+--------------+\n| ASCII(''abc'') |\n+--------------+\n| 97 |\n+--------------+
+description=Returns the numeric ASCII value of the leftmost character of the string\nargument. Returns 0 if the given string is empty and NULL if it is NULL.\n\nASCII() works for 8-bit characters.\n\nExamples\n--------\n\nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n| 57 |\n+----------+\n\nSELECT ASCII('9');\n+------------+\n| ASCII('9') |\n+------------+\n| 57 |\n+------------+\n\nSELECT ASCII('abc');\n+--------------+\n| ASCII('abc') |\n+--------------+\n| 97 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/ascii/
[ASIN]
declaration=X
category=Numeric Functions
-description=Returns the arc sine of X, that is, the value whose sine is\nX. Returns\nNULL if X is not in the range -1 to 1.\n \n\nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n \nSELECT ASIN(''foo'');\n+-------------+\n| ASIN(''foo'') |\n+-------------+\n| 0 |\n+-------------+\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: ''foo''\n|\n+---------+------+-----------------------------------------+
+description=Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if\nX is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n\nSELECT ASIN('foo');\n+-------------+\n| ASIN('foo') |\n+-------------+\n| 0 |\n+-------------+\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: 'foo' |\n+---------+------+-----------------------------------------+\n\nURL: https://mariadb.com/kb/en/asin/
[ATAN]
declaration=X
category=Numeric Functions
-description=Returns the arc tangent of X, that is, the value whose\ntangent is X.\n \n\nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n \nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+
+description=Returns the arc tangent of X, that is, the value whose tangent is X.\n\nExamples\n--------\n\nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n\nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/atan/
+[ATAN2]
+declaration=Y,X
+category=Numeric Functions
+description=Returns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both arguments\nare used to determine the quadrant of the result.\n\nExamples\n--------\n\nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2) |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n\nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0) |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/atan2/
[AVG]
declaration=[DISTINCT] expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the average value of expr. The DISTINCT option can\nbe used to return the average of the distinct values of\nexpr. NULL values are ignored. It is an aggregate function,\nand so can be used with the GROUP BY clause.\n \nAVG() returns NULL if there were no matching rows.\n \nFrom MariaDB 10.2.0, AVG() can be used as a window function.\n \n\nCREATE TABLE sales (sales_value INT);\n \nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT AVG(sales_value) FROM sales;\n \n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n \nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n \nCommonly, AVG() is used with a GROUP BY clause:\n \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n \nSELECT name, AVG(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,AVG(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nAs a window function:\n \nCREATE TABLE student_test (name CHAR(10), test CHAR(10),\nscore TINYINT); \n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\ntest) \n AS average_by_test FROM student_test;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+
+description=Returns the average value of expr. The DISTINCT option can be used to return\nthe average of the distinct values of expr. NULL values are ignored. It is an\naggregate function, and so can be used with the GROUP BY clause.\n\nAVG() returns NULL if there were no matching rows.\n\nAVG() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\n\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT AVG(sales_value) FROM sales;\n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n\nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n\nCommonly, AVG() is used with a GROUP BY clause:\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);\n\nSELECT name, AVG(score) FROM student GROUP BY name;\n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\n ...
[BENCHMARK]
declaration=count,expr
category=Information Functions
-description=The BENCHMARK() function executes the expression expr\nrepeatedly count\ntimes. It may be used to time how quickly MariaDB processes\nthe\nexpression. The result value is always 0. The intended use\nis from\nwithin the mysql client, which reports query execution\ntimes.\n \n\nSELECT BENCHMARK(1000000,ENCODE(''hello'',''goodbye''));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(''hello'',''goodbye'')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)
+description=The BENCHMARK() function executes the expression expr repeatedly count times.\nIt may be used to time how quickly MariaDB processes the expression. The\nresult value is always 0. The intended use is from within the mariadb client,\nwhich reports query execution times.\n\nExamples\n--------\n\nSELECT BENCHMARK(1000000,ENCODE('hello','goodbye'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE('hello','goodbye')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n\nURL: https://mariadb.com/kb/en/benchmark/
+[BIGINT]
+declaration=M
+category=Data Types
+description=A large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so\nthat the BIGINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nSERIAL is an alias for:\n\nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n\nINT8 is a synonym for BIGINT.\n\nExamples\n--------\n\nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO bigints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column 'b' at row 1\n\nINSERT INTO bigints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column 'c' at row 1\n\nINSERT INTO bigints VALUES (-10,10,10);\n\nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nERROR 1264 (22003): Out of range value for column 'a' at row 1\n\nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n\nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n+---------------------+---------------------+----------------------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO bigints VALUES (-10,-10,-10);\n ...
+[BIN]
+declaration=N
+category=String Functions
+description=Returns a string representation of the binary value of the given longlong\n(that is, BIGINT) number. This is equivalent to CONV(N,10,2). The argument\nshould be positive. If it is a FLOAT, it will be truncated. Returns NULL if\nthe argument is NULL.\n\nExamples\n--------\n\nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\n+---------+\n\nURL: https://mariadb.com/kb/en/bin/
[BINARY]
declaration=M
category=Data Types
-description=The BINARY type is similar to the CHAR type, but stores\nbinary\nbyte strings rather than non-binary character strings. M\nrepresents the\ncolumn length in bytes.\n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nBINARY values are right-padded with 0x00 (the zero byte) to\nthe specified length when inserted. The padding is not\nremoved on select, so this needs to be taken into account\nwhen sorting and comparing, where all bytes are significant.\nThe zero byte, 0x00 is less than a space for comparison\npurposes.\n \n\nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE bins (a BINARY(10));\n \nINSERT INTO bins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM bins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=''STRICT_ALL_TABLES'';\n \nINSERT INTO bins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(''A''),(''B''),(''a''),(''b'');\n \nSELECT * FROM bins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM bins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \nThe field is a BINARY(10), so padding of two ''\0''s are\ninserted, causing comparisons that don''t take this into\naccount to fail:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(''12345678'');\n \nSELECT a = ''12345678'', a = ''12345678\0\0'' from bins;\n \n+----------------+--------------------+\n| a = ''12345678'' | a = ''12345678\0\0'' |\n+----------------+--------------------+\n| 0 | 1 |\n+----------------+--------------------+
+description=The BINARY type is similar to the CHAR type, but stores binary byte strings\nrather than non-binary character strings. M represents the column length in\nbytes.\n\nIt contains no character set, and comparison and sorting are based on the\nnumeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the\nextra characters will be dropped with a warning. If strict mode is enabled, an\nerror will occur.\n\nBINARY values are right-padded with 0x00 (the zero byte) to the specified\nlength when inserted. The padding is not removed on select, so this needs to\nbe taken into account when sorting and comparing, where all bytes are\nsignificant. The zero byte, 0x00 is less than a space for comparison purposes.\n\nExamples\n--------\n\nInserting too many characters, first with strict mode off, then with it on:\n\nCREATE TABLE bins (a BINARY(10));\n\nINSERT INTO bins VALUES('12345678901');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM bins;\n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode='STRICT_ALL_TABLES';\n\nINSERT INTO bins VALUES('12345678901');\nERROR 1406 (22001): Data too long for column 'a' at row 1\n\nSorting is performed with the byte value:\n\nTRUNCATE bins;\n\nINSERT INTO bins VALUES('A'),('B'),('a'),('b');\n\nSELECT * FROM bins ORDER BY a;\n+------+\n| a |\n+------+\n| A |\n| B |\n ...
[BINLOG_GTID_POS]
declaration=binlog_filename,binlog_offset
category=Information Functions
-description=The BINLOG_GTID_POS() function takes as input an old-style\nbinary log position in the form of a file name and a file\noffset. It looks up the position in the current binlog, and\nreturns a string representation of the corresponding GTID\nposition. If the position is not found in the current\nbinlog, NULL is returned.\n \n\nSELECT BINLOG_GTID_POS("master-bin.000001", 600);
-[BIN]
-declaration=N
-category=String Functions
-description=Returns a string representation of the binary value of the\ngiven longlong (that is, BIGINT) number. This is equivalent\nto CONV(N,10,2). The argument should be positive. If it is a\nFLOAT, it will be truncated. Returns NULL if the argument is\nNULL.\n \n\nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\n+---------+
+description=The BINLOG_GTID_POS() function takes as input an old-style binary log position\nin the form of a file name and a file offset. It looks up the position in the\ncurrent binlog, and returns a string representation of the corresponding GTID\nposition. If the position is not found in the current binlog, NULL is returned.\n\nExamples\n--------\n\nSELECT BINLOG_GTID_POS("master-bin.000001", 600);\n\nURL: https://mariadb.com/kb/en/binlog_gtid_pos/
+[BIT]
+declaration=M
+category=Data Types
+description=A bit-field type. M indicates the number of bits per value, from 1 to 64. The\ndefault is 1 if M is omitted.\n\nBit values can be inserted with b'value' notation, where value is the bit\nvalue in 0's and 1's.\n\nBit fields are automatically zero-padded from the left to the full length of\nthe bit, so for example in a BIT(4) field, '10' is equivalent to '0010'.\n\nBits are returned as binary, so to display them, either add 0, or use a\nfunction such as HEX, OCT or BIN to convert them.\n\nExamples\n--------\n\nCREATE TABLE b ( b1 BIT(8) );\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO b VALUES (b'11111111');\n\nINSERT INTO b VALUES (b'01010101');\n\nINSERT INTO b VALUES (b'1111111111111');\nERROR 1406 (22001): Data too long for column 'b1' at row 1\n\nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n+------+---------+---------+----------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO b VALUES (b'11111111'),(b'01010101'),(b'1111111111111');\nQuery OK, 3 rows affected, 1 warning (0.10 sec)\nRecords: 3 Duplicates: 0 Warnings: 1\n\nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column 'b1' at row 3 |\n+---------+------+---------------------------------------------+\n\nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n ...
[BIT_AND]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the bitwise AND of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_AND() can be used as a window\nfunction.\n \n\nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (''a'',111),(''a'',110),(''a'',100),\n (''b'',''000''),(''b'',001),(''b'',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+
+description=Returns the bitwise AND of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_AND will return a value with all bits set to 1. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_AND can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n ('a',111),('a',110),('a',100),\n ('b','000'),('b',001),('b',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_AND(NULL);\n+----------------------+\n| BIT_AND(NULL) |\n+----------------------+\n| 18446744073709551615 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/bit_and/
[BIT_COUNT]
declaration=N
category=Bit Functions
-description=Returns the number of bits that are set in the argument N.\n \n\nSELECT BIT_COUNT(29), BIT_COUNT(b''101010'');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b''101010'') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+
+description=Returns the number of bits that are set in the argument N.\n\nExamples\n--------\n\nSELECT BIT_COUNT(29), BIT_COUNT(b'101010');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b'101010') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+\n\nURL: https://mariadb.com/kb/en/bit_count/
[BIT_LENGTH]
declaration=str
category=String Functions
-description=Returns the length of the given string argument in bits. If\nthe argument is not a string, it will be converted to\nstring. If the argument is NULL, it returns NULL.\n \n\nSELECT BIT_LENGTH(''text'');\n+--------------------+\n| BIT_LENGTH(''text'') |\n+--------------------+\n| 32 |\n+--------------------+\n \nSELECT BIT_LENGTH('''');\n+----------------+\n| BIT_LENGTH('''') |\n+----------------+\n| 0 |\n+----------------+\n \nCompatibility\n \nPostgreSQL and Sybase support BIT_LENGTH().
+description=Returns the length of the given string argument in bits. If the argument is\nnot a string, it will be converted to string. If the argument is NULL, it\nreturns NULL.\n\nExamples\n--------\n\nSELECT BIT_LENGTH('text');\n+--------------------+\n| BIT_LENGTH('text') |\n+--------------------+\n| 32 |\n+--------------------+\n\nSELECT BIT_LENGTH('');\n+----------------+\n| BIT_LENGTH('') |\n+----------------+\n| 0 |\n+----------------+\n\nCompatibility\n-------------\n\nPostgreSQL and Sybase support BIT_LENGTH().\n\nURL: https://mariadb.com/kb/en/bit_length/
[BIT_OR]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the bitwise OR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_OR can be used as a window\nfunction.\n \n\nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (''a'',111),(''a'',110),(''a'',100),\n (''b'',''000''),(''b'',001),(''b'',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+
+description=Returns the bitwise OR of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_OR will return a value with all bits set to 0. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_OR can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n ('a',111),('a',110),('a',100),\n ('b','000'),('b',001),('b',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_OR(NULL);\n+--------------+\n| BIT_OR(NULL) |\n+--------------+\n| 0 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/bit_or/
[BIT_XOR]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the bitwise XOR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_XOR() can be used as a window\nfunction.\n \n\nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (''a'',111),(''a'',110),(''a'',100),\n (''b'',''000''),(''b'',001),(''b'',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+
+description=Returns the bitwise XOR of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_XOR will return a value with all bits set to 0. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_XOR can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n ('a',111),('a',110),('a',100),\n ('b','000'),('b',001),('b',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_XOR(NULL);\n+---------------+\n| BIT_XOR(NULL) |\n+---------------+\n| 0 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/bit_xor/
+[BLOB]
+declaration=M
+category=Data Types
+description=A BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each BLOB value\nis stored using a two-byte length prefix that indicates the number of bytes in\nthe value.\n\nAn optional length M can be given for this type. If this is done, MariaDB\ncreates the column as the smallest BLOB type large enough to hold values M\nbytes long.\n\nBLOBS can also be used to store dynamic columns.\n\nBLOB and TEXT columns can both be assigned a DEFAULT value.\n\nIndexing\n--------\n\nMariaDB starting with 10.4\n--------------------------\nFrom MariaDB 10.4, it is possible to set a unique index on a column that uses\nthe BLOB data type. In previous releases this was not possible, as the index\nwould only guarantee the uniqueness of a fixed number of characters.\n\nOracle Mode\n-----------\n\nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for LONGBLOB.\n\nURL: https://mariadb.com/kb/en/blob/
[CAST]
declaration=expr AS type
category=String Functions
-description=The CAST() function takes a value of one type and produces a\nvalue of another type, similar to the CONVERT() function.\nFor more information, see the description of CONVERT(). \n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nIn MariaDB 10.4 and later, you can use the CAST() function\nwith the INTERVAL keyword.\n \nUntil MariaDB 5.5.31, X''HHHH'', the standard SQL syntax for\nbinary string literals, erroneously worked in the same way\nas 0xHHHH. In 5.5.31 it was intentionally changed to behave\nas a string in all contexts (and never as a number).\n \nThis introduces an incompatibility with previous versions of\nMariaDB, and all versions of MySQL (see the example below). \n \n\nSimple casts:\n \nSELECT CAST("abc" AS BINARY);\nSELECT CAST("1" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n \nNote that when one casts to CHAR without specifying the\ncharacter set, the collation_connection character set\ncollation will be used. When used with CHAR CHARACTER SET,\nthe default collation for that character set will be used.\n \nSELECT COLLATION(CAST(123 AS CHAR));\n+------------------------------+\n| COLLATION(CAST(123 AS CHAR)) |\n+------------------------------+\n| latin1_swedish_ci |\n+------------------------------+\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8));\n+-------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8)) |\n+-------------------------------------------------+\n| utf8_general_ci |\n+-------------------------------------------------+\n \nIf you also want to change the collation, you have to use\nthe COLLATE operator:\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) \n COLLATE utf8_unicode_ci);\n+-------------------------------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) COLLATE\nutf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n \nUsing CAST() to order an ENUM field as a CHAR rather than\nthe internal numerical value:\n \nCREATE TABLE enum_list (enum_field enum(''c'',''a'',''b''));\n \nINSERT INTO enum_list (enum_field) \nVALUES(''c''),(''a''),(''c''),(''b'');\n \nSELECT * FROM enum_list \nORDER BY enum_field;\n \n+------------+\n| enum_field |\n+------------+\n| c |\n| c |\n| a |\n| b |\n+------------+\n \nSELECT * FROM enum_list \nORDER BY CAST(enum_field AS CHAR);\n+------------+\n| enum_field |\n+------------+\n| a |\n| b |\n| c |\n| c |\n+------------+\n \nFrom MariaDB 5.5.31, the following will trigger warnings,\nsince x''aa'' and ''X''aa'' no longer behave as a number.\nPreviously, and in all versions of MySQL, no warnings are\ntriggered since they did erroneously behave as a number:\n \nSELECT CAST(0xAA AS UNSIGNED), CAST(x''aa'' AS UNSIGNED),\nCAST(X''aa'' AS UNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x''aa'' AS UNSIGNED) |\nCAST(X''aa'' AS UNSIGNED) |\n+------------------------+-------------------------+-------------------------+\n| 170 | 0 | 0 |\n+------------------------+-------------------------+-------------------------+\n1 row in set, 2 warnings (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n''\xAA''\nWarning (Code 1292): Truncated incorrect INTEGER value:\n''\xAA''\n \nCasting to intervals:\n \nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS\n"Cast";\n \n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\n+-------------+
-[CEILING]
+description=The CAST() function takes a value of one type and produces a value of another\ntype, similar to the CONVERT() function.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nThe main difference between CAST and CONVERT() is that CONVERT(expr,type) is\nODBC syntax while CAST(expr as type) and CONVERT(... USING ...) are SQL92\nsyntax.\n\nIn MariaDB 10.4 and later, you can use the CAST() function with the INTERVAL\nkeyword.\n\nUntil MariaDB 5.5.31, X'HHHH', the standard SQL syntax for binary string\nliterals, erroneously worked in the same way as 0xHHHH. In 5.5.31 it was\nintentionally changed to behave as a string in all contexts (and never as a\nnumber).\n\nThis introduced an incompatibility with previous versions of MariaDB, and all\nversions of MySQL (see the example below).\n\nExamples\n--------\n\nSimple casts:\n\nSELECT CAST("abc" AS BINARY);\nSELECT CAST("1" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n\nNote that when one casts to CHAR without specifying the character set, the\ncollation_connection character set collation will be used. When used with CHAR\nCHARACTER SET, the default collation for that character set will be used.\n\nSELECT COLLATION(CAST(123 AS CHAR));\n+------------------------------+\n ...
+[CEIL]
declaration=X
category=Numeric Functions
-description=Returns the smallest integer value not less than X.\n \n\nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+
-[CEIL]
+description=CEIL() is a synonym for CEILING().\n\nURL: https://mariadb.com/kb/en/ceil/
+[CEILING]
declaration=X
category=Numeric Functions
-description=CEIL() is a synonym for CEILING().
-[CHARACTER_LENGTH]
-declaration=str
-category=String Functions
-description=CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().
+description=Returns the smallest integer value not less than X.\n\nExamples\n--------\n\nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n\nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+\n\nURL: https://mariadb.com/kb/en/ceiling/
+[CHAR]
+declaration=M
+category=Data Types
+description=A fixed-length string that is always right-padded with spaces to the specified\nlength when stored. M represents the column length in characters. The range of\nM is 0 to 255. If M is omitted, the length is 1.\n\nCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns\ncannot be part of an index. The CONNECT storage engine does not support\nCHAR(0).\n\nNote: Trailing spaces are removed when CHAR values are retrieved unless the\nPAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nBefore MariaDB 10.2, all collations were of type PADSPACE, meaning that CHAR\n(as well as VARCHAR and TEXT) values are compared without regard for trailing\nspaces. This does not apply to the LIKE pattern-matching operator, which takes\ninto account trailing spaces.\n\nIf a unique index consists of a column where trailing pad characters are\nstripped or ignored, inserts into that column where values differ only by the\nnumber of trailing pad characters will result in a duplicate-key error.\n\nExamples\n--------\n\nTrailing spaces:\n\nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES('Maria ');\n\nSELECT c='Maria',c='Maria ' FROM strtest;\n+-----------+--------------+\n| c='Maria' | c='Maria ' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n\nSELECT c LIKE 'Maria',c LIKE 'Maria ' FROM strtest;\n+----------------+-------------------+\n| c LIKE 'Maria' | c LIKE 'Maria ' |\n+----------------+-------------------+\n| 1 | 0 |\n+----------------+-------------------+\n\nNO PAD Collations\n-----------------\n\nNO PAD collations regard trailing spaces as normal characters. You can get a\nlist of all NO PAD collations by querying the Information Schema Collations\ntable, for example:\n\nSELECT collation_name FROM information_schema.collations \n ...
[CHARSET]
declaration=str
category=Information Functions
-description=Returns the character set of the string argument. If str is\nnot a string, it is considered as a binary string (so the\nfunction returns ''binary''). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \n\nSELECT CHARSET(''abc'');\n+----------------+\n| CHARSET(''abc'') |\n+----------------+\n| latin1 |\n+----------------+\n \nSELECT CHARSET(CONVERT(''abc'' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(''abc'' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n \nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+
+description=Returns the character set of the string argument. If str is not a string, it\nis considered as a binary string (so the function returns 'binary'). This\napplies to NULL, too. The return value is a string in the utf8 character set.\n\nExamples\n--------\n\nSELECT CHARSET('abc');\n+----------------+\n| CHARSET('abc') |\n+----------------+\n| latin1 |\n+----------------+\n\nSELECT CHARSET(CONVERT('abc' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT('abc' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n\nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/charset/
[CHAR_LENGTH]
declaration=str
category=String Functions
-description=Returns the length of the given string argument, measured in\ncharacters. A multi-byte character counts as a single\ncharacter. This means that for a string containing five\ntwo-byte characters, LENGTH() (or OCTET_LENGTH() in Oracle\nmode) returns 10, whereas CHAR_LENGTH() returns 5. If the\nargument is NULL, it returns NULL. \n \nIf the argument is not a string value, it is converted into\na string.\n \nIt is synonymous with the CHARACTER_LENGTH() function.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \n\nSELECT CHAR_LENGTH(''MariaDB'');\n+------------------------+\n| CHAR_LENGTH(''MariaDB'') |\n+------------------------+\n| 7 |\n+------------------------+\n \nSELECT CHAR_LENGTH(''?'');\n+-------------------+\n| CHAR_LENGTH(''?'') |\n+-------------------+\n| 1 |\n+-------------------+
+description=Returns the length of the given string argument, measured in characters. A\nmulti-byte character counts as a single character. This means that for a\nstring containing five two-byte characters, LENGTH() (or OCTET_LENGTH() in\nOracle mode) returns 10, whereas CHAR_LENGTH() returns 5. If the argument is\nNULL, it returns NULL.\n\nIf the argument is not a string value, it is converted into a string.\n\nIt is synonymous with the CHARACTER_LENGTH() function.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH('MariaDB');\n+------------------------+\n| CHAR_LENGTH('MariaDB') |\n+------------------------+\n| 7 |\n+------------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/kb/en/char_length/
[CHR]
declaration=N
category=String Functions
-description=CHR() interprets each argument N as an integer and returns a\nVARCHAR(1) string consisting of the character given by the\ncode values of the integer. The character set and collation\nof the string are set according to the values of the\ncharacter_set_database and collation_database system\nvariables.\n \nCHR() is similar to the CHAR() function, but only accepts a\nsingle argument.\n \nCHR() is available in all sql_modes.\n \n\nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C |\n+---------+\n \nSELECT CHR(''67'');\n+-----------+\n| CHR(''67'') |\n+-----------+\n| C |\n+-----------+\n \nSELECT CHR(''C'');\n+----------+\n| CHR(''C'') |\n+----------+\n| |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: ''C''\n|\n+---------+------+----------------------------------------+
+description=CHR() interprets each argument N as an integer and returns a VARCHAR(1) string\nconsisting of the character given by the code values of the integer. The\ncharacter set and collation of the string are set according to the values of\nthe character_set_database and collation_database system variables.\n\nCHR() is similar to the CHAR() function, but only accepts a single argument.\n\nCHR() is available in all sql_modes.\n\nExamples\n--------\n\nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C |\n+---------+\n\nSELECT CHR('67');\n+-----------+\n| CHR('67') |\n+-----------+\n| C |\n+-----------+\n\nSELECT CHR('C');\n+----------+\n| CHR('C') |\n+----------+\n| |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: 'C' |\n+---------+------+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/chr/
[COALESCE]
declaration=value,...
category=Comparison Operators
-description=Returns the first non-NULL value in the list, or NULL if\nthere are no\nnon-NULL values. At least one parameter must be passed.\n \nSee also NULL Values in MariaDB.\n \n\nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n \nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n \nWhen two arguments are given, COALESCE() is the same as\nIFNULL():\n \nSET @a=NULL, @b=1;\n \nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n \nHex type confusion:\n \nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31),\nCOALESCE(0x61));\n \nSELECT * FROM t1;\n \n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n \nThe reason for the differing results above is that when 0x31\nis inserted directly to the column, it''s treated as a\nnumber (see Hexadecimal Literals), while when 0x31 is passed\nto COALESCE(), it''s treated as a string, because:\nHEX values have a string data type by default.\nCOALESCE() has the same data type as the argument.
+description=Returns the first non-NULL value in the list, or NULL if there are no non-NULL\nvalues. At least one parameter must be passed.\n\nThe function is useful when substituting a default value for null values when\ndisplaying data.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n\nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n\nWhen two arguments are given, COALESCE() is the same as IFNULL():\n\nSET @a=NULL, @b=1;\n\nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n\nHex type confusion:\n\nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31), COALESCE(0x61));\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n\nThe reason for the differing results above is that when 0x31 is inserted\n ...
[COERCIBILITY]
declaration=str
category=Information Functions
-description=Returns the collation coercibility value of the string\nargument. Coercibility defines what will be converted to\nwhat in case of collation conflict, with an expression with\nhigher coercibility being converted to the collation of an\nexpression with lower coercibility.\n \nCoercibility | Description | Example | \n \n0 | Explicit | Value using a COLLATE clause | \n \n1 | No collation | Concatenated strings using different\ncollations | \n \n2 | Implicit | Column value | \n \n3 | Constant | USER() return value | \n \n4 | Coercible | Literal string | \n \n5 | Ignorable | NULL or derived from NULL | \n \n\nSELECT COERCIBILITY(''abc'' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(''abc'' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n \nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n| 3 |\n+----------------------+\n \nSELECT COERCIBILITY(''abc'');\n+---------------------+\n| COERCIBILITY(''abc'') |\n+---------------------+\n| 4 |\n+---------------------+
+description=Returns the collation coercibility value of the string argument. Coercibility\ndefines what will be converted to what in case of collation conflict, with an\nexpression with higher coercibility being converted to the collation of an\nexpression with lower coercibility.\n\n+-----------------------------+---------------------------+------------------+\n| Coercibility | Description | Example |\n+-----------------------------+---------------------------+------------------+\n| 0 | Explicit | Value using a |\n| | | COLLATE clause |\n+-----------------------------+---------------------------+------------------+\n| 1 | No collation | Concatenated |\n| | | strings using |\n| | | different |\n| | | collations |\n+-----------------------------+---------------------------+------------------+\n| 2 | Implicit | A string data |\n| | | type column |\n| | | value, CAST to |\n| | | a string data |\n| | | type |\n+-----------------------------+---------------------------+------------------+\n| 3 | System constant | DATABASE(), |\n| | | USER() return |\n| | | value |\n+-----------------------------+---------------------------+------------------+\n| 4 | Coercible | Literal string |\n+-----------------------------+---------------------------+------------------+\n| 5 | Numeric | Numeric and |\n| | | temporal values |\n+-----------------------------+---------------------------+------------------+\n| 6 | Ignorable | NULL or derived |\n| | | from NULL |\n+-----------------------------+---------------------------+------------------+\n\nExamples\n--------\n\nSELECT COERCIBILITY('abc' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY('abc' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n\nSELECT COERCIBILITY(CAST(1 AS CHAR));\n+-------------------------------+\n| COERCIBILITY(CAST(1 AS CHAR)) |\n+-------------------------------+\n| 2 |\n ...
[COLLATION]
declaration=str
category=Information Functions
-description=Returns the collation of the string argument. If str is not\na string, it is considered as a binary string (so the\nfunction returns ''binary''). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nSee Character Sets and Collations.\n \n\nSELECT COLLATION(''abc'');\n+-------------------+\n| COLLATION(''abc'') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n \nSELECT COLLATION(_utf8''abc'');\n+-----------------------+\n| COLLATION(_utf8''abc'') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+
-[COLUMN_ADD1]
-name=COLUMN_ADD
+description=Returns the collation of the string argument. If str is not a string, it is\nconsidered as a binary string (so the function returns 'binary'). This applies\nto NULL, too. The return value is a string in the utf8 character set.\n\nSee Character Sets and Collations.\n\nExamples\n--------\n\nSELECT COLLATION('abc');\n+-------------------+\n| COLLATION('abc') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n\nSELECT COLLATION(_utf8'abc');\n+-----------------------+\n| COLLATION(_utf8'abc') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/collation/
+[COLUMN_ADD]
declaration=dyncol_blob, column_nr, value [as type], [column_nr, value [as type]]...
category=Dynamic Column Functions
-description=Adds or updates dynamic columns.\ndyncol_blob must be either a valid dynamic columns blob (for\nexample, COLUMN_CREATE returns such blob), or an empty\nstring.\ncolumn_name specifies the name of the column to be added. If\ndyncol_blob already has a column with this name, it will be\noverwritten.\nvalue specifies the new value for the column. Passing a NULL\nvalue will cause the column to be deleted.\nas type is optional. See #datatypes section for a discussion\nabout types.\n \nThe return value is a dynamic column blob after the\nmodifications.\n \n\n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1\n/*column id*/, "value") WHERE id=1;\n \n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob,\n"column_name", "value") WHERE id=1;\n \nNote: COLUMN_ADD() is a regular function (just like\nCONCAT()), hence, in order to update the value in the table\nyou have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col,\n....) pattern.
-[COLUMN_ADD2]
-name=COLUMN_ADD
-declaration=dyncol_blob, column_name, value [as type], [column_name, value [as type]]...
-category=Dynamic Column Functions
-description=Adds or updates dynamic columns.\ndyncol_blob must be either a valid dynamic columns blob (for\nexample, COLUMN_CREATE returns such blob), or an empty\nstring.\ncolumn_name specifies the name of the column to be added. If\ndyncol_blob already has a column with this name, it will be\noverwritten.\nvalue specifies the new value for the column. Passing a NULL\nvalue will cause the column to be deleted.\nas type is optional. See #datatypes section for a discussion\nabout types.\n \nThe return value is a dynamic column blob after the\nmodifications.\n \n\n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1\n/*column id*/, "value") WHERE id=1;\n \n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob,\n"column_name", "value") WHERE id=1;\n \nNote: COLUMN_ADD() is a regular function (just like\nCONCAT()), hence, in order to update the value in the table\nyou have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col,\n....) pattern.
+description=Adds or updates dynamic columns.\n\n* dyncol_blob must be either a valid dynamic columns blob (for example,\nCOLUMN_CREATE returns such blob), or an empty string.\n* column_name specifies the name of the column to be added. If dyncol_blob\nalready has a column with this name, it will be overwritten.\n* value specifies the new value for the column. Passing a NULL value will\ncause the column to be deleted.\n* as type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nExamples\n--------\n\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, "column_name", "value")\nWHERE id=1;\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order\nto update the value in the table you have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\n\nURL: https://mariadb.com/kb/en/column_add/
[COLUMN_CHECK]
declaration=dyncol_blob
category=Dynamic Column Functions
-description=Check if dyncol_blob is a valid packed dynamic columns blob.\nReturn value of 1 means the blob is valid, return value of 0\nmeans it is not.\n \nRationale:\nNormally, one works with valid dynamic column blobs.\nFunctions like COLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE\nalways return valid dynamic column blobs. However, if a\ndynamic column blob is accidentally truncated, or transcoded\nfrom one character set to another, it will be corrupted.\nThis function can be used to check if a value in a blob\nfield is a valid dynamic column blob.
-[COLUMN_CREATE1]
-name=COLUMN_CREATE
+description=Check if dyncol_blob is a valid packed dynamic columns blob. Return value of 1\nmeans the blob is valid, return value of 0 means it is not.\n\nRationale: Normally, one works with valid dynamic column blobs. Functions like\nCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column\nblobs. However, if a dynamic column blob is accidentally truncated, or\ntranscoded from one character set to another, it will be corrupted. This\nfunction can be used to check if a value in a blob field is a valid dynamic\ncolumn blob.\n\nURL: https://mariadb.com/kb/en/column_check/
+[COLUMN_CREATE]
declaration=column_nr, value [as type], [column_nr, value [as type]]...
category=Dynamic Column Functions
-description=Returns a dynamic columns blob that stores the specified\ncolumns with values.\n \nThe return value is suitable for \nstoring in a table\nfurther modification with other dynamic columns functions\n \nThe as type part allows one to specify the value type. In\nmost cases,\nthis is redundant because MariaDB will be able to deduce the\ntype of the\nvalue. Explicit type specification may be needed when the\ntype of the value is\nnot apparent. For example, a literal ''2012-12-01'' has a\nCHAR type by\ndefault, one will need to specify ''2012-12-01'' AS DATE to\nhave it stored as\na date. See Dynamic Columns:Datatypes for further details.\n \n\n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column\nid*/, "value");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET\ndyncol_blob=COLUMN_CREATE("column_name", "value");
-[COLUMN_CREATE2]
-name=COLUMN_CREATE
-declaration=column_name, value [as type], [column_name, value [as type]]...
-category=Dynamic Column Functions
-description=Returns a dynamic columns blob that stores the specified\ncolumns with values.\n \nThe return value is suitable for \nstoring in a table\nfurther modification with other dynamic columns functions\n \nThe as type part allows one to specify the value type. In\nmost cases,\nthis is redundant because MariaDB will be able to deduce the\ntype of the\nvalue. Explicit type specification may be needed when the\ntype of the value is\nnot apparent. For example, a literal ''2012-12-01'' has a\nCHAR type by\ndefault, one will need to specify ''2012-12-01'' AS DATE to\nhave it stored as\na date. See Dynamic Columns:Datatypes for further details.\n \n\n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column\nid*/, "value");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET\ndyncol_blob=COLUMN_CREATE("column_name", "value");
-[COLUMN_DELETE1]
-name=COLUMN_DELETE
+description=Returns a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n* storing in a table\n* further modification with other dynamic columns functions\n\nThe as type part allows one to specify the value type. In most cases, this is\nredundant because MariaDB will be able to deduce the type of the value.\nExplicit type specification may be needed when the type of the value is not\napparent. For example, a literal '2012-12-01' has a CHAR type by default, one\nwill need to specify '2012-12-01' AS DATE to have it stored as a date. See\nDynamic Columns:Datatypes for further details.\n\nExamples\n--------\n\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE("column_name", "value");\n\nURL: https://mariadb.com/kb/en/column_create/
+[COLUMN_DELETE]
declaration=dyncol_blob, column_nr, column_nr...
category=Dynamic Column Functions
-description=Deletes a dynamic column with the specified name. Multiple\nnames can be given. The return value is a dynamic column\nblob after the modification.
-[COLUMN_DELETE2]
-name=COLUMN_DELETE
-declaration=dyncol_blob, column_name, column_name...
-category=Dynamic Column Functions
-description=Deletes a dynamic column with the specified name. Multiple\nnames can be given. The return value is a dynamic column\nblob after the modification.
-[COLUMN_EXISTS1]
-name=COLUMN_EXISTS
+description=Deletes a dynamic column with the specified name. Multiple names can be given.\nThe return value is a dynamic column blob after the modification.\n\nURL: https://mariadb.com/kb/en/column_delete/
+[COLUMN_EXISTS]
declaration=dyncol_blob, column_nr
category=Dynamic Column Functions
-description=Checks if a column with name column_name exists in\ndyncol_blob. If yes, return 1, otherwise return 0. See\ndynamic columns for more information.
-[COLUMN_EXISTS2]
-name=COLUMN_EXISTS
-declaration=dyncol_blob, column_name
-category=Dynamic Column Functions
-description=Checks if a column with name column_name exists in\ndyncol_blob. If yes, return 1, otherwise return 0. See\ndynamic columns for more information.
-[COLUMN_GET1]
-name=COLUMN_GET
+description=Checks if a column with name column_name exists in dyncol_blob. If yes, return\n1, otherwise return 0. See dynamic columns for more information.\n\nURL: https://mariadb.com/kb/en/column_exists/
+[COLUMN_GET]
declaration=dyncol_blob, column_nr as type
category=Dynamic Column Functions
-description=Gets the value of a dynamic column by its name. If no column\nwith the given name exists, NULL will be returned.\n \ncolumn_name as type requires that one specify the datatype\nof the dynamic column they are reading. \n \nThis may seem counter-intuitive: why would one need to\nspecify which datatype they''re retrieving? Can''t the\ndynamic columns system figure the datatype from the data\nbeing stored?\n \nThe answer is: SQL is a statically-typed language. The SQL\ninterpreter needs to know the datatypes of all expressions\nbefore the query is run (for example, when one is using\nprepared statements and runs "select COLUMN_GET(...)", the\nprepared statement API requires the server to inform the\nclient about the datatype of the column being read before\nthe query is executed and the server can see what datatype\nthe column actually has).\n \nA note about lengths\n \nIf you''re running queries like:\n \nSELECT COLUMN_GET(blob, ''colname'' as CHAR) ...\n \nwithout specifying a maximum length (i.e. using #as CHAR#,\nnot as CHAR(n)), MariaDB will report the maximum length of\nthe resultset column to be 53,6870,911 for MariaDB\n5.3-10.0.0 and 16,777,216 for MariaDB 10.0.1+. This may\ncause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum\nresultset width. To avoid this problem, use CHAR(n) whenever\nyou''re using COLUMN_GET in the select list.\n \nSee Dynamic Columns:Datatypes for more information about\ndatatypes.
-[COLUMN_GET2]
-name=COLUMN_GET
-declaration=dyncol_blob, column_name as type
-category=Dynamic Column Functions
-description=Gets the value of a dynamic column by its name. If no column\nwith the given name exists, NULL will be returned.\n \ncolumn_name as type requires that one specify the datatype\nof the dynamic column they are reading. \n \nThis may seem counter-intuitive: why would one need to\nspecify which datatype they''re retrieving? Can''t the\ndynamic columns system figure the datatype from the data\nbeing stored?\n \nThe answer is: SQL is a statically-typed language. The SQL\ninterpreter needs to know the datatypes of all expressions\nbefore the query is run (for example, when one is using\nprepared statements and runs "select COLUMN_GET(...)", the\nprepared statement API requires the server to inform the\nclient about the datatype of the column being read before\nthe query is executed and the server can see what datatype\nthe column actually has).\n \nA note about lengths\n \nIf you''re running queries like:\n \nSELECT COLUMN_GET(blob, ''colname'' as CHAR) ...\n \nwithout specifying a maximum length (i.e. using #as CHAR#,\nnot as CHAR(n)), MariaDB will report the maximum length of\nthe resultset column to be 53,6870,911 for MariaDB\n5.3-10.0.0 and 16,777,216 for MariaDB 10.0.1+. This may\ncause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum\nresultset width. To avoid this problem, use CHAR(n) whenever\nyou''re using COLUMN_GET in the select list.\n \nSee Dynamic Columns:Datatypes for more information about\ndatatypes.
+description=Gets the value of a dynamic column by its name. If no column with the given\nname exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic\ncolumn they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype\nthey're retrieving? Can't the dynamic columns system figure the datatype from\nthe data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs\nto know the datatypes of all expressions before the query is run (for example,\nwhen one is using prepared statements and runs "select COLUMN_GET(...)", the\nprepared statement API requires the server to inform the client about the\ndatatype of the column being read before the query is executed and the server\ncan see what datatype the column actually has).\n\nLengths\n-------\n\nIf you're running queries like:\n\nSELECT COLUMN_GET(blob, 'colname' as CHAR) ...\n\nwithout specifying a maximum length (i.e. using as CHAR, not as CHAR(n)),\nMariaDB will report the maximum length of the resultset column to be\n16,777,216. This may cause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum resultset width. To avoid\nthis problem, use CHAR(n) whenever you're using COLUMN_GET in the select list.\n\nSee Dynamic Columns:Datatypes for more information about datatypes.\n\nURL: https://mariadb.com/kb/en/column_get/
[COLUMN_JSON]
declaration=dyncol_blob
category=Dynamic Column Functions
-description=Returns a JSON representation of data in dyncol_blob. Can\nalso be used to display nested columns. See dynamic columns\nfor more information.\n \nExample\n \nselect item_name, COLUMN_JSON(dynamic_cols) from assets;\n+-----------------+----------------------------------------+\n| item_name | COLUMN_JSON(dynamic_cols) |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {"size":"XL","color":"blue"} |\n| Thinkpad Laptop | {"color":"black","warranty":"3\nyears"} |\n+-----------------+----------------------------------------+\n \nLimitation: COLUMN_JSON will decode nested dynamic columns\nat a nesting level of not more than 10 levels deep. Dynamic\ncolumns that are nested deeper than 10 levels will be shown\nas BINARY string, without encoding.
+description=Returns a JSON representation of data in dyncol_blob. Can also be used to\ndisplay nested columns. See dynamic columns for more information.\n\nExample\n-------\n\nselect item_name, COLUMN_JSON(dynamic_cols) from assets;\n+-----------------+----------------------------------------+\n| item_name | COLUMN_JSON(dynamic_cols) |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {"size":"XL","color":"blue"} |\n| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |\n+-----------------+----------------------------------------+\n\nLimitation: COLUMN_JSON will decode nested dynamic columns at a nesting level\nof not more than 10 levels deep. Dynamic columns that are nested deeper than\n10 levels will be shown as BINARY string, without encoding.\n\nURL: https://mariadb.com/kb/en/column_json/
[COLUMN_LIST]
declaration=dyncol_blob
category=Dynamic Column Functions
-description=Since MariaDB 10.0.1, this function returns a\ncomma-separated list of column names. The names are quoted\nwith backticks.\n \nBefore MariaDB 10.0.1, it returned a comma-separated list of\ncolumn numbers, not names.\n \nSee dynamic columns for more information.
+description=Returns a comma-separated list of column names. The names are quoted with\nbackticks.\n\nSee dynamic columns for more information.\n\nURL: https://mariadb.com/kb/en/column_list/
+[COMMIT]
+declaration=the keyword WORK is simply noise and can be omitted without changing the effect
+category=Transactions
+description=The optional AND CHAIN clause is a convenience for initiating a new\ntransaction as soon as the old transaction terminates. If AND CHAIN is\nspecified, then there is effectively nothing between the old and new\ntransactions, although they remain separate. The characteristics of the new\ntransaction will be the same as the characteristics of the old one - that is,\nthe new transaction will have the same access mode, isolation level and\ndiagnostics area size (we'll discuss all of these shortly) as the transaction\njust terminated.\n\nRELEASE tells the server to disconnect the client immediately after the\ncurrent transaction.\n\nThere are NO RELEASE and AND NO CHAIN options. By default, commits do not\nRELEASE or CHAIN, but it's possible to change this default behavior with the\ncompletion_type server system variable. In this case, the AND NO CHAIN and NO\nRELEASE options override the server default.\n\nURL: https://mariadb.com/kb/en/commit/
[COMPRESS]
declaration=string_to_compress
category=Encryption Functions
-description=Compresses a string and returns the result as a binary\nstring. This\nfunction requires MariaDB to have been compiled with a\ncompression\nlibrary such as zlib. Otherwise, the return value is always\nNULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n \nThe have_compress server system variable indicates whether a\ncompression library is present. \n \n\nSELECT LENGTH(COMPRESS(REPEAT(''a'',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(''a'',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n \nSELECT LENGTH(COMPRESS(''''));\n+----------------------+\n| LENGTH(COMPRESS('''')) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSELECT LENGTH(COMPRESS(''a''));\n+-----------------------+\n| LENGTH(COMPRESS(''a'')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n \nSELECT LENGTH(COMPRESS(REPEAT(''a'',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(''a'',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+
+description=Compresses a string and returns the result as a binary string. This function\nrequires MariaDB to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL. The compressed string can be\nuncompressed with UNCOMPRESS().\n\nThe have_compress server system variable indicates whether a compression\nlibrary is present.\n\nExamples\n--------\n\nSELECT LENGTH(COMPRESS(REPEAT('a',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT('a',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n\nSELECT LENGTH(COMPRESS(''));\n+----------------------+\n| LENGTH(COMPRESS('')) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSELECT LENGTH(COMPRESS('a'));\n+-----------------------+\n| LENGTH(COMPRESS('a')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n\nSELECT LENGTH(COMPRESS(REPEAT('a',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT('a',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/compress/
[CONCAT]
declaration=str1,str2,...
category=String Functions
-description=Returns the string that results from concatenating the\narguments. May have one or more arguments. If all arguments\nare non-binary strings, the result is a non-binary string.\nIf the arguments include any binary strings, the result is a\nbinary string. A numeric argument is converted to its\nequivalent binary string form; if you want to avoid that,\nyou can use an explicit type cast, as in this example:\n \nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n \nCONCAT() returns NULL if any argument is NULL.\n \nA NULL parameter hides all information contained in other\nparameters from the result. Sometimes this is not desirable;\nto avoid this, you can:\nUse the CONCAT_WS() function with an empty separator,\nbecause that function is NULL-safe.\nUse IFNULL() to turn NULLs into empty strings.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n \n\nSELECT CONCAT(''Ma'', ''ria'', ''DB'');\n+---------------------------+\n| CONCAT(''Ma'', ''ria'', ''DB'') |\n+---------------------------+\n| MariaDB |\n+---------------------------+\n \nSELECT CONCAT(''Ma'', ''ria'', NULL, ''DB'');\n+---------------------------------+\n| CONCAT(''Ma'', ''ria'', NULL, ''DB'') |\n+---------------------------------+\n| NULL |\n+---------------------------------+\n \nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0 |\n+--------------+\n \nUsing IFNULL() to handle NULLs:\n \nSELECT CONCAT(''The value of @v is: '', IFNULL(@v, ''''));\n+------------------------------------------------+\n| CONCAT(''The value of @v is: '', IFNULL(@v, '''')) |\n+------------------------------------------------+\n| The value of @v is: |\n+------------------------------------------------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT CONCAT(''Ma'', ''ria'', NULL, ''DB'');\n+---------------------------------+\n| CONCAT(''Ma'', ''ria'', NULL, ''DB'') |\n+---------------------------------+\n| MariaDB |\n+---------------------------------+
+description=Returns the string that results from concatenating the arguments. May have one\nor more arguments. If all arguments are non-binary strings, the result is a\nnon-binary string. If the arguments include any binary strings, the result is\na binary string. A numeric argument is converted to its equivalent binary\nstring form; if you want to avoid that, you can use an explicit type cast, as\nin this example:\n\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n\nCONCAT() returns NULL if any argument is NULL.\n\nA NULL parameter hides all information contained in other parameters from the\nresult. Sometimes this is not desirable; to avoid this, you can:\n\n* Use the CONCAT_WS() function with an empty separator, because that function\nis NULL-safe.\n* Use IFNULL() to turn NULLs into empty strings.\n\nOracle Mode\n-----------\n\nIn Oracle mode, CONCAT ignores NULL.\n\nExamples\n--------\n\nSELECT CONCAT('Ma', 'ria', 'DB');\n+---------------------------+\n| CONCAT('Ma', 'ria', 'DB') |\n+---------------------------+\n| MariaDB |\n+---------------------------+\n\nSELECT CONCAT('Ma', 'ria', NULL, 'DB');\n+---------------------------------+\n| CONCAT('Ma', 'ria', NULL, 'DB') |\n+---------------------------------+\n| NULL |\n+---------------------------------+\n\nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0 |\n+--------------+\n\nUsing IFNULL() to handle NULLs:\n\nSELECT CONCAT('The value of @v is: ', IFNULL(@v, ''));\n ...
[CONCAT_WS]
declaration=separator,str1,str2,...
category=String Functions
-description=CONCAT_WS() stands for Concatenate With Separator and is a\nspecial form of CONCAT(). The first argument is the\nseparator for the rest of the arguments. The separator is\nadded between the strings to be concatenated. The separator\ncan be a string, as can the rest of the arguments.\n \nIf the separator is NULL, the result is NULL; all other NULL\nvalues are skipped. This makes CONCAT_WS() suitable when you\nwant to concatenate some values and avoid losing all\ninformation if one of them is NULL.\n \n\nSELECT CONCAT_WS('','',''First name'',''Second name'',''Last\nName'');\n+-------------------------------------------------------+\n| CONCAT_WS('','',''First name'',''Second name'',''Last\nName'') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name |\n+-------------------------------------------------------+\n \nSELECT CONCAT_WS(''-'',''Floor'',NULL,''Room'');\n+------------------------------------+\n| CONCAT_WS(''-'',''Floor'',NULL,''Room'') |\n+------------------------------------+\n| Floor-Room |\n+------------------------------------+\n \nIn some cases, remember to include a space in the separator\nstring:\n \nSET @a = ''gnu'', @b = ''penguin'', @c = ''sea lion'';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CONCAT_WS('', '', @a, @b, @c);\n+-----------------------------+\n| CONCAT_WS('', '', @a, @b, @c) |\n+-----------------------------+\n| gnu, penguin, sea lion |\n+-----------------------------+\n \nUsing CONCAT_WS() to handle NULLs:\n \nSET @a = ''a'', @b = NULL, @c = ''c'';\n \nSELECT CONCAT_WS('''', @a, @b, @c);\n+---------------------------+\n| CONCAT_WS('''', @a, @b, @c) |\n+---------------------------+\n| ac |\n+---------------------------+
+description=CONCAT_WS() stands for Concatenate With Separator and is a special form of\nCONCAT(). The first argument is the separator for the rest of the arguments.\nThe separator is added between the strings to be concatenated. The separator\ncan be a string, as can the rest of the arguments.\n\nIf the separator is NULL, the result is NULL; all other NULL values are\nskipped. This makes CONCAT_WS() suitable when you want to concatenate some\nvalues and avoid losing all information if one of them is NULL.\n\nExamples\n--------\n\nSELECT CONCAT_WS(',','First name','Second name','Last Name');\n+-------------------------------------------------------+\n| CONCAT_WS(',','First name','Second name','Last Name') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name |\n+-------------------------------------------------------+\n\nSELECT CONCAT_WS('-','Floor',NULL,'Room');\n+------------------------------------+\n| CONCAT_WS('-','Floor',NULL,'Room') |\n+------------------------------------+\n| Floor-Room |\n+------------------------------------+\n\nIn some cases, remember to include a space in the separator string:\n\nSET @a = 'gnu', @b = 'penguin', @c = 'sea lion';\nQuery OK, 0 rows affected (0.00 sec)\n\nSELECT CONCAT_WS(', ', @a, @b, @c);\n+-----------------------------+\n| CONCAT_WS(', ', @a, @b, @c) |\n+-----------------------------+\n| gnu, penguin, sea lion |\n+-----------------------------+\n\nUsing CONCAT_WS() to handle NULLs:\n\nSET @a = 'a', @b = NULL, @c = 'c';\n\nSELECT CONCAT_WS('', @a, @b, @c);\n+---------------------------+\n| CONCAT_WS('', @a, @b, @c) |\n+---------------------------+\n| ac |\n+---------------------------+\n\nURL: https://mariadb.com/kb/en/concat_ws/
[CONNECTION_ID]
declaration=
category=Information Functions
-description=Returns the connection ID (thread ID) for the connection.\nEvery\nthread (including events) has an ID that is unique among the\nset of currently\nconnected clients.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \n\nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+
+description=Returns the connection ID for the connection. Every connection (including\nevents) has an ID that is unique among the set of currently connected clients.\n\nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or bigint(10), in all\ncases. From MariaDB 10.3.1, returns MYSQL_TYPE_LONG, or int(10), when the\nresult would fit within 32-bits.\n\nExamples\n--------\n\nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/connection_id/
[CONTAINS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2. CONTAINS() is based on the original\nMySQL implementation and uses object bounding rectangles,\nwhile ST_CONTAINS() uses object shapes. \n \nThis tests the opposite relationship to Within().
-[CONVERT1]
-name=CONVERT
+description=Returns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2. CONTAINS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_CONTAINS() uses object shapes.\n\nThis tests the opposite relationship to Within().\n\nURL: https://mariadb.com/kb/en/contains/
+[CONV]
+declaration=N,from_base,to_base
+category=Numeric Functions
+description=Converts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base to_base.\n\nReturns NULL if any argument is NULL, or if the second or third argument are\nnot in the allowed range.\n\nThe argument N is interpreted as an integer, but may be specified as an\ninteger or a string. The minimum base is 2 and the maximum base is 36 (prior\nto MariaDB 11.4.0) or 62 (from MariaDB 11.4.0). If to_base is a negative\nnumber, N is regarded as a signed number. Otherwise, N is treated as unsigned.\nCONV() works with 64-bit precision.\n\nSome shortcuts for this function are also available: BIN(), OCT(), HEX(),\nUNHEX(). Also, MariaDB allows binary literal values and hexadecimal literal\nvalues.\n\nExamples\n--------\n\nSELECT CONV('a',16,2);\n+----------------+\n| CONV('a',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n\nSELECT CONV('6E',18,8);\n+-----------------+\n| CONV('6E',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n\nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n\nSELECT CONV(12+'10'+'10'+0xa,10,10);\n+------------------------------+\n| CONV(12+'10'+'10'+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/conv/
+[CONVERT]
declaration=expr,type
category=String Functions
-description=The CONVERT() and CAST() functions take a value of one type\nand produce a value of another type.\n \nThe type can be one of the following values:\nBINARY\nCHAR\nDATE\nDATETIME \nDECIMAL[(M[,D])]\nDOUBLE \nFLOAT From MariaDB 10.4.5\nINTEGER \nShort for SIGNED INTEGER\n \nSIGNED [INTEGER]\nTIME \nUNSIGNED [INTEGER]\n \nNote that in MariaDB, INT and INTEGER are the same thing.\n \nBINARY produces a string with the BINARY data type. If the\noptional length is given, BINARY(N) causes the cast to use\nno more than N bytes of the argument. Values shorter than\nthe given number in bytes are padded with 0x00 bytes to make\nthem equal the length value.\n \nCHAR(N) causes the cast to use no more than the number of\ncharacters given in the argument.\n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nCONVERT() with USING is used to convert data between\ndifferent character sets. In MariaDB, transcoding names are\nthe same as the\ncorresponding character set names. For example, this\nstatement\nconverts the string ''abc'' in the default character set to\nthe\ncorresponding string in the utf8 character set:\n \nSELECT CONVERT(''abc'' USING utf8);\n \n\nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n \nConverting a BINARY to string to permit the LOWER function\nto work:\n \nSET @x = ''AardVark'';\n \nSET @x = BINARY ''AardVark'';\n \nSELECT LOWER(@x), LOWER(CONVERT (@x USING latin1));\n+-----------+----------------------------------+\n| LOWER(@x) | LOWER(CONVERT (@x USING latin1)) |\n+-----------+----------------------------------+\n| AardVark | aardvark |\n+-----------+----------------------------------+
-[CONVERT2]
-name=CONVERT
-declaration=expr USING transcoding_name
-category=String Functions
-description=The CONVERT() and CAST() functions take a value of one type\nand produce a value of another type.\n \nThe type can be one of the following values:\nBINARY\nCHAR\nDATE\nDATETIME \nDECIMAL[(M[,D])]\nDOUBLE \nFLOAT From MariaDB 10.4.5\nINTEGER \nShort for SIGNED INTEGER\n \nSIGNED [INTEGER]\nTIME \nUNSIGNED [INTEGER]\n \nNote that in MariaDB, INT and INTEGER are the same thing.\n \nBINARY produces a string with the BINARY data type. If the\noptional length is given, BINARY(N) causes the cast to use\nno more than N bytes of the argument. Values shorter than\nthe given number in bytes are padded with 0x00 bytes to make\nthem equal the length value.\n \nCHAR(N) causes the cast to use no more than the number of\ncharacters given in the argument.\n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nCONVERT() with USING is used to convert data between\ndifferent character sets. In MariaDB, transcoding names are\nthe same as the\ncorresponding character set names. For example, this\nstatement\nconverts the string ''abc'' in the default character set to\nthe\ncorresponding string in the utf8 character set:\n \nSELECT CONVERT(''abc'' USING utf8);\n \n\nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n \nConverting a BINARY to string to permit the LOWER function\nto work:\n \nSET @x = ''AardVark'';\n \nSET @x = BINARY ''AardVark'';\n \nSELECT LOWER(@x), LOWER(CONVERT (@x USING latin1));\n+-----------+----------------------------------+\n| LOWER(@x) | LOWER(CONVERT (@x USING latin1)) |\n+-----------+----------------------------------+\n| AardVark | aardvark |\n+-----------+----------------------------------+
+description=The CONVERT() and CAST() functions take a value of one type and produce a\nvalue of another type.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nNote that in MariaDB, INT and INTEGER are the same thing.\n\nBINARY produces a string with the BINARY data type. If the optional length is\ngiven, BINARY(N) causes the cast to use no more than N bytes of the argument.\nValues shorter than the given number in bytes are padded with 0x00 bytes to\nmake them equal the length value.\n\nCHAR(N) causes the cast to use no more than the number of characters given in\nthe argument.\n\nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type) and CONVERT(...\nUSING ...) are SQL92 syntax.\n\nCONVERT() with USING is used to convert data between different character sets.\nIn MariaDB, transcoding names are the same as the corresponding character set\nnames. For example, this statement converts the string 'abc' in the default\ncharacter set to the corresponding string in the utf8 character set:\n\nSELECT CONVERT('abc' USING utf8);\n\nExamples\n--------\n\nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n\nConverting a BINARY to string to permit the LOWER function to work:\n\nSET @x = 'AardVark';\n ...
[CONVERT_TZ]
declaration=dt,from_tz,to_tz
category=Date and Time Functions
-description=CONVERT_TZ() converts a datetime value dt from the time zone\ngiven by from_tz to the time zone given by to_tz and returns\nthe resulting value.\n \nIn order to use named time zones, such as GMT, MET or\nAfrica/Johannesburg, the time_zone tables must be loaded\n(see mysql_tzinfo_to_sql).\n \nNo conversion will take place if the value falls outside of\nthe supported TIMESTAMP range (''1970-01-01 00:00:01'' to\n''2038-01-19 05:14:07'' UTC) when converted from from_tz to\nUTC.\n \nThis function returns NULL if the arguments are invalid (or\nnamed time zones have not been loaded).\n \nSee time zones for more information.\n \n\nSELECT CONVERT_TZ(''2016-01-01\n12:00:00'',''+00:00'',''+10:00'');\n+-----------------------------------------------------+\n| CONVERT_TZ(''2016-01-01 12:00:00'',''+00:00'',''+10:00'')\n|\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00 |\n+-----------------------------------------------------+\n \nUsing named time zones (with the time zone tables loaded):\n \nSELECT CONVERT_TZ(''2016-01-01\n12:00:00'',''GMT'',''Africa/Johannesburg'');\n+---------------------------------------------------------------+\n| CONVERT_TZ(''2016-01-01\n12:00:00'',''GMT'',''Africa/Johannesburg'') |\n+---------------------------------------------------------------+\n| 2016-01-01 14:00:00 |\n+---------------------------------------------------------------+\n \nThe value is out of the TIMESTAMP range, so no conversion\ntakes place:\n \nSELECT CONVERT_TZ(''1969-12-31\n22:00:00'',''+00:00'',''+10:00'');\n+-----------------------------------------------------+\n| CONVERT_TZ(''1969-12-31 22:00:00'',''+00:00'',''+10:00'')\n|\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\n+-----------------------------------------------------+
-[CONV]
-declaration=N,from_base,to_base
-category=Numeric Functions
-description=Converts numbers between different number bases. Returns a\nstring\nrepresentation of the number N, converted from base\nfrom_base\nto base to_base.\n \nReturns NULL if any argument is NULL, or if the second or\nthird argument are not in the allowed range.\n \nThe argument N is interpreted as an integer, but may be\nspecified as an\ninteger or a string. The minimum base is 2 and the maximum\nbase is 36. If\nto_base is a negative number, N is regarded as a signed\nnumber.\nOtherwise, N is treated as unsigned. CONV() works with\n64-bit\nprecision.\n \nSome shortcuts for this function are also available: BIN(),\nOCT(), HEX(), UNHEX(). Also, MariaDB allows binary literal\nvalues and hexadecimal literal values.\n \n\nSELECT CONV(''a'',16,2);\n+----------------+\n| CONV(''a'',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n \nSELECT CONV(''6E'',18,8);\n+-----------------+\n| CONV(''6E'',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n \nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n \nSELECT CONV(12+''10''+''10''+0xa,10,10);\n+------------------------------+\n| CONV(12+''10''+''10''+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+
+description=CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz\nto the time zone given by to_tz and returns the resulting value.\n\nIn order to use named time zones, such as GMT, MET or Africa/Johannesburg, the\ntime_zone tables must be loaded (see mysql_tzinfo_to_sql).\n\nNo conversion will take place if the value falls outside of the supported\nTIMESTAMP range ('1970-01-01 00:00:01' to '2038-01-19 05:14:07' UTC) when\nconverted from from_tz to UTC.\n\nThis function returns NULL if the arguments are invalid (or named time zones\nhave not been loaded).\n\nSee time zones for more information.\n\nExamples\n--------\n\nSELECT CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00');\n+-----------------------------------------------------+\n| CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00') |\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00 |\n+-----------------------------------------------------+\n\nUsing named time zones (with the time zone tables loaded):\n\nSELECT CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg');\n+---------------------------------------------------------------+\n| CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg') |\n+---------------------------------------------------------------+\n| 2016-01-01 14:00:00 |\n+---------------------------------------------------------------+\n\nThe value is out of the TIMESTAMP range, so no conversion takes place:\n\nSELECT CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00');\n+-----------------------------------------------------+\n| CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00') |\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/convert_tz/
[COS]
declaration=X
category=Numeric Functions
-description=Returns the cosine of X, where X is given in radians.\n \n\nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------
+description=Returns the cosine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/cos/
[COT]
declaration=X
category=Numeric Functions
-description=Returns the cotangent of X.\n \n\nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n \nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n \nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in\n''cot(0)''
+description=Returns the cotangent of X.\n\nExamples\n--------\n\nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n\nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n\nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in 'cot(0)'\n\nURL: https://mariadb.com/kb/en/cot/
[COUNT]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns a count of the number of non-NULL values of expr in\nthe rows retrieved by a SELECT statement. The result is a\nBIGINT value. It is an aggregate function, and so can be\nused with the GROUP BY clause.\n \nCOUNT(*) counts the total number of rows in a table.\n \nCOUNT() returns 0 if there were no matching rows.\n \nFrom MariaDB 10.2.0, COUNT() can be used as a window\nfunction.\n \n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n \nSELECT COUNT(*) FROM student;\n \n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n \nCOUNT(DISTINCT) example:\n \nSELECT COUNT(DISTINCT (name)) FROM student;\n \n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n \nAs a window function\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, COUNT(score) OVER (PARTITION BY\nname) \n AS tests_written FROM student_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | tests_written |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 2 |\n| Chun | Tuning | 73 | 2 |\n| Esben | SQL | 43 | 2 |\n| Esben | Tuning | 31 | 2 |\n| Kaolin | SQL | 56 | 2 |\n| Kaolin | Tuning | 88 | 2 |\n| Tatiana | SQL | 87 | 1 |\n+---------+--------+-------+---------------+
+description=Returns a count of the number of non-NULL values of expr in the rows retrieved\nby a SELECT statement. The result is a BIGINT value. It is an aggregate\nfunction, and so can be used with the GROUP BY clause.\n\nCOUNT(*) counts the total number of rows in a table.\n\nCOUNT() returns 0 if there were no matching rows.\n\nCOUNT() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);\n\nSELECT COUNT(*) FROM student;\n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n\nCOUNT(DISTINCT) example:\n\nSELECT COUNT(DISTINCT (name)) FROM student;\n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n\nAs a window function\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87);\n\nSELECT name, test, score, COUNT(score) OVER (PARTITION BY name) \n AS tests_written FROM student_test;\n ...
[CRC32]
declaration=expr
category=Numeric Functions
-description=Computes a cyclic redundancy check value and returns a\n32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The\nargument is\nexpected to be a string and (if possible) is treated as one\nif it is\nnot.\n \n\nSELECT CRC32(''MariaDB'');\n+------------------+\n| CRC32(''MariaDB'') |\n+------------------+\n| 4227209140 |\n+------------------+\n \nSELECT CRC32(''mariadb'');\n+------------------+\n| CRC32(''mariadb'') |\n+------------------+\n| 2594253378 |\n+------------------+
+description=Computes a cyclic redundancy check (CRC) value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is expected to\nbe a string and (if possible) is treated as one if it is not.\n\nUses the ISO 3309 polynomial that used by zlib and many others. MariaDB 10.8\nintroduced the CRC32C() function, which uses the alternate Castagnoli\npolynomia.\n\nMariaDB starting with 10.8\n--------------------------\nOften, CRC is computed in pieces. To facilitate this, MariaDB 10.8.0\nintroduced an optional parameter: CRC32('MariaDB')=CRC32(CRC32('Maria'),'DB').\n\nExamples\n--------\n\nSELECT CRC32('MariaDB');\n+------------------+\n| CRC32('MariaDB') |\n+------------------+\n| 4227209140 |\n+------------------+\n\nSELECT CRC32('mariadb');\n+------------------+\n| CRC32('mariadb') |\n+------------------+\n| 2594253378 |\n+------------------+\n\nFrom MariaDB 10.8.0\n\nSELECT CRC32(CRC32('Maria'),'DB');\n+----------------------------+\n| CRC32(CRC32('Maria'),'DB') |\n+----------------------------+\n| 4227209140 |\n+----------------------------+\n\nURL: https://mariadb.com/kb/en/crc32/
+[CRC32C]
+declaration=[par,]expr
+category=Numeric Functions
+description=MariaDB has always included a native unary function CRC32() that computes the\nCRC-32 of a string using the ISO 3309 polynomial that used by zlib and many\nothers.\n\nInnoDB and MyRocks use a different polynomial, which was implemented in SSE4.2\ninstructions that were introduced in the Intel Nehalem microarchitecture. This\nis commonly called CRC-32C (Castagnoli).\n\nThe CRC32C function uses the Castagnoli polynomial.\n\nThis allows SELECT…INTO DUMPFILE to be used for the creation of files with\nvalid checksums, such as a logically empty InnoDB redo log file ib_logfile0\ncorresponding to a particular log sequence number.\n\nThe optional parameter allows the checksum to be computed in pieces:\nCRC32C('MariaDB')=CRC32C(CRC32C('Maria'),'DB').\n\nExamples\n--------\n\nSELECT CRC32C('MariaDB');\n+-------------------+\n| CRC32C('MariaDB') |\n+-------------------+\n| 809606978 |\n+-------------------+\n\nSELECT CRC32C(CRC32C('Maria'),'DB');\n+------------------------------+\n| CRC32C(CRC32C('Maria'),'DB') |\n+------------------------------+\n| 809606978 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/crc32c/
[CROSSES]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 if g1 spatially crosses g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nCROSSES() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_CROSSES() uses\nobject shapes.
-[CUME_DIST1]
-name=CUME_DIST
+description=Returns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon or a\nMultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise, returns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nCROSSES() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_CROSSES() uses object shapes.\n\nURL: https://mariadb.com/kb/en/crosses/
+[CUME_DIST]
declaration=
category=Window Functions
-description=CUME_DIST() is a window function that returns the cumulative\ndistribution of a given row. The following formula is used\nto calculate the value:\n \n(number of rows
-[CUME_DIST2]
-name=CUME_DIST
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Window Functions
-description=CUME_DIST() is a window function that returns the cumulative\ndistribution of a given row. The following formula is used\nto calculate the value:\n \n(number of rows
-[CURRENT_TIMESTAMP]
-name=CURRENT_TIMESTAMP
+description=CUME_DIST() is a window function that returns the cumulative distribution of a\ngiven row. The following formula is used to calculate the value:\n\n(number of rows <= current row) / (total rows)\n\nExamples\n--------\n\ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n\ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n\nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n\nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n ...
+[CURDATE]
declaration=
category=Date and Time Functions
-description=CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().
-[CURDATE]
+description=CURDATE returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD\nformat, depending on whether the function is used in a string or numeric\ncontext.\n\nCURRENT_DATE and CURRENT_DATE() are synonyms.\n\nExamples\n--------\n\nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n\nIn a numeric context (note this is not performing date calculations):\n\nSELECT CURDATE() +0;\n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n\nData calculation:\n\nSELECT CURDATE() - INTERVAL 5 DAY;\n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+\n\nURL: https://mariadb.com/kb/en/curdate/
+[CURRENT_DATE]
declaration=
category=Date and Time Functions
-description=Returns the current date as a value in ''YYYY-MM-DD'' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or\nnumeric context.\n \n\nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n \nIn a numeric context (note this is not performing date\ncalculations):\n \nSELECT CURDATE() +0;\n \n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n \nData calculation:\n \nSELECT CURDATE() - INTERVAL 5 DAY;\n \n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+
+description=CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: https://mariadb.com/kb/en/current_date/
+[CURRENT_ROLE]
+declaration=
+category=Information Functions
+description=Returns the current role name. This determines your access privileges. The\nreturn value is a string in the utf8 character set.\n\nIf there is no current role, NULL is returned.\n\nThe output of SELECT CURRENT_ROLE is equivalent to the contents of the\nENABLED_ROLES Information Schema table.\n\nUSER() returns the combination of user and host used to login. CURRENT_USER()\nreturns the account used to determine current connection's privileges.\n\nStatements using the CURRENT_ROLE function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n\nSET ROLE staff;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n\nURL: https://mariadb.com/kb/en/current_role/
+[CURRENT_TIME]
+declaration=[precision]
+category=Date and Time Functions
+description=CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: https://mariadb.com/kb/en/current_time/
+[CURRENT_TIMESTAMP]
+declaration=[precision]
+category=Date and Time Functions
+description=CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/current_timestamp/
+[CURRENT_USER]
+declaration=
+category=Information Functions
+description=Returns the user name and host name combination for the MariaDB account that\nthe server used to authenticate the current client. This account determines\nyour access privileges. The return value is a string in the utf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\nCURRENT_ROLE() returns the current active role.\n\nStatements using the CURRENT_USER function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nshell> mysql --user="anonymous"\n\nselect user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n\nWhen calling CURRENT_USER() in a stored procedure, it returns the owner of the\nstored procedure, as defined with DEFINER.\n\nURL: https://mariadb.com/kb/en/current_user/
[CURTIME]
declaration=[precision]
category=Date and Time Functions
-description=Returns the current time as a value in ''HH:MM:SS'' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed\nin the current time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \n\nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n \nSELECT CURTIME() + 0;\n \n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n \nWith precision:\n \nSELECT CURTIME(2);\n+-------------+\n| CURTIME(2) |\n+-------------+\n| 09:49:08.09 |\n+-------------+
+description=Returns the current time as a value in 'HH:MM:SS' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context. The\nvalue is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n\nSELECT CURTIME() + 0;\n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n\nWith precision:\n\nSELECT CURTIME(2);\n+-------------+\n| CURTIME(2) |\n+-------------+\n| 09:49:08.09 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/curtime/
[DATABASE]
declaration=
category=Information Functions
-description=Returns the default (current) database name as a string in\nthe utf8 character set. If there is no default database,\nDATABASE() returns NULL. Within a stored routine, the\ndefault database is the database that the routine is\nassociated with, which is not necessarily the same as the\ndatabase that is the default in the calling context.\n \nSCHEMA() is a synonym for DATABASE().\n \nTo select a default database, the USE statement can be run.\nAnother way to set the default database is specifying its\nname at mysql command line client startup.\n \n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n \nUSE test;\n \nDatabase changed\n \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+
+description=Returns the default (current) database name as a string in the utf8 character\nset. If there is no default database, DATABASE() returns NULL. Within a stored\nroutine, the default database is the database that the routine is associated\nwith, which is not necessarily the same as the database that is the default in\nthe calling context.\n\nSCHEMA() is a synonym for DATABASE().\n\nTo select a default database, the USE statement can be run. Another way to set\nthe default database is specifying its name at mariadb command line client\nstartup.\n\nExamples\n--------\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n\nUSE test;\nDatabase changed\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+\n\nURL: https://mariadb.com/kb/en/database/
[DATEDIFF]
declaration=expr1,expr2
category=Date and Time Functions
-description=DATEDIFF() returns (expr1 expr2) expressed\nas a value in days from one date to the other. expr1 and\nexpr2 are date\nor date-and-time expressions. Only the date parts of the\nvalues are used in the\ncalculation.\n \n\nSELECT DATEDIFF(''2007-12-31 23:59:59'',''2007-12-30'');\n+----------------------------------------------+\n| DATEDIFF(''2007-12-31 23:59:59'',''2007-12-30'') |\n+----------------------------------------------+\n| 1 |\n+----------------------------------------------+\n \nSELECT DATEDIFF(''2010-11-30 23:59:59'',''2010-12-31'');\n+----------------------------------------------+\n| DATEDIFF(''2010-11-30 23:59:59'',''2010-12-31'') |\n+----------------------------------------------+\n| -31 |\n+----------------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2011-05-23 10:56:05 |\n+---------------------+\n \nSELECT d, DATEDIFF(NOW(),d) FROM t1;\n \n+---------------------+-------------------+\n| d | DATEDIFF(NOW(),d) |\n+---------------------+-------------------+\n| 2007-01-30 21:31:07 | 1574 |\n| 1983-10-15 06:42:51 | 10082 |\n| 2011-04-21 12:34:56 | 32 |\n| 2011-10-30 06:31:41 | -160 |\n| 2011-01-30 14:03:25 | 113 |\n| 2004-10-07 11:19:34 | 2419 |\n+---------------------+-------------------+
+description=DATEDIFF() returns (expr1 – expr2) expressed as a value in days from one date\nto the other. expr1 and expr2 are date or date-and-time expressions. Only the\ndate parts of the values are used in the calculation.\n\nExamples\n--------\n\nSELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');\n+----------------------------------------------+\n| DATEDIFF('2007-12-31 23:59:59','2007-12-30') |\n+----------------------------------------------+\n| 1 |\n+----------------------------------------------+\n\nSELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');\n+----------------------------------------------+\n| DATEDIFF('2010-11-30 23:59:59','2010-12-31') |\n+----------------------------------------------+\n| -31 |\n+----------------------------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2011-05-23 10:56:05 |\n+---------------------+\n\nSELECT d, DATEDIFF(NOW(),d) FROM t1;\n+---------------------+-------------------+\n| d | DATEDIFF(NOW(),d) |\n+---------------------+-------------------+\n| 2007-01-30 21:31:07 | 1574 |\n| 1983-10-15 06:42:51 | 10082 |\n| 2011-04-21 12:34:56 | 32 |\n| 2011-10-30 06:31:41 | -160 |\n| 2011-01-30 14:03:25 | 113 |\n| 2004-10-07 11:19:34 | 2419 |\n+---------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/datediff/
+[DATETIME]
+declaration=microsecond precision
+category=Data Types
+description=A date and time combination.\n\nMariaDB displays DATETIME values in 'YYYY-MM-DD HH:MM:SS.ffffff' format, but\nallows assignment of values to DATETIME columns using either strings or\nnumbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store DATETMEs using the same low-level format MySQL\n5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the DATETIME data type in a format that\nsupports values between 1000-01-01 00:00:00.000000 and 9999-12-31\n23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nMariaDB also supports '0000-00-00' as a special zero-date value, unless\nNO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of\na date can be set to 0 (for example: '2015-00-12'), unless NO_ZERO_IN_DATE is\nspecified in the SQL_MODE. In many cases, the result of en expression\ninvolving a zero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range\nbetween 1 and 31, the date does not produce any error, even for months that\nhave less than 31 days.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\n ...
[DATE_ADD]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=Performs date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a "-" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_SUB().\n \n\nSELECT ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND;\n \n+-------------------------------------------+\n| ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n \nSELECT INTERVAL 1 DAY + ''2008-12-31'';\n \n+-------------------------------+\n| INTERVAL 1 DAY + ''2008-12-31'' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n \nSELECT ''2005-01-01'' - INTERVAL 1 SECOND;\n \n+----------------------------------+\n| ''2005-01-01'' - INTERVAL 1 SECOND |\n+----------------------------------+\n| 2004-12-31 23:59:59 |\n+----------------------------------+\n \nSELECT DATE_ADD(''2000-12-31 23:59:59'', INTERVAL 1 SECOND);\n+----------------------------------------------------+\n| DATE_ADD(''2000-12-31 23:59:59'', INTERVAL 1 SECOND) |\n+----------------------------------------------------+\n| 2001-01-01 00:00:00 |\n+----------------------------------------------------+\n \nSELECT DATE_ADD(''2010-12-31 23:59:59'', INTERVAL 1 DAY);\n+-------------------------------------------------+\n| DATE_ADD(''2010-12-31 23:59:59'', INTERVAL 1 DAY) |\n+-------------------------------------------------+\n| 2011-01-01 23:59:59 |\n+-------------------------------------------------+\n \nSELECT DATE_ADD(''2100-12-31 23:59:59'', INTERVAL ''1:1''\nMINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(''2100-12-31 23:59:59'', INTERVAL ''1:1''\nMINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n \nSELECT DATE_ADD(''1900-01-01 00:00:00'', INTERVAL ''-1 10''\nDAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(''1900-01-01 00:00:00'', INTERVAL ''-1 10''\nDAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n \nSELECT DATE_ADD(''1992-12-31 23:59:59.000002'', INTERVAL\n''1.999999'' SECOND_MICROSECOND);\n+--------------------------------------------------------------------------------+\n| DATE_ADD(''1992-12-31 23:59:59.000002'', INTERVAL\n''1.999999'' SECOND_MICROSECOND) |\n+--------------------------------------------------------------------------------+\n| 1993-01-01 00:00:01.000001 |\n+--------------------------------------------------------------------------------+
+description=Performs date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a "-" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nExamples\n--------\n\nSELECT '2008-12-31 23:59:59' + INTERVAL 1 SECOND;\n+-------------------------------------------+\n| '2008-12-31 23:59:59' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n\nSELECT INTERVAL 1 DAY + '2008-12-31';\n+-------------------------------+\n| INTERVAL 1 DAY + '2008-12-31' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n\nSELECT '2005-01-01' - INTERVAL 1 SECOND;\n+----------------------------------+\n| '2005-01-01' - INTERVAL 1 SECOND |\n+----------------------------------+\n| 2004-12-31 23:59:59 |\n+----------------------------------+\n\nSELECT DATE_ADD('2000-12-31 23:59:59', INTERVAL 1 SECOND);\n+----------------------------------------------------+\n| DATE_ADD('2000-12-31 23:59:59', INTERVAL 1 SECOND) |\n+----------------------------------------------------+\n| 2001-01-01 00:00:00 |\n+----------------------------------------------------+\n\nSELECT DATE_ADD('2010-12-31 23:59:59', INTERVAL 1 DAY);\n+-------------------------------------------------+\n| DATE_ADD('2010-12-31 23:59:59', INTERVAL 1 DAY) |\n+-------------------------------------------------+\n| 2011-01-01 23:59:59 |\n+-------------------------------------------------+\n\nSELECT DATE_ADD('2100-12-31 23:59:59', INTERVAL '1:1' MINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD('2100-12-31 23:59:59', INTERVAL '1:1' MINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n ...
[DATE_FORMAT]
declaration=date, format[, locale]
category=Date and Time Functions
-description=Formats the date value according to the format string. \n \nThe language used for the names is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nThe options that can be used by DATE_FORMAT(), as well as\nits inverse STR_TO_DATE() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix ''th'', ''nd'', ''st'' or\n''rd''''. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n''%I:%i:%S %p''. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for ''%H:%i:%S''. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nTo get a date in one of the standard formats, GET_FORMAT()\ncan be used.\n \n\nSELECT DATE_FORMAT(''2009-10-04 22:23:00'', ''%W %M %Y'');\n+------------------------------------------------+\n| DATE_FORMAT(''2009-10-04 22:23:00'', ''%W %M %Y'') |\n+------------------------------------------------+\n| Sunday October 2009 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(''2007-10-04 22:23:00'', ''%H:%i:%s'');\n+------------------------------------------------+\n| DATE_FORMAT(''2007-10-04 22:23:00'', ''%H:%i:%s'') |\n+------------------------------------------------+\n| 22:23:00 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(''1900-10-04 22:23:00'', ''%D %y %a %d %m\n%b %j'');\n+------------------------------------------------------------+\n| DATE_FORMAT(''1900-10-04 22:23:00'', ''%D %y %a %d %m %b\n%j'') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(''1997-10-04 22:23:00'', ''%H %k %I %r %T\n%S %w'');\n+------------------------------------------------------------+\n| DATE_FORMAT(''1997-10-04 22:23:00'', ''%H %k %I %r %T %S\n%w'') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(''1999-01-01'', ''%X %V'');\n+------------------------------------+\n| DATE_FORMAT(''1999-01-01'', ''%X %V'') |\n+------------------------------------+\n| 1998 52 |\n+------------------------------------+\n \nSELECT DATE_FORMAT(''2006-06-00'', ''%d'');\n+---------------------------------+\n| DATE_FORMAT(''2006-06-00'', ''%d'') |\n+---------------------------------+\n| 00 |\n+---------------------------------+\n \nOptionally, the locale can be explicitly specified as the\nthird DATE_FORMAT() argument. Doing so makes the function\nindependent from the session settings, and the three\nargument version of DATE_FORMAT() can be used in virtual\nindexed and persistent generated-columns:\n \nSELECT DATE_FORMAT(''2006-01-01'', ''%W'', ''el_GR'');\n+------------------------------------------+\n| DATE_FORMAT(''2006-01-01'', ''%W'', ''el_GR'') |\n+------------------------------------------+\n| ??????? |\n+------------------------------------------+
+description=Formats the date value according to the format string.\n\nThe language used for the names is controlled by the value of the\nlc_time_names system variable. See server locale for more on the supported\nlocales.\n\nThe options that can be used by DATE_FORMAT(), as well as its inverse\nSTR_TO_DATE() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | or Dec. |\n+---------------------------+------------------------------------------------+\n| %c | Month with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %D | Day with English suffix 'th', 'nd', 'st' or |\n| | 'rd''. (1st, 2nd, 3rd...). |\n+---------------------------+------------------------------------------------+\n| %d | Day with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %e | Day with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %f | Microseconds 6 digits. |\n+---------------------------+------------------------------------------------+\n| %H | Hour with 2 digits between 00-23. |\n+---------------------------+------------------------------------------------+\n| %h | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %I | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %i | Minute with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %j | Day of the year (001-366) |\n+---------------------------+------------------------------------------------+\n| %k | Hour with 1 digits between 0-23. |\n+---------------------------+------------------------------------------------+\n| %l | Hour with 1 digits between 1-12. |\n+---------------------------+------------------------------------------------+\n| %M | Full month name in current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n ...
[DATE_SUB]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=Performs date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a "-" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_ADD().\n \n\nSELECT DATE_SUB(''1998-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(''1998-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02 |\n+-----------------------------------------+\n \nSELECT DATE_SUB(''2005-01-01 00:00:00'', INTERVAL ''1\n1:1:1'' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(''2005-01-01 00:00:00'', INTERVAL ''1 1:1:1''\nDAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\n+----------------------------------------------------------------+
+description=Performs date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a "-" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nSee also DATE_ADD().\n\nExamples\n--------\n\nSELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB('1998-01-02', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02 |\n+-----------------------------------------+\n\nSELECT DATE_SUB('2005-01-01 00:00:00', INTERVAL '1 1:1:1' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB('2005-01-01 00:00:00', INTERVAL '1 1:1:1' DAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/date_sub/
+[DAY]
+declaration=date
+category=Date and Time Functions
+description=DAY() is a synonym for DAYOFMONTH().\n\nURL: https://mariadb.com/kb/en/day/
[DAYNAME]
declaration=date
category=Date and Time Functions
-description=Returns the name of the weekday for date. The language used\nfor the name is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \n\nSELECT DAYNAME(''2007-02-03'');\n+-----------------------+\n| DAYNAME(''2007-02-03'') |\n+-----------------------+\n| Saturday |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, DAYNAME(d) FROM t1;\n \n+---------------------+------------+\n| d | DAYNAME(d) |\n+---------------------+------------+\n| 2007-01-30 21:31:07 | Tuesday |\n| 1983-10-15 06:42:51 | Saturday |\n| 2011-04-21 12:34:56 | Thursday |\n| 2011-10-30 06:31:41 | Sunday |\n| 2011-01-30 14:03:25 | Sunday |\n| 2004-10-07 11:19:34 | Thursday |\n+---------------------+------------+\n \nChanging the locale:\n \nSET lc_time_names = ''fr_CA'';\n \nSELECT DAYNAME(''2013-04-01'');\n+-----------------------+\n| DAYNAME(''2013-04-01'') |\n+-----------------------+\n| lundi |\n+-----------------------+
+description=Returns the name of the weekday for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\n\nSELECT DAYNAME('2007-02-03');\n+-----------------------+\n| DAYNAME('2007-02-03') |\n+-----------------------+\n| Saturday |\n+-----------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d, DAYNAME(d) FROM t1;\n+---------------------+------------+\n| d | DAYNAME(d) |\n+---------------------+------------+\n| 2007-01-30 21:31:07 | Tuesday |\n| 1983-10-15 06:42:51 | Saturday |\n| 2011-04-21 12:34:56 | Thursday |\n| 2011-10-30 06:31:41 | Sunday |\n| 2011-01-30 14:03:25 | Sunday |\n| 2004-10-07 11:19:34 | Thursday |\n+---------------------+------------+\n\nChanging the locale:\n\nSET lc_time_names = 'fr_CA';\n\nSELECT DAYNAME('2013-04-01');\n+-----------------------+\n| DAYNAME('2013-04-01') |\n+-----------------------+\n| lundi |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/dayname/
[DAYOFMONTH]
declaration=date
category=Date and Time Functions
-description=Returns the day of the month for date, in the range 1 to 31,\nor 0\nfor dates such as ''0000-00-00'' or ''2008-00-00'' which\nhave a zero day\npart.\n \nDAY() is a synonym.\n \n\nSELECT DAYOFMONTH(''2007-02-03'');\n+--------------------------+\n| DAYOFMONTH(''2007-02-03'') |\n+--------------------------+\n| 3 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d FROM t1 where DAYOFMONTH(d) = 30;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+
+description=Returns the day of the month for date, in the range 1 to 31, or 0 for dates\nsuch as '0000-00-00' or '2008-00-00' which have a zero day part.\n\nDAY() is a synonym.\n\nExamples\n--------\n\nSELECT DAYOFMONTH('2007-02-03');\n+--------------------------+\n| DAYOFMONTH('2007-02-03') |\n+--------------------------+\n| 3 |\n+--------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d FROM t1 where DAYOFMONTH(d) = 30;\n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/dayofmonth/
[DAYOFWEEK]
declaration=date
category=Date and Time Functions
-description=Returns the day of the week index for the date (1 = Sunday,\n2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC\nstandard.\n \nThis contrasts with WEEKDAY() which follows a different\nindex numbering\n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \n\nSELECT DAYOFWEEK(''2007-02-03'');\n+-------------------------+\n| DAYOFWEEK(''2007-02-03'') |\n+-------------------------+\n| 7 |\n+-------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, DAYNAME(d), DAYOFWEEK(d), WEEKDAY(d) from t1;\n \n+---------------------+------------+--------------+------------+\n| d | DAYNAME(d) | DAYOFWEEK(d) | WEEKDAY(d) |\n+---------------------+------------+--------------+------------+\n| 2007-01-30 21:31:07 | Tuesday | 3 | 1 |\n| 1983-10-15 06:42:51 | Saturday | 7 | 5 |\n| 2011-04-21 12:34:56 | Thursday | 5 | 3 |\n| 2011-10-30 06:31:41 | Sunday | 1 | 6 |\n| 2011-01-30 14:03:25 | Sunday | 1 | 6 |\n| 2004-10-07 11:19:34 | Thursday | 5 | 3 |\n+---------------------+------------+--------------+------------+
+description=Returns the day of the week index for the date (1 = Sunday, 2 = Monday, ..., 7\n= Saturday). These index values correspond to the ODBC standard.\n\nThis contrasts with WEEKDAY() which follows a different index numbering (0 =\nMonday, 1 = Tuesday, ... 6 = Sunday).\n\nExamples\n--------\n\nSELECT DAYOFWEEK('2007-02-03');\n+-------------------------+\n| DAYOFWEEK('2007-02-03') |\n+-------------------------+\n| 7 |\n+-------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d, DAYNAME(d), DAYOFWEEK(d), WEEKDAY(d) from t1;\n+---------------------+------------+--------------+------------+\n| d | DAYNAME(d) | DAYOFWEEK(d) | WEEKDAY(d) |\n+---------------------+------------+--------------+------------+\n| 2007-01-30 21:31:07 | Tuesday | 3 | 1 |\n| 1983-10-15 06:42:51 | Saturday | 7 | 5 |\n| 2011-04-21 12:34:56 | Thursday | 5 | 3 |\n| 2011-10-30 06:31:41 | Sunday | 1 | 6 |\n| 2011-01-30 14:03:25 | Sunday | 1 | 6 |\n| 2004-10-07 11:19:34 | Thursday | 5 | 3 |\n+---------------------+------------+--------------+------------+\n\nURL: https://mariadb.com/kb/en/dayofweek/
[DAYOFYEAR]
declaration=date
category=Date and Time Functions
-description=Returns the day of the year for date, in the range 1 to 366.\n \n\nSELECT DAYOFYEAR(''2018-02-16'');\n+-------------------------+\n| DAYOFYEAR(''2018-02-16'') |\n+-------------------------+\n| 47 |\n+-------------------------+
-[DAY]
-declaration=date
-category=Date and Time Functions
-description=DAY() is a synonym for DAYOFMONTH().
+description=Returns the day of the year for date, in the range 1 to 366.\n\nExamples\n--------\n\nSELECT DAYOFYEAR('2018-02-16');\n+-------------------------+\n| DAYOFYEAR('2018-02-16') |\n+-------------------------+\n| 47 |\n+-------------------------+\n\nURL: https://mariadb.com/kb/en/dayofyear/
+[DECIMAL]
+declaration=M[,D]
+category=Data Types
+description=A packed "exact" fixed-point number. M is the total number of digits (the\nprecision) and D is the number of digits after the decimal point (the scale).\n\n* The decimal point and (for negative numbers) the "-" sign are not\ncounted in M. \n* If D is 0, values have no decimal point or fractional\npart and on INSERT the value will be rounded to the nearest DECIMAL. \n* The maximum number of digits (M) for DECIMAL is 65. \n* The maximum number of supported decimals (D) is 30 before MariadB 10.2.1 and\n38 afterwards. \n* If D is omitted, the default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of\ndigits specified by M.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with a\nprecision of 65 digits.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nDEC, NUMERIC and FIXED are synonyms, as well as NUMBER in Oracle mode from\nMariaDB 10.3.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6 Duplicates: 0 Warnings: 2\n\nNote (Code 1265): Data truncated for column 'd' at row 5\nNote (Code 1265): Data truncated for column 'd' at row 6\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n ...
[DECODE]
declaration=crypt_str,pass_str
category=Encryption Functions
-description=Decrypts the encrypted string crypt_str using pass_str as\nthe\npassword. crypt_str should be a string returned from\nENCODE(). The resulting string will be the original string\nonly if pass_str is the same.
+description=In the default mode, DECODE decrypts the encrypted string crypt_str using\npass_str as the password. crypt_str should be a string returned from ENCODE().\nThe resulting string will be the original string only if pass_str is the same.\n\nIn Oracle mode from MariaDB 10.3.2, DECODE compares expr to the search\nexpressions, in order. If it finds a match, the corresponding result\nexpression is returned. If no matches are found, the default expression is\nreturned, or NULL if no default is provided.\n\nNULLs are treated as equivalent.\n\nDECODE_ORACLE is a synonym for the Oracle-mode version of the function, and is\navailable in all modes.\n\nExamples\n--------\n\nFrom MariaDB 10.3.2:\n\nSELECT DECODE_ORACLE(2+1,3*1,'found1',3*2,'found2','default');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+1,3*1,'found1',3*2,'found2','default') |\n+--------------------------------------------------------+\n| found1 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+4,3*1,'found1',3*2,'found2','default');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+4,3*1,'found1',3*2,'found2','default') |\n+--------------------------------------------------------+\n| found2 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+2,3*1,'found1',3*2,'found2','default');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+2,3*1,'found1',3*2,'found2','default') |\n+--------------------------------------------------------+\n| default |\n+--------------------------------------------------------+\n\nNulls are treated as equivalent:\n\nSELECT DECODE_ORACLE(NULL,NULL,'Nulls are equivalent','Nulls are not\nequivalent');\n+----------------------------------------------------------------------------+\n| DECODE_ORACLE(NULL,NULL,'Nulls are equivalent','Nulls are not equivalent') |\n+----------------------------------------------------------------------------+\n| Nulls are equivalent |\n+----------------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/decode/
[DECODE_HISTOGRAM]
declaration=hist_type,histogram
category=Information Functions
-description=Returns a string of comma separated numeric values\ncorresponding to a probability distribution represented by\nthe histogram of type hist_type (SINGLE_PREC_HB or\nDOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n \nSee Histogram Based Statistics for details.\n \n\nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n \nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n \nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram) \n FROM mysql.column_stats WHERE db_name=''test'' and\ntable_name=''origin'';\n \n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0\n|\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059\n|\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F\n|\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502\n|\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n \nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,\n hist_type,hex(histogram),decode_histogram(hist_type,histogram)\n\n FROM mysql.column_stats WHERE db_name=''test'' and\ntable_name=''origin'';\n \n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| test | origin | i | DOUBLE_PREC_HB |\n0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 |\n0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.05882\n|\n| test | origin | v | DOUBLE_PREC_HB |\n5200F600480116067E0CB30F1B16831CB81FD67F |\n0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546,0.50063\n|
+description=Returns a string of comma separated numeric values corresponding to a\nprobability distribution represented by the histogram of type hist_type\n(SINGLE_PREC_HB or DOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n\nSee Histogram Based Statistics for details.\n\nExamples\n--------\n\nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n\nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n\nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent statistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n\nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram)\n FROM mysql.column_stats WHERE db_name='test' and table_name='origin';\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type | hex(histogram) |\ndecode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0 |\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059 |\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F |\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502 |\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n\nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n ...
[DEFAULT]
declaration=col_name
category=Information Functions
-description=Returns the default value for a table column. If the column\nhas no default value, NULL is returned.\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n \nWhen using DEFAULT as a value to set in an INSERT or UPDATE\nstatement, you can use the bare keyword DEFAULT without the\nparentheses and argument to\nrefer to the column in context. You can only use DEFAULT as\na bare keyword if you are using it\nalone without a surrounding expression or function.\n \n\nSelect only non-default values for a column:\n \nSELECT i FROM t WHERE i != DEFAULT(i);\n \nUpdate values to be one greater than the default value:\n \nUPDATE t SET i = DEFAULT(i)+1 WHERE i
+description=Returns the default value for a table column. If the column has no default\nvalue (and is not NULLABLE - NULLABLE fields have a NULL default), an error is\nreturned.\n\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n\nWhen using DEFAULT as a value to set in an INSERT or UPDATE statement, you can\nuse the bare keyword DEFAULT without the parentheses and argument to refer to\nthe column in context. You can only use DEFAULT as a bare keyword if you are\nusing it alone without a surrounding expression or function.\n\nExamples\n--------\n\nSelect only non-default values for a column:\n\nSELECT i FROM t WHERE i != DEFAULT(i);\n\nUpdate values to be one greater than the default value:\n\nUPDATE t SET i = DEFAULT(i)+1 WHERE i < 100;\n\nWhen referring to the default value exactly in UPDATE or INSERT, you can omit\nthe argument:\n\nINSERT INTO t (i) VALUES (DEFAULT);\nUPDATE t SET i = DEFAULT WHERE i < 100;\n\nCREATE OR REPLACE TABLE t (\n i INT NOT NULL AUTO_INCREMENT,\n j INT NOT NULL,\n k INT DEFAULT 3,\n l INT NOT NULL DEFAULT 4,\n m INT,\n PRIMARY KEY (i)\n);\n\nDESC t;\n+-------+---------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+----------------+\n| i | int(11) | NO | PRI | NULL | auto_increment |\n| j | int(11) | NO | | NULL | |\n| k | int(11) | YES | | 3 | |\n| l | int(11) | NO | | 4 | |\n| m | int(11) | YES | | NULL | |\n+-------+---------+------+-----+---------+----------------+\n\nINSERT INTO t (j) VALUES (1);\nINSERT INTO t (j,m) VALUES (2,2);\n ...
[DEGREES]
declaration=X
category=Numeric Functions
-description=Returns the argument X, converted from radians to degrees.\n \nThis is the converse of the RADIANS() function.\n \n\nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n \nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n \nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+
-[DENSE_RANK1]
-name=DENSE_RANK
+description=Returns the argument X, converted from radians to degrees.\n\nThis is the converse of the RADIANS() function.\n\nExamples\n--------\n\nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n\nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n\nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/degrees/
+[DENSE_RANK]
declaration=
category=Window Functions
-description=DENSE_RANK() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. Unlike the RANK() function, there\nare no skipped values if the preceding results are\nidentical. It is also similar to the ROW_NUMBER() function\nexcept that in that function, identical values will receive\na different row number for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
-[DENSE_RANK2]
-name=DENSE_RANK
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Window Functions
-description=DENSE_RANK() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. Unlike the RANK() function, there\nare no skipped values if the preceding results are\nidentical. It is also similar to the ROW_NUMBER() function\nexcept that in that function, identical values will receive\na different row number for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
+description=DENSE_RANK() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving the same result. Unlike the RANK() function,\nthere are no skipped values if the preceding results are identical. It is also\nsimilar to the ROW_NUMBER() function except that in that function, identical\nvalues will receive a different row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n ('Maths', 60, 'Thulile'),\n ('Maths', 60, 'Pritha'),\n ('Maths', 70, 'Voitto'),\n ('Maths', 55, 'Chun'),\n ('Biology', 60, 'Bilal'),\n ('Biology', 70, 'Roger');\n\nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/kb/en/dense_rank/
[DES_DECRYPT]
declaration=crypt_str[,key_str]
category=Encryption Functions
-description=Decrypts a string encrypted with DES_ENCRYPT(). If an error\noccurs,\nthis function returns NULL.\n \nThis function works only if MariaDB has been configured with\nTLS\nsupport.\n \nIf no key_str argument is given, DES_DECRYPT() examines the\nfirst byte\nof the encrypted string to determine the DES key number that\nwas used\nto encrypt the original string, and then reads the key from\nthe DES\nkey file to decrypt the message. For this to work, the user\nmust have\nthe SUPER privilege. The key file can be specified with the\n--des-key-file server option.\n \nIf you pass this function a key_str argument, that string is\nused as\nthe key for decrypting the message.\n \nIf the crypt_str argument does not appear to be an encrypted\nstring,\nMariaDB returns the given crypt_str.
+description=Decrypts a string encrypted with DES_ENCRYPT(). If an error occurs, this\nfunction returns NULL.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte of the\nencrypted string to determine the DES key number that was used to encrypt the\noriginal string, and then reads the key from the DES key file to decrypt the\nmessage. For this to work, the user must have the SUPER privilege. The key\nfile can be specified with the --des-key-file server option.\n\nIf you pass this function a key_str argument, that string is used as the key\nfor decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string, MariaDB\nreturns the given crypt_str.\n\nURL: https://mariadb.com/kb/en/des_decrypt/
[DES_ENCRYPT]
declaration=str[,{key_num|key_str}]
category=Encryption Functions
-description=Encrypts the string with the given key using the Triple-DES\nalgorithm.\n \nThis function works only if MariaDB has been configured with\nTLS support.\n \nThe encryption key to use is chosen based on the second\nargument to\nDES_ENCRYPT(), if one was given. With no argument, the first\nkey from\nthe DES key file is used. With a key_num argument, the given\nkey \nnumber (0-9) from the DES key file is used. With a key_str\nargument,\nthe given key string is used to encrypt str. \n \nThe key file can be specified with the --des-key-file server\noption.\n \nThe return string is a binary string where the first\ncharacter is \nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT()\nreturns NULL.\n \nThe 128 is added to make it easier to recognize an encrypted\nkey. If\nyou use a string key, key_num is 127.\n \nThe string length for the result is given by this formula:\n \nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n \nEach line in the DES key file has the following format:\n \nkey_num des_key_str\n \nEach key_num value must be a number in the range from 0 to\n9. Lines in\nthe file may be in any order. des_key_str is the string that\nis used\nto encrypt the message. There should be at least one space\nbetween the\nnumber and the key. The first key is the default key that is\nused if\nyou do not specify any key argument to DES_ENCRYPT().\n \nYou can tell MariaDB to read new key values from the key\nfile with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD\nprivilege.\n \nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted\ncolumn\nvalues, without giving the end user the right to decrypt\nthose values.\n \n\nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card =\nDES_ENCRYPT(''credit_card_number'');
+description=Encrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from the DES\nkey file is used. With a key_num argument, the given key number (0-9) from the\nDES key file is used. With a key_str argument, the given key string is used to\nencrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is CHAR(128 |\nkey_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If you use a\nstring key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in the\nfile may be in any order. des_key_str is the string that is used to encrypt\nthe message. There should be at least one space between the number and the\nkey. The first key is the default key that is used if you do not specify any\nkey argument to DES_ENCRYPT().\n\nYou can tell MariaDB to read new key values from the key file with the FLUSH\nDES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives applications a\nway to check for the existence of encrypted column values, without giving the\nend user the right to decrypt those values.\n\nExamples\n--------\n\nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card = DES_ENCRYPT('credit_card_number');\n\nURL: https://mariadb.com/kb/en/des_encrypt/
[DISJOINT]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether g1 is spatially disjoint\nfrom\n(does not intersect) g2.\n \nDISJOINT() tests the opposite relationship to INTERSECTS().\n \nDISJOINT() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_DISJOINT() uses\nobject shapes.
+description=Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does not\nintersect) g2.\n\nDISJOINT() tests the opposite relationship to INTERSECTS().\n\nDISJOINT() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_DISJOINT() uses object shapes.\n\nURL: https://mariadb.com/kb/en/disjoint/
+[DOUBLE]
+declaration=M,D
+category=Data Types
+description=A normal-size (double-precision) floating-point number (see FLOAT for a\nsingle-precision floating-point number).\n\nAllowable values are:\n\n* -1.7976931348623157E+308 to -2.2250738585072014E-308\n* 0\n* 2.2250738585072014E-308 to 1.7976931348623157E+308\n\nThese are the theoretical limits, based on the IEEE standard. The actual range\nmight be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the\ndecimal point. If M and D are omitted, values are stored to the limits allowed\nby the hardware. A double-precision floating-point number is accurate to\napproximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of\ndigits specified by M.\n\nREAL and DOUBLE PRECISION are synonyms, unless the REAL_AS_FLOAT SQL mode is\nenabled, in which case REAL is a synonym for FLOAT rather than DOUBLE.\n\nSee Floating Point Accuracy for issues when using floating-point numbers.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\n\nSELECT * FROM t1;\n+-------+\n| d |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n\nURL: https://mariadb.com/kb/en/double/
[ELT]
declaration=N, str1[, str2, str3,...]
category=String Functions
-description=Takes a numeric argument and a series of string arguments.\nReturns the string that corresponds to the given numeric\nposition. For instance, it returns str1 if N is 1, str2 if N\nis 2, and so on. If the numeric argument is a FLOAT, MariaDB\nrounds it to the nearest INTEGER. If the numeric argument is\nless than 1, greater than the total number of arguments, or\nnot a number, ELT() returns NULL. It must have at least two\narguments.\n \nIt is complementary to the FIELD() function.\n \n\nSELECT ELT(1, ''ej'', ''Heja'', ''hej'', ''foo'');\n+------------------------------------+\n| ELT(1, ''ej'', ''Heja'', ''hej'', ''foo'') |\n+------------------------------------+\n| ej |\n+------------------------------------+\n \nSELECT ELT(4, ''ej'', ''Heja'', ''hej'', ''foo'');\n+------------------------------------+\n| ELT(4, ''ej'', ''Heja'', ''hej'', ''foo'') |\n+------------------------------------+\n| foo |\n+------------------------------------+
+description=Takes a numeric argument and a series of string arguments. Returns the string\nthat corresponds to the given numeric position. For instance, it returns str1\nif N is 1, str2 if N is 2, and so on. If the numeric argument is a FLOAT,\nMariaDB rounds it to the nearest INTEGER. If the numeric argument is less than\n1, greater than the total number of arguments, or not a number, ELT() returns\nNULL. It must have at least two arguments.\n\nIt is complementary to the FIELD() function.\n\nExamples\n--------\n\nSELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');\n+------------------------------------+\n| ELT(1, 'ej', 'Heja', 'hej', 'foo') |\n+------------------------------------+\n| ej |\n+------------------------------------+\n\nSELECT ELT(4, 'ej', 'Heja', 'hej', 'foo');\n+------------------------------------+\n| ELT(4, 'ej', 'Heja', 'hej', 'foo') |\n+------------------------------------+\n| foo |\n+------------------------------------+\n\nURL: https://mariadb.com/kb/en/elt/
[ENCODE]
declaration=str,pass_str
category=Encryption Functions
-description=ENCODE is not considered cryptographically secure, and\nshould not be used for password encryption.\n \nEncrypt str using pass_str as the password. To decrypt the\nresult, use\nDECODE().\n \nThe result is a binary string of the same length as str.\n \nThe strength of the encryption is based on how good the\nrandom generator is. \n \nIt is not recommended to rely on the encryption performed by\nthe ENCODE function. Using a salt value (changed when a\npassword is updated) will improve matters somewhat, but for\nstoring passwords, consider a more cryptographically secure\nfunction, such as SHA2().\n \n\nENCODE(''not so secret text'',\nCONCAT(''random_salt'',''password''))
+description=ENCODE is not considered cryptographically secure, and should not be used for\npassword encryption.\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random generator is.\n\nIt is not recommended to rely on the encryption performed by the ENCODE\nfunction. Using a salt value (changed when a password is updated) will improve\nmatters somewhat, but for storing passwords, consider a more cryptographically\nsecure function, such as SHA2().\n\nExamples\n--------\n\nENCODE('not so secret text', CONCAT('random_salt','password'))\n\nURL: https://mariadb.com/kb/en/encode/
[ENCRYPT]
declaration=str[,salt]
category=Encryption Functions
-description=Encrypts a string using the Unix crypt() system call,\nreturning an encrypted binary string. The salt argument\nshould be a string with at least two characters or the\nreturned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n \nIt is not recommended to use ENCRYPT() with utf16, utf32 or\nucs2 multi-byte character sets because the crypt() system\ncall expects a string terminated with a zero byte.\n \nNote that the underlying crypt() system call may have some\nlimitations, such as ignoring all but the first eight\ncharacters.\n \nIf the have_crypt system variable is set to NO (because the\ncrypt() system call is not available), the ENCRYPT function\nwill always return NULL.\n \n\nSELECT ENCRYPT(''encrypt me'');\n+-----------------------+\n| ENCRYPT(''encrypt me'') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+
+description=Encrypts a string using the Unix crypt() system call, returning an encrypted\nbinary string. The salt argument should be a string with at least two\ncharacters or the returned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n\nIt is not recommended to use ENCRYPT() with utf16, utf32 or ucs2 multi-byte\ncharacter sets because the crypt() system call expects a string terminated\nwith a zero byte.\n\nNote that the underlying crypt() system call may have some limitations, such\nas ignoring all but the first eight characters.\n\nIf the have_crypt system variable is set to NO (because the crypt() system\ncall is not available), the ENCRYPT function will always return NULL.\n\nExamples\n--------\n\nSELECT ENCRYPT('encrypt me');\n+-----------------------+\n| ENCRYPT('encrypt me') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/encrypt/
[ENUM]
-declaration=''value1'',''value2'',...
+declaration='value1','value2',...
category=Data Types
-description=An enumeration. A string object that can have only one\nvalue, chosen\nfrom the list of values ''value1'', ''value2'', ..., NULL or\nthe special \n'''' error value. In theory, an ENUM column can have a\nmaximum of 65,535 distinct\nvalues; in practice, the real maximum depends on many\nfactors. ENUM values are represented internally as integers.\n \nTrailing spaces are automatically stripped from ENUM values\non table creation.\n \nENUMs require relatively little storage space compared to\nstrings, either one or two bytes depending on the number of\nenumeration values.\n \nNULL and empty values\n \nAn ENUM can also contain NULL and empty values. If the ENUM\ncolumn is declared to permit NULL values, NULL becomes a\nvalid value, as well as the default value (see below). If\nstrict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index\nvalue of zero (see Numeric index, below), is inserted, with\na warning. This may be confusing, because the empty string\nis also a possible value, and the only difference if that in\nthis case its index is not 0. Inserting will fail with an\nerror if strict mode is active.\n \nIf a DEFAULT clause is missing, the default value will be:\nNULL is the column is nullable;\notherwise, the first value in the enumaration.\n \nNumeric index\n \nENUM values are indexed numerically in the order they are\ndefined, and sorting will be performed in this numeric\norder. We suggest not using ENUM to store numerals, as there\nis little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by\nleaving out the quotes.\n \nAn ENUM defined as ENUM(''apple'',''orange'',''pear'') would\nhave the following index values:\n \nIndex | Value | \n \nNULL | NULL | \n \n0 | '''' | \n \n1 | ''apple'' | \n \n2 | ''orange'' | \n \n3 | ''pear'' | \n \n\nCREATE TABLE fruits (\n id INT NOT NULL auto_increment PRIMARY KEY,\n fruit ENUM(''apple'',''orange'',''pear''),\n bushels INT);\n \nDESCRIBE fruits;\n \n+---------+-------------------------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| fruit | enum(''apple'',''orange'',''pear'') | YES | | NULL\n| |\n| bushels | int(11) | YES | | NULL | |\n+---------+-------------------------------+------+-----+---------+----------------+\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (''pear'',20),\n (''apple'',100),\n (''orange'',25);\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (''avocado'',10);\nERROR 1265 (01000): Data truncated for column ''fruit'' at\nrow 1\n \nSELECT * FROM fruits;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 1 | pear | 20 |\n| 2 | apple | 100 |\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSelecting by numeric index:\n \nSELECT * FROM fruits WHERE fruit=2;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSorting is according to the index value:\n \nCREATE TABLE enums (a ENUM(''2'',''1''));\n \nINSERT INTO enums VALUES (''1''),(''2'');\n \nSELECT * FROM enums ORDER BY a ASC;\n \n+------+\n| a |\n+------+\n| 2 |\n| 1 |\n+------+\n \nIt''s easy to get confused between returning the enum\ninteger with the stored value, so we don''t suggest using\nENUM to store numerals. The first example returns the 1st\nindexed field (''2'' has an index value of 1, as it''s\ndefined first), while the second example returns the string\nvalue ''1''.\n \nSELECT * FROM enums WHERE a=1;\n \n+------+\n| a |\n+------+\n| 2 |\n+------+\n \nSELECT * FROM enums WHERE a=''1'';\n \n+------+\n| a |\n+------+\n| 1 |\n+------+
+description=An enumeration. A string object that can have only one value, chosen from the\nlist of values 'value1', 'value2', ..., NULL or the special '' error value. In\ntheory, an ENUM column can have a maximum of 65,535 distinct values; in\npractice, the real maximum depends on many factors. ENUM values are\nrepresented internally as integers.\n\nTrailing spaces are automatically stripped from ENUM values on table creation.\n\nENUMs require relatively little storage space compared to strings, either one\nor two bytes depending on the number of enumeration values.\n\nNULL and empty values\n---------------------\n\nAn ENUM can also contain NULL and empty values. If the ENUM column is declared\nto permit NULL values, NULL becomes a valid value, as well as the default\nvalue (see below). If strict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index value of zero\n(see Numeric index, below), is inserted, with a warning. This may be\nconfusing, because the empty string is also a possible value, and the only\ndifference if that is this case its index is not 0. Inserting will fail with\nan error if strict mode is active.\n\nIf a DEFAULT clause is missing, the default value will be:\n\n* NULL if the column is nullable;\n* otherwise, the first value in the enumeration.\n\nNumeric index\n-------------\n\nENUM values are indexed numerically in the order they are defined, and sorting\nwill be performed in this numeric order. We suggest not using ENUM to store\nnumerals, as there is little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by leaving out the quotes.\n\nAn ENUM defined as ENUM('apple','orange','pear') would have the following\nindex values:\n\n+--------------------------------------+--------------------------------------+\n| Index | Value |\n+--------------------------------------+--------------------------------------+\n| NULL | NULL |\n+--------------------------------------+--------------------------------------+\n| 0 | '' |\n+--------------------------------------+--------------------------------------+\n| 1 | 'apple' |\n+--------------------------------------+--------------------------------------+\n| 2 | 'orange' |\n+--------------------------------------+--------------------------------------+\n ...
[EQUALS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether g1 is spatially equal to\ng2.\n \nEQUALS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_EQUALS() uses\nobject shapes.\n \nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.
-[EXPORT_SET]
-declaration=bits, on, off[, separator[, number_of_bits]]
-category=String Functions
-description=Takes a minimum of three arguments. Returns a string where\neach bit in the given bits argument is returned, with the\nstring values given for on and off. \n \nBits are examined from right to left, (from low-order to\nhigh-order bits). Strings are added to the result from left\nto right, separated by a separator string (defaults as\n'',''). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits\noption. \n \nIf any of the arguments are set as NULL, the function\nreturns NULL.\n \n\nSELECT EXPORT_SET(5,''Y'',''N'','','',4);\n+-----------------------------+\n| EXPORT_SET(5,''Y'',''N'','','',4) |\n+-----------------------------+\n| Y,N,Y,N |\n+-----------------------------+\n \nSELECT EXPORT_SET(6,''1'',''0'','','',10);\n+------------------------------+\n| EXPORT_SET(6,''1'',''0'','','',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0 |\n+------------------------------+
+description=Returns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nEQUALS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_EQUALS() uses object shapes.\n\nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\n\nURL: https://mariadb.com/kb/en/equals/
+[EXCEPT]
+declaration=SELECT c_name AS name, email FROM employees
+category=Data Manipulation
+description=Difference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n ...
[EXP]
declaration=X
category=Numeric Functions
-description=Returns the value of e (the base of natural logarithms)\nraised to the\npower of X. The inverse of this function is LOG() (using a\nsingle\nargument only) or LN().\n \nIf X is NULL, this function returns NULL.\n \n\nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n \nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n \nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n \nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+
-[EXTRACTVALUE]
-declaration=xml_frag, xpath_expr
+description=Returns the value of e (the base of natural logarithms) raised to the power of\nX. The inverse of this function is LOG() (using a single argument only) or\nLN().\n\nIf X is NULL, this function returns NULL.\n\nExamples\n--------\n\nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n\nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n\nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n\nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+\n\nURL: https://mariadb.com/kb/en/exp/
+[EXPORT_SET]
+declaration=bits, on, off[, separator[, number_of_bits]]
category=String Functions
-description=The EXTRACTVALUE() function takes two string arguments: a\nfragment of XML markup and an XPath expression, (also known\nas a locator). It returns the text (That is, CDDATA), of the\nfirst text node which is a child of the element or elements\nmatching the XPath expression. \n \nIn cases where a valid XPath expression does not match any\ntext nodes in a valid XML fragment, (including the implicit\n/text() expression), the EXTRACTVALUE() function returns an\nempty string.\n \nInvalid Arguments\n \nWhen either the XML fragment or the XPath expression is\nNULL, the EXTRACTVALUE() function returns NULL. When the XML\nfragment is invalid, it raises a warning Code 1525:\n \nWarning (Code 1525): Incorrect XML value: ''parse error at\nline 1 pos 11: unexpected END-OF-INPUT''\n \nWhen the XPath value is invalid, it generates an Error 1105:\n \nERROR 1105 (HY000): XPATH syntax error: '')''\n \nExplicit text() Expressions\n \nThis function is the equivalent of performing a match using\nthe XPath expression after appending /text(). In other\nwords:\n \nSELECT\n EXTRACTVALUE(''example'', ''/cases/case'') AS ''Base\nExample'',\n EXTRACTVALUE(''example'', ''/cases/case/text()'') AS\n''text() Example'';\n \n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n \nCount Matches\n \nWhen EXTRACTVALUE() returns multiple matches, it returns the\ncontent of the first child text node of each matching\nelement, in the matched order, as a single, space-delimited\nstring.\n \nBy design, the EXTRACTVALUE() function makes no distinction\nbetween a match on an empty element and no match at all. If\nyou need to determine whether no matching element was found\nin the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count()\nfunction. \n \nFor instance, when looking for a value that exists, but\ncontains no child text nodes, you would get a count of the\nnumber of matching instances:\n \nSELECT\n EXTRACTVALUE('''', ''/cases/case'') AS ''Empty Example'',\n EXTRACTVALUE('''', ''/cases/case/count()'') AS ''count()\nExample'';\n \n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n \nAlternatively, when looking for a value that doesn''t exist,\ncount() returns 0.\n \nSELECT\n EXTRACTVALUE('''', ''/cases/person'') AS ''No Match\nExample'',\n EXTRACTVALUE('''', ''/cases/person/count()'') AS ''count()\nExample'';\n \n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n \nMatches\n \nImportant: The EXTRACTVALUE() function only returns CDDATA.\nIt does not return tags that the element might contain or\nthe text that these child elements contain.\n \nSELECT EXTRACTVALUE(''Personx@example.com'', ''/cases'') AS\nCase;\n \n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n \nNote, in the above example, while the XPath expression\nmatches to the parent instance, it does not return the\ncontained tag or its content.\n \n\nSELECT\n ExtractValue(''cccddd'', ''/a'') AS val1,\n ExtractValue(''cccddd'', ''/a/b'') AS val2,\n ExtractValue(''cccddd'', ''//b'') AS val3,\n ExtractValue(''cccddd'', ''/b'') AS val4,\n ExtractValue(''cccdddeee'', ''//b'') AS val5;\n \n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+
+description=Takes a minimum of three arguments. Returns a string where each bit in the\ngiven bits argument is returned, with the string values given for on and off.\n\nBits are examined from right to left, (from low-order to high-order bits).\nStrings are added to the result from left to right, separated by a separator\nstring (defaults as ','). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits option.\n\nIf any of the arguments are set as NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT EXPORT_SET(5,'Y','N',',',4);\n+-----------------------------+\n| EXPORT_SET(5,'Y','N',',',4) |\n+-----------------------------+\n| Y,N,Y,N |\n+-----------------------------+\n\nSELECT EXPORT_SET(6,'1','0',',',10);\n+------------------------------+\n| EXPORT_SET(6,'1','0',',',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/export_set/
[EXTRACT]
declaration=unit FROM date
category=Date and Time Functions
-description=The EXTRACT() function extracts the required unit from the\ndate. See Date and Time Units for a complete list of\npermitted units.\n \nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM\n...) was changed to return a value from 0 to 23, adhering to\nthe SQL standard. Until MariaDB 10.0.6 and MariaDB 5.5.34,\nand in all versions of MySQL at least as of MySQL 5.7, it\ncould return a value > 23. HOUR() is not a standard\nfunction, so continues to adhere to the old behaviour\ninherited from MySQL.\n \n\nSELECT EXTRACT(YEAR FROM ''2009-07-02'');\n+---------------------------------+\n| EXTRACT(YEAR FROM ''2009-07-02'') |\n+---------------------------------+\n| 2009 |\n+---------------------------------+\n \nSELECT EXTRACT(YEAR_MONTH FROM ''2009-07-02 01:02:03'');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM ''2009-07-02 01:02:03'') |\n+------------------------------------------------+\n| 200907 |\n+------------------------------------------------+\n \nSELECT EXTRACT(DAY_MINUTE FROM ''2009-07-02 01:02:03'');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM ''2009-07-02 01:02:03'') |\n+------------------------------------------------+\n| 20102 |\n+------------------------------------------------+\n \nSELECT EXTRACT(MICROSECOND FROM ''2003-01-02\n10:30:00.000123'');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM ''2003-01-02 10:30:00.000123'') |\n+--------------------------------------------------------+\n| 123 |\n+--------------------------------------------------------+\n \nFrom MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR\nFROM...) returns a value from 0 to 23, as per the SQL\nstandard. HOUR is not a standard function, so continues to\nadhere to the old behaviour inherited from MySQL.\n \nSELECT EXTRACT(HOUR FROM ''26:30:00''), HOUR(''26:30:00'');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM ''26:30:00'') | HOUR(''26:30:00'') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+
+description=The EXTRACT() function extracts the required unit from the date. See Date and\nTime Units for a complete list of permitted units.\n\nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM ...) was changed to\nreturn a value from 0 to 23, adhering to the SQL standard. Until MariaDB\n10.0.6 and MariaDB 5.5.34, and in all versions of MySQL at least as of MySQL\n5.7, it could return a value > 23. HOUR() is not a standard function, so\ncontinues to adhere to the old behaviour inherited from MySQL.\n\nExamples\n--------\n\nSELECT EXTRACT(YEAR FROM '2009-07-02');\n+---------------------------------+\n| EXTRACT(YEAR FROM '2009-07-02') |\n+---------------------------------+\n| 2009 |\n+---------------------------------+\n\nSELECT EXTRACT(YEAR_MONTH FROM '2009-07-02 01:02:03');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM '2009-07-02 01:02:03') |\n+------------------------------------------------+\n| 200907 |\n+------------------------------------------------+\n\nSELECT EXTRACT(DAY_MINUTE FROM '2009-07-02 01:02:03');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM '2009-07-02 01:02:03') |\n+------------------------------------------------+\n| 20102 |\n+------------------------------------------------+\n\nSELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:00.000123');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM '2003-01-02 10:30:00.000123') |\n+--------------------------------------------------------+\n| 123 |\n+--------------------------------------------------------+\n\nFrom MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM...) returns a value\nfrom 0 to 23, as per the SQL standard. HOUR is not a standard function, so\ncontinues to adhere to the old behaviour inherited from MySQL.\n\nSELECT EXTRACT(HOUR FROM '26:30:00'), HOUR('26:30:00');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM '26:30:00') | HOUR('26:30:00') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n\nURL: https://mariadb.com/kb/en/extract/
+[EXTRACTVALUE]
+declaration=xml_frag, xpath_expr
+category=String Functions
+description=The EXTRACTVALUE() function takes two string arguments: a fragment of XML\nmarkup and an XPath expression, (also known as a locator). It returns the text\n(That is, CDDATA), of the first text node which is a child of the element or\nelements matching the XPath expression.\n\nIn cases where a valid XPath expression does not match any text nodes in a\nvalid XML fragment, (including the implicit /text() expression), the\nEXTRACTVALUE() function returns an empty string.\n\nInvalid Arguments\n-----------------\n\nWhen either the XML fragment or the XPath expression is NULL, the\nEXTRACTVALUE() function returns NULL. When the XML fragment is invalid, it\nraises a warning Code 1525:\n\nWarning (Code 1525): Incorrect XML value: 'parse error at line 1 pos 11:\nunexpected END-OF-INPUT'\n\nWhen the XPath value is invalid, it generates an Error 1105:\n\nERROR 1105 (HY000): XPATH syntax error: ')'\n\nExplicit text() Expressions\n---------------------------\n\nThis function is the equivalent of performing a match using the XPath\nexpression after appending /text(). In other words:\n\nSELECT\n EXTRACTVALUE('example', '/cases/case')\n AS 'Base Example',\n EXTRACTVALUE('example', '/cases/case/text()')\n AS 'text() Example';\n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n\nCount Matches\n-------------\n\nWhen EXTRACTVALUE() returns multiple matches, it returns the content of the\nfirst child text node of each matching element, in the matched order, as a\nsingle, space-delimited string.\n\nBy design, the EXTRACTVALUE() function makes no distinction between a match on\nan empty element and no match at all. If you need to determine whether no\nmatching element was found in the XML fragment or if an element was found that\n ...
[FIELD]
declaration=pattern, str1[,str2,...]
category=String Functions
-description=Returns the index position of the string or number matching\nthe given pattern. Returns 0 in the event that none of the\narguments match the pattern. Raises an Error 1582 if not\ngiven at least two arguments.\n \nWhen all arguments given to the FIELD() function are\nstrings, they are treated as case-insensitive. When all the\narguments are numbers, they are treated as numbers.\nOtherwise, they are treated as doubles. \n \nIf the given pattern occurs more than once, the FIELD()\nfunction only returns the index of the first instance. If\nthe given pattern is NULL, the function returns 0, as a NULL\npattern always fails to match.\n \nThis function is complementary to the ELT() function.\n \n\nSELECT FIELD(''ej'', ''Hej'', ''ej'', ''Heja'', ''hej'',\n''foo'') \n AS ''Field Results'';\n \n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n \nSELECT FIELD(''fo'', ''Hej'', ''ej'', ''Heja'', ''hej'',\n''foo'')\n AS ''Field Results'';\n \n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(1, 2, 3, 4, 5, 1) AS ''Field Results'';\n \n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n \nSELECT FIELD(NULL, 2, 3) AS ''Field Results'';\n \n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(''fail'') AS ''Field Results'';\n \nError 1582 (42000): Incorrect parameter count in call\nto native function ''field''
+description=Returns the index position of the string or number matching the given pattern.\nReturns 0 in the event that none of the arguments match the pattern. Raises an\nError 1582 if not given at least two arguments.\n\nWhen all arguments given to the FIELD() function are strings, they are treated\nas case-insensitive. When all the arguments are numbers, they are treated as\nnumbers. Otherwise, they are treated as doubles.\n\nIf the given pattern occurs more than once, the FIELD() function only returns\nthe index of the first instance. If the given pattern is NULL, the function\nreturns 0, as a NULL pattern always fails to match.\n\nThis function is complementary to the ELT() function.\n\nExamples\n--------\n\nSELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo') \n AS 'Field Results';\n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n\nSELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo')\n AS 'Field Results';\n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD(1, 2, 3, 4, 5, 1) AS 'Field Results';\n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n\nSELECT FIELD(NULL, 2, 3) AS 'Field Results';\n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD('fail') AS 'Field Results';\nError 1582 (42000): Incorrect parameter count in call\nto native function 'field'\n\nURL: https://mariadb.com/kb/en/field/
[FIND_IN_SET]
declaration=pattern, strlist
category=String Functions
-description=Returns the index position where the given pattern occurs in\na string list. The first argument is the pattern you want to\nsearch for. The second argument is a string containing\ncomma-separated variables. If the second argument is of the\nSET data-type, the function is optimized to use bit\narithmetic.\n \nIf the pattern does not occur in the string list or if the\nstring list is an empty string, the function returns 0. If\neither argument is NULL, the function returns NULL. The\nfunction does not return the correct result if the pattern\ncontains a comma (",") character.\n \n\nSELECT FIND_IN_SET(''b'',''a,b,c,d'') AS "Found Results";\n \n+---------------+\n| Found Results |\n+---------------+\n| 2 |\n+---------------+
-[FIRST_VALUE1]
-name=FIRST_VALUE
+description=Returns the index position where the given pattern occurs in a string list.\nThe first argument is the pattern you want to search for. The second argument\nis a string containing comma-separated variables. If the second argument is of\nthe SET data-type, the function is optimized to use bit arithmetic.\n\nIf the pattern does not occur in the string list or if the string list is an\nempty string, the function returns 0. If either argument is NULL, the function\nreturns NULL. The function does not return the correct result if the pattern\ncontains a comma (",") character.\n\nExamples\n--------\n\nSELECT FIND_IN_SET('b','a,b,c,d') AS "Found Results";\n+---------------+\n| Found Results |\n+---------------+\n| 2 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/find_in_set/
+[FIRST_VALUE]
declaration=expr
category=Window Functions
-description=FIRST_VALUE returns the first result from an ordered set, or\nNULL if no such result exists.\n \n\nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, ''one'', 0.1, 0.001),\n( 2, 0, 2, ''two'', 0.2, 0.002),\n( 3, 0, 3, ''three'', 0.3, 0.003),\n( 4, 1, 2, ''three'', 0.4, 0.004),\n( 5, 1, 1, ''two'', 0.5, 0.005),\n( 6, 1, 1, ''one'', 0.6, 0.006),\n( 7, 2, NULL, ''n_one'', 0.5, 0.007),\n( 8, 2, 1, ''n_two'', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, ''n_four'', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+
-[FIRST_VALUE2]
-name=FIRST_VALUE
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Window Functions
-description=FIRST_VALUE returns the first result from an ordered set, or\nNULL if no such result exists.\n \n\nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, ''one'', 0.1, 0.001),\n( 2, 0, 2, ''two'', 0.2, 0.002),\n( 3, 0, 3, ''three'', 0.3, 0.003),\n( 4, 1, 2, ''three'', 0.4, 0.004),\n( 5, 1, 1, ''two'', 0.5, 0.005),\n( 6, 1, 1, ''one'', 0.6, 0.006),\n( 7, 2, NULL, ''n_one'', 0.5, 0.007),\n( 8, 2, 1, ''n_two'', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, ''n_four'', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+
+description=FIRST_VALUE returns the first result from an ordered set, or NULL if no such\nresult exists.\n\nExamples\n--------\n\nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n\nINSERT INTO t1 VALUES\n( 1, 0, 1, 'one', 0.1, 0.001),\n( 2, 0, 2, 'two', 0.2, 0.002),\n( 3, 0, 3, 'three', 0.3, 0.003),\n( 4, 1, 2, 'three', 0.4, 0.004),\n( 5, 1, 1, 'two', 0.5, 0.005),\n( 6, 1, 1, 'one', 0.6, 0.006),\n( 7, 2, NULL, 'n_one', 0.5, 0.007),\n( 8, 2, 1, 'n_two', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, 'n_four', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n\nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n\n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n ...
+[FLOAT]
+declaration=M,D
+category=Data Types
+description=A small (single-precision) floating-point number (see DOUBLE for a\nregular-size floating point number). Allowable values are:\n\n* -3.402823466E+38 to -1.175494351E-38\n* 0\n* 1.175494351E-38 to 3.402823466E+38.\n\nThese are the theoretical limits, based on the IEEE standard. The actual range\nmight be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the\ndecimal point. If M and D are omitted, values are stored to the limits allowed\nby the hardware. A single-precision floating-point number is accurate to\napproximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all calculations\nin MariaDB are done with double precision. See Floating Point Accuracy.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nURL: https://mariadb.com/kb/en/float/
[FLOOR]
declaration=X
category=Numeric Functions
-description=Returns the largest integer value not greater than X.\n \n\nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+
+description=Returns the largest integer value not greater than X.\n\nExamples\n--------\n\nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n\nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/floor/
[FORMAT]
declaration=num, decimal_position[, locale]
category=String Functions
-description=Formats the given number for display as a string, adding\nseparators to appropriate position and rounding the results\nto the given decimal position. For instance, it would format\n15233.345 to 15,233.35.\n \nIf the given decimal position is 0, it rounds to return no\ndecimal point or fractional part. You can optionally specify\na locale value to format numbers to the pattern appropriate\nfor the given region.\n \n\nSELECT FORMAT(1234567890.09876543210, 4) AS ''Format'';\n \n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n \nSELECT FORMAT(1234567.89, 4) AS ''Format'';\n \n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n \nSELECT FORMAT(1234567.89, 0) AS ''Format'';\n \n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n \nSELECT FORMAT(123456789,2,''rm_CH'') AS ''Format'';\n \n+----------------+\n| Format |\n+----------------+\n| 123''456''789,00 |\n+----------------+
+description=Formats the given number for display as a string, adding separators to\nappropriate position and rounding the results to the given decimal position.\nFor instance, it would format 15233.345 to 15,233.35.\n\nIf the given decimal position is 0, it rounds to return no decimal point or\nfractional part. You can optionally specify a locale value to format numbers\nto the pattern appropriate for the given region.\n\nExamples\n--------\n\nSELECT FORMAT(1234567890.09876543210, 4) AS 'Format';\n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n\nSELECT FORMAT(1234567.89, 4) AS 'Format';\n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n\nSELECT FORMAT(1234567.89, 0) AS 'Format';\n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n\nSELECT FORMAT(123456789,2,'rm_CH') AS 'Format';\n+----------------+\n| Format |\n+----------------+\n| 123'456'789,00 |\n+----------------+\n\nURL: https://mariadb.com/kb/en/format/
+[FORMAT_PICO_TIME]
+declaration=time_val
+category=Date and Time Functions
+description=Given a time in picoseconds, returns a human-readable time value and unit\nindicator. Resulting unit is dependent on the length of the argument, and can\nbe:\n\n* ps - picoseconds\n* ns - nanoseconds\n* us - microseconds\n* ms - milliseconds\n* s - seconds\n* min - minutes\n* h - hours\n* d - days\n\nWith the exception of results under one nanosecond, which are not rounded and\nare represented as whole numbers, the result is rounded to 2 decimal places,\nwith a minimum of 3 significant digits.\n\nReturns NULL if the argument is NULL.\n\nThis function is very similar to the Sys Schema FORMAT_TIME function, but with\nthe following differences:\n\n* Represents minutes as min rather than m.\n* Does not represent weeks.\n\nExamples\n--------\n\nSELECT\n FORMAT_PICO_TIME(43) AS ps,\n FORMAT_PICO_TIME(4321) AS ns,\n FORMAT_PICO_TIME(43211234) AS us,\n FORMAT_PICO_TIME(432112344321) AS ms,\n FORMAT_PICO_TIME(43211234432123) AS s,\n FORMAT_PICO_TIME(432112344321234) AS m,\n FORMAT_PICO_TIME(4321123443212345) AS h,\n FORMAT_PICO_TIME(432112344321234545) AS d;\n+--------+---------+----------+-----------+---------+----------+--------+------\n-+\n| ps | ns | us | ms | s | m | h | d \n |\n+--------+---------+----------+-----------+---------+----------+--------+------\n-+\n| 43 ps | 4.32 ns | 43.21 us | 432.11 ms | 43.21 s | 7.20 min | 1.20 h | 5.00\nd |\n+--------+---------+----------+-----------+---------+----------+--------+------\n-+\n\nURL: https://mariadb.com/kb/en/format_pico_time/
[FOUND_ROWS]
declaration=
category=Information Functions
-description=A SELECT statement may include a LIMIT clause to restrict\nthe number\nof rows the server returns to the client. In some cases, it\nis\ndesirable to know how many rows the statement would have\nreturned\nwithout the LIMIT, but without running the statement again.\nTo obtain\nthis row count, include a SQL_CALC_FOUND_ROWS option in the\nSELECT\nstatement, and then invoke FOUND_ROWS() afterwards.\n \nYou can also use FOUND_ROWS() to obtain the number of rows\nreturned by a SELECT which does not contain a LIMIT clause.\nIn this case you don''t need to use the SQL_CALC_FOUND_ROWS\noption. This can be useful for example in a stored\nprocedure.\n \nAlso, this function works with some other statements which\nreturn a resultset, including SHOW, DESC and HELP. For\nDELETE ... RETURNING you should use ROW_COUNT(). It also\nworks as a prepared statement, or after executing a prepared\nstatement.\n \nStatements which don''t return any results don''t affect\nFOUND_ROWS() - the previous value will still be returned.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows selected by the last query in the\nprocedure, not by the whole procedure.\n \nStatements using the FOUND_ROWS() function are not safe for\nreplication.\n \n\nSHOW ENGINES;\n \n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| Engine | Support | Comment | Transactions | XA |\nSavepoints |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| InnoDB | DEFAULT | Supports transactions, row-level\nlocking, and foreign keys | YES | YES | YES |\n...\n| SPHINX | YES | Sphinx storage engine | NO | NO | NO |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n11 rows in set (0.01 sec)\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 11 |\n+--------------+\n \nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100\nLIMIT 10;\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 23 |\n+--------------+
+description=A SELECT statement may include a LIMIT clause to restrict the number of rows\nthe server returns to the client. In some cases, it is desirable to know how\nmany rows the statement would have returned without the LIMIT, but without\nrunning the statement again. To obtain this row count, include a\nSQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke\nFOUND_ROWS() afterwards.\n\nYou can also use FOUND_ROWS() to obtain the number of rows returned by a\nSELECT which does not contain a LIMIT clause. In this case you don't need to\nuse the SQL_CALC_FOUND_ROWS option. This can be useful for example in a stored\nprocedure.\n\nAlso, this function works with some other statements which return a resultset,\nincluding SHOW, DESC and HELP. For DELETE ... RETURNING you should use\nROW_COUNT(). It also works as a prepared statement, or after executing a\nprepared statement.\n\nStatements which don't return any results don't affect FOUND_ROWS() - the\nprevious value will still be returned.\n\nWarning: When used after a CALL statement, this function returns the number of\nrows selected by the last query in the procedure, not by the whole procedure.\n\nStatements using the FOUND_ROWS() function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nSHOW ENGINES\G\n*************************** 1. row ***************************\n Engine: CSV\n Support: YES\n Comment: Stores tables as CSV files\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 2. row ***************************\n Engine: MRG_MyISAM\n Support: YES\n Comment: Collection of identical MyISAM tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n\n...\n\n*************************** 8. row ***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n ...
[FROM_BASE64]
declaration=str
category=String Functions
-description=Decodes the given base-64 encode string, returning the\nresult as a binary string. Returns NULL if the given string\nis NULL or if it''s invalid.\n \nIt is the reverse of the TO_BASE64 function.\n \nThere are numerous methods to base-64 encode a string.\nMariaDB uses the following:\nIt encodes alphabet value 64 as ''+''.\nIt encodes alphabet value 63 as ''/''.\nIt codes output in groups of four printable characters. Each\nthree byte of data encoded uses four characters. If the\nfinal group is incomplete, it pads the difference with the\n''='' character.\nIt divides long output, adding a new line very 76\ncharacters.\nIn decoding, it recognizes and ignores newlines, carriage\nreturns, tabs and space whitespace characters.\n \nSELECT TO_BASE64(''Maria'') AS ''Input'';\n \n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n \nSELECT FROM_BASE64(''TWFyaWE='') AS ''Output'';\n \n+--------+\n| Output |\n+--------+\n| Maria |\n+--------+
+description=Decodes the given base-64 encode string, returning the result as a binary\nstring. Returns NULL if the given string is NULL or if it's invalid.\n\nIt is the reverse of the TO_BASE64 function.\n\nThere are numerous methods to base-64 encode a string. MariaDB uses the\nfollowing:\n\n* It encodes alphabet value 64 as '+'.\n* It encodes alphabet value 63 as '/'.\n* It codes output in groups of four printable characters. Each three byte of\ndata encoded uses four characters. If the final group is incomplete, it pads\nthe difference with the '=' character.\n* It divides long output, adding a new line very 76 characters.\n* In decoding, it recognizes and ignores newlines, carriage returns, tabs and\nspace whitespace characters.\n\nSELECT TO_BASE64('Maria') AS 'Input';\n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n\nSELECT FROM_BASE64('TWFyaWE=') AS 'Output';\n+--------+\n| Output |\n+--------+\n| Maria |\n+--------+\n\nURL: https://mariadb.com/kb/en/from_base64/
[FROM_DAYS]
declaration=N
category=Date and Time Functions
-description=Given a day number N, returns a DATE value. The day count is\nbased on the number of days from the start of the standard\ncalendar (0000-00-00). \n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn''t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the TO_DAYS() function.\n \n\nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\n+-------------------+
-[FROM_UNIXTIME1]
-name=FROM_UNIXTIME
+description=Given a day number N, returns a DATE value. The day count is based on the\nnumber of days from the start of the standard calendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the\nGregorian calendar in October 1582. Results will not be reliable since it\ndoesn't account for the lost days when the calendar changed from the Julian\ncalendar.\n\nThis is the converse of the TO_DAYS() function.\n\nExamples\n--------\n\nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/from_days/
+[FROM_UNIXTIME]
declaration=unix_timestamp
category=Date and Time Functions
-description=Returns a representation of the unix_timestamp argument as a\nvalue in\n''YYYY-MM-DD HH:MM:SS'' or YYYYMMDDHHMMSS.uuuuuu format,\ndepending on\nwhether the function is used in a string or numeric context.\nThe value\nis expressed in the current time zone. unix_timestamp is an\ninternal\ntimestamp value such as is produced by the UNIX_TIMESTAMP()\nfunction.\n \nIf format is given, the result is formatted according to the\nformat\nstring, which is used the same way as listed in the entry\nfor the\nDATE_FORMAT() function.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a\ntimestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond\nthis.\n \nThe options that can be used by FROM_UNIXTIME(), as well as\nDATE_FORMAT() and STR_TO_DATE(), are:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix ''th'', ''nd'', ''st'' or\n''rd''''. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n''%I:%i:%S %p''. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for ''%H:%i:%S''. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 1 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nSunday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nPerformance Considerations\n \nIf your session time zone is set to SYSTEM (the default),\nFROM_UNIXTIME() will call the OS function to convert the\ndata using the system time zone. At least on Linux, the\ncorresponding function (localtime_r) uses a global mutex\ninside glibc that can cause contention under high concurrent\nload.\n \nSet your time zone to a named time zone to avoid this issue.\nSee mysql time zone tables for details on how to do this.\n \n\nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19 |\n+---------------------------+\n \nSELECT FROM_UNIXTIME(1196440219) + 0;\n \n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s\n%x'');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s %x'')\n|\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\n+---------------------------------------------------------+
-[FROM_UNIXTIME2]
-name=FROM_UNIXTIME
-declaration=unix_timestamp,format
-category=Date and Time Functions
-description=Returns a representation of the unix_timestamp argument as a\nvalue in\n''YYYY-MM-DD HH:MM:SS'' or YYYYMMDDHHMMSS.uuuuuu format,\ndepending on\nwhether the function is used in a string or numeric context.\nThe value\nis expressed in the current time zone. unix_timestamp is an\ninternal\ntimestamp value such as is produced by the UNIX_TIMESTAMP()\nfunction.\n \nIf format is given, the result is formatted according to the\nformat\nstring, which is used the same way as listed in the entry\nfor the\nDATE_FORMAT() function.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a\ntimestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond\nthis.\n \nThe options that can be used by FROM_UNIXTIME(), as well as\nDATE_FORMAT() and STR_TO_DATE(), are:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix ''th'', ''nd'', ''st'' or\n''rd''''. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n''%I:%i:%S %p''. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for ''%H:%i:%S''. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 1 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nSunday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nPerformance Considerations\n \nIf your session time zone is set to SYSTEM (the default),\nFROM_UNIXTIME() will call the OS function to convert the\ndata using the system time zone. At least on Linux, the\ncorresponding function (localtime_r) uses a global mutex\ninside glibc that can cause contention under high concurrent\nload.\n \nSet your time zone to a named time zone to avoid this issue.\nSee mysql time zone tables for details on how to do this.\n \n\nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19 |\n+---------------------------+\n \nSELECT FROM_UNIXTIME(1196440219) + 0;\n \n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s\n%x'');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s %x'')\n|\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\n+---------------------------------------------------------+
+description=Returns a representation of the unix_timestamp argument as a value in\n'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether\nthe function is used in a string or numeric context. The value is expressed in\nthe current time zone. unix_timestamp is an internal timestamp value such as\nis produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format string,\nwhich is used the same way as listed in the entry for the DATE_FORMAT()\nfunction.\n\nTimestamps in MariaDB have a maximum value of 2147483647, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a timestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond this.\n\nThe options that can be used by FROM_UNIXTIME(), as well as DATE_FORMAT() and\nSTR_TO_DATE(), are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | or Dec. |\n+---------------------------+------------------------------------------------+\n| %c | Month with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %D | Day with English suffix 'th', 'nd', 'st' or |\n| | 'rd''. (1st, 2nd, 3rd...). |\n+---------------------------+------------------------------------------------+\n| %d | Day with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %e | Day with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %f | Microseconds 6 digits. |\n+---------------------------+------------------------------------------------+\n| %H | Hour with 2 digits between 00-23. |\n+---------------------------+------------------------------------------------+\n| %h | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %I | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %i | Minute with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %j | Day of the year (001-366) |\n+---------------------------+------------------------------------------------+\n ...
[GEOMETRYCOLLECTION]
declaration=g1,g2,...
category=Geometry Constructors
-description=Constructs a WKB GeometryCollection. If any argument is not\na well-formed WKB representation of a geometry, the return\nvalue is NULL.\n \n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(''GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))'')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(''GeometryCollection()'')),\n (GeomFromText(''GeometryCollection EMPTY''));
+description=Constructs a WKB GeometryCollection. If any argument is not a well-formed WKB\nrepresentation of a geometry, the return value is NULL.\n\nExamples\n--------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText('GeometryCollection()')),\n (GeomFromText('GeometryCollection EMPTY'));\n\nURL: https://mariadb.com/kb/en/geometrycollection/
[GET_FORMAT]
-declaration={DATE|DATETIME|TIME}, {''EUR''|''USA''|''JIS''|''ISO''|''INTERNAL''}
+declaration={DATE|DATETIME|TIME}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'}
category=Date and Time Functions
-description=Returns a format string. This function is useful in\ncombination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n \nPossible result formats are:\n \nFunction Call | Result Format | \n \nGET_FORMAT(DATE,''EUR'') | ''%d.%m.%Y'' | \n \nGET_FORMAT(DATE,''USA'') | ''%m.%d.%Y'' | \n \nGET_FORMAT(DATE,''JIS'') | ''%Y-%m-%d'' | \n \nGET_FORMAT(DATE,''ISO'') | ''%Y-%m-%d'' | \n \nGET_FORMAT(DATE,''INTERNAL'') | ''%Y%m%d'' | \n \nGET_FORMAT(DATETIME,''EUR'') | ''%Y-%m-%d %H.%i.%s'' | \n \nGET_FORMAT(DATETIME,''USA'') | ''%Y-%m-%d %H.%i.%s'' | \n \nGET_FORMAT(DATETIME,''JIS'') | ''%Y-%m-%d %H:%i:%s'' | \n \nGET_FORMAT(DATETIME,''ISO'') | ''%Y-%m-%d %H:%i:%s'' | \n \nGET_FORMAT(DATETIME,''INTERNAL'') | ''%Y%m%d%H%i%s'' | \n \nGET_FORMAT(TIME,''EUR'') | ''%H.%i.%s'' | \n \nGET_FORMAT(TIME,''USA'') | ''%h:%i:%s %p'' | \n \nGET_FORMAT(TIME,''JIS'') | ''%H:%i:%s'' | \n \nGET_FORMAT(TIME,''ISO'') | ''%H:%i:%s'' | \n \nGET_FORMAT(TIME,''INTERNAL'') | ''%H%i%s'' | \n \n\nObtaining the string matching to the standard European date\nformat:\n \nSELECT GET_FORMAT(DATE, ''EUR'');\n+-------------------------+\n| GET_FORMAT(DATE, ''EUR'') |\n+-------------------------+\n| %d.%m.%Y |\n+-------------------------+\n \nUsing the same string to format a date:\n \nSELECT DATE_FORMAT(''2003-10-03'',GET_FORMAT(DATE,''EUR''));\n+--------------------------------------------------+\n| DATE_FORMAT(''2003-10-03'',GET_FORMAT(DATE,''EUR'')) |\n+--------------------------------------------------+\n| 03.10.2003 |\n+--------------------------------------------------+\n \nSELECT STR_TO_DATE(''10.31.2003'',GET_FORMAT(DATE,''USA''));\n+--------------------------------------------------+\n| STR_TO_DATE(''10.31.2003'',GET_FORMAT(DATE,''USA'')) |\n+--------------------------------------------------+\n| 2003-10-31 |\n+--------------------------------------------------+
+description=Returns a format string. This function is useful in combination with the\nDATE_FORMAT() and the STR_TO_DATE() functions.\n\nPossible result formats are:\n\n+--------------------------------------+--------------------------------------+\n| Function Call | Result Format |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,'EUR') | '%d.%m.%Y' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,'USA') | '%m.%d.%Y' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,'JIS') | '%Y-%m-%d' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,'ISO') | '%Y-%m-%d' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,'INTERNAL') | '%Y%m%d' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,'EUR') | '%Y-%m-%d %H.%i.%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,'USA') | '%Y-%m-%d %H.%i.%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,'JIS') | '%Y-%m-%d %H:%i:%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,'ISO') | '%Y-%m-%d %H:%i:%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,'INTERNAL') | '%Y%m%d%H%i%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,'EUR') | '%H.%i.%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,'USA') | '%h:%i:%s %p' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,'JIS') | '%H:%i:%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,'ISO') | '%H:%i:%s' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,'INTERNAL') | '%H%i%s' |\n+--------------------------------------+--------------------------------------+\n\nExamples\n--------\n\nObtaining the string matching to the standard European date format:\n\nSELECT GET_FORMAT(DATE, 'EUR');\n+-------------------------+\n| GET_FORMAT(DATE, 'EUR') |\n+-------------------------+\n| %d.%m.%Y |\n+-------------------------+\n ...
[GET_LOCK]
declaration=str,timeout
category=Miscellaneous Functions
-description=Tries to obtain a lock with a name given by the string str,\nusing a timeout of timeout seconds. Returns 1 if the lock\nwas obtained successfully, 0 if the attempt timed out (for\nexample, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of\nmemory or the thread was killed with mysqladmin kill).\n \nA lock is released with RELEASE_LOCK(), when the connection\nterminates (either normally or abnormally), or before\nMariaDB 10.0.2, when the connection executes another\nGET_LOCK statement. From MariaDB 10.0.2, a connection can\nhold multiple locks at the same time, so a lock that is no\nlonger needed needs to be explicitly released.\n \nThe IS_FREE_LOCK function returns whether a specified lock a\nfree or not, and the IS_USED_LOCK whether the function is in\nuse or not.\n \nLocks obtained with GET_LOCK() do not interact with\ntransactions. That is, committing a transaction does not\nrelease any such locks obtained during the transaction.\n \nFrom MariaDB 10.0.2, it is also possible to recursively set\nthe same lock. If a lock with the same name is set n times,\nit needs to be released n times as well. \n \nstr is case insensitive for GET_LOCK() and related\nfunctions. If str is an empty string or NULL, GET_LOCK()\nreturns NULL and does nothing. From MariaDB 10.2.2, timeout\nsupports microseconds. Before then, it was rounded to the\nclosest integer.\n \nIf the metadata_lock_info plugin is installed, locks\nacquired with this function are visible in the Information\nSchema METADATA_LOCK_INFO table.\n \nThis function can be used to implement application locks or\nto simulate record locks. Names are locked on a server-wide\nbasis. If a name has been locked by one client, GET_LOCK()\nblocks any request by another client for a lock with the\nsame name. This allows clients that agree on a given lock\nname to use the name to perform cooperative advisory\nlocking. But be aware that it also allows a client that is\nnot among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any\nof the cooperating clients from locking that name. One way\nto reduce the likelihood of this is to use lock names that\nare database-specific or application-specific. For example,\nuse lock names of the form db_name.str or app_name.str.\n \nStatements using the GET_LOCK() function are not safe for\nreplication.\n \nThe patch to permit multiple locks was contributed by\nKonstantin "Kostja" Osipov (MDEV-3917).\n \n\nSELECT GET_LOCK(''lock1'',10);\n+----------------------+\n| GET_LOCK(''lock1'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(''lock1''), IS_USED_LOCK(''lock1'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock1'') | IS_USED_LOCK(''lock1'') |\n+-----------------------+-----------------------+\n| 0 | 46 |\n+-----------------------+-----------------------+\n \nSELECT IS_FREE_LOCK(''lock2''), IS_USED_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock2'') | IS_USED_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n| 1 | NULL |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, multiple locks can be held:\n \nSELECT GET_LOCK(''lock2'',10);\n+----------------------+\n| GET_LOCK(''lock2'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(''lock1''), IS_FREE_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock1'') | IS_FREE_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n| 0 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(''lock1''), RELEASE_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(''lock1'') | RELEASE_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n| 1 | 1 |\n+-----------------------+-----------------------+\n \nBefore MariaDB 10.0.2, a connection could only hold a single\nlock:\n \nSELECT GET_LOCK(''lock2'',10);\n+----------------------+\n| GET_LOCK(''lock2'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(''lock1''), IS_FREE_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock1'') | IS_FREE_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n| 1 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(''lock1''), RELEASE_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(''lock1'') | RELEASE_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n| NULL | 1 |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(''lock3'',10);\n+----------------------+\n| GET_LOCK(''lock3'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(''lock3'',10);\n+----------------------+\n| GET_LOCK(''lock3'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(''lock3'');\n+-----------------------+\n| RELEASE_LOCK(''lock3'') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(''lock3'');\n+-----------------------+\n| RELEASE_LOCK(''lock3'') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \nTimeout example: Connection 1:\n \nSELECT GET_LOCK(''lock4'',10);\n+----------------------+\n| GET_LOCK(''lock4'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(''lock4'',10);\n \nAfter 10 seconds...\n \n+----------------------+\n| GET_LOCK(''lock4'',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nDeadlocks are automatically detected and resolved.\nConnection 1:\n \nSELECT GET_LOCK(''lock5'',10); \n+----------------------+\n| GET_LOCK(''lock5'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(''lock6'',10);\n+----------------------+\n| GET_LOCK(''lock6'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT GET_LOCK(''lock6'',10); \n+----------------------+\n| GET_LOCK(''lock6'',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(''lock5'',10);\nERROR 1213 (40001): Deadlock found when trying to get lock;\n try restarting transaction
+description=Tries to obtain a lock with a name given by the string str, using a timeout of\ntimeout seconds. Returns 1 if the lock was obtained successfully, 0 if the\nattempt timed out (for example, because another client has previously locked\nthe name), or NULL if an error occurred (such as running out of memory or the\nthread was killed with mariadb-admin kill).\n\nA lock is released with RELEASE_LOCK(), when the connection terminates (either\nnormally or abnormally). A connection can hold multiple locks at the same\ntime, so a lock that is no longer needed needs to be explicitly released.\n\nThe IS_FREE_LOCK function returns whether a specified lock a free or not, and\nthe IS_USED_LOCK whether the function is in use or not.\n\nLocks obtained with GET_LOCK() do not interact with transactions. That is,\ncommitting a transaction does not release any such locks obtained during the\ntransaction.\n\nIt is also possible to recursively set the same lock. If a lock with the same\nname is set n times, it needs to be released n times as well.\n\nstr is case insensitive for GET_LOCK() and related functions. If str is an\nempty string or NULL, GET_LOCK() returns NULL and does nothing. timeout\nsupports microseconds.\n\nIf the metadata_lock_info plugin is installed, locks acquired with this\nfunction are visible in the Information Schema METADATA_LOCK_INFO table.\n\nThis function can be used to implement application locks or to simulate record\nlocks. Names are locked on a server-wide basis. If a name has been locked by\none client, GET_LOCK() blocks any request by another client for a lock with\nthe same name. This allows clients that agree on a given lock name to use the\nname to perform cooperative advisory locking. But be aware that it also allows\na client that is not among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any of the cooperating\nclients from locking that name. One way to reduce the likelihood of this is to\nuse lock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nStatements using the GET_LOCK function are not safe for statement-based\nreplication.\n\nThe patch to permit multiple locks was contributed by Konstantin "Kostja"\nOsipov (MDEV-3917).\n\nExamples\n--------\n\nSELECT GET_LOCK('lock1',10);\n+----------------------+\n| GET_LOCK('lock1',10) |\n ...
[GLENGTH]
declaration=ls
category=LineString Properties
-description=Returns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+
+description=Returns as a double-precision number the length of the LineString value ls in\nits associated spatial reference.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+\n\nURL: https://mariadb.com/kb/en/glength/
[GREATEST]
declaration=value1,value2,...
category=Comparison Operators
-description=With two or more arguments, returns the largest\n(maximum-valued)\nargument. The arguments are compared using the same rules as\nfor\nLEAST().\n \n\nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n \nSELECT GREATEST(''B'',''A'',''C'');\n+-----------------------+\n| GREATEST(''B'',''A'',''C'') |\n+-----------------------+\n| C |\n+-----------------------+
+description=With two or more arguments, returns the largest (maximum-valued) argument. The\narguments are compared using the same rules as for LEAST().\n\nExamples\n--------\n\nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n\nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n\nSELECT GREATEST('B','A','C');\n+-----------------------+\n| GREATEST('B','A','C') |\n+-----------------------+\n| C |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/greatest/
[GROUP_CONCAT]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=This function returns a string result with the concatenated\nnon-NULL\nvalues from a group. It returns NULL if there are no\nnon-NULL values.\n \nThe maximum returned length in bytes is determined by the\ngroup_concat_max_len server system variable, which defaults\nto 1M (>= MariaDB 10.2.4) or 1K (
+description=This function returns a string result with the concatenated non-NULL values\nfrom a group. If any expr in GROUP_CONCAT evaluates to NULL, that tuple is not\npresent in the list returned by GROUP_CONCAT.\n\nIt returns NULL if all arguments are NULL, or there are no matching rows.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len\nserver system variable, which defaults to 1M.\n\nIf group_concat_max_len <= 512, the return type is VARBINARY or VARCHAR;\notherwise, the return type is BLOB or TEXT. The choice between binary or\nnon-binary types depends from the input.\n\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nDISTINCT eliminates duplicate values from the output string.\n\nORDER BY determines the order of returned values.\n\nSEPARATOR specifies a separator between the values. The default separator is a\ncomma (,). It is possible to avoid using a separator by specifying an empty\nstring.\n\nLIMIT\n-----\n\nThe LIMIT clause can be used with GROUP_CONCAT. This was not possible prior to\nMariaDB 10.3.3.\n\nExamples\n--------\n\nSELECT student_name,\n GROUP_CONCAT(test_score)\n FROM student\n GROUP BY student_name;\n\nGet a readable list of MariaDB users from the mysql.user table:\n\nSELECT GROUP_CONCAT(DISTINCT User ORDER BY User SEPARATOR '\n')\n FROM mysql.user;\n\nIn the former example, DISTINCT is used because the same user may occur more\nthan once. The new line (\n) used as a SEPARATOR makes the results easier to\n ...
[HEX]
declaration=N_or_S
category=String Functions
-description=If N_or_S is a number, returns a string representation of\nthe hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is\nequivalent to CONV(N,10,16).\n \nIf N_or_S is a string, returns a hexadecimal string\nrepresentation of\nN_or_S where each byte of each character in N_or_S is\nconverted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this\noperation is performed by the UNHEX()\nfunction.\n \n\nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT HEX(''MariaDB'');\n+----------------+\n| HEX(''MariaDB'') |\n+----------------+\n| 4D617269614442 |\n+----------------+
+description=If N_or_S is a number, returns a string representation of the hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,16).\n\nIf N_or_S is a string, returns a hexadecimal string representation of N_or_S\nwhere each byte of each character in N_or_S is converted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this operation is\nperformed by the UNHEX() function.\n\nMariaDB starting with 10.5.0\n----------------------------\nHEX() with an INET6 argument returns a hexadecimal representation of the\nunderlying 16-byte binary string.\n\nExamples\n--------\n\nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n\nSELECT 0x4D617269614442;\n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n\nSELECT HEX('MariaDB');\n+----------------+\n| HEX('MariaDB') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n\nFrom MariaDB 10.5.0:\n\nSELECT HEX(CAST('2001:db8::ff00:42:8329' AS INET6));\n+----------------------------------------------+\n| HEX(CAST('2001:db8::ff00:42:8329' AS INET6)) |\n+----------------------------------------------+\n| 20010DB8000000000000FF0000428329 |\n+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/hex/
[HOUR]
declaration=time
category=Date and Time Functions
-description=Returns the hour for time. The range of the return value is\n0 to 23\nfor time-of-day values. However, the range of TIME values\nactually is\nmuch larger, so HOUR can return values greater than 23.\n \nThe return value is always positive, even if a negative TIME\nvalue is provided.\n \n\nSELECT HOUR(''10:05:03'');\n+------------------+\n| HOUR(''10:05:03'') |\n+------------------+\n| 10 |\n+------------------+\n \nSELECT HOUR(''272:59:59'');\n+-------------------+\n| HOUR(''272:59:59'') |\n+-------------------+\n| 272 |\n+-------------------+\n \nDifference between EXTRACT (HOUR FROM ...) (>= MariaDB\n10.0.7 and MariaDB 5.5.35) and HOUR:\n \nSELECT EXTRACT(HOUR FROM ''26:30:00''), HOUR(''26:30:00'');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM ''26:30:00'') | HOUR(''26:30:00'') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+
+description=Returns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much larger,\nso HOUR can return values greater than 23.\n\nThe return value is always positive, even if a negative TIME value is provided.\n\nExamples\n--------\n\nSELECT HOUR('10:05:03');\n+------------------+\n| HOUR('10:05:03') |\n+------------------+\n| 10 |\n+------------------+\n\nSELECT HOUR('272:59:59');\n+-------------------+\n| HOUR('272:59:59') |\n+-------------------+\n| 272 |\n+-------------------+\n\nDifference between EXTRACT (HOUR FROM ...) (>= MariaDB 10.0.7 and MariaDB\n5.5.35) and HOUR:\n\nSELECT EXTRACT(HOUR FROM '26:30:00'), HOUR('26:30:00');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM '26:30:00') | HOUR('26:30:00') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n\nURL: https://mariadb.com/kb/en/hour/
[IFNULL]
declaration=expr1,expr2
category=Control Flow Functions
-description=If expr1 is not NULL, IFNULL() returns expr1; otherwise it\nreturns\nexpr2. IFNULL() returns a numeric or string value, depending\non the\ncontext in which it is used.\n \n\nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n \nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n \nSELECT IFNULL(1/0,''yes'');\n+-------------------+\n| IFNULL(1/0,''yes'') |\n+-------------------+\n| yes |\n+-------------------+
+description=If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.\nIFNULL() returns a numeric or string value, depending on the context in which\nit is used.\n\nFrom MariaDB 10.3, NVL() is an alias for IFNULL().\n\nExamples\n--------\n\nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n\nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n\nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n\nSELECT IFNULL(1/0,'yes');\n+-------------------+\n| IFNULL(1/0,'yes') |\n+-------------------+\n| yes |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/ifnull/
+[IN]
+declaration=value,...
+category=Comparison Operators
+description=Returns 1 if expr is equal to any of the values in the IN list, else returns\n0. If all values are constants, they are evaluated according to the type of\nexpr and sorted. The search for the item then is done using a binary search.\nThis means IN is very quick if the IN value list consists entirely of\nconstants. Otherwise, type conversion takes place according to the rules\ndescribed at Type Conversion, but applied to all the arguments.\n\nIf expr is NULL, IN always returns NULL. If at least one of the values in the\nlist is NULL, and one of the comparisons is true, the result is 1. If at least\none of the values in the list is NULL and none of the comparisons is true, the\nresult is NULL.\n\nExamples\n--------\n\nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n| 0 |\n+----------------+\n\nSELECT 'wefwf' IN ('wee','wefwf','weg');\n+----------------------------------+\n| 'wefwf' IN ('wee','wefwf','weg') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n\nType conversion:\n\nSELECT 1 IN ('1', '2', '3');\n+----------------------+\n| 1 IN ('1', '2', '3') |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT NULL IN (1, 2, 3);\n+-------------------+\n| NULL IN (1, 2, 3) |\n+-------------------+\n| NULL |\n+-------------------+\n\nSELECT 1 IN (1, 2, NULL);\n+-------------------+\n| 1 IN (1, 2, NULL) |\n+-------------------+\n| 1 |\n ...
[INET6_ATON]
declaration=expr
category=Miscellaneous Functions
-description=Given an IPv6 or IPv4 network address as a string, returns a\nbinary string that represents the numeric value of the\naddress.\n \nNo trailing zone ID''s or traling network masks are\npermitted. For IPv4 addresses, or IPv6 addresses with IPv4\naddress parts, no classful addresses or trailing port\nnumbers are permitted and octal numbers are not supported.\n \nThe returned binary string will be VARBINARY(16) or\nVARBINARY(4) for IPv6 and IPv4 addresses respectively.\n \nReturns NULL if the argument is not understood.\n \n\nSELECT HEX(INET6_ATON(''10.0.1.1''));\n+-----------------------------+\n| HEX(INET6_ATON(''10.0.1.1'')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n \nSELECT HEX(INET6_ATON(''48f3::d432:1431:ba23:846f''));\n+----------------------------------------------+\n| HEX(INET6_ATON(''48f3::d432:1431:ba23:846f'')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+
+description=Given an IPv6 or IPv4 network address as a string, returns a binary string\nthat represents the numeric value of the address.\n\nNo trailing zone ID's or traling network masks are permitted. For IPv4\naddresses, or IPv6 addresses with IPv4 address parts, no classful addresses or\ntrailing port numbers are permitted and octal numbers are not supported.\n\nThe returned binary string will be VARBINARY(16) or VARBINARY(4) for IPv6 and\nIPv4 addresses respectively.\n\nReturns NULL if the argument is not understood.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, INET6_ATON can take INET6 as an argument.\n\nExamples\n--------\n\nSELECT HEX(INET6_ATON('10.0.1.1'));\n+-----------------------------+\n| HEX(INET6_ATON('10.0.1.1')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n\nSELECT HEX(INET6_ATON('48f3::d432:1431:ba23:846f'));\n+----------------------------------------------+\n| HEX(INET6_ATON('48f3::d432:1431:ba23:846f')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/inet6_aton/
[INET6_NTOA]
declaration=expr
category=Miscellaneous Functions
-description=Given an IPv6 or IPv4 network address as a numeric binary\nstring, returns the address as a nonbinary string in the\nconnection character set.\n \nThe return string is lowercase, and is platform independent,\nsince it does not use functions specific to the operating\nsystem. It has a maximum length of 39 characters.\n \nReturns NULL if the argument is not understood.\n \n\nSELECT INET6_NTOA(UNHEX(''0A000101''));\n+-------------------------------+\n| INET6_NTOA(UNHEX(''0A000101'')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n \nSELECT\nINET6_NTOA(UNHEX(''48F3000000000000D4321431BA23846F''));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(''48F3000000000000D4321431BA23846F'')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+
+description=Given an IPv6 or IPv4 network address as a numeric binary string, returns the\naddress as a nonbinary string in the connection character set.\n\nThe return string is lowercase, and is platform independent, since it does not\nuse functions specific to the operating system. It has a maximum length of 39\ncharacters.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET6_NTOA(UNHEX('0A000101'));\n+-------------------------------+\n| INET6_NTOA(UNHEX('0A000101')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n\nSELECT INET6_NTOA(UNHEX('48F3000000000000D4321431BA23846F'));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX('48F3000000000000D4321431BA23846F')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/inet6_ntoa/
[INET_ATON]
declaration=expr
category=Miscellaneous Functions
-description=Given the dotted-quad representation of an IPv4 network\naddress as a string,\nreturns an integer that represents the numeric value of the\naddress.\nAddresses may be 4- or 8-byte addresses.\n \nReturns NULL if the argument is not understood.\n \n\nSELECT INET_ATON(''192.168.1.1'');\n+--------------------------+\n| INET_ATON(''192.168.1.1'') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n \nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1\nx 256 + 1
+description=Given the dotted-quad representation of an IPv4 network address as a string,\nreturns an integer that represents the numeric value of the address. Addresses\nmay be 4- or 8-byte addresses.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET_ATON('192.168.1.1');\n+--------------------------+\n| INET_ATON('192.168.1.1') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n\nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1 x 256 + 1\n\nURL: https://mariadb.com/kb/en/inet_aton/
[INET_NTOA]
declaration=expr
category=Miscellaneous Functions
-description=Given a numeric IPv4 network address in network byte order\n(4 or 8 byte),\nreturns the dotted-quad representation of the address as a\nstring.\n \n\nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n \n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168\nx 256 2 + 1 x 256 + 1 = 3232235777
+description=Given a numeric IPv4 network address in network byte order (4 or 8 byte),\nreturns the dotted-quad representation of the address as a string.\n\nExamples\n--------\n\nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n\n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168 x 256 2 + 1 x 256\n+ 1 = 3232235777\n\nURL: https://mariadb.com/kb/en/inet_ntoa/
[INSTR]
declaration=str,substr
category=String Functions
-description=Returns the position of the first occurrence of substring\nsubstr in\nstring str. This is the same as the two-argument form of\nLOCATE(),\nexcept that the order of the arguments is reversed.\n \nINSTR() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT INSTR(''foobarbar'', ''bar'');\n+---------------------------+\n| INSTR(''foobarbar'', ''bar'') |\n+---------------------------+\n| 4 |\n+---------------------------+\n \nSELECT INSTR(''My'', ''Maria'');\n+----------------------+\n| INSTR(''My'', ''Maria'') |\n+----------------------+\n| 0 |\n+----------------------+
+description=Returns the position of the first occurrence of substring substr in string\nstr. This is the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nINSTR() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT INSTR('foobarbar', 'bar');\n+---------------------------+\n| INSTR('foobarbar', 'bar') |\n+---------------------------+\n| 4 |\n+---------------------------+\n\nSELECT INSTR('My', 'Maria');\n+----------------------+\n| INSTR('My', 'Maria') |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/instr/
+[INT]
+declaration=M
+category=Data Types
+description=A normal-size integer. When marked UNSIGNED, it ranges from 0 to 4294967295,\notherwise its range is -2147483648 to 2147483647 (SIGNED is the default). If a\ncolumn has been set to ZEROFILL, all values will be prepended by zeros so that\nthe INT value contains a number of M digits. INTEGER is a synonym for INT.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nINT4 is a synonym for INT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE ints (a INT,b INT UNSIGNED,c INT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO ints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column 'b' at row 1\n\nINSERT INTO ints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column 'c' at row 1\n\nINSERT INTO ints VALUES (-10,10,10);\n\nINSERT INTO ints VALUES (2147483648,2147483648,2147483648);\nERROR 1264 (22003): Out of range value for column 'a' at row 1\n\nINSERT INTO ints VALUES (2147483647,2147483648,2147483648);\n\nSELECT * FROM ints;\n+------------+------------+------------+\n| a | b | c |\n+------------+------------+------------+\n| -10 | 10 | 0000000010 |\n| 2147483647 | 2147483648 | 2147483648 |\n+------------+------------+------------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO ints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.10 sec)\nWarning (Code 1264): Out of range value for column 'b' at row 1\nWarning (Code 1264): Out of range value for column 'c' at row 1\n\nINSERT INTO ints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column 'c' at row 1\n ...
+[INTERSECT]
+declaration=as well as EXCEPT
+category=Data Manipulation
+description=MariaDB 10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nINTERSECT implicitly supposes a DISTINCT operation.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nINTERSECT has higher precedence than UNION and EXCEPT (unless running running\nin Oracle mode, in which case all three have the same precedence). If possible\nit will be executed linearly but if not it will be translated to a subquery in\nthe FROM clause:\n\n(select a,b from t1)\nunion\n(select c,d from t2)\nintersect\n(select e,f from t3)\nunion\n(select 4,4);\n\nwill be translated to:\n\n(select a,b from t1)\nunion\nselect c,d from\n ((select c,d from t2)\n intersect\n (select e,f from t3)) dummy_subselect\nunion\n(select 4,4)\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nINTERSECT ALL and INTERSECT DISTINCT were introduced in MariaDB 10.5.0. The\n ...
[INTERSECTS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nINTERSECTS() is based on the original MySQL implementation\nand uses object bounding rectangles, while ST_INTERSECTS()\nuses object shapes.\n \nINTERSECTS() tests the opposite relationship to DISJOINT().
+description=Returns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nINTERSECTS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_INTERSECTS() uses object shapes.\n\nINTERSECTS() tests the opposite relationship to DISJOINT().\n\nURL: https://mariadb.com/kb/en/intersects/
[INTERVAL]
declaration=N,N1,N2,N3,...
category=Comparison Operators
-description=Returns the index of the last argument that is less than the\nfirst argument or is NULL. \n \nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or\n-1 if N is NULL. All\narguments are treated as integers. It is required that N1 <\nN2 < N3
+description=Returns the index of the last argument that is less than the first argument or\nis NULL.\n\nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or -1 if N is NULL.\nAll arguments are treated as integers. It is required that N1 < N2 < N3 < ...\n< Nn for this function to work correctly. This is because a fast binary search\nis used.\n\nExamples\n--------\n\nSELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n+--------------------------------------+\n| INTERVAL(23, 1, 15, 17, 30, 44, 200) |\n+--------------------------------------+\n| 3 |\n+--------------------------------------+\n\nSELECT INTERVAL(10, 1, 10, 100, 1000);\n+--------------------------------+\n| INTERVAL(10, 1, 10, 100, 1000) |\n+--------------------------------+\n| 2 |\n+--------------------------------+\n\nSELECT INTERVAL(22, 23, 30, 44, 200);\n+-------------------------------+\n| INTERVAL(22, 23, 30, 44, 200) |\n+-------------------------------+\n| 0 |\n+-------------------------------+\n\nSELECT INTERVAL(10, 2, NULL);\n+-----------------------+\n| INTERVAL(10, 2, NULL) |\n+-----------------------+\n| 2 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/interval/
[ISNULL]
declaration=expr
category=Comparison Operators
-description=If expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n \nSee also NULL Values in MariaDB.\n \n\nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n \nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+
+description=If expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n\nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/isnull/
[IS_FREE_LOCK]
declaration=str
category=Miscellaneous Functions
-description=Checks whether the lock named str is free to use (that is,\nnot locked).\nReturns 1 if the lock is free (no one is using the lock),\n 0 if the lock is in use, and NULL if an\nerror occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_FREE_LOCK() function are not safe\nfor replication.
+description=Checks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock is in\nuse, and NULL if an error occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema\nmetadata_lock_info table contains information about locks of this kind (as\nwell as metadata locks).\n\nStatements using the IS_FREE_LOCK function are not safe for statement-based\nreplication.\n\nURL: https://mariadb.com/kb/en/is_free_lock/
[IS_IPV4]
declaration=expr
category=Miscellaneous Functions
-description=If the expression is a valid IPv4 address, returns 1,\notherwise returns 0.\n \nIS_IPV4() is stricter than INET_ATON(), but as strict as\nINET6_ATON(), in determining the validity of an IPv4\naddress. This implies that if IS_IPV4 returns 1, the same\nexpression will always return a non-NULL result when passed\nto INET_ATON(), but that the reverse may not apply.\n \n\nSELECT IS_IPV4(''1110.0.1.1'');\n+-----------------------+\n| IS_IPV4(''1110.0.1.1'') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT IS_IPV4(''48f3::d432:1431:ba23:846f'');\n+--------------------------------------+\n| IS_IPV4(''48f3::d432:1431:ba23:846f'') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+
+description=If the expression is a valid IPv4 address, returns 1, otherwise returns 0.\n\nIS_IPV4() is stricter than INET_ATON(), but as strict as INET6_ATON(), in\ndetermining the validity of an IPv4 address. This implies that if IS_IPV4\nreturns 1, the same expression will always return a non-NULL result when\npassed to INET_ATON(), but that the reverse may not apply.\n\nExamples\n--------\n\nSELECT IS_IPV4('1110.0.1.1');\n+-----------------------+\n| IS_IPV4('1110.0.1.1') |\n+-----------------------+\n| 0 |\n+-----------------------+\n\nSELECT IS_IPV4('48f3::d432:1431:ba23:846f');\n+--------------------------------------+\n| IS_IPV4('48f3::d432:1431:ba23:846f') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4/
[IS_IPV4_COMPAT]
declaration=expr
category=Miscellaneous Functions
-description=Returns 1 if a given numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is IPv4-compatible,\notherwise returns 0. \n \n\nSELECT IS_IPV4_COMPAT(INET6_ATON(''::10.0.1.1''));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(''::10.0.1.1'')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT\nIS_IPV4_COMPAT(INET6_ATON(''::48f3::d432:1431:ba23:846f''));\n+-----------------------------------------------------------+\n|\nIS_IPV4_COMPAT(INET6_ATON(''::48f3::d432:1431:ba23:846f''))\n|\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+
+description=Returns 1 if a given numeric binary string IPv6 address, such as returned by\nINET6_ATON(), is IPv4-compatible, otherwise returns 0.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, when the argument is not INET6, automatic implicit CAST\nto INET6 is applied. As a consequence, IS_IPV4_COMPAT now understands\narguments in both text representation and binary(16) representation. Before\nMariaDB 10.5.0, the function understood only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_COMPAT(INET6_ATON('::10.0.1.1'));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON('::10.0.1.1')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n\nSELECT IS_IPV4_COMPAT(INET6_ATON('::48f3::d432:1431:ba23:846f'));\n+-----------------------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON('::48f3::d432:1431:ba23:846f')) |\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4_compat/
[IS_IPV4_MAPPED]
declaration=expr
category=Miscellaneous Functions
-description=Returns 1 if a given a numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is a valid IPv4-mapped\naddress, otherwise returns 0.\n \n\nSELECT IS_IPV4_MAPPED(INET6_ATON(''::10.0.1.1''));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(''::10.0.1.1'')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n \nSELECT IS_IPV4_MAPPED(INET6_ATON(''::ffff:10.0.1.1''));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(''::ffff:10.0.1.1'')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+
+description=Returns 1 if a given a numeric binary string IPv6 address, such as returned by\nINET6_ATON(), is a valid IPv4-mapped address, otherwise returns 0.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, when the argument is not INET6, automatic implicit CAST\nto INET6 is applied. As a consequence, IS_IPV4_MAPPED now understands\narguments in both text representation and binary(16) representation. Before\nMariaDB 10.5.0, the function understood only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_MAPPED(INET6_ATON('::10.0.1.1'));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON('::10.0.1.1')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n\nSELECT IS_IPV4_MAPPED(INET6_ATON('::ffff:10.0.1.1'));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON('::ffff:10.0.1.1')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4_mapped/
[IS_IPV6]
declaration=expr
category=Miscellaneous Functions
-description=Returns 1 if the expression is a valid IPv6 address\nspecified as a string, otherwise returns 0. Does not\nconsider IPv4 addresses to be valid IPv6 addresses.\n \n\n SELECT IS_IPV6(''48f3::d432:1431:ba23:846f'');\n+--------------------------------------+\n| IS_IPV6(''48f3::d432:1431:ba23:846f'') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n \nSELECT IS_IPV6(''10.0.1.1'');\n+---------------------+\n| IS_IPV6(''10.0.1.1'') |\n+---------------------+\n| 0 |\n+---------------------+
+description=Returns 1 if the expression is a valid IPv6 address specified as a string,\notherwise returns 0. Does not consider IPv4 addresses to be valid IPv6\naddresses.\n\nExamples\n--------\n\nSELECT IS_IPV6('48f3::d432:1431:ba23:846f');\n+--------------------------------------+\n| IS_IPV6('48f3::d432:1431:ba23:846f') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n\nSELECT IS_IPV6('10.0.1.1');\n+---------------------+\n| IS_IPV6('10.0.1.1') |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv6/
[IS_USED_LOCK]
declaration=str
category=Miscellaneous Functions
-description=Checks whether the lock named str is in use (that is,\nlocked). If so,\nit returns the connection identifier of the client that\nholds the\nlock. Otherwise, it returns NULL. str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_USED_LOCK() function are not safe\nfor replication.
+description=Checks whether the lock named str is in use (that is, locked). If so, it\nreturns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL. str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema\nmetadata_lock_info table contains information about locks of this kind (as\nwell as metadata locks).\n\nStatements using the IS_USED_LOCK function are not safe for statement-based\nreplication.\n\nURL: https://mariadb.com/kb/en/is_used_lock/
[JSON_ARRAY]
declaration=[value[, value2] ...]
category=JSON Functions
-description=Returns a JSON array containing the listed values. The list\ncan be empty.\n \nExample\n \nSELECT Json_Array(56, 3.1416, ''My name is "Foo"'', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, ''My name is "Foo"'', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, "My name is \"Foo\"", null] |\n+--------------------------------------------------+
+description=Returns a JSON array containing the listed values. The list can be empty.\n\nExample\n-------\n\nSELECT Json_Array(56, 3.1416, 'My name is "Foo"', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, 'My name is "Foo"', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, "My name is \"Foo\"", null] |\n+--------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array/
+[JSON_ARRAYAGG]
+declaration=column_or_expression
+category=JSON Functions
+description=JSON_ARRAYAGG returns a JSON array containing an element for each value in a\ngiven set of JSON or SQL values. It acts on a column or an expression that\nevaluates to a single value.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len\nserver system variable.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_ARRAYAGG cannot currently be used as a window function.\n\nThe full syntax is as follows:\n\nJSON_ARRAYAGG([DISTINCT] expr\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT);\n\nINSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2,\n2);\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;\n+-------------------+-------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+-------------------+-------------------+\n| [1,2,1,2,3,2,2,2] | [1,1,1,1,2,2,2,2] |\n+-------------------+-------------------+\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;\n+------------------+------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+------------------+------------------+\n| [1,2,1,2] | [1,1,1,1] |\n| [3,2,2,2] | [2,2,2,2] |\n+------------------+------------------+\n\nURL: https://mariadb.com/kb/en/json_arrayagg/
[JSON_ARRAY_APPEND]
declaration=json_doc, path, value[, path, value] ...
category=JSON Functions
-description=Appends values to the end of the specified arrays within a\nJSON document, returning the result, or NULL if any of the\narguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \n\nSET @json = ''[1, 2, [3, 4]]'';\n \nSELECT JSON_ARRAY_APPEND(@json, ''$[0]'', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[0]'', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, ''$[1]'', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[1]'', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, ''$[1]'', 6, ''$[2]'', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[1]'', 6, ''$[2]'', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, ''$'', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$'', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n \nSET @json = ''{"A": 1, "B": [2], "C": [3, 4]}'';\n \nSELECT JSON_ARRAY_APPEND(@json, ''$.B'', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$.B'', 5) |\n+------------------------------------+\n| {"A": 1, "B": [2, 5], "C": [3, 4]} |\n+------------------------------------+
+description=Appends values to the end of the specified arrays within a JSON document,\nreturning the result, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = '[1, 2, [3, 4]]';\n\nSELECT JSON_ARRAY_APPEND(@json, '$[0]', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, '$[0]', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, '$[1]', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, '$[1]', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, '$[1]', 6, '$[2]', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, '$[1]', 6, '$[2]', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, '$', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, '$', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n\nSET @json = '{"A": 1, "B": [2], "C": [3, 4]}';\n\nSELECT JSON_ARRAY_APPEND(@json, '$.B', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, '$.B', 5) |\n+------------------------------------+\n| {"A": 1, "B": [2, 5], "C": [3, 4]} |\n+------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array_append/
[JSON_ARRAY_INSERT]
declaration=json_doc, path, value[, path, value] ...
category=JSON Functions
-description=Inserts a value into a JSON document, returning the modified\ndocument, or NULL if any of the arguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \n\nSET @json = ''[1, 2, [3, 4]]'';\n \nSELECT JSON_ARRAY_INSERT(@json, ''$[0]'', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[0]'', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, ''$[1]'', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[1]'', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, ''$[1]'', 6, ''$[2]'', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[1]'', 6, ''$[2]'', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+
+description=Inserts a value into a JSON document, returning the modified document, or NULL\nif any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = '[1, 2, [3, 4]]';\n\nSELECT JSON_ARRAY_INSERT(@json, '$[0]', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, '$[0]', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, '$[1]', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, '$[1]', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, '$[1]', 6, '$[2]', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, '$[1]', 6, '$[2]', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array_insert/
+[JSON_ARRAY_INTERSECT]
+declaration=arr1, arr2
+category=JSON Functions
+description=Finds intersection between two json arrays and returns an array of items found\nin both array.\n\nExamples\n--------\n\nSET @json1= '[1,2,3]';\nSET @json2= '[1,2,4]';\n\nSELECT json_array_intersect(@json1, @json2); \n+--------------------------------------+\n| json_array_intersect(@json1, @json2) |\n+--------------------------------------+\n| [1, 2] |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array_intersect/
[JSON_COMPACT]
declaration=json_doc
category=JSON Functions
-description=Removes all unnecessary spaces so the json document is as\nshort as possible.\n \nExample\n \nSET @j = ''{ "A": 1, "B": [2, 3]}'';\n \nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j) | @j |\n+-------------------+------------------------+\n| {"A":1,"B":[2,3]} | { "A": 1, "B": [2, 3]} |\n+-------------------+------------------------+
+description=Removes all unnecessary spaces so the json document is as short as possible.\n\nExample\n-------\n\nSET @j = '{ "A": 1, "B": [2, 3]}';\n\nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j) | @j |\n+-------------------+------------------------+\n| {"A":1,"B":[2,3]} | { "A": 1, "B": [2, 3]} |\n+-------------------+------------------------+\n\nURL: https://mariadb.com/kb/en/json_compact/
[JSON_CONTAINS]
declaration=json_doc, val[, path]
category=JSON Functions
-description=Returns whether or not the specified value is found in the\ngiven JSON document or, optionally, at the specified path\nwithin the document. Returns 1 if it does, 0 if not and NULL\nif any of the arguments are null. An error occurs if the\ndocument or path is not valid, or contains the * or **\nwildcards.\n \n\nSET @json = ''{"A": 0, "B": {"C": 1}, "D": 2}'';\n \nSELECT JSON_CONTAINS(@json, ''2'', ''$.A'');\n+----------------------------------+\n| JSON_CONTAINS(@json, ''2'', ''$.A'') |\n+----------------------------------+\n| 0 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, ''2'', ''$.D'');\n+----------------------------------+\n| JSON_CONTAINS(@json, ''2'', ''$.D'') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, ''{"C": 1}'', ''$.A'');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, ''{"C": 1}'', ''$.A'') |\n+-----------------------------------------+\n| 0 |\n+-----------------------------------------+\n \nSELECT JSON_CONTAINS(@json, ''{"C": 1}'', ''$.B'');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, ''{"C": 1}'', ''$.B'') |\n+-----------------------------------------+\n| 1 |\n+-----------------------------------------+
+description=Returns whether or not the specified value is found in the given JSON document\nor, optionally, at the specified path within the document. Returns 1 if it\ndoes, 0 if not and NULL if any of the arguments are null. An error occurs if\nthe document or path is not valid, or contains the * or ** wildcards.\n\nExamples\n--------\n\nSET @json = '{"A": 0, "B": {"C": 1}, "D": 2}';\n\nSELECT JSON_CONTAINS(@json, '2', '$.A');\n+----------------------------------+\n| JSON_CONTAINS(@json, '2', '$.A') |\n+----------------------------------+\n| 0 |\n+----------------------------------+\n\nSELECT JSON_CONTAINS(@json, '2', '$.D');\n+----------------------------------+\n| JSON_CONTAINS(@json, '2', '$.D') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n\nSELECT JSON_CONTAINS(@json, '{"C": 1}', '$.A');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, '{"C": 1}', '$.A') |\n+-----------------------------------------+\n| 0 |\n+-----------------------------------------+\n\nSELECT JSON_CONTAINS(@json, '{"C": 1}', '$.B');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, '{"C": 1}', '$.B') |\n+-----------------------------------------+\n| 1 |\n+-----------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_contains/
[JSON_CONTAINS_PATH]
declaration=json_doc, return_arg, path[, path] ...
category=JSON Functions
-description=Indicates whether the given JSON document contains data at\nthe specified path or paths. Returns 1 if it does, 0 if not\nand NULL if any of the arguments are null.\n \nThe return_arg can be one or all:\none - Returns 1 if at least one path exists within the JSON\ndocument. \nall - Returns 1 only if all paths exist within the JSON\ndocument.\n \n\nSET @json = ''{"A": 1, "B": [2], "C": [3, 4]}'';\n \nSELECT JSON_CONTAINS_PATH(@json, ''one'', ''$.A'', ''$.D'');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, ''one'', ''$.A'', ''$.D'') |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n \nSELECT JSON_CONTAINS_PATH(@json, ''all'', ''$.A'', ''$.D'');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, ''all'', ''$.A'', ''$.D'') |\n+------------------------------------------------+\n| 0 |\n+------------------------------------------------+
+description=Indicates whether the given JSON document contains data at the specified path\nor paths. Returns 1 if it does, 0 if not and NULL if any of the arguments are\nnull.\n\nThe return_arg can be one or all:\n\n* one - Returns 1 if at least one path exists within the JSON document. \n* all - Returns 1 only if all paths exist within the JSON document.\n\nExamples\n--------\n\nSET @json = '{"A": 1, "B": [2], "C": [3, 4]}';\n\nSELECT JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D') |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n\nSELECT JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D') |\n+------------------------------------------------+\n| 0 |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_contains_path/
[JSON_DEPTH]
declaration=json_doc
category=JSON Functions
-description=Returns the maximum depth of the given JSON document, or\nNULL if the argument is null. An error will occur if the\nargument is an invalid JSON document.\nScalar values or empty arrays or objects have a depth of 1.\nArrays or objects that are not empty but contain only\nelements or member values of depth 1 will have a depth of 2.\nIn other cases, the depth will be greater than 2.\n \n\nSELECT JSON_DEPTH(''[]''), JSON_DEPTH(''true''),\nJSON_DEPTH(''{}'');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(''[]'') | JSON_DEPTH(''true'') |\nJSON_DEPTH(''{}'') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n \nSELECT JSON_DEPTH(''[1, 2, 3]''), JSON_DEPTH(''[[], {},\n[]]'');\n+-------------------------+----------------------------+\n| JSON_DEPTH(''[1, 2, 3]'') | JSON_DEPTH(''[[], {}, []]'') |\n+-------------------------+----------------------------+\n| 2 | 2 |\n+-------------------------+----------------------------+\n \nSELECT JSON_DEPTH(''[1, 2, [3, 4, 5, 6], 7]'');\n+---------------------------------------+\n| JSON_DEPTH(''[1, 2, [3, 4, 5, 6], 7]'') |\n+---------------------------------------+\n| 3 |\n+---------------------------------------+
+description=Returns the maximum depth of the given JSON document, or NULL if the argument\nis null. An error will occur if the argument is an invalid JSON document.\n\n* Scalar values or empty arrays or objects have a depth of 1.\n* Arrays or objects that are not empty but contain only elements or member\nvalues of depth 1 will have a depth of 2.\n* In other cases, the depth will be greater than 2.\n\nExamples\n--------\n\nSELECT JSON_DEPTH('[]'), JSON_DEPTH('true'), JSON_DEPTH('{}');\n+------------------+--------------------+------------------+\n| JSON_DEPTH('[]') | JSON_DEPTH('true') | JSON_DEPTH('{}') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n\nSELECT JSON_DEPTH('[1, 2, 3]'), JSON_DEPTH('[[], {}, []]');\n+-------------------------+----------------------------+\n| JSON_DEPTH('[1, 2, 3]') | JSON_DEPTH('[[], {}, []]') |\n+-------------------------+----------------------------+\n| 2 | 2 |\n+-------------------------+----------------------------+\n\nSELECT JSON_DEPTH('[1, 2, [3, 4, 5, 6], 7]');\n+---------------------------------------+\n| JSON_DEPTH('[1, 2, [3, 4, 5, 6], 7]') |\n+---------------------------------------+\n| 3 |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_depth/
[JSON_DETAILED]
declaration=json_doc[, tab_size]
category=JSON Functions
-description=Represents JSON in the most understandable way emphasizing\nnested structures.\n \nExample\n \nSET @j = ''{ "A":1,"B":[2,3]}'';\n \nSELECT @j;\n+--------------------+\n| @j |\n+--------------------+\n| { "A":1,"B":[2,3]} |\n+--------------------+\n \nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j) |\n+------------------------------------------------------------+\n| {\n "A": 1,\n "B": \n [\n 2,\n 3\n ]\n} |\n+------------------------------------------------------------+
+description=Represents JSON in the most understandable way emphasizing nested structures.\n\nJSON_PRETTY was added as an alias for JSON_DETAILED in MariaDB 10.10.3,\nMariaDB 10.9.5, MariaDB 10.8.7, MariaDB 10.7.8, MariaDB 10.6.12, MariaDB\n10.5.19 and MariaDB 10.4.28.\n\nExample\n-------\n\nSET @j = '{ "A":1,"B":[2,3]}';\n\nSELECT @j;\n+--------------------+\n| @j |\n+--------------------+\n| { "A":1,"B":[2,3]} |\n+--------------------+\n\nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j) |\n+------------------------------------------------------------+\n| {\n "A": 1,\n "B":\n [\n 2,\n 3\n ]\n} |\n+------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_detailed/
+[JSON_EQUALS]
+declaration=json1, json2
+category=JSON Functions
+description=Checks if there is equality between two json objects. Returns 1 if it there\nis, 0 if not, or NULL if any of the arguments are null.\n\nExamples\n--------\n\nSELECT JSON_EQUALS('{"a" :[1, 2, 3],"b":[4]}', '{"b":[4],"a":[1, 2, 3.0]}');\n+------------------------------------------------------------------------+\n| JSON_EQUALS('{"a" :[1, 2, 3],"b":[4]}', '{"b":[4],"a":[1, 2, 3.0]}') |\n+------------------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------------------+\n\nSELECT JSON_EQUALS('{"a":[1, 2, 3]}', '{"a":[1, 2, 3.01]}');\n+------------------------------------------------------+\n| JSON_EQUALS('{"a":[1, 2, 3]}', '{"a":[1, 2, 3.01]}') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_equals/
+[JSON_EXISTS]
+declaration='{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2"
+category=JSON Functions
+description=+------------------------------------------------------------+\n| JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key3");\n+------------------------------------------------------------+\n| JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key3") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");\n+---------------------------------------------------------------+\n| JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n\nSELECT JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");\n+----------------------------------------------------------------+\n| JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") |\n+----------------------------------------------------------------+\n| 0 |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_exists/
[JSON_EXTRACT]
declaration=json_doc, path[, path] ...
category=JSON Functions
-description=Extracts data from a JSON document. The extracted data is\nselected from the parts matching the path arguments. Returns\nall matched values; either as a single matched value, or, if\nthe arguments could return multiple values, a result\nautowrapped as an array in the matching order.\n \nReturns NULL if no paths match or if any of the arguments\nare NULL. \n \nAn error will occur if any path argument is not a valid\npath, or if the json_doc argument is not a valid JSON\ndocument.\n \n\nSET @json = ''[1, 2, [3, 4]]'';\n \nSELECT JSON_EXTRACT(@json, ''$[1]'');\n+-----------------------------+\n| JSON_EXTRACT(@json, ''$[1]'') |\n+-----------------------------+\n| 2 |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, ''$[2]'');\n+-----------------------------+\n| JSON_EXTRACT(@json, ''$[2]'') |\n+-----------------------------+\n| [3, 4] |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, ''$[2][1]'');\n+--------------------------------+\n| JSON_EXTRACT(@json, ''$[2][1]'') |\n+--------------------------------+\n| 4 |\n+--------------------------------+
+description=Extracts data from a JSON document. The extracted data is selected from the\nparts matching the path arguments. Returns all matched values; either as a\nsingle matched value, or, if the arguments could return multiple values, a\nresult autowrapped as an array in the matching order.\n\nReturns NULL if no paths match or if any of the arguments are NULL.\n\nAn error will occur if any path argument is not a valid path, or if the\njson_doc argument is not a valid JSON document.\n\nThe path expression be a JSONPath expression as supported by MariaDB\n\nExamples\n--------\n\nSET @json = '[1, 2, [3, 4]]';\n\nSELECT JSON_EXTRACT(@json, '$[1]');\n+-----------------------------+\n| JSON_EXTRACT(@json, '$[1]') |\n+-----------------------------+\n| 2 |\n+-----------------------------+\n\nSELECT JSON_EXTRACT(@json, '$[2]');\n+-----------------------------+\n| JSON_EXTRACT(@json, '$[2]') |\n+-----------------------------+\n| [3, 4] |\n+-----------------------------+\n\nSELECT JSON_EXTRACT(@json, '$[2][1]');\n+--------------------------------+\n| JSON_EXTRACT(@json, '$[2][1]') |\n+--------------------------------+\n| 4 |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/json_extract/
[JSON_INSERT]
declaration=json_doc, path, val[, path, val] ...
category=JSON Functions
-description=Inserts data into a JSON document, returning the resulting\ndocument or NULL if any argument is null. \n \nAn error will occur if the JSON document is not invalid, or\nif any of the paths are invalid or contain a * or **\nwildcard.\n \nJSON_INSERT can only insert data while JSON_REPLACE can only\nupdate. JSON_SET can update or insert data. \n \n\nSET @json = ''{ "A": 0, "B": [1, 2]}'';\n \nSELECT JSON_INSERT(@json, ''$.C'', ''[3, 4]'');\n+--------------------------------------+\n| JSON_INSERT(@json, ''$.C'', ''[3, 4]'') |\n+--------------------------------------+\n| { "A": 0, "B": [1, 2], "C":"[3, 4]"} |\n+--------------------------------------+
+description=Inserts data into a JSON document, returning the resulting document or NULL if\neither of the json_doc or path arguments are null.\n\nAn error will occur if the JSON document is invalid, or if any of the paths\nare invalid or contain a * or ** wildcard.\n\nJSON_INSERT can only insert data while JSON_REPLACE can only update. JSON_SET\ncan update or insert data.\n\nExamples\n--------\n\nSET @json = '{ "A": 0, "B": [1, 2]}';\n\nSELECT JSON_INSERT(@json, '$.C', '[3, 4]');\n+--------------------------------------+\n| JSON_INSERT(@json, '$.C', '[3, 4]') |\n+--------------------------------------+\n| { "A": 0, "B": [1, 2], "C":"[3, 4]"} |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_insert/
[JSON_KEYS]
declaration=json_doc[, path]
category=JSON Functions
-description=Returns the keys as a JSON array from the top-level value of\na JSON object or, if the optional path argument is provided,\nthe top-level keys from the path. \n \nExcludes keys from nested sub-objects in the top level\nvalue. The resulting array will be empty if the selected\nobject is empty.\n \nReturns NULL if any of the arguments are null, a given path\ndoes not locate an object, or if the json_doc argument is\nnot an object.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \n\nSELECT JSON_KEYS(''{"A": 1, "B": {"C": 2}}'');\n+--------------------------------------+\n| JSON_KEYS(''{"A": 1, "B": {"C": 2}}'') |\n+--------------------------------------+\n| ["A", "B"] |\n+--------------------------------------+\n \nSELECT JSON_KEYS(''{"A": 1, "B": 2, "C": {"D":\n3}}'', ''$.C'');\n+-----------------------------------------------------+\n| JSON_KEYS(''{"A": 1, "B": 2, "C": {"D": 3}}'',\n''$.C'') |\n+-----------------------------------------------------+\n| ["D"] |\n+-----------------------------------------------------+
+description=Returns the keys as a JSON array from the top-level value of a JSON object or,\nif the optional path argument is provided, the top-level keys from the path.\n\nExcludes keys from nested sub-objects in the top level value. The resulting\narray will be empty if the selected object is empty.\n\nReturns NULL if any of the arguments are null, a given path does not locate an\nobject, or if the json_doc argument is not an object.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the\npath contains a * or ** wildcard.\n\nExamples\n--------\n\nSELECT JSON_KEYS('{"A": 1, "B": {"C": 2}}');\n+--------------------------------------+\n| JSON_KEYS('{"A": 1, "B": {"C": 2}}') |\n+--------------------------------------+\n| ["A", "B"] |\n+--------------------------------------+\n\nSELECT JSON_KEYS('{"A": 1, "B": 2, "C": {"D": 3}}', '$.C');\n+-----------------------------------------------------+\n| JSON_KEYS('{"A": 1, "B": 2, "C": {"D": 3}}', '$.C') |\n+-----------------------------------------------------+\n| ["D"] |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_keys/
[JSON_LENGTH]
declaration=json_doc[, path]
category=JSON Functions
-description=Returns the length of a JSON document, or, if the optional\npath argument is given, the length of the value within the\ndocument specified by the path. \n \nReturns NULL if any of the arguments argument are null or\nthe path argument does not identify a value in the document.\n\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nLength will be determined as follow:\nA scalar''s length is always 1.\nIf an array, the number of elements in the array.\nIf an object, the number of members in the object.\n \nThe length of nested arrays or objects are not counted.
+description=Returns the length of a JSON document, or, if the optional path argument is\ngiven, the length of the value within the document specified by the path.\n\nReturns NULL if any of the arguments argument are null or the path argument\ndoes not identify a value in the document.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nLength will be determined as follow:\n\n* A scalar's length is always 1.\n* If an array, the number of elements in the array.\n* If an object, the number of members in the object.\n\nThe length of nested arrays or objects are not counted.\n\nExamples\n--------\n\nURL: https://mariadb.com/kb/en/json_length/
[JSON_LOOSE]
declaration=json_doc
category=JSON Functions
-description=Adds spaces to a JSON document to make it look more\nreadable.\n \nExample\n \nSET @j = ''{ "A":1,"B":[2,3]}'';\n \nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j) | @j |\n+-----------------------+--------------------+\n| {"A": 1, "B": [2, 3]} | { "A":1,"B":[2,3]} |\n+-----------------------+--------------------+
+description=Adds spaces to a JSON document to make it look more readable.\n\nExample\n-------\n\nSET @j = '{ "A":1,"B":[2,3]}';\n\nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j) | @j |\n+-----------------------+--------------------+\n| {"A": 1, "B": [2, 3]} | { "A":1,"B":[2,3]} |\n+-----------------------+--------------------+\n\nURL: https://mariadb.com/kb/en/json_loose/
[JSON_MERGE]
declaration=json_doc, json_doc[, json_doc] ...
category=JSON Functions
-description=Merges the given JSON documents.\n \nReturns the merged result,or NULL if any argument is NULL.\n \nAn error occurs if any of the arguments are not valid JSON\ndocuments.\n \nExample\n \nSET @json1 = ''[1, 2]'';\n \nSET @json2 = ''[3, 4]'';\n \nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\n+---------------------------+
+description=Merges the given JSON documents.\n\nReturns the merged result,or NULL if any argument is NULL.\n\nAn error occurs if any of the arguments are not valid JSON documents.\n\nJSON_MERGE has been deprecated since MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5. JSON_MERGE_PATCH is an RFC 7396-compliant replacement, and\nJSON_MERGE_PRESERVE is a synonym.\n\nExample\n-------\n\nSET @json1 = '[1, 2]';\nSET @json2 = '[3, 4]';\n\nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\n+---------------------------+\n\nURL: https://mariadb.com/kb/en/json_merge/
+[JSON_MERGE_PATCH]
+declaration=json_doc, json_doc[, json_doc] ...
+category=JSON Functions
+description=Merges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PATCH is an RFC 7396-compliant replacement for JSON_MERGE, which\nhas been deprecated.\n\nUnlike JSON_MERGE_PRESERVE, members with duplicate keys are not preserved.\n\nExample\n-------\n\nSET @json1 = '[1, 2]';\nSET @json2 = '[2, 3]';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\n+---------------------------------+------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_merge_patch/
+[JSON_MERGE_PRESERVE]
+declaration=json_doc, json_doc[, json_doc] ...
+category=JSON Functions
+description=Merges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PRESERVE was introduced as a synonym for JSON_MERGE, which has been\ndeprecated.\n\nUnlike JSON_MERGE_PATCH, members with duplicate keys are preserved.\n\nExample\n-------\n\nSET @json1 = '[1, 2]';\nSET @json2 = '[2, 3]';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\n+---------------------------------+------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_merge_preserve/
+[JSON_NORMALIZE]
+declaration=json
+category=JSON Functions
+description=Recursively sorts keys and removes spaces, allowing comparison of json\ndocuments for equality.\n\nExamples\n--------\n\nWe may wish our application to use the database to enforce a unique constraint\non the JSON contents, and we can do so using the JSON_NORMALIZE function in\ncombination with a unique key.\n\nFor example, if we have a table with a JSON column:\n\nCREATE TABLE t1 (\n id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n val JSON,\n /* other columns here */\n PRIMARY KEY (id)\n);\n\nAdd a unique constraint using JSON_NORMALIZE like this:\n\nALTER TABLE t1\n ADD COLUMN jnorm JSON AS (JSON_NORMALIZE(val)) VIRTUAL,\n ADD UNIQUE KEY (jnorm);\n\nWe can test this by first inserting a row as normal:\n\nINSERT INTO t1 (val) VALUES ('{"name":"alice","color":"blue"}');\n\nAnd then seeing what happens with a different string which would produce the\nsame JSON object:\n\nINSERT INTO t1 (val) VALUES ('{ "color": "blue", "name": "alice" }');\nERROR 1062 (23000): Duplicate entry '{"color":"blue","name":"alice"}' for key\n'jnorm'\n\nURL: https://mariadb.com/kb/en/json_normalize/
[JSON_OBJECT]
declaration=[key, value[, key, value] ...]
category=JSON Functions
-description=Returns a JSON object containing the given key/value pairs.\nThe key/value list can be empty.\n \nAn error will occur if there are an odd number of arguments,\nor any key name is NULL.\n \nExample\n \nSELECT JSON_OBJECT("id", 1, "name", "Monty");\n+---------------------------------------+\n| JSON_OBJECT("id", 1, "name", "Monty") |\n+---------------------------------------+\n| {"id": 1, "name": "Monty"} |\n+---------------------------------------+
+description=Returns a JSON object containing the given key/value pairs. The key/value list\ncan be empty.\n\nAn error will occur if there are an odd number of arguments, or any key name\nis NULL.\n\nExample\n-------\n\nSELECT JSON_OBJECT("id", 1, "name", "Monty");\n+---------------------------------------+\n| JSON_OBJECT("id", 1, "name", "Monty") |\n+---------------------------------------+\n| {"id": 1, "name": "Monty"} |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_object/
+[JSON_OBJECTAGG]
+declaration=key, value
+category=JSON Functions
+description=JSON_OBJECTAGG returns a JSON object containing key-value pairs. It takes two\nexpressions that evaluate to a single value, or two column names, as\narguments, the first used as a key, and the second as a value.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len\nserver system variable.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_OBJECTAGG cannot currently be used as a window function.\n\nExamples\n--------\n\nselect * from t1;\n+------+-------+\n| a | b |\n+------+-------+\n| 1 | Hello |\n| 1 | World |\n| 2 | This |\n+------+-------+\n\nSELECT JSON_OBJECTAGG(a, b) FROM t1;\n+----------------------------------------+\n| JSON_OBJECTAGG(a, b) |\n+----------------------------------------+\n| {"1":"Hello", "1":"World", "2":"This"} |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_objectagg/
+[JSON_OBJECT_FILTER_KEYS]
+declaration=obj, array_keys
+category=JSON Functions
+description=JSON_OBJECT_FILTER_KEYS returns a JSON object with keys from the object that\nare also present in the array as string. It is used when one wants to get\nkey-value pair such that the keys are common but the values may not be common.\n\nExample\n-------\n\nSET @obj1= '{ "a": 1, "b": 2, "c": 3}';\nSET @obj2= '{"b" : 10, "c": 20, "d": 30}';\nSELECT JSON_OBJECT_FILTER_KEYS (@obj1, JSON_ARRAY_INTERSECT(JSON_KEYS(@obj1),\nJSON_KEYS(@obj2)));\n+------------------------------------------------------------------------------\n------------+\n| JSON_OBJECT_FILTER_KEYS (@obj1, JSON_ARRAY_INTERSECT(JSON_KEYS(@obj1),\nJSON_KEYS(@obj2))) |\n+------------------------------------------------------------------------------\n------------+\n| {"b": 2, "c": 3} \n |\n+------------------------------------------------------------------------------\n------------+\n\nURL: https://mariadb.com/kb/en/json_object_filter_keys/
+[JSON_OBJECT_TO_ARRAY]
+declaration=Obj
+category=JSON Functions
+description=It is used to convert all JSON objects found in a JSON document to JSON arrays\nwhere each item in the outer array represents a single key-value pair from the\nobject. It is used when we want not just common keys, but also common values.\nIt can be used in conjunction with JSON_ARRAY_INTERSECT().\n\nExamples\n--------\n\nSET @obj1= '{ "a": [1, 2, 3], "b": { "key1":"val1", "key2": {"key3":"val3"}\n}}';\n\nSELECT JSON_OBJECT_TO_ARRAY(@obj1);\n+-----------------------------------------------------------------------+\n| JSON_OBJECT_TO_ARRAY(@obj1) |\n+-----------------------------------------------------------------------+\n| [["a", [1, 2, 3]], ["b", {"key1": "val1", "key2": {"key3": "val3"}}]] |\n+-----------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_object_to_array/
+[JSON_OVERLAPS]
+declaration=json_doc1, json_doc2
+category=JSON Functions
+description=JSON_OVERLAPS() compares two json documents and returns true if they have at\nleast one common key-value pair between two objects, array element common\nbetween two arrays, or array element common with scalar if one of the\narguments is a scalar and other is an array. If two json documents are\nscalars, it returns true if they have same type and value.\n\nIf none of the above conditions are satisfied then it returns false.\n\nExamples\n--------\n\nSELECT JSON_OVERLAPS('false', 'false');\n+---------------------------------+\n| JSON_OVERLAPS('false', 'false') |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n\nSELECT JSON_OVERLAPS('true', '["abc", 1, 2, true, false]');\n+----------------------------------------------------+\n| JSON_OVERLAPS('true','["abc", 1, 2, true, false]') |\n+----------------------------------------------------+\n| 1 |\n+----------------------------------------------------+\n\nSELECT JSON_OVERLAPS('{"A": 1, "B": {"C":2}}', '{"A": 2, "B": {"C":2}}') AS\nis_overlap;\n+---------------------+\n| is_overlap |\n+---------------------+\n| 1 |\n+---------------------+\n\nPartial match is considered as no-match.\n\nExamples\n--------\n\nSELECT JSON_OVERLAPS('[1, 2, true, false, null]', '[3, 4, [1]]') AS is_overlap;\n+--------------------- +\n| is_overlap |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/json_overlaps/
[JSON_QUERY]
declaration=json_doc, path
category=JSON Functions
-description=Given a JSON document, returns an object or array specified\nby the path. Returns NULL if not given a valid JSON\ndocument, or if there is no match.\n \n\nselect json_query(''{"key1":{"a":1, "b":[1,2]}}'',\n''$.key1'');\n+-----------------------------------------------------+\n| json_query(''{"key1":{"a":1, "b":[1,2]}}'',\n''$.key1'') |\n+-----------------------------------------------------+\n| {"a":1, "b":[1,2]} |\n+-----------------------------------------------------+\n \nselect json_query(''{"key1":123, "key1": [1,2,3]}'',\n''$.key1'');\n+-------------------------------------------------------+\n| json_query(''{"key1":123, "key1": [1,2,3]}'',\n''$.key1'') |\n+-------------------------------------------------------+\n| [1,2,3] |\n+-------------------------------------------------------+
+description=Given a JSON document, returns an object or array specified by the path.\nReturns NULL if not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nselect json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');\n+-----------------------------------------------------+\n| json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1') |\n+-----------------------------------------------------+\n| {"a":1, "b":[1,2]} |\n+-----------------------------------------------------+\n\nselect json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');\n+-------------------------------------------------------+\n| json_query('{"key1":123, "key1": [1,2,3]}', '$.key1') |\n+-------------------------------------------------------+\n| [1,2,3] |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_query/
[JSON_QUOTE]
declaration=json_value
category=JSON Functions
-description=Quotes a string as a JSON value, usually for producing valid\nJSON string literals for inclusion in JSON documents. Wraps\nthe string with double quote characters and escapes interior\nquotes and other special characters, returning a utf8mb4\nstring. \n \nReturns NULL if the argument is NULL.\n \n\nSELECT JSON_QUOTE(''A''), JSON_QUOTE("B"),\nJSON_QUOTE(''"C"'');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(''A'') | JSON_QUOTE("B") |\nJSON_QUOTE(''"C"'') |\n+-----------------+-----------------+-------------------+\n| "A" | "B" | "\"C\"" |\n+-----------------+-----------------+-------------------+
+description=Quotes a string as a JSON value, usually for producing valid JSON string\nliterals for inclusion in JSON documents. Wraps the string with double quote\ncharacters and escapes interior quotes and other special characters, returning\na utf8mb4 string.\n\nReturns NULL if the argument is NULL.\n\nExamples\n--------\n\nSELECT JSON_QUOTE('A'), JSON_QUOTE("B"), JSON_QUOTE('"C"');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE('A') | JSON_QUOTE("B") | JSON_QUOTE('"C"') |\n+-----------------+-----------------+-------------------+\n| "A" | "B" | "\"C\"" |\n+-----------------+-----------------+-------------------+\n\nURL: https://mariadb.com/kb/en/json_quote/
[JSON_REMOVE]
declaration=json_doc, path[, path] ...
category=JSON Functions
-description=Removes data from a JSON document returning the result, or\nNULL if any of the arguments are null. If the element does\nnot exist in the document, no changes are made.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nPath arguments are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \n\nSELECT JSON_REMOVE(''{"A": 1, "B": 2, "C": {"D":\n3}}'', ''$.C'');\n+-------------------------------------------------------+\n| JSON_REMOVE(''{"A": 1, "B": 2, "C": {"D": 3}}'',\n''$.C'') |\n+-------------------------------------------------------+\n| {"A": 1, "B": 2} |\n+-------------------------------------------------------+\n \nSELECT JSON_REMOVE(''["A", "B", ["C", "D"],\n"E"]'', ''$[1]'');\n+----------------------------------------------------+\n| JSON_REMOVE(''["A", "B", ["C", "D"], "E"]'',\n''$[1]'') |\n+----------------------------------------------------+\n| ["A", ["C", "D"], "E"] |\n+----------------------------------------------------+
+description=Removes data from a JSON document returning the result, or NULL if any of the\narguments are null. If the element does not exist in the document, no changes\nare made.\n\nThe function returns NULL and throws a warning if the JSON document is\ninvalid, the path is invalid, contains a range, or contains a * or ** wildcard.\n\nPath arguments are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nExamples\n--------\n\nSELECT JSON_REMOVE('{"A": 1, "B": 2, "C": {"D": 3}}', '$.C');\n+-------------------------------------------------------+\n| JSON_REMOVE('{"A": 1, "B": 2, "C": {"D": 3}}', '$.C') |\n+-------------------------------------------------------+\n| {"A": 1, "B": 2} |\n+-------------------------------------------------------+\n\nSELECT JSON_REMOVE('["A", "B", ["C", "D"], "E"]', '$[1]');\n+----------------------------------------------------+\n| JSON_REMOVE('["A", "B", ["C", "D"], "E"]', '$[1]') |\n+----------------------------------------------------+\n| ["A", ["C", "D"], "E"] |\n+----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_remove/
[JSON_REPLACE]
declaration=json_doc, path, val[, path, val] ...
category=JSON Functions
-description=Replaces existing values in a JSON document, returning the\nresult, or NULL if any of the arguments are NULL. \n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nPaths and values are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nJSON_REPLACE can only update data, while JSON_INSERT can\nonly insert. JSON_SET can update or insert data. \n \n\nSELECT JSON_REPLACE(''{ "A": 1, "B": [2, 3]}'',\n''$.B[1]'', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(''{ "A": 1, "B": [2, 3]}'', ''$.B[1]'',\n4) |\n+-----------------------------------------------------+\n| { "A": 1, "B": [2, 4]} |\n+-----------------------------------------------------+
+description=Replaces existing values in a JSON document, returning the result, or NULL if\nany of the arguments are NULL.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nPaths and values are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nJSON_REPLACE can only update data, while JSON_INSERT can only insert. JSON_SET\ncan update or insert data.\n\nExamples\n--------\n\nSELECT JSON_REPLACE('{ "A": 1, "B": [2, 3]}', '$.B[1]', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE('{ "A": 1, "B": [2, 3]}', '$.B[1]', 4) |\n+-----------------------------------------------------+\n| { "A": 1, "B": [2, 4]} |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_replace/
+[JSON_SCHEMA_VALID]
+declaration=schema, json
+category=JSON Functions
+description=JSON_SCHEMA_VALID allows MariaDB to support JSON schema validation. If a given\njson is valid against a schema it returns true. When JSON does not validate\nagainst the schema, it does not return a message about which keyword it failed\nagainst and only returns false.\n\nThe function supports JSON Schema Draft 2020 with a few exceptions:\n\n* External resources are not supported\n* Hyper schema keywords are not supported\n* Formats like date, email etc are treated as annotations.\n\nExamples\n--------\n\nTo create validation rules for json field\n\nCREATE TABLE obj_table(val_obj JSON CHECK(JSON_SCHEMA_VALID('{\n "type":"object",\n "properties": {\n "number1":{\n "type":"number",\n "maximum":5,\n "const":4\n },\n "string1":{\n "type":"string",\n "maxLength":5,\n "minLength":3\n },\n "object1":{\n "type":"object",\n "properties":{\n "key1": {"type":"string"},\n "key2":{"type":"array"},\n "key3":{"type":"number", "minimum":3}\n },\n "dependentRequired": { "key1":["key3"] }\n }\n },\n "required":["number1","object1"]\n }', val_obj)));\n\nINSERT INTO obj_table VALUES(\n '{"number1":4, "string1":"abcd",\n "object1":{"key1":"val1", "key2":[1,2,3, "string1"], "key3":4}}'\n);\n\nINSERT INTO obj_table VALUES(\n '{"number1":3, "string1":"abcd",\n "object1":{"key1":"val1", "key2":[1,2,3, "string1"], "key3":4}}'\n ...
[JSON_SEARCH]
declaration=json_doc, return_arg, search_str[, escape_char[, path] ...]
category=JSON Functions
-description=Returns the path to the given string within a JSON document,\nor NULL if any of json_doc, search_str or a path argument is\nNULL; if the search string is not found, or if no path\nexists within the document. \n \nA warning will occur if the JSON document is not valid, any\nof the path arguments are not valid, if return_arg is\nneither one nor all, or if the escape character is not a\nconstant. NULL will be returned.\n \nreturn_arg can be one of two values:\n''one: Terminates after finding the first match, so will\nreturn one path string. If there is more than one match, it\nis undefined which is considered first.\nall: Returns all matching path strings, without duplicates.\nMultiple strings are autowrapped as an array. The order is\nundefined.\n \n\nSET @json = ''["A", [{"B": "1"}], {"C":"AB"},\n{"D":"BC"}]'';\n \nSELECT JSON_SEARCH(@json, ''one'', ''AB'');\n+---------------------------------+\n| JSON_SEARCH(@json, ''one'', ''AB'') |\n+---------------------------------+\n| "$[2].C" |\n+---------------------------------+
+description=Returns the path to the given string within a JSON document, or NULL if any of\njson_doc, search_str or a path argument is NULL; if the search string is not\nfound, or if no path exists within the document.\n\nA warning will occur if the JSON document is not valid, any of the path\narguments are not valid, if return_arg is neither one nor all, or if the\nescape character is not a constant. NULL will be returned.\n\nreturn_arg can be one of two values:\n\n* 'one: Terminates after finding the first match, so will return one path\nstring. If there is more than one match, it is undefined which is considered\nfirst.\n* all: Returns all matching path strings, without duplicates. Multiple strings\nare autowrapped as an array. The order is undefined.\n\nExamples\n--------\n\nSET @json = '["A", [{"B": "1"}], {"C":"AB"}, {"D":"BC"}]';\n\nSELECT JSON_SEARCH(@json, 'one', 'AB');\n+---------------------------------+\n| JSON_SEARCH(@json, 'one', 'AB') |\n+---------------------------------+\n| "$[2].C" |\n+---------------------------------+\n\nURL: https://mariadb.com/kb/en/json_search/
[JSON_SET]
declaration=json_doc, path, val[, path, val] ...
category=JSON Functions
-description=Updates or inserts data into a JSON document, returning the\nresult, or NULL if any of the arguments are NULL or the\noptional path fails to find an object.\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or wildcard.\n \nJSON_SET can update or insert data, while JSON_REPLACE can\nonly update, and JSON_INSERT only insert.
+description=Updates or inserts data into a JSON document, returning the result, or NULL if\nany of the arguments are NULL or the optional path fails to find an object.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or wildcard.\n\nJSON_SET can update or insert data, while JSON_REPLACE can only update, and\nJSON_INSERT only insert.\n\nExamples\n--------\n\nSELECT JSON_SET(Priv, '$.locked', 'true') FROM mysql.global_priv\n\nURL: https://mariadb.com/kb/en/json_set/
+[JSON_TABLE]
+declaration=json_doc, context_path COLUMNS (column_list
+category=JSON Functions
+description=JSON_TABLE can be used in contexts where a table reference can be used; in the\nFROM clause of a SELECT statement, and in multi-table UPDATE/DELETE statements.\n\njson_doc is the JSON document to extract data from. In the simplest case, it\nis a string literal containing JSON. In more complex cases it can be an\narbitrary expression returning JSON. The expression may have references to\ncolumns of other tables. However, one can only refer to tables that precede\nthis JSON_TABLE invocation. For RIGHT JOIN, it is assumed that its outer side\nprecedes the inner. All tables in outer selects are also considered preceding.\n\ncontext_path is a JSON Path expression pointing to a collection of nodes in\njson_doc that will be used as the source of rows.\n\nThe COLUMNS clause declares the names and types of the columns that JSON_TABLE\nreturns, as well as how the values of the columns are produced.\n\nColumn Definitions\n------------------\n\nThe following types of columns are supported:\n\nPath Columns\n------------\n\nname type PATH path_str [on_empty] [on_error]\n\nLocates the JSON node pointed to by path_str and returns its value. The\npath_str is evaluated using the current row source node as the context node.\n\nset @json='\n[\n {"name":"Laptop", "color":"black", "price":"1000"},\n {"name":"Jeans", "color":"blue"}\n]';\n\nselect * from json_table(@json, '$[*]' \n columns(\n name varchar(10) path '$.name',\n color varchar(10) path '$.color',\n price decimal(8,2) path '$.price' )\n) as jt;\n+--------+-------+---------+\n| name | color | price |\n+--------+-------+---------+\n| Laptop | black | 1000.00 |\n| Jeans | blue | NULL |\n+--------+-------+---------+\n\nThe on_empty and on_error clauses specify the actions to be performed when the\nvalue was not found or there was an error condition. See the ON EMPTY and ON\n ...
[JSON_TYPE]
declaration=json_val
category=JSON Functions
-description=Returns the type of a JSON value, or NULL if the argument is\nnull.\n \nAn error will occur if the argument is an invalid JSON\nvalue.\n \nThe following is a complete list of the possible return\ntypes:\n \nReturn type | Value | \n \nARRAY | JSON array | \n \nBIT | MariaDB BIT scalar | \n \nBLOB | MariaDB binary types (BINARY, VARBINARY or BLOB) | \n \nBOOLEAN | JSON true/false literals | \n \nDATE | MariaDB DATE scalar | \n \nDATETIME | MariaDB DATETIME or TIMESTAMP scalar | \n \nDECIMAL | MariaDB DECIMAL or NUMERIC scalar | \n \nDOUBLE | MariaDB DOUBLE FLOAT scalar | \n \nINTEGER | MariaDB integer types (TINYINT, SMALLINT,\nMEDIUMINT, INT or BIGINT) | \n \nNULL | JSON null literal or NULL argument | \n \nOBJECT | JSON object | \n \nOPAQUE | Any valid JSON value that is not one of the other\ntypes. | \n \nSTRING | MariaDB character types (CHAR, VARCHAR, TEXT, ENUM\nor SET) | \n \nTIME | MariaDB TIME scalar | \n \n\nSELECT JSON_TYPE(''{"A": 1, "B": 2, "C": 3}'');\n+---------------------------------------+\n| JSON_TYPE(''{"A": 1, "B": 2, "C": 3}'') |\n+---------------------------------------+\n| OBJECT |\n+---------------------------------------+
+description=Returns the type of a JSON value (as a string), or NULL if the argument is\nnull.\n\nAn error will occur if the argument is an invalid JSON value.\n\nThe following is a complete list of the possible return types:\n\n+-----------------------------------+-----------------+-----------------------+\n| Return type | Value | Example |\n+-----------------------------------+-----------------+-----------------------+\n| ARRAY | JSON array | [1, 2, {"key": |\n| | | "value"}] |\n+-----------------------------------+-----------------+-----------------------+\n| OBJECT | JSON object | {"key":"value"} |\n+-----------------------------------+-----------------+-----------------------+\n| BOOLEAN | JSON | true, false |\n| | true/false | |\n| | literals | |\n+-----------------------------------+-----------------+-----------------------+\n| DOUBLE | A number with | 1.2 |\n| | at least one | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| INTEGER | A number | 1 |\n| | without a | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| NULL | JSON null | null |\n| | literal (this | |\n| | is returned as | |\n| | a string, not | |\n| | to be confused | |\n| | with the SQL | |\n| | NULL value!) | |\n+-----------------------------------+-----------------+-----------------------+\n| STRING | JSON String | "a sample string" |\n+-----------------------------------+-----------------+-----------------------+\n\nExamples\n--------\n\nSELECT JSON_TYPE('{"A": 1, "B": 2, "C": 3}');\n+---------------------------------------+\n| JSON_TYPE('{"A": 1, "B": 2, "C": 3}') |\n+---------------------------------------+\n| OBJECT |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_type/
[JSON_UNQUOTE]
declaration=val
category=JSON Functions
-description=Unquotes a JSON value, returning a string, or NULL if the\nargument is null. \n \nAn error will occur if the given value begins and ends with\ndouble quotes and is an invalid JSON string literal.\n \nCertain character sequences have special meanings within a\nstring. Usually, a backspace is ignored, but the escape\nsequences in the table below are recognised by MariaDB,\nunless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n \nEscape sequence | Character | \n \n\" | Double quote (") | \n \n\b | Backspace | \n \n\f | Formfeed | \n \n\n | Newline (linefeed) | \n \n\r | Carriage return | \n \n\t | Tab | \n \n\\ | Backslash (\) | \n \n\uXXXX | UTF-8 bytes for Unicode value XXXX | \n \n\nSELECT JSON_UNQUOTE(''"Monty"'');\n+-------------------------+\n| JSON_UNQUOTE(''"Monty"'') |\n+-------------------------+\n| Monty |\n+-------------------------+\n \nWith the default SQL Mode:\n \nSELECT JSON_UNQUOTE(''Si\bng\ting'');\n+-----------------------------+\n| JSON_UNQUOTE(''Si\bng\ting'') |\n+-----------------------------+\n| Sng ing |\n+-----------------------------+\n \nSetting NO_BACKSLASH_ESCAPES:\n \nSET @@sql_mode = ''NO_BACKSLASH_ESCAPES'';\n \nSELECT JSON_UNQUOTE(''Si\bng\ting'');\n+-----------------------------+\n| JSON_UNQUOTE(''Si\bng\ting'') |\n+-----------------------------+\n| Si\bng\ting |\n+-----------------------------+
+description=Unquotes a JSON value, returning a string, or NULL if the argument is null.\n\nAn error will occur if the given value begins and ends with double quotes and\nis an invalid JSON string literal.\n\nIf the given value is not a JSON string, value is passed through unmodified.\n\nCertain character sequences have special meanings within a string. Usually, a\nbackslash is ignored, but the escape sequences in the table below are\nrecognised by MariaDB, unless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n\n+-----------------------------------------------+-----------------------------+\n| Escape sequence | Character |\n+-----------------------------------------------+-----------------------------+\n| \" | Double quote (") |\n+-----------------------------------------------+-----------------------------+\n| \b | Backslash |\n+-----------------------------------------------+-----------------------------+\n| \f | Formfeed |\n+-----------------------------------------------+-----------------------------+\n| \n | Newline (linefeed) |\n+-----------------------------------------------+-----------------------------+\n| \r | Carriage return |\n+-----------------------------------------------+-----------------------------+\n| \t | Tab |\n+-----------------------------------------------+-----------------------------+\n| \\ | Backslash (\) |\n+-----------------------------------------------+-----------------------------+\n| \uXXXX | UTF-8 bytes for Unicode |\n| | value XXXX |\n+-----------------------------------------------+-----------------------------+\n\nExamples\n--------\n\nSELECT JSON_UNQUOTE('"Monty"');\n+-------------------------+\n| JSON_UNQUOTE('"Monty"') |\n+-------------------------+\n| Monty |\n+-------------------------+\n\nWith the default SQL Mode:\n\nSELECT JSON_UNQUOTE('Si\bng\ting');\n+-----------------------------+\n| JSON_UNQUOTE('Si\bng\ting') |\n+-----------------------------+\n| Sng ing |\n+-----------------------------+\n ...
[JSON_VALID]
declaration=value
category=JSON Functions
-description=Indicates whether the given value is a valid JSON document\nor not. Returns 1 if valid, 0 if not, and NULL if the\nargument is NULL.\n \nFrom MariaDB 10.4.3, the JSON_VALID function is\nautomatically used as a CHECK constraint for the JSON data\ntype alias in order to ensure that a valid json document is\ninserted. \n \n\nSELECT JSON_VALID(''{"id": 1, "name": "Monty"}'');\n+------------------------------------------+\n| JSON_VALID(''{"id": 1, "name": "Monty"}'') |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT JSON_VALID(''{"id": 1, "name": "Monty",\n"oddfield"}'');\n+------------------------------------------------------+\n| JSON_VALID(''{"id": 1, "name": "Monty",\n"oddfield"}'') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+
+description=Indicates whether the given value is a valid JSON document or not. Returns 1\nif valid, 0 if not, and NULL if the argument is NULL.\n\nFrom MariaDB 10.4.3, the JSON_VALID function is automatically used as a CHECK\nconstraint for the JSON data type alias in order to ensure that a valid json\ndocument is inserted.\n\nExamples\n--------\n\nSELECT JSON_VALID('{"id": 1, "name": "Monty"}');\n+------------------------------------------+\n| JSON_VALID('{"id": 1, "name": "Monty"}') |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n\nSELECT JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}');\n+------------------------------------------------------+\n| JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_valid/
[JSON_VALUE]
declaration=json_doc, path
category=JSON Functions
-description=Given a JSON document, returns the scalar specified by the\npath. Returns NULL if not given a valid JSON document, or if\nthere is no match.\n \n\nselect json_value(''{"key1":123}'', ''$.key1'');\n+--------------------------------------+\n| json_value(''{"key1":123}'', ''$.key1'') |\n+--------------------------------------+\n| 123 |\n+--------------------------------------+\n \nselect json_value(''{"key1": [1,2,3], "key1":123}'',\n''$.key1'');\n+-------------------------------------------------------+\n| json_value(''{"key1": [1,2,3], "key1":123}'',\n''$.key1'') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+
+description=Given a JSON document, returns the scalar specified by the path. Returns NULL\nif not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nselect json_value('{"key1":123}', '$.key1');\n+--------------------------------------+\n| json_value('{"key1":123}', '$.key1') |\n+--------------------------------------+\n| 123 |\n+--------------------------------------+\n\nselect json_value('{"key1": [1,2,3], "key1":123}', '$.key1');\n+-------------------------------------------------------+\n| json_value('{"key1": [1,2,3], "key1":123}', '$.key1') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n\nIn the SET statement below, two escape characters are needed, as a single\nescape character would be applied by the SQL parser in the SET statement, and\nthe escaped character would not form part of the saved value.\n\nSET @json = '{"key1":"60\\" Table", "key2":"1"}';\n\nSELECT JSON_VALUE(@json,'$.key1') AS Name , json_value(@json,'$.key2') as ID;\n+-----------+------+\n| Name | ID |\n+-----------+------+\n| 60" Table | 1 |\n+-----------+------+\n\nURL: https://mariadb.com/kb/en/json_value/
+[KDF]
+declaration=
+category=Encryption Functions
+description=KDF is a key derivation function, similar to OpenSSL's EVP_KDF_derive(). The\npurpose of a KDF is to be slow, so if the calculated value is lost/stolen, the\noriginal key_str is not achievable easily with modern GPU. KDFs are therefore\nan ideal replacement for password hashes. KDFs can also pad out a password\nsecret to the number of bits used in encryption algorithms.\n\nFor generating good encryption keys for AES_ENCRYPT a less expensive function,\nbut cryptographically secure function like RANDOM_BYTES is recommended..\n\n* kdf_name is "hkdf" or "pbkdf2_hmac" (default)\n* width (in bits) can be any number divisible by 8, by default it's taken from\n@@block_encryption_mode\n* iterations must be positive, and is 1000 by default\n\nNote that OpenSSL 1.0 doesn't support HKDF, so in this case NULL is returned.\nThis OpenSSL version is still used in SLES 12 and CentOS 7.\n\nExamples\n--------\n\nselect hex(kdf('foo', 'bar', 'infa', 'hkdf')); \n+----------------------------------------+\n| hex(kdf('foo', 'bar', 'infa', 'hkdf')) |\n+----------------------------------------+\n| 612875F859CFB4EE0DFEFF9F2A18E836 |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/kdf/
+[LAG]
+declaration=expr[, offset]
+category=Window Functions
+description=The LAG function accesses data from a previous row according to the ORDER BY\nclause without the need for a self-join. The specific row is determined by the\noffset (default 1), which specifies the number of rows behind the current row\nto use. An offset of 0 is the current row.\n\nExamples\n--------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), e real);\n\nINSERT INTO t1 VALUES\n ( 1, 0, 1, 'one', 0.1, 0.001),\n ( 2, 0, 2, 'two', 0.2, 0.002),\n ( 3, 0, 3, 'three', 0.3, 0.003),\n ( 4, 1, 2, 'three', 0.4, 0.004),\n ( 5, 1, 1, 'two', 0.5, 0.005),\n ( 6, 1, 1, 'one', 0.6, 0.006),\n ( 7, 2, NULL, 'n_one', 0.5, 0.007),\n ( 8, 2, 1, 'n_two', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, 'n_four', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n\nSELECT pk, LAG(pk) OVER (ORDER BY pk) AS l,\n LAG(pk,1) OVER (ORDER BY pk) AS l1,\n LAG(pk,2) OVER (ORDER BY pk) AS l2,\n LAG(pk,0) OVER (ORDER BY pk) AS l0,\n LAG(pk,-1) OVER (ORDER BY pk) AS lm1,\n LAG(pk,-2) OVER (ORDER BY pk) AS lm2\nFROM t1;\n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | NULL | NULL | NULL | 1 | 2 | 3 |\n| 2 | 1 | 1 | NULL | 2 | 3 | 4 |\n| 3 | 2 | 2 | 1 | 3 | 4 | 5 |\n| 4 | 3 | 3 | 2 | 4 | 5 | 6 |\n| 5 | 4 | 4 | 3 | 5 | 6 | 7 |\n| 6 | 5 | 5 | 4 | 6 | 7 | 8 |\n| 7 | 6 | 6 | 5 | 7 | 8 | 9 |\n| 8 | 7 | 7 | 6 | 8 | 9 | 10 |\n| 9 | 8 | 8 | 7 | 9 | 10 | 11 |\n| 10 | 9 | 9 | 8 | 10 | 11 | NULL |\n| 11 | 10 | 10 | 9 | 11 | NULL | NULL |\n+----+------+------+------+------+------+------+\n\nURL: https://mariadb.com/kb/en/lag/
[LAST_DAY]
declaration=date
category=Date and Time Functions
-description=Takes a date or datetime value and returns the corresponding\nvalue for\nthe last day of the month. Returns NULL if the argument is\ninvalid.\n \n\nSELECT LAST_DAY(''2003-02-05'');\n+------------------------+\n| LAST_DAY(''2003-02-05'') |\n+------------------------+\n| 2003-02-28 |\n+------------------------+\n \nSELECT LAST_DAY(''2004-02-05'');\n+------------------------+\n| LAST_DAY(''2004-02-05'') |\n+------------------------+\n| 2004-02-29 |\n+------------------------+\n \nSELECT LAST_DAY(''2004-01-01 01:01:01'');\n+---------------------------------+\n| LAST_DAY(''2004-01-01 01:01:01'') |\n+---------------------------------+\n| 2004-01-31 |\n+---------------------------------+\n \nSELECT LAST_DAY(''2003-03-32'');\n+------------------------+\n| LAST_DAY(''2003-03-32'') |\n+------------------------+\n| NULL |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Incorrect datetime value:\n''2003-03-32''
-[LAST_INSERT_ID1]
-name=LAST_INSERT_ID
+description=Takes a date or datetime value and returns the corresponding value for the\nlast day of the month. Returns NULL if the argument is invalid.\n\nExamples\n--------\n\nSELECT LAST_DAY('2003-02-05');\n+------------------------+\n| LAST_DAY('2003-02-05') |\n+------------------------+\n| 2003-02-28 |\n+------------------------+\n\nSELECT LAST_DAY('2004-02-05');\n+------------------------+\n| LAST_DAY('2004-02-05') |\n+------------------------+\n| 2004-02-29 |\n+------------------------+\n\nSELECT LAST_DAY('2004-01-01 01:01:01');\n+---------------------------------+\n| LAST_DAY('2004-01-01 01:01:01') |\n+---------------------------------+\n| 2004-01-31 |\n+---------------------------------+\n\nSELECT LAST_DAY('2003-03-32');\n+------------------------+\n| LAST_DAY('2003-03-32') |\n+------------------------+\n| NULL |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Incorrect datetime value: '2003-03-32'\n\nURL: https://mariadb.com/kb/en/last_day/
+[LAST_INSERT_ID]
declaration=
category=Information Functions
-description=LAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value successfully\ninserted for an\nAUTO_INCREMENT column as a result of the most recently\nexecuted INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged\nif no rows\nare successfully inserted.\n \nIf one gives an argument to LAST_INSERT_ID(), then it will\nreturn the value of the expression and\nthe next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client\nand can be accessed by the mysql_insert_id function.\n \nFor example, after inserting a row that generates an\nAUTO_INCREMENT\nvalue, you can get the value like this:\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n \nYou can also use LAST_INSERT_ID() to delete the last\ninserted row:\n \nDELETE FROM product WHERE id = LAST_INSERT_ID();\n \nIf no rows were successfully inserted, LAST_INSERT_ID()\nreturns 0.\n \nThe value of LAST_INSERT_ID() will be consistent across all\nversions\nif all rows in the INSERT or UPDATE statement were\nsuccessful.\n \nThe currently executing statement does not affect the value\nof\nLAST_INSERT_ID(). Suppose that you generate an\nAUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table\nwith its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID()\nwill remain\nstable in the second statement; its value for the second and\nlater\nrows is not affected by the earlier row insertions.\n(However, if you\nmix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr),\nthe\neffect is undefined.)\n \nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if\nthe\nstatement is rolled back due to an error, the value of\nLAST_INSERT_ID() is left undefined. For manual ROLLBACK, the\nvalue of\nLAST_INSERT_ID() is not restored to that before the\ntransaction; it\nremains as it was at the point of the ROLLBACK.\n \nWithin the body of a stored routine (procedure or function)\nor a\ntrigger, the value of LAST_INSERT_ID() changes the same way\nas for\nstatements executed outside the body of these kinds of\nobjects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements\ndepends on the\nkind of routine:\nIf a stored procedure executes statements that change the\nvalue of LAST_INSERT_ID(), the new value will be seen by\nstatements that follow the procedure call.\n \nFor stored functions and triggers that change the value, the\nvalue is restored when the function or trigger ends, so\nfollowing statements will not see a changed value.\n \n\nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n f VARCHAR(1)) \nENGINE = InnoDB;\n \nINSERT INTO t(f) VALUES(''a'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''b'');\n \nINSERT INTO t(f) VALUES(''c'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''d''),(''e'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''f'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nINSERT INTO t(f) VALUES(''g'');\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+
-[LAST_INSERT_ID2]
-name=LAST_INSERT_ID
-declaration=expr
-category=Information Functions
-description=LAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value successfully\ninserted for an\nAUTO_INCREMENT column as a result of the most recently\nexecuted INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged\nif no rows\nare successfully inserted.\n \nIf one gives an argument to LAST_INSERT_ID(), then it will\nreturn the value of the expression and\nthe next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client\nand can be accessed by the mysql_insert_id function.\n \nFor example, after inserting a row that generates an\nAUTO_INCREMENT\nvalue, you can get the value like this:\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n \nYou can also use LAST_INSERT_ID() to delete the last\ninserted row:\n \nDELETE FROM product WHERE id = LAST_INSERT_ID();\n \nIf no rows were successfully inserted, LAST_INSERT_ID()\nreturns 0.\n \nThe value of LAST_INSERT_ID() will be consistent across all\nversions\nif all rows in the INSERT or UPDATE statement were\nsuccessful.\n \nThe currently executing statement does not affect the value\nof\nLAST_INSERT_ID(). Suppose that you generate an\nAUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table\nwith its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID()\nwill remain\nstable in the second statement; its value for the second and\nlater\nrows is not affected by the earlier row insertions.\n(However, if you\nmix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr),\nthe\neffect is undefined.)\n \nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if\nthe\nstatement is rolled back due to an error, the value of\nLAST_INSERT_ID() is left undefined. For manual ROLLBACK, the\nvalue of\nLAST_INSERT_ID() is not restored to that before the\ntransaction; it\nremains as it was at the point of the ROLLBACK.\n \nWithin the body of a stored routine (procedure or function)\nor a\ntrigger, the value of LAST_INSERT_ID() changes the same way\nas for\nstatements executed outside the body of these kinds of\nobjects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements\ndepends on the\nkind of routine:\nIf a stored procedure executes statements that change the\nvalue of LAST_INSERT_ID(), the new value will be seen by\nstatements that follow the procedure call.\n \nFor stored functions and triggers that change the value, the\nvalue is restored when the function or trigger ends, so\nfollowing statements will not see a changed value.\n \n\nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n f VARCHAR(1)) \nENGINE = InnoDB;\n \nINSERT INTO t(f) VALUES(''a'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''b'');\n \nINSERT INTO t(f) VALUES(''c'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''d''),(''e'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n \nINSERT INTO t(f) VALUES(''f'');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nINSERT INTO t(f) VALUES(''g'');\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+
-[LAST_VALUE1]
-name=LAST_VALUE
+description=LAST_INSERT_ID() (no arguments) returns the first automatically generated\nvalue successfully inserted for an AUTO_INCREMENT column as a result of the\nmost recently executed INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nIf one gives an argument to LAST_INSERT_ID(), then it will return the value of\nthe expression and the next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client and can be accessed by the\nmysql_insert_id function.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT value, you\ncan get the value like this:\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n\nYou can also use LAST_INSERT_ID() to delete the last inserted row:\n\nDELETE FROM product WHERE id = LAST_INSERT_ID();\n\nIf no rows were successfully inserted, LAST_INSERT_ID() returns 0.\n\nThe value of LAST_INSERT_ID() will be consistent across all versions if all\nrows in the INSERT or UPDATE statement were successful.\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value with one\nstatement, and then refer to LAST_INSERT_ID() in a multiple-row INSERT\nstatement that inserts rows into a table with its own AUTO_INCREMENT column.\nThe value of LAST_INSERT_ID() will remain stable in the second statement; its\nvalue for the second and later rows is not affected by the earlier row\ninsertions. (However, if you mix references to LAST_INSERT_ID() and\nLAST_INSERT_ID(expr), the effect is undefined.)\n\nIf the previous statement returned an error, the value of LAST_INSERT_ID() is\nundefined. For transactional tables, if the statement is rolled back due to an\nerror, the value of LAST_INSERT_ID() is left undefined. For manual ROLLBACK,\nthe value of LAST_INSERT_ID() is not restored to that before the transaction;\nit remains as it was at the point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a trigger, the\nvalue of LAST_INSERT_ID() changes the same way as for statements executed\noutside the body of these kinds of objects. The effect of a stored routine or\ntrigger upon the value of LAST_INSERT_ID() that is seen by following\nstatements depends on the kind of routine:\n\n ...
+[LAST_VALUE]
declaration=expr,[expr,...]
category=Information Functions
-description=LAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, ''one'', 0.1, 0.001),\n( 2, 0, 2, ''two'', 0.2, 0.002),\n( 3, 0, 3, ''three'', 0.3, 0.003),\n( 4, 1, 2, ''three'', 0.4, 0.004),\n( 5, 1, 1, ''two'', 0.5, 0.005),\n( 6, 1, 1, ''one'', 0.6, 0.006),\n( 7, 2, NULL, ''n_one'', 0.5, 0.007),\n( 8, 2, 1, ''n_two'', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, ''n_four'', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+
-[LAST_VALUE2]
-name=LAST_VALUE
-declaration=expr
-category=Information Functions
-description=LAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, ''one'', 0.1, 0.001),\n( 2, 0, 2, ''two'', 0.2, 0.002),\n( 3, 0, 3, ''three'', 0.3, 0.003),\n( 4, 1, 2, ''three'', 0.4, 0.004),\n( 5, 1, 1, ''two'', 0.5, 0.005),\n( 6, 1, 1, ''one'', 0.6, 0.006),\n( 7, 2, NULL, ''n_one'', 0.5, 0.007),\n( 8, 2, 1, ''n_two'', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, ''n_four'', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+
-[LAST_VALUE3]
-name=LAST_VALUE
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Information Functions
-description=LAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, ''one'', 0.1, 0.001),\n( 2, 0, 2, ''two'', 0.2, 0.002),\n( 3, 0, 3, ''three'', 0.3, 0.003),\n( 4, 1, 2, ''three'', 0.4, 0.004),\n( 5, 1, 1, ''two'', 0.5, 0.005),\n( 6, 1, 1, ''one'', 0.6, 0.006),\n( 7, 2, NULL, ''n_one'', 0.5, 0.007),\n( 8, 2, 1, ''n_two'', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, ''n_four'', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+
+description=LAST_VALUE() evaluates all expressions and returns the last.\n\nThis is useful together with setting user variables to a value with\n@var:=expr, for example when you want to get data of rows updated/deleted\nwithout having to do two queries against the table.\n\nLAST_VALUE can be used as a window function.\n\nReturns NULL if no last value exists.\n\nExamples\n--------\n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n\nAs a window function:\n\nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n\nINSERT INTO t1 VALUES\n( 1, 0, 1, 'one', 0.1, 0.001),\n( 2, 0, 2, 'two', 0.2, 0.002),\n( 3, 0, 3, 'three', 0.3, 0.003),\n( 4, 1, 2, 'three', 0.4, 0.004),\n( 5, 1, 1, 'two', 0.5, 0.005),\n( 6, 1, 1, 'one', 0.6, 0.006),\n( 7, 2, NULL, 'n_one', 0.5, 0.007),\n( 8, 2, 1, 'n_two', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, 'n_four', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n\nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n ...
[LCASE]
declaration=str
category=String Functions
-description=LCASE() is a synonym for LOWER().
+description=LCASE() is a synonym for LOWER().\n\nURL: https://mariadb.com/kb/en/lcase/
+[LEAD]
+declaration=expr[, offset]
+category=Window Functions
+description=The LEAD function accesses data from a following row in the same result set\nwithout the need for a self-join. The specific row is determined by the offset\n(default 1), which specifies the number of rows ahead the current row to use.\nAn offset of 0 is the current row.\n\nExample\n-------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), e real);\n\nINSERT INTO t1 VALUES\n ( 1, 0, 1, 'one', 0.1, 0.001),\n ( 2, 0, 2, 'two', 0.2, 0.002),\n ( 3, 0, 3, 'three', 0.3, 0.003),\n ( 4, 1, 2, 'three', 0.4, 0.004),\n ( 5, 1, 1, 'two', 0.5, 0.005),\n ( 6, 1, 1, 'one', 0.6, 0.006),\n ( 7, 2, NULL, 'n_one', 0.5, 0.007),\n ( 8, 2, 1, 'n_two', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, 'n_four', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n\nSELECT pk, LEAD(pk) OVER (ORDER BY pk) AS l,\n LEAD(pk,1) OVER (ORDER BY pk) AS l1,\n LEAD(pk,2) OVER (ORDER BY pk) AS l2,\n LEAD(pk,0) OVER (ORDER BY pk) AS l0,\n LEAD(pk,-1) OVER (ORDER BY pk) AS lm1,\n LEAD(pk,-2) OVER (ORDER BY pk) AS lm2\nFROM t1;\n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | 2 | 2 | 3 | 1 | NULL | NULL |\n| 2 | 3 | 3 | 4 | 2 | 1 | NULL |\n| 3 | 4 | 4 | 5 | 3 | 2 | 1 |\n| 4 | 5 | 5 | 6 | 4 | 3 | 2 |\n| 5 | 6 | 6 | 7 | 5 | 4 | 3 |\n| 6 | 7 | 7 | 8 | 6 | 5 | 4 |\n| 7 | 8 | 8 | 9 | 7 | 6 | 5 |\n| 8 | 9 | 9 | 10 | 8 | 7 | 6 |\n| 9 | 10 | 10 | 11 | 9 | 8 | 7 |\n| 10 | 11 | 11 | NULL | 10 | 9 | 8 |\n| 11 | NULL | NULL | NULL | 11 | 10 | 9 |\n+----+------+------+------+------+------+------+\n\nURL: https://mariadb.com/kb/en/lead/
[LEAST]
declaration=value1,value2,...
category=Comparison Operators
-description=With two or more arguments, returns the smallest\n(minimum-valued)\nargument. The arguments are compared using the following\nrules:\nIf the return value is used in an INTEGER context or all\narguments are integer-valued, they are compared as integers.\nIf the return value is used in a REAL context or all\narguments are real-valued, they are compared as reals.\nIf any argument is a case-sensitive string, the arguments\nare compared as case-sensitive strings.\nIn all other cases, the arguments are compared as\ncase-insensitive strings.\n \nLEAST() returns NULL if any argument is NULL.\n \n\nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n \nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n \nSELECT LEAST(''B'',''A'',''C'');\n+--------------------+\n| LEAST(''B'',''A'',''C'') |\n+--------------------+\n| A |\n+--------------------+
+description=With two or more arguments, returns the smallest (minimum-valued) argument.\nThe arguments are compared using the following rules:\n\n* If the return value is used in an INTEGER context or all arguments are\ninteger-valued, they are compared as integers.\n* If the return value is used in a REAL context or all arguments are\nreal-valued, they are compared as reals.\n* If any argument is a case-sensitive string, the arguments are compared as\ncase-sensitive strings.\n* In all other cases, the arguments are compared as case-insensitive strings.\n\nLEAST() returns NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n\nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n\nSELECT LEAST('B','A','C');\n+--------------------+\n| LEAST('B','A','C') |\n+--------------------+\n| A |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/least/
[LEFT]
declaration=str,len
category=String Functions
-description=Returns the leftmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \n\nSELECT LEFT(''MariaDB'', 5);\n+--------------------+\n| LEFT(''MariaDB'', 5) |\n+--------------------+\n| Maria |\n+--------------------+
-[LENGTHB]
+description=Returns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT LEFT('MariaDB', 5);\n+--------------------+\n| LEFT('MariaDB', 5) |\n+--------------------+\n| Maria |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/left/
+[LENGTH]
declaration=str
category=String Functions
-description=LENGTHB() is a synonym for LENGTH().
-[LENGTH]
+description=Returns the length of the string str.\n\nIn the default mode, when Oracle mode from MariaDB 10.3 is not set, the length\nis measured in bytes. In this case, a multi-byte character counts as multiple\nbytes. This means that for a string containing five two-byte characters,\nLENGTH() returns 10, whereas CHAR_LENGTH() returns 5.\n\nWhen running Oracle mode from MariaDB 10.3, the length is measured in\ncharacters, and LENGTH is a synonym for CHAR_LENGTH().\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nSELECT LENGTH('MariaDB');\n+-------------------+\n| LENGTH('MariaDB') |\n+-------------------+\n| 7 |\n+-------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/kb/en/length/
+[LENGTHB]
declaration=str
category=String Functions
-description=Returns the length of the string str, measured in bytes. A\nmulti-byte\ncharacter counts as multiple bytes. This means that for a\nstring\ncontaining five two-byte characters, LENGTH() returns 10,\nwhereas\nCHAR_LENGTH() returns 5. \n \nIf str is not a string value, it is converted into a string.\nIf str is NULL, the function returns NULL.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nOracle Mode\n \nWhen running Oracle mode from MariaDB 10.3, LENGTH() is a\nsynonym for CHAR_LENGTH().\n \n\nSELECT LENGTH(''MariaDB'');\n+-------------------+\n| LENGTH(''MariaDB'') |\n+-------------------+\n| 7 |\n+-------------------+\n \nSELECT LENGTH(''?'');\n+--------------+\n| LENGTH(''?'') |\n+--------------+\n| 2 |\n+--------------+\n \nIn Oracle mode from MariaDB 10.3:\n \nSELECT LENGTH(''?'');\n+--------------+\n| LENGTH(''?'') |\n+--------------+\n| 1 |\n+--------------+
+description=LENGTHB() returns the length of the given string, in bytes. When Oracle mode\nis not set, this is a synonym for LENGTH.\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, LENGTHB() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/kb/en/lengthb/
+[LIMIT]
+declaration=or ORDER BY
+category=Data Manipulation
+description=multi-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nGROUP_CONCAT\n------------\n\nStarting from MariaDB 10.3.3, it is possible to use LIMIT with GROUP_CONCAT().\n\nExamples\n--------\n\nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members VALUES('Jagdish'),('Kenny'),('Rokurou'),('Immaculada');\n\nSELECT * FROM members;\n+------------+\n| name |\n+------------+\n| Jagdish |\n| Kenny |\n| Rokurou |\n| Immaculada |\n+------------+\n\nSelect the first two names (no ordering specified):\n\nSELECT * FROM members LIMIT 2;\n+---------+\n| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n\nAll the names in alphabetical order:\n\nSELECT * FROM members ORDER BY name;\n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n| Kenny |\n| Rokurou |\n+------------+\n\nThe first two names, ordered alphabetically:\n\nSELECT * FROM members ORDER BY name LIMIT 2;\n+------------+\n| name |\n ...
[LINESTRING]
declaration=pt1,pt2,...
category=Geometry Constructors
-description=Constructs a WKB LineString value from a number of WKB Point\narguments. If any argument is not a WKB Point, the return\nvalue is\nNULL. If the number of Point arguments is less than two, the\nreturn value is NULL.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \nCREATE TABLE gis_line (g LINESTRING);\nINSERT INTO gis_line VALUES\n (LineFromText(''LINESTRING(0 0,0 10,10 0)'')),\n (LineStringFromText(''LINESTRING(10 10,20 10,20 20,10 20,10\n10)'')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));
+description=Constructs a WKB LineString value from a number of WKB Point arguments. If any\nargument is not a WKB Point, the return value is NULL. If the number of Point\narguments is less than two, the return value is NULL.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n\nCREATE TABLE gis_line (g LINESTRING);\nINSERT INTO gis_line VALUES\n (LineFromText('LINESTRING(0 0,0 10,10 0)')),\n (LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nURL: https://mariadb.com/kb/en/linestring/
[LN]
declaration=X
category=Numeric Functions
-description=Returns the natural logarithm of X; that is, the base-e\nlogarithm of X.\nIf X is less than or equal to 0, or NULL, then NULL is\nreturned.\n \nThe inverse of this function is EXP().\n \n\nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n \nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+
+description=Returns the natural logarithm of X; that is, the base-e logarithm of X. If X\nis less than or equal to 0, or NULL, then NULL is returned.\n\nThe inverse of this function is EXP().\n\nExamples\n--------\n\nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+\n\nURL: https://mariadb.com/kb/en/ln/
[LOAD_FILE]
declaration=file_name
category=String Functions
-description=Reads the file and returns the file contents as a string. To\nuse this function, the file must be located on the server\nhost, you must specify the full path name to the file, and\nyou must have the FILE privilege. The file must be readable\nby all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv\nsystem variable is set to a non-empty directory name, the\nfile to be loaded must be located in that directory.\n \nIf the file does not exist or cannot be read because one of\nthe preceding conditions is not satisfied, the function\nreturns NULL.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nStatements using the LOAD_FILE() function are not safe for\nstatement based replication. This is because the slave will\nexecute the LOAD_FILE() command itself. If the file doesn''t\nexist on the slave, the function will return NULL.\n \n\nUPDATE t SET blob_col=LOAD_FILE(''/tmp/picture'') WHERE\nid=1;
-[LOCATE1]
-name=LOCATE
+description=Reads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify the\nfull path name to the file, and you must have the FILE privilege. The file\nmust be readable by all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv system variable is\nset to a non-empty directory name, the file to be loaded must be located in\nthat directory.\n\nIf the file does not exist or cannot be read because one of the preceding\nconditions is not satisfied, the function returns NULL.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nStatements using the LOAD_FILE() function are not safe for statement based\nreplication. This is because the slave will execute the LOAD_FILE() command\nitself. If the file doesn't exist on the slave, the function will return NULL.\n\nExamples\n--------\n\nUPDATE t SET blob_col=LOAD_FILE('/tmp/picture') WHERE id=1;\n\nURL: https://mariadb.com/kb/en/load_file/
+[LOCALTIME]
+declaration=[precision]
+category=Date and Time Functions
+description=LOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/localtime/
+[LOCALTIMESTAMP]
+declaration=[precision]
+category=Date and Time Functions
+description=LOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/kb/en/localtimestamp/
+[LOCATE]
declaration=substr,str
category=String Functions
-description=The first syntax returns the position of the first\noccurrence of\nsubstring substr in string str. The second syntax returns\nthe position\nof the first occurrence of substring substr in string str,\nstarting at\nposition pos. Returns 0 if substr is not in str.\n \nLOCATE() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nINSTR() is a synonym of LOCATE() without the third argument.\n \n\nSELECT LOCATE(''bar'', ''foobarbar'');\n+----------------------------+\n| LOCATE(''bar'', ''foobarbar'') |\n+----------------------------+\n| 4 |\n+----------------------------+\n \nSELECT LOCATE(''My'', ''Maria'');\n+-----------------------+\n| LOCATE(''My'', ''Maria'') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT LOCATE(''bar'', ''foobarbar'', 5);\n+-------------------------------+\n| LOCATE(''bar'', ''foobarbar'', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+
-[LOCATE2]
-name=LOCATE
-declaration=substr,str,pos
-category=String Functions
-description=The first syntax returns the position of the first\noccurrence of\nsubstring substr in string str. The second syntax returns\nthe position\nof the first occurrence of substring substr in string str,\nstarting at\nposition pos. Returns 0 if substr is not in str.\n \nLOCATE() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nINSTR() is a synonym of LOCATE() without the third argument.\n \n\nSELECT LOCATE(''bar'', ''foobarbar'');\n+----------------------------+\n| LOCATE(''bar'', ''foobarbar'') |\n+----------------------------+\n| 4 |\n+----------------------------+\n \nSELECT LOCATE(''My'', ''Maria'');\n+-----------------------+\n| LOCATE(''My'', ''Maria'') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT LOCATE(''bar'', ''foobarbar'', 5);\n+-------------------------------+\n| LOCATE(''bar'', ''foobarbar'', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+
-[LOG10]
+description=The first syntax returns the position of the first occurrence of substring\nsubstr in string str. The second syntax returns the position of the first\noccurrence of substring substr in string str, starting at position pos.\nReturns 0 if substr is not in str.\n\nLOCATE() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nINSTR() is the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nExamples\n--------\n\nSELECT LOCATE('bar', 'foobarbar');\n+----------------------------+\n| LOCATE('bar', 'foobarbar') |\n+----------------------------+\n| 4 |\n+----------------------------+\n\nSELECT LOCATE('My', 'Maria');\n+-----------------------+\n| LOCATE('My', 'Maria') |\n+-----------------------+\n| 0 |\n+-----------------------+\n\nSELECT LOCATE('bar', 'foobarbar', 5);\n+-------------------------------+\n| LOCATE('bar', 'foobarbar', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+\n\nURL: https://mariadb.com/kb/en/locate/
+[LOG]
declaration=X
category=Numeric Functions
-description=Returns the base-10 logarithm of X.\n \n\nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n \nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n \nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+
-[LOG1]
-name=LOG
+description=If called with one parameter, this function returns the natural logarithm of\nX. If X is less than or equal to 0, then NULL is returned.\n\nIf called with two parameters, it returns the logarithm of X to the base B. If\nB is <= 1 or X <= 0, the function returns NULL.\n\nIf any argument is NULL, the function returns NULL.\n\nThe inverse of this function (when called with a single argument) is the EXP()\nfunction.\n\nExamples\n--------\n\nLOG(X):\n\nSELECT LOG(2);\n+-------------------+\n| LOG(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LOG(-2);\n+---------+\n| LOG(-2) |\n+---------+\n| NULL |\n+---------+\n\nLOG(B,X)\n\nSELECT LOG(2,16);\n+-----------+\n| LOG(2,16) |\n+-----------+\n| 4 |\n+-----------+\n\nSELECT LOG(3,27);\n+-----------+\n| LOG(3,27) |\n+-----------+\n| 3 |\n+-----------+\n\nSELECT LOG(3,1);\n+----------+\n| LOG(3,1) |\n+----------+\n ...
+[LOG10]
declaration=X
category=Numeric Functions
-description=If called with one parameter, this function returns the\nnatural\nlogarithm of X. If X is less than or equal to 0, then NULL\nis\nreturned.\n \nIf called with two parameters, it returns the logarithm of X\nto the base B. If B is
+description=Returns the base-10 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n\nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n\nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+\n\nURL: https://mariadb.com/kb/en/log10/
[LOG2]
declaration=X
category=Numeric Functions
-description=Returns the base-2 logarithm of X.\n \n\nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n \nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n \nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+
-[LOG2]
-name=LOG
-declaration=B,X
-category=Numeric Functions
-description=If called with one parameter, this function returns the\nnatural\nlogarithm of X. If X is less than or equal to 0, then NULL\nis\nreturned.\n \nIf called with two parameters, it returns the logarithm of X\nto the base B. If B is
+description=Returns the base-2 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n\nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n\nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+\n\nURL: https://mariadb.com/kb/en/log2/
[LOWER]
declaration=str
category=String Functions
-description=Returns the string str with all characters changed to\nlowercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \n\n SELECT LOWER(''QUADRATICALLY'');\n+------------------------+\n| LOWER(''QUADRATICALLY'') |\n+------------------------+\n| quadratically |\n+------------------------+\n \nLOWER() (and UPPER()) are ineffective when applied to binary\nstrings (BINARY, VARBINARY, BLOB). \nTo perform lettercase conversion, CONVERT the string to a\nnon-binary string:\n \nSET @str = BINARY ''North Carolina'';\n \nSELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+----------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+----------------+-----------------------------------+\n| North Carolina | north carolina |\n+----------------+-----------------------------------+
+description=Returns the string str with all characters changed to lowercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nLCASE is a synonym for LOWER\n\nExamples\n--------\n\nSELECT LOWER('QUADRATICALLY');\n+------------------------+\n| LOWER('QUADRATICALLY') |\n+------------------------+\n| quadratically |\n+------------------------+\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings (BINARY,\nVARBINARY, BLOB). To perform lettercase conversion, CONVERT the string to a\nnon-binary string:\n\nSET @str = BINARY 'North Carolina';\n\nSELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+----------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+----------------+-----------------------------------+\n| North Carolina | north carolina |\n+----------------+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/lower/
[LPAD]
declaration=str, len [,padstr]
category=String Functions
-description=Returns the string str, left-padded with the string padstr\nto a length\nof len characters. If str is longer than len, the return\nvalue is\nshortened to len characters. If padstr is omitted, the LPAD\nfunction pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (zero length), returns either an empty string or, from\nMariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LPAD_ORACLE as the function\nname.\n \n\nSELECT LPAD(''hello'',10,''.'');\n+----------------------+\n| LPAD(''hello'',10,''.'') |\n+----------------------+\n| .....hello |\n+----------------------+\n \nSELECT LPAD(''hello'',2,''.'');\n+---------------------+\n| LPAD(''hello'',2,''.'') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT LPAD(''hello'',10);\n+------------------+\n| LPAD(''hello'',10) |\n+------------------+\n| hello |\n+------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LPAD('''',0),LPAD_ORACLE('''',0);\n+------------+-------------------+\n| LPAD('''',0) | LPAD_ORACLE('''',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+
+description=Returns the string str, left-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the LPAD function pads spaces.\n\nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n\nReturns NULL if given a NULL argument. If the result is empty (zero length),\nreturns either an empty string or, from MariaDB 10.3.6 with SQL_MODE=Oracle,\nNULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LPAD_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT LPAD('hello',10,'.');\n+----------------------+\n| LPAD('hello',10,'.') |\n+----------------------+\n| .....hello |\n+----------------------+\n\nSELECT LPAD('hello',2,'.');\n+---------------------+\n| LPAD('hello',2,'.') |\n+---------------------+\n| he |\n+---------------------+\n\nFrom MariaDB 10.3.1, with the pad string defaulting to space.\n\nSELECT LPAD('hello',10);\n+------------------+\n| LPAD('hello',10) |\n+------------------+\n| hello |\n+------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT LPAD('',0),LPAD_ORACLE('',0);\n+------------+-------------------+\n| LPAD('',0) | LPAD_ORACLE('',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n\nURL: https://mariadb.com/kb/en/lpad/
[LTRIM]
declaration=str
category=String Functions
-description=Returns the string str with leading space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LTRIM_ORACLE as the function\nname.\n \n\nSELECT QUOTE(LTRIM('' MariaDB ''));\n+-------------------------------+\n| QUOTE(LTRIM('' MariaDB '')) |\n+-------------------------------+\n| ''MariaDB '' |\n+-------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LTRIM(''''),LTRIM_ORACLE('''');\n+-----------+------------------+\n| LTRIM('''') | LTRIM_ORACLE('''') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+
+description=Returns the string str with leading space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT QUOTE(LTRIM(' MariaDB '));\n+-------------------------------+\n| QUOTE(LTRIM(' MariaDB ')) |\n+-------------------------------+\n| 'MariaDB ' |\n+-------------------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT LTRIM(''),LTRIM_ORACLE('');\n+-----------+------------------+\n| LTRIM('') | LTRIM_ORACLE('') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n\nURL: https://mariadb.com/kb/en/ltrim/
[MAKEDATE]
declaration=year,dayofyear
category=Date and Time Functions
-description=Returns a date, given year and day-of-year values. dayofyear\nmust be\ngreater than 0 or the result is NULL.\n \n\nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31 | 2011-02-01 |\n+-------------------+-------------------+\n \nSELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n+--------------------+--------------------+\n| MAKEDATE(2011,365) | MAKEDATE(2014,365) |\n+--------------------+--------------------+\n| 2011-12-31 | 2014-12-31 |\n+--------------------+--------------------+\n \nSELECT MAKEDATE(2011,0);\n+------------------+\n| MAKEDATE(2011,0) |\n+------------------+\n| NULL |\n+------------------+
+description=Returns a date, given year and day-of-year values. dayofyear must be greater\nthan 0 or the result is NULL.\n\nExamples\n--------\n\nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31 | 2011-02-01 |\n+-------------------+-------------------+\n\nSELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n+--------------------+--------------------+\n| MAKEDATE(2011,365) | MAKEDATE(2014,365) |\n+--------------------+--------------------+\n| 2011-12-31 | 2014-12-31 |\n+--------------------+--------------------+\n\nSELECT MAKEDATE(2011,0);\n+------------------+\n| MAKEDATE(2011,0) |\n+------------------+\n| NULL |\n+------------------+\n\nURL: https://mariadb.com/kb/en/makedate/
[MAKETIME]
declaration=hour,minute,second
category=Date and Time Functions
-description=Returns a time value calculated from the hour, minute, and\nsecond arguments.\n \nIf minute or second are out of the range 0 to 60, NULL is\nreturned. The hour can be in the range -838 to 838, outside\nof which the value is truncated with a warning.\n \n\nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33 |\n+--------------------+\n \nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33 |\n+---------------------+\n \nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL |\n+--------------------+\n \nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n''-1000:57:33'' |\n+---------+------+-----------------------------------------------+
+description=Returns a time value calculated from the hour, minute, and second arguments.\n\nIf minute or second are out of the range 0 to 60, NULL is returned. The hour\ncan be in the range -838 to 838, outside of which the value is truncated with\na warning.\n\nExamples\n--------\n\nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33 |\n+--------------------+\n\nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33 |\n+---------------------+\n\nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL |\n+--------------------+\n\nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: '-1000:57:33' |\n+---------+------+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/maketime/
[MAKE_SET]
declaration=bits,str1,str2,...
category=String Functions
-description=Returns a set value (a string containing substrings\nseparated by ","\ncharacters) consisting of the strings that have the\ncorresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and\nso on. NULL\nvalues in str1, str2, ... are not appended to the result.\n \n\nSELECT MAKE_SET(1,''a'',''b'',''c'');\n+-------------------------+\n| MAKE_SET(1,''a'',''b'',''c'') |\n+-------------------------+\n| a |\n+-------------------------+\n \nSELECT MAKE_SET(1 | 4,''hello'',''nice'',''world'');\n+----------------------------------------+\n| MAKE_SET(1 | 4,''hello'',''nice'',''world'') |\n+----------------------------------------+\n| hello,world |\n+----------------------------------------+\n \nSELECT MAKE_SET(1 | 4,''hello'',''nice'',NULL,''world'');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,''hello'',''nice'',NULL,''world'') |\n+---------------------------------------------+\n| hello |\n+---------------------------------------------+\n \nSELECT QUOTE(MAKE_SET(0,''a'',''b'',''c''));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,''a'',''b'',''c'')) |\n+--------------------------------+\n| '''' |\n+--------------------------------+
+description=Returns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit in bits\nset. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL values in str1,\nstr2, ... are not appended to the result.\n\nExamples\n--------\n\nSELECT MAKE_SET(1,'a','b','c');\n+-------------------------+\n| MAKE_SET(1,'a','b','c') |\n+-------------------------+\n| a |\n+-------------------------+\n\nSELECT MAKE_SET(1 | 4,'hello','nice','world');\n+----------------------------------------+\n| MAKE_SET(1 | 4,'hello','nice','world') |\n+----------------------------------------+\n| hello,world |\n+----------------------------------------+\n\nSELECT MAKE_SET(1 | 4,'hello','nice',NULL,'world');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,'hello','nice',NULL,'world') |\n+---------------------------------------------+\n| hello |\n+---------------------------------------------+\n\nSELECT QUOTE(MAKE_SET(0,'a','b','c'));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,'a','b','c')) |\n+--------------------------------+\n| '' |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/make_set/
[MASTER_GTID_WAIT]
declaration=gtid-list[, timeout
category=Miscellaneous Functions
-description=This function takes a string containing a comma-separated\nlist of global transaction id''s\n(similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or\nhigher seq_no within all replication domains specified in\nthe gtid-list; in other words, it waits until the slave has\nreached the specified GTID position.\n \nAn optional second argument gives a timeout in seconds. If\nthe timeout\nexpires before the specified GTID position is reached, then\nthe function\nreturns -1. Passing NULL or a negative number for the\ntimeout means no timeout, and the function will wait\nindefinitely.\n \n If the wait completes without a timeout, 0 is returned.\nPassing NULL for the\n gtid-list makes the function return NULL immediately,\nwithout waiting.\n \nThe gtid-list may be the empty string, in which case\nMASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains\nthan\ngtid_slave_pos, then only those domains are waited upon. If\ngtid-list\ncontains a domain that is not present in @@gtid_slave_pos,\nthen\nMASTER_GTID_WAIT() will wait until an event containing such\ndomain_id arrives\non the slave (or until timed out or killed).\n \nMASTER_GTID_WAIT() can be useful to ensure that a slave has\ncaught up to\na master. Simply take the value of gtid_binlog_pos on the\nmaster, and use it in a MASTER_GTID_WAIT() call on the\nslave; when the call completes, the slave\nwill have caught up with that master position.\n \nMASTER_GTID_WAIT() can also be used in client applications\ntogether with the\nlast_gtid session variable. This is useful in a\nread-scaleout replication setup, where the application\nwrites to a single master but divides the\nreads out to a number of slaves to distribute the load. In\nsuch a setup, there\nis a risk that an application could first do an update on\nthe master, and then\na bit later do a read on a slave, and if the slave is not\nfast enough, the\ndata read from the slave might not include the update just\nmade, possibly\nconfusing the application and/or the end-user. One way to\navoid this is to\nrequest the value of last_gtid on the master just after the\nupdate. Then\nbefore doing the read on the slave, do a MASTER_GTID_WAIT()\non the value\nobtained from the master; this will ensure that the read is\nnot performed\nuntil the slave has replicated sufficiently far for the\nupdate to have become\nvisible.\n \nNote that MASTER_GTID_WAIT() can be used even if the slave\nis configured not\nto use GTID for connections (CHANGE MASTER TO\nmaster_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the\nmaster server, and\nalways recorded on the slave servers.\n \nDifferences to MASTER_POS_WAIT()\n \nMASTER_GTID_WAIT() is global; it waits for any master\nconnection to reach\n the specified GTID position. MASTER_POS_WAIT() works only\nagainst a\n specific connection. This also means that while\nMASTER_POS_WAIT() aborts if\n its master connection is terminated with STOP SLAVE or due\nto an error,\n MASTER_GTID_WAIT() continues to wait while slaves are\nstopped.\n \nMASTER_GTID_WAIT() can take its timeout as a floating-point\nvalue, so a\n timeout in fractional seconds is supported, eg.\nMASTER_GTID_WAIT("0-1-100",\n 0.5). (The minimum wait is one microsecond, 0.000001\nseconds).\n \nMASTER_GTID_WAIT() allows one to specify a timeout of zero\nin order to do a\n non-blocking check to see if the slaves have progressed to\na specific GTID position\n (MASTER_POS_WAIT() takes a zero timeout as meaning an\ninfinite wait). To do\n an infinite MASTER_GTID_WAIT(), specify a negative timeout,\nor omit the\n timeout argument.\n \nMASTER_GTID_WAIT() does not return the number of events\nexecuted since the\n wait started, nor does it return NULL if a slave thread is\nstopped. It\n always returns either 0 for successful wait completed, or\n-1 for timeout\n reached (or NULL if the specified gtid-pos is NULL).\n \nSince MASTER_GTID_WAIT() looks only at the seq_no part of\nthe GTIDs, not the\nserver_id, care is needed if a slave becomes diverged from\nanother server so\nthat two different GTIDs with the same seq_no (in the same\ndomain) arrive at\nthe same server. This situation is in any case best avoided;\nsetting\ngtid_strict_mode is recommended, as this will prevent any\nsuch out-of-order sequence numbers from ever being\nreplicated on a slave.
+description=This function takes a string containing a comma-separated list of global\ntransaction id's (similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or higher seq_no within\nall replication domains specified in the gtid-list; in other words, it waits\nuntil the slave has reached the specified GTID position.\n\nAn optional second argument gives a timeout in seconds. If the timeout expires\nbefore the specified GTID position is reached, then the function returns -1.\nPassing NULL or a negative number for the timeout means no timeout, and the\nfunction will wait indefinitely.\n\nIf the wait completes without a timeout, 0 is returned. Passing NULL for the\ngtid-list makes the function return NULL immediately, without waiting.\n\nThe gtid-list may be the empty string, in which case MASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains than\ngtid_slave_pos, then only those domains are waited upon. If gtid-list contains\na domain that is not present in @@gtid_slave_pos, then MASTER_GTID_WAIT() will\nwait until an event containing such domain_id arrives on the slave (or until\ntimed out or killed).\n\nMASTER_GTID_WAIT() can be useful to ensure that a slave has caught up to a\nmaster. Simply take the value of gtid_binlog_pos on the master, and use it in\na MASTER_GTID_WAIT() call on the slave; when the call completes, the slave\nwill have caught up with that master position.\n\nMASTER_GTID_WAIT() can also be used in client applications together with the\nlast_gtid session variable. This is useful in a read-scaleout replication\nsetup, where the application writes to a single master but divides the reads\nout to a number of slaves to distribute the load. In such a setup, there is a\nrisk that an application could first do an update on the master, and then a\nbit later do a read on a slave, and if the slave is not fast enough, the data\nread from the slave might not include the update just made, possibly confusing\nthe application and/or the end-user. One way to avoid this is to request the\nvalue of last_gtid on the master just after the update. Then before doing the\nread on the slave, do a MASTER_GTID_WAIT() on the value obtained from the\nmaster; this will ensure that the read is not performed until the slave has\nreplicated sufficiently far for the update to have become visible.\n\nNote that MASTER_GTID_WAIT() can be used even if the slave is configured not\nto use GTID for connections (CHANGE MASTER TO master_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the master server, and\nalways recorded on the slave servers.\n\nDifferences to MASTER_POS_WAIT()\n--------------------------------\n\n* MASTER_GTID_WAIT() is global; it waits for any master connection to reach\n the specified GTID position. MASTER_POS_WAIT() works only against a\n specific connection. This also means that while MASTER_POS_WAIT() aborts if\n ...
[MASTER_POS_WAIT]
declaration=log_name,log_pos[,timeout,["connection_name"]]
category=Miscellaneous Functions
-description=This function is useful in replication for controlling\nmaster/slave synchronization. It blocks until the slave has\nread and applied all updates up to the specified position\n(log_name,log_pos) in the master log. The return value is\nthe number of log events the slave had to wait for to\nadvance to the specified position. The function returns NULL\nif\nthe slave SQL thread is not started, the slave''s master\ninformation is not\ninitialized, the arguments are incorrect, or an error\noccurs. It returns -1 if\nthe timeout has been exceeded. If the slave SQL thread stops\nwhile\n MASTER_POS_WAIT() is waiting, the function returns NULL. If\nthe slave is past the specified position, the function\nreturns immediately.\n \nIf a timeout value is specified, MASTER_POS_WAIT() stops\nwaiting when timeout seconds have elapsed. timeout must be\ngreater than 0; a\nzero or negative timeout means no timeout.\n \nThe connection_name is used when you are using\nmulti-source-replication. If you don''t specify it, it''s\nset to the value of the default_master_connection system\nvariable.\n \nStatements using the MASTER_POS_WAIT() function are not safe\nfor replication.
+description=This function is useful in replication for controlling primary/replica\nsynchronization. It blocks until the replica has read and applied all updates\nup to the specified position (log_name,log_pos) in the primary log. The return\nvalue is the number of log events the replica had to wait for to advance to\nthe specified position. The function returns NULL if the replica SQL thread is\nnot started, the replica's primary information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the timeout has\nbeen exceeded. If the replica SQL thread stops while MASTER_POS_WAIT() is\nwaiting, the function returns NULL. If the replica is past the specified\nposition, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when timeout\nseconds have elapsed. timeout must be greater than 0; a zero or negative\ntimeout means no timeout.\n\nThe connection_name is used when you are using multi-source-replication. If\nyou don't specify it, it's set to the value of the default_master_connection\nsystem variable.\n\nStatements using the MASTER_POS_WAIT() function are not safe for\nstatement-based replication.\n\nURL: https://mariadb.com/kb/en/master_pos_wait/
[MAX]
declaration=[DISTINCT] expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the largest, or maximum, value of expr. MAX() can\nalso take a string\nargument in which case it returns the maximum string value.\nThe DISTINCT\nkeyword can be used to find the maximum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MAX() may produce a different highest result\nthan ORDER BY DESC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MAX() can be used as a window function.\n \nMAX() returns NULL if there were no matching rows.\n \n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n \nSELECT name, MAX(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n \nMAX string:\n \nSELECT MAX(name) FROM student;\n \n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MAX(SCORE) FROM student;\n \n+------+------+------------+\n| name | test | MAX(SCORE) |\n+------+------+------------+\n| Chun | SQL | 88 |\n+------+------+------------+\n \nDifference between ORDER BY DESC and MAX():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(''b'',''c'',''a''));\n \nINSERT INTO student2\nVALUES(''Chun'',''b''),(''Esben'',''c''),(''Kaolin'',''a'');\n \nSELECT MAX(grade) FROM student2;\n \n+------------+\n| MAX(grade) |\n+------------+\n| c |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade DESC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| a |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, MAX(score) \n OVER (PARTITION BY name) AS highest_score FROM\nstudent_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | highest_score |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 75 |\n| Chun | Tuning | 73 | 75 |\n| Esben | SQL | 43 | 43 |\n| Esben | Tuning | 31 | 43 |\n| Kaolin | SQL | 56 | 88 |\n| Kaolin | Tuning | 88 | 88 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+---------------+
-[MBRCONTAINS]
+description=Returns the largest, or maximum, value of expr. MAX() can also take a string\nargument in which case it returns the maximum string value. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value\nrather than their relative position in the set, so MAX() may produce a\ndifferent highest result than ORDER BY DESC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMAX() can be used as a window function.\n\nMAX() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);\n\nSELECT name, MAX(score) FROM student GROUP BY name;\n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n\nMAX string:\n\nSELECT MAX(name) FROM student;\n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\nmismatched data:\n\nSELECT name,test,MAX(SCORE) FROM student;\n+------+------+------------+\n ...
+[MBRContains]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 contains the Minimum Bounding Rectangle of g2. This tests\nthe\nopposite relationship as MBRWithin().\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\n \nSET @g2 = GeomFromText(''Point(1 1)'');\n \nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+
-[MBRDISJOINT]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\n\nSET @g2 = GeomFromText('Point(1 1)');\n\nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n\nURL: https://mariadb.com/kb/en/mbrcontains/
+[MBRDisjoint]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 are disjoint. Two\ngeometries are disjoint if they do not intersect, that is\ntouch or overlap.\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+
-[MBREQUAL]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 are disjoint. Two geometries are disjoint if they do not\nintersect, that is touch or overlap.\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((4 4,4 7,7 7,7 4,4 4))');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/mbrdisjoint/
+[MBREqual]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 are the same.\n \n\nSET @g1=GEOMFROMTEXT(''LINESTRING(0 0, 1 2)'');\nSET @g2=GEOMFROMTEXT(''POLYGON((0 0, 0 2, 1 2, 1 0, 0\n0))'');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSET @g1=GEOMFROMTEXT(''LINESTRING(0 0, 1 3)'');\nSET @g2=GEOMFROMTEXT(''POLYGON((0 0, 0 2, 1 4, 1 0, 0\n0))'');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+
-[MBRINTERSECTS]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 are the same.\n\nExamples\n--------\n\nSET @g1=GEOMFROMTEXT('LINESTRING(0 0, 1 2)');\nSET @g2=GEOMFROMTEXT('POLYGON((0 0, 0 2, 1 2, 1 0, 0 0))');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n\nSET @g1=GEOMFROMTEXT('LINESTRING(0 0, 1 3)');\nSET @g2=GEOMFROMTEXT('POLYGON((0 0, 0 2, 1 4, 1 0, 0 0))');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/mbrequal/
+[MBRIntersects]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 intersect.\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+
-[MBROVERLAPS]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 intersect.\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((4 4,4 7,7 7,7 4,4 4))');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/mbrintersects/
+[MBROverlaps]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 overlap. The term spatially\noverlaps is\nused if two geometries intersect and their intersection\nresults in a\ngeometry of the same dimension but not equal to either of\nthe given\ngeometries.\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 4,4 4,4 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+
-[MBRTOUCHES]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 overlap. The term spatially overlaps is used if two\ngeometries intersect and their intersection results in a geometry of the same\ndimension but not equal to either of the given geometries.\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((4 4,4 7,7 7,7 4,4 4))');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 4,4 4,4 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/mbroverlaps/
+[MBRTouches]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially\ntouch if\nthe interiors of the geometries do not intersect, but the\nboundary of\none of the geometries intersects either the boundary or the\ninterior\nof the other.\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = GeomFromText(''Polygon((0 0,0 4,4 4,4 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+
-[MBRWITHIN]
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 touch. Two geometries spatially touch if the interiors of\nthe geometries do not intersect, but the boundary of one of the geometries\nintersects either the boundary or the interior of the other.\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((4 4,4 7,7 7,7 4,4 4))');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n\nSET @g1 = GeomFromText('Polygon((0 0,0 4,4 4,4 0,0 0))');\nSET @g2 = GeomFromText('Polygon((3 3,3 6,6 6,6 3,3 3))');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/mbrtouches/
+[MBRWithin]
declaration=g1,g2
category=MBR
-description=Returns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 is within the Minimum Bounding Rectangle of g2. This\ntests the\nopposite relationship as MBRContains().\n \n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((0 0,0 5,5 5,5 0,0 0))'');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+
+description=Returns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1 is\nwithin the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nExamples\n--------\n\nSET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nSET @g2 = GeomFromText('Polygon((0 0,0 5,5 5,5 0,0 0))');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n\nURL: https://mariadb.com/kb/en/mbrwithin/
[MD5]
declaration=str
category=Encryption Functions
-description=Calculates an MD5 128-bit checksum for the string. \n \nThe return value is a 32-hex digit string, and as of MariaDB\n5.5, is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nNULL is returned if the argument was NULL. \n \n\nSELECT MD5(''testing'');\n+----------------------------------+\n| MD5(''testing'') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+
-[MEDIAN1]
-name=MEDIAN
-declaration=median expression
-category=Window Functions
-description=MEDIAN() is a window function that returns the median value\nof a range of values.\n \nIt is a specific case of PERCENTILE_CONT, with an argument\nof 0.5 and the ORDER BY column the one in MEDIAN''s\nargument. \n \nMEDIAN() OVER ( [ PARTITION BY partition_expression] )\n \nIs equivalent to:\n \nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY ) OVER ( [ PARTITION BY\npartition_expression ])\n \n\nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'',\n5);\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'',\n3);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 1);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 2);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 5);\n \nSELECT name, median(star_rating) OVER (PARTITION BY name)\nFROM book_rating;\n \n+-----------------------+----------------------------------------------+\n| name | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+----------------------------------------------+
-[MEDIAN2]
-name=MEDIAN
-declaration=[ PARTITION BY partition_expression ]
-category=Window Functions
-description=MEDIAN() is a window function that returns the median value\nof a range of values.\n \nIt is a specific case of PERCENTILE_CONT, with an argument\nof 0.5 and the ORDER BY column the one in MEDIAN''s\nargument. \n \nMEDIAN() OVER ( [ PARTITION BY partition_expression] )\n \nIs equivalent to:\n \nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY ) OVER ( [ PARTITION BY\npartition_expression ])\n \n\nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'',\n5);\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'',\n3);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 1);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 2);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 5);\n \nSELECT name, median(star_rating) OVER (PARTITION BY name)\nFROM book_rating;\n \n+-----------------------+----------------------------------------------+\n| name | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+----------------------------------------------+
+description=Calculates an MD5 128-bit checksum for the string.\n\nThe return value is a 32-hex digit string, and as of MariaDB 5.5, is a\nnonbinary string in the connection character set and collation, determined by\nthe values of the character_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n\nNULL is returned if the argument was NULL.\n\nExamples\n--------\n\nSELECT MD5('testing');\n+----------------------------------+\n| MD5('testing') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/md5/
+[MEDIUMINT]
+declaration=M
+category=Data Types
+description=A medium-sized integer. The signed range is -8388608 to 8388607. The unsigned\nrange is 0 to 16777215.\n\nZEROFILL pads the integer with zeroes and assumes UNSIGNED (even if UNSIGNED\nis not specified).\n\nINT3 is a synonym for MEDIUMINT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c MEDIUMINT\nZEROFILL);\n\nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a | mediumint(9) | YES | | NULL | |\n| b | mediumint(8) unsigned | YES | | NULL | |\n| c | mediumint(8) unsigned zerofill | YES | | NULL | |\n+-------+--------------------------------+------+-----+---------+-------+\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO mediumints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column 'b' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column 'c' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,10);\n\nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nERROR 1264 (22003): Out of range value for column 'a' at row 1\n\nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n\nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\n ...
[MICROSECOND]
declaration=expr
category=Date and Time Functions
-description=Returns the microseconds from the time or datetime\nexpression expr as a number in the range from 0 to 999999.\n \nIf expr is a time with no microseconds, zero is returned,\nwhile if expr is a date with no time, zero with a warning is\nreturned.\n \n\nSELECT MICROSECOND(''12:00:00.123456'');\n+--------------------------------+\n| MICROSECOND(''12:00:00.123456'') |\n+--------------------------------+\n| 123456 |\n+--------------------------------+\n \nSELECT MICROSECOND(''2009-12-31 23:59:59.000010'');\n+-------------------------------------------+\n| MICROSECOND(''2009-12-31 23:59:59.000010'') |\n+-------------------------------------------+\n| 10 |\n+-------------------------------------------+\n \nSELECT MICROSECOND(''2013-08-07 12:13:14'');\n+------------------------------------+\n| MICROSECOND(''2013-08-07 12:13:14'') |\n+------------------------------------+\n| 0 |\n+------------------------------------+\n \nSELECT MICROSECOND(''2013-08-07'');\n+---------------------------+\n| MICROSECOND(''2013-08-07'') |\n+---------------------------+\n| 0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n''2013-08-07'' |\n+---------+------+----------------------------------------------+
+description=Returns the microseconds from the time or datetime expression expr as a number\nin the range from 0 to 999999.\n\nIf expr is a time with no microseconds, zero is returned, while if expr is a\ndate with no time, zero with a warning is returned.\n\nExamples\n--------\n\nSELECT MICROSECOND('12:00:00.123456');\n+--------------------------------+\n| MICROSECOND('12:00:00.123456') |\n+--------------------------------+\n| 123456 |\n+--------------------------------+\n\nSELECT MICROSECOND('2009-12-31 23:59:59.000010');\n+-------------------------------------------+\n| MICROSECOND('2009-12-31 23:59:59.000010') |\n+-------------------------------------------+\n| 10 |\n+-------------------------------------------+\n\nSELECT MICROSECOND('2013-08-07 12:13:14');\n+------------------------------------+\n| MICROSECOND('2013-08-07 12:13:14') |\n+------------------------------------+\n| 0 |\n+------------------------------------+\n\nSELECT MICROSECOND('2013-08-07');\n+---------------------------+\n| MICROSECOND('2013-08-07') |\n+---------------------------+\n| 0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: '2013-08-07' |\n+---------+------+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/microsecond/
[MID]
declaration=str,pos,len
category=String Functions
-description=MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n \n\nSELECT MID(''abcd'',4,1);\n+-----------------+\n| MID(''abcd'',4,1) |\n+-----------------+\n| d |\n+-----------------+\n \nSELECT MID(''abcd'',2,2);\n+-----------------+\n| MID(''abcd'',2,2) |\n+-----------------+\n| bc |\n+-----------------+\n \nA negative starting position:\n \nSELECT MID(''abcd'',-2,4);\n+------------------+\n| MID(''abcd'',-2,4) |\n+------------------+\n| cd |\n+------------------+
-[MINUTE]
-declaration=time
-category=Date and Time Functions
-description=Returns the minute for time, in the range 0 to 59. \n \n\nSELECT MINUTE(''2013-08-03 11:04:03'');\n+-------------------------------+\n| MINUTE(''2013-08-03 11:04:03'') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n \n SELECT MINUTE (''23:12:50'');\n+---------------------+\n| MINUTE (''23:12:50'') |\n+---------------------+\n| 12 |\n+---------------------+
+description=MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nExamples\n--------\n\nSELECT MID('abcd',4,1);\n+-----------------+\n| MID('abcd',4,1) |\n+-----------------+\n| d |\n+-----------------+\n\nSELECT MID('abcd',2,2);\n+-----------------+\n| MID('abcd',2,2) |\n+-----------------+\n| bc |\n+-----------------+\n\nA negative starting position:\n\nSELECT MID('abcd',-2,4);\n+------------------+\n| MID('abcd',-2,4) |\n+------------------+\n| cd |\n+------------------+\n\nURL: https://mariadb.com/kb/en/mid/
[MIN]
declaration=[DISTINCT] expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the minimum value of expr. MIN() may take a string\nargument, in which case it returns the minimum string value.\nThe DISTINCT\nkeyword can be used to find the minimum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MIN() may produce a different lowest result than\nORDER BY ASC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MIN() can be used as a window function.\n \nMIN() returns NULL if there were no matching rows.\n \n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n \nSELECT name, MIN(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n \nMIN() with a string:\n \nSELECT MIN(name) FROM student;\n \n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MIN(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nDifference between ORDER BY ASC and MIN():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(''b'',''c'',''a''));\n \nINSERT INTO student2\nVALUES(''Chun'',''b''),(''Esben'',''c''),(''Kaolin'',''a'');\n \nSELECT MIN(grade) FROM student2;\n \n+------------+\n| MIN(grade) |\n+------------+\n| a |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade ASC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| b |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, MIN(score) \n OVER (PARTITION BY name) AS lowest_score FROM student_test;\n \n+---------+--------+-------+--------------+\n| name | test | score | lowest_score |\n+---------+--------+-------+--------------+\n| Chun | SQL | 75 | 73 |\n| Chun | Tuning | 73 | 73 |\n| Esben | SQL | 43 | 31 |\n| Esben | Tuning | 31 | 31 |\n| Kaolin | SQL | 56 | 56 |\n| Kaolin | Tuning | 88 | 56 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+--------------+
-[MLINEFROMTEXT]
+description=Returns the minimum value of expr. MIN() may take a string argument, in which\ncase it returns the minimum string value. The DISTINCT keyword can be used to\nfind the minimum of the distinct values of expr, however, this produces the\nsame result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value\nrather than their relative position in the set, so MIN() may produce a\ndifferent lowest result than ORDER BY ASC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMIN() can be used as a window function.\n\nMIN() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);\n\nSELECT name, MIN(score) FROM student GROUP BY name;\n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n\nMIN() with a string:\n\nSELECT MIN(name) FROM student;\n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\nmismatched data:\n\nSELECT name,test,MIN(score) FROM student;\n+------+------+------------+\n ...
+[MINUTE]
+declaration=time
+category=Date and Time Functions
+description=Returns the minute for time, in the range 0 to 59.\n\nExamples\n--------\n\nSELECT MINUTE('2013-08-03 11:04:03');\n+-------------------------------+\n| MINUTE('2013-08-03 11:04:03') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n\nSELECT MINUTE ('23:12:50');\n+---------------------+\n| MINUTE ('23:12:50') |\n+---------------------+\n| 12 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/minute/
+[MLineFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a MULTILINESTRING value using its WKT\nrepresentation and SRID.\n \nMLineFromText() and MultiLineStringFromText() are synonyms.\n \n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(''MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))'')),\n (MLineFromText(''MULTILINESTRING((10 48,10 21,10 0))'')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));
-[MLINEFROMWKB]
+description=Constructs a MULTILINESTRING value using its WKT representation and SRID.\n\nMLineFromText() and MultiLineStringFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16\n23,16 48))')),\n (MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),\n (MLineFromWKB(AsWKB(MultiLineString(\n LineString(Point(1, 2), Point(3, 5)),\n LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));\n\nURL: https://mariadb.com/kb/en/mlinefromtext/
+[MLineFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a MULTILINESTRING value using its WKB\nrepresentation and SRID.\n \nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(MLineFromText(''MULTILINESTRING((10\n48,10 21,10 0),(16 0,16 23,16 48))''));\n \nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g)) |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+
+description=Constructs a MULTILINESTRING value using its WKB representation and SRID.\n\nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MLineFromText('MULTILINESTRING((10 48,10 21,10 0),(16\n0,16 23,16 48))'));\n\nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g)) |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/mlinefromwkb/
[MOD]
declaration=N,M
category=Numeric Functions
-description=Modulo operation. Returns the remainder of N divided by M.\nSee also Modulo Operator.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any\nnumber modulus zero produces an error. Otherwise, it returns\nNULL.\n \nThe integer part of a division can be obtained using DIV.\n \n\nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n \nSELECT 253 % 7;\n \n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n \nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n \nSELECT 29 MOD 9;\n \n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+
-[MONTHNAME]
+description=Modulo operation. Returns the remainder of N divided by M. See also Modulo\nOperator.\n\nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any number modulus zero\nproduces an error. Otherwise, it returns NULL.\n\nThe integer part of a division can be obtained using DIV.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n\nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n\nSELECT 253 % 7;\n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n\nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n\nSELECT 29 MOD 9;\n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+\n\nURL: https://mariadb.com/kb/en/mod/
+[MONTH]
declaration=date
category=Date and Time Functions
-description=Returns the full name of the month for date. The language\nused for the name is controlled by the value of the\nlc_time_names system variable. See server locale for more on\nthe supported locales.\n \n\nSELECT MONTHNAME(''2019-02-03'');\n+-------------------------+\n| MONTHNAME(''2019-02-03'') |\n+-------------------------+\n| February |\n+-------------------------+\n \nChanging the locale:\n \nSET lc_time_names = ''fr_CA'';\n \nSELECT MONTHNAME(''2019-05-21'');\n+-------------------------+\n| MONTHNAME(''2019-05-21'') |\n+-------------------------+\n| mai |\n+-------------------------+
-[MONTH]
+description=Returns the month for date in the range 1 to 12 for January to December, or 0\nfor dates such as '0000-00-00' or '2008-00-00' that have a zero month part.\n\nExamples\n--------\n\nSELECT MONTH('2019-01-03');\n+---------------------+\n| MONTH('2019-01-03') |\n+---------------------+\n| 1 |\n+---------------------+\n\nSELECT MONTH('2019-00-03');\n+---------------------+\n| MONTH('2019-00-03') |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/month/
+[MONTHNAME]
declaration=date
category=Date and Time Functions
-description=Returns the month for date in the range 1 to 12 for January\nto\nDecember, or 0 for dates such as ''0000-00-00'' or\n''2008-00-00'' that\nhave a zero month part.\n \n\nSELECT MONTH(''2019-01-03'');\n+---------------------+\n| MONTH(''2019-01-03'') |\n+---------------------+\n| 1 |\n+---------------------+\n \nSELECT MONTH(''2019-00-03'');\n+---------------------+\n| MONTH(''2019-00-03'') |\n+---------------------+\n| 0 |\n+---------------------+
-[MPOINTFROMTEXT]
+description=Returns the full name of the month for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\n\nSELECT MONTHNAME('2019-02-03');\n+-------------------------+\n| MONTHNAME('2019-02-03') |\n+-------------------------+\n| February |\n+-------------------------+\n\nChanging the locale:\n\nSET lc_time_names = 'fr_CA';\n\nSELECT MONTHNAME('2019-05-21');\n+-------------------------+\n| MONTHNAME('2019-05-21') |\n+-------------------------+\n| mai |\n+-------------------------+\n\nURL: https://mariadb.com/kb/en/monthname/
+[MPointFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a MULTIPOINT value using its WKT representation\nand SRID.\n \nMPointFromText() and MultiPointFromText() are synonyms.\n \n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(''MULTIPOINT(0 0,10 10,10 20,20\n20)'')),\n (MPointFromText(''MULTIPOINT(1 1,11 11,11 21,21 21)'')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));
-[MPOINTFROMWKB]
+description=Constructs a MULTIPOINT value using its WKT representation and SRID.\n\nMPointFromText() and MultiPointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),\n (MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nURL: https://mariadb.com/kb/en/mpointfromtext/
+[MPointFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a MULTIPOINT value using its WKB representation\nand SRID.\n \nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(MPointFromText(''MultiPoint( 1 1, 2 2,\n5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )''));\n \nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g)) |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+
-[MPOLYFROMTEXT]
+description=Constructs a MULTIPOINT value using its WKB representation and SRID.\n\nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText('MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4,\n6 6, 6 9, 4 9, 1 5 )'));\n\nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g)) |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/mpointfromwkb/
+[MPolyFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a MULTIPOLYGON value using its WKT representation\nand SRID.\n \nMPolyFromText() and MultiPolygonFromText() are synonyms.\n \n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))'')),\n (MPolyFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))'')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-[MPOLYFROMWKB]
+description=Constructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nMPolyFromText() and MultiPolygonFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText('MULTIPOLYGON(\n ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))')),\n (MPolyFromText('MULTIPOLYGON(\n ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(\n LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n\nURL: https://mariadb.com/kb/en/mpolyfromtext/
+[MPolyFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a MULTIPOLYGON value using its WKB representation\nand SRID.\n \nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(MPointFromText(''MULTIPOLYGON(((28\n26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52\n18)),((59 18,67 18,67 13,59 13,59 18)))''));\n \nSELECT ST_AsText(MPolyFromWKB(@g));\n+---------------------------------------------------------------------------------------------------------------+\n| ST_AsText(MPolyFromWKB(@g)) |\n+---------------------------------------------------------------------------------------------------------------+\n| MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) |\n+---------------------------------------------------------------------------------------------------------------+
+description=Constructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));\n\nSELECT ST_AsText(MPolyFromWKB(@g))\G\n*************************** 1. row ***************************\nST_AsText(MPolyFromWKB(@g)): MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\n\nURL: https://mariadb.com/kb/en/mpolyfromwkb/
[MULTILINESTRING]
declaration=ls1,ls2,...
category=Geometry Constructors
-description=Constructs a WKB MultiLineString value using WKB LineString\narguments. If any argument is not a WKB LineString, the\nreturn value is\nNULL.\n \nExample\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(''MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))'')),\n (MLineFromText(''MULTILINESTRING((10 48,10 21,10 0))'')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21,\n7))))));
+description=Constructs a WKB MultiLineString value using WKB LineString arguments. If any\nargument is not a WKB LineString, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16\n48))')),\n (MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), \n Point(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21, 7))))));\n\nURL: https://mariadb.com/kb/en/multilinestring/
[MULTIPOINT]
declaration=pt1,pt2,...
category=Geometry Constructors
-description=Constructs a WKB MultiPoint value using WKB Point arguments.\nIf any argument is not a WKB Point, the return value is\nNULL.\n \n\nSET @g = ST_GEOMFROMTEXT(''MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )'');\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(''MULTIPOINT(0 0,10 10,10 20,20\n20)'')),\n (MPointFromText(''MULTIPOINT(1 1,11 11,11 21,21 21)'')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));
+description=Constructs a WKB MultiPoint value using WKB Point arguments. If any argument\nis not a WKB Point, the return value is NULL.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT('MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9,\n4 9, 1 5 )');\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),\n (MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nURL: https://mariadb.com/kb/en/multipoint/
[MULTIPOLYGON]
declaration=poly1,poly2,...
category=Geometry Constructors
-description=Constructs a WKB MultiPolygon value from a set of WKB\nPolygon arguments. If any argument is not a WKB Polygon, the\nreturn value is NULL.\n \nExample\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))'')),\n (MPolyFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))'')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+description=Constructs a WKB MultiPolygon value from a set of WKB Polygon arguments. If\nany argument is not a WKB Polygon, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))')),\n (MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(\n Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n\nURL: https://mariadb.com/kb/en/multipolygon/
[NAME_CONST]
declaration=name,value
category=Miscellaneous Functions
-description=Returns the given value. When used to produce a result set\ncolumn,\n NAME_CONST() causes the column to have the given name. The\narguments should be constants.\n \nThis function is used internally when replicating stored\nprocedures. It makes little sense to use it explicitly in\nSQL statements, and it was not supposed to be used like\nthat.\n \nSELECT NAME_CONST(''myname'', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+
+description=Returns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments should be\nconstants.\n\nThis function is used internally when replicating stored procedures. It makes\nlittle sense to use it explicitly in SQL statements, and it was not supposed\nto be used like that.\n\nSELECT NAME_CONST('myname', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: https://mariadb.com/kb/en/name_const/
+[NATURAL_SORT_KEY]
+declaration=str
+category=String Functions
+description=The NATURAL_SORT_KEY function is used for sorting that is closer to natural\nsorting. Strings are sorted in alphabetical order, while numbers are treated\nin a way such that, for example, 10 is greater than 2, whereas in other forms\nof sorting, 2 would be greater than 10, just like z is greater than ya.\n\nThere are multiple natural sort implementations, differing in the way they\nhandle leading zeroes, fractions, i18n, negatives, decimals and so on.\n\nMariaDB's implementation ignores leading zeroes when performing the sort.\n\nYou can use also use NATURAL_SORT_KEY with generated columns. The value is not\nstored permanently in the table. When using a generated column, the virtual\ncolumn must be longer than the base column to cater for embedded numbers in\nthe string and MDEV-24582.\n\nExamples\n--------\n\nStrings and Numbers\n-------------------\n\nCREATE TABLE t1 (c TEXT);\n\nINSERT INTO t1 VALUES ('b1'),('a2'),('a11'),('a1');\n\nSELECT c FROM t1;\n+------+\n| c |\n+------+\n| b1 |\n| a2 |\n| a11 |\n| a1 |\n+------+\n\nSELECT c FROM t1 ORDER BY c;\n+------+\n| c |\n+------+\n| a1 |\n| a11 |\n| a2 |\n| b1 |\n+------+\n\nUnsorted, regular sort and natural sort:\n\nTRUNCATE t1;\n\nINSERT INTO t1 VALUES \n ...
[NOW]
declaration=[precision]
category=Date and Time Functions
-description=Returns the current date and time as a value in ''YYYY-MM-DD\nHH:MM:SS''\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context. The value is expressed\nin the\ncurrent time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nNOW() (or its synonyms) can be used as the default value for\nTIMESTAMP columns as well as, since MariaDB 10.0.1, DATETIME\ncolumns. Before MariaDB 10.0.1, it was only possible for a\nsingle TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n \nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a\ndefault CURRENT TIMESTAMP is displayed as CURRENT_TIMESTAMP\nup until MariaDB 10.2.2, and as current_timestamp() from\nMariaDB 10.2.3, due to to MariaDB 10.2 accepting expressions\nin the DEFAULT clause.\n \n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n \nSELECT NOW() + 0;\n \n+-----------------------+\n| NOW() + 0 |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n \nWith precision:\n \nSELECT CURRENT_TIMESTAMP(2);\n+------------------------+\n| CURRENT_TIMESTAMP(2) |\n+------------------------+\n| 2018-07-10 09:47:26.24 |\n+------------------------+\n \nUsed as a default TIMESTAMP:\n \nCREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT\nCURRENT_TIMESTAMP);\n \nFrom MariaDB 10.2.2:\n \nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE\nTABLE_SCHEMA=''test''\n AND COLUMN_NAME LIKE ''%ts%''\G\n*************************** 1. row\n***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: ts\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: current_timestamp()\n...
+description=Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context. The value is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nNOW() (or its synonyms) can be used as the default value for TIMESTAMP columns\nas well as, since MariaDB 10.0.1, DATETIME columns. Before MariaDB 10.0.1, it\nwas only possible for a single TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n\nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a default CURRENT\nTIMESTAMP is displayed as CURRENT_TIMESTAMP up until MariaDB 10.2.2, and as\ncurrent_timestamp() from MariaDB 10.2.3, due to to MariaDB 10.2 accepting\nexpressions in the DEFAULT clause.\n\nChanging the timestamp system variable with a SET timestamp statement affects\nthe value returned by NOW(), but not by SYSDATE().\n\nExamples\n--------\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n\nSELECT NOW() + 0;\n+-----------------------+\n| NOW() + 0 |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n\nWith precision:\n\nSELECT CURRENT_TIMESTAMP(2);\n+------------------------+\n| CURRENT_TIMESTAMP(2) |\n+------------------------+\n| 2018-07-10 09:47:26.24 |\n+------------------------+\n\nUsed as a default TIMESTAMP:\n\nCREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);\n\n ...
+[NTH_VALUE]
+declaration=expr[, num_row]
+category=Window Functions
+description=The NTH_VALUE function returns the value evaluated at row number num_row of\nthe window frame, starting from 1, or NULL if the row does not exist.\n\nURL: https://mariadb.com/kb/en/nth_value/
+[NTILE]
+declaration=expr
+category=Window Functions
+description=NTILE() is a window function that returns an integer indicating which group a\ngiven row falls into. The number of groups is specified in the argument\n(expr), starting at one. Ordered rows in the partition are divided into the\nspecified number of groups with as equal a size as possible.\n\nExamples\n--------\n\ncreate table t1 (\n pk int primary key,\n a int,\n b int\n );\n\ninsert into t1 values\n (11 , 0, 10),\n (12 , 0, 10),\n (13 , 1, 10),\n (14 , 1, 10),\n (18 , 2, 10),\n (15 , 2, 20),\n (16 , 2, 20),\n (17 , 2, 20),\n (19 , 4, 20),\n (20 , 4, 20);\n\nselect pk, a, b,\n ntile(1) over (order by pk)\n from t1;\n+----+------+------+-----------------------------+\n| pk | a | b | ntile(1) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 1 |\n| 15 | 2 | 20 | 1 |\n| 16 | 2 | 20 | 1 |\n| 17 | 2 | 20 | 1 |\n| 18 | 2 | 10 | 1 |\n| 19 | 4 | 20 | 1 |\n| 20 | 4 | 20 | 1 |\n+----+------+------+-----------------------------+\n\nselect pk, a, b,\n ntile(4) over (order by pk)\n from t1;\n+----+------+------+-----------------------------+\n| pk | a | b | ntile(4) over (order by pk) |\n+----+------+------+-----------------------------+\n ...
[NULLIF]
declaration=expr1,expr2
category=Control Flow Functions
-description=Returns NULL if expr1 = expr2 is true, otherwise returns\nexpr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1\nEND.\n \n\nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n \nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+
-[OCTET_LENGTH]
-declaration=str
-category=String Functions
-description=OCTET_LENGTH() is normally a synonym for LENGTH(). When\nrunning Oracle mode from MariaDB 10.3, they are not\nsynonyms, but OCTET_LENGTH() behaves as LENGTH() would when\nnot in Oracle mode.
+description=Returns NULL if expr1 = expr2 is true, otherwise returns expr1. This is the\nsame as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nExamples\n--------\n\nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n\nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/nullif/
+[NVL2]
+declaration=expr1,expr2,expr3
+category=Control Flow Functions
+description=The NVL2 function returns a value based on whether a specified expression is\nNULL or not. If expr1 is not NULL, then NVL2 returns expr2. If expr1 is NULL,\nthen NVL2 returns expr3.\n\nExamples\n--------\n\nSELECT NVL2(NULL,1,2);\n+----------------+\n| NVL2(NULL,1,2) |\n+----------------+\n| 2 |\n+----------------+\n\nSELECT NVL2('x',1,2);\n+---------------+\n| NVL2('x',1,2) |\n+---------------+\n| 1 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/nvl2/
[OCT]
declaration=N
category=Numeric Functions
-description=Returns a string representation of the octal value of N,\nwhere N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,8). Returns NULL if N is NULL.\n \n\nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n \nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+
+description=Returns a string representation of the octal value of N, where N is a longlong\n(BIGINT) number. This is equivalent to CONV(N,10,8). Returns NULL if N is NULL.\n\nExamples\n--------\n\nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n\nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+\n\nURL: https://mariadb.com/kb/en/oct/
+[OCTET_LENGTH]
+declaration=str
+category=String Functions
+description=OCTET_LENGTH() returns the length of the given string, in octets (bytes). This\nis a synonym for LENGTHB(), and, when Oracle mode from MariaDB 10.3 is not\nset, a synonym for LENGTH().\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, OCTET_LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/kb/en/octet_length/
[OLD_PASSWORD]
declaration=str
category=Encryption Functions
-description=OLD_PASSWORD() was added to MySQL when the implementation of\n\nPASSWORD() was changed to improve security. OLD_PASSWORD()\nreturns the\nvalue of the old (pre-MySQL 4.1) implementation of\nPASSWORD() as a\nstring, and is intended to permit you to reset passwords for\nany\npre-4.1 clients that need to connect to a more recent MySQL\nserver version, or any version of MariaDB,\nwithout locking them out.\n \nAs of MariaDB 5.5, the return value is a nonbinary string in\nthe connection character set and collation, determined by\nthe values of the character_set_connection and\ncollation_connection system variables. Before 5.5, the\nreturn value was a binary string.\n \nThe return value is 16 bytes in length, or NULL if the\nargument was NULL.
+description=OLD_PASSWORD() was added to MySQL when the implementation of PASSWORD() was\nchanged to improve security. OLD_PASSWORD() returns the value of the old\n(pre-MySQL 4.1) implementation of PASSWORD() as a string, and is intended to\npermit you to reset passwords for any pre-4.1 clients that need to connect to\na more recent MySQL server version, or any version of MariaDB, without locking\nthem out.\n\nAs of MariaDB 5.5, the return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system variables. Before\n5.5, the return value was a binary string.\n\nThe return value is 16 bytes in length, or NULL if the argument was NULL.\n\nURL: https://mariadb.com/kb/en/old_password/
[ORD]
declaration=str
category=String Functions
-description=If the leftmost character of the string str is a multi-byte\ncharacter,\nreturns the code for that character, calculated from the\nnumeric\nvalues of its constituent bytes using this formula:\n \n (1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n \nIf the leftmost character is not a multi-byte character,\nORD() returns\nthe same value as the ASCII() function.\n \n\nSELECT ORD(''2'');\n+----------+\n| ORD(''2'') |\n+----------+\n| 50 |\n+----------+
+description=If the leftmost character of the string str is a multi-byte character, returns\nthe code for that character, calculated from the numeric values of its\nconstituent bytes using this formula:\n\n(1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n\nIf the leftmost character is not a multi-byte character, ORD() returns the\nsame value as the ASCII() function.\n\nExamples\n--------\n\nSELECT ORD('2');\n+----------+\n| ORD('2') |\n+----------+\n| 50 |\n+----------+\n\nURL: https://mariadb.com/kb/en/ord/
[OVERLAPS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether g1 spatially overlaps g2.\nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nOVERLAPS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_OVERLAPS() uses\nobject shapes.
+description=Returns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their intersection\nresults in a geometry of the same dimension but not equal to either of the\ngiven geometries.\n\nOVERLAPS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_OVERLAPS() uses object shapes.\n\nURL: https://mariadb.com/kb/en/overlaps/
[PASSWORD]
declaration=str
category=Encryption Functions
-description=The PASSWORD() function is used for hashing passwords for\nuse in authentication by the MariaDB server. It is not\nintended for use in other applications.\n \nCalculates and returns a hashed password string from the\nplaintext password str. Returns an empty string (>= MariaDB\n10.0.4) or NULL (
-[PERCENT_RANK1]
-name=PERCENT_RANK
+description=The PASSWORD() function is used for hashing passwords for use in\nauthentication by the MariaDB server. It is not intended for use in other\napplications.\n\nCalculates and returns a hashed password string from the plaintext password\nstr. Returns an empty string (>= MariaDB 10.0.4) if the argument was NULL.\n\nThe return value is a nonbinary string in the connection character set and\ncollation, determined by the values of the character_set_connection and\ncollation_connection system variables.\n\nThis is the function that is used for hashing MariaDB passwords for storage in\nthe Password column of the user table (see privileges), usually used with the\nSET PASSWORD statement. It is not intended for use in other applications.\n\nUntil MariaDB 10.3, the return value is 41-bytes in length, and the first\ncharacter is always '*'. From MariaDB 10.4, the function takes into account\nthe authentication plugin where applicable (A CREATE USER or SET PASSWORD\nstatement). For example, when used in conjunction with a user authenticated by\nthe ed25519 plugin, the statement will create a longer hash:\n\nCREATE USER edtest@localhost IDENTIFIED VIA ed25519 USING PASSWORD('secret');\n\nCREATE USER edtest2@localhost IDENTIFIED BY 'secret';\n\nSELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM\nmysql.global_priv\n WHERE user LIKE 'edtest%'\G\n*************************** 1. row ***************************\nCONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest@localhost => {\n...\n "plugin": "ed25519",\n "authentication_string": "ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY",\n...\n}\n*************************** 2. row ***************************\nCONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest2@localhost => {\n...\n "plugin": "mysql_native_password",\n "authentication_string": "*14E65567ABDB5135D0CFD9A70B3032C179A49EE7",\n...\n}\n\nThe behavior of this function is affected by the value of the old_passwords\nsystem variable. If this is set to 1 (0 is default), MariaDB reverts to using\nthe mysql_old_password authentication plugin by default for newly created\nusers and passwords.\n\nExamples\n--------\n ...
+[PERCENTILE_CONT]
declaration=
category=Window Functions
-description=PERCENT_RANK() is a window function that returns the\nrelative percent rank of a given row. The following formula\nis used to calculate the percent rank:\n \n(rank - 1) / (number of rows in the window or partition - 1)\n \n\ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n \ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n \nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n \n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 0.1000000000 |\n| 2 | 0 | 10 | 0.1111111111 | 0.2000000000 |\n| 3 | 1 | 10 | 0.2222222222 | 0.3000000000 |\n| 4 | 1 | 10 | 0.3333333333 | 0.4000000000 |\n| 5 | 2 | 20 | 0.4444444444 | 0.5000000000 |\n| 6 | 2 | 20 | 0.5555555556 | 0.6000000000 |\n| 7 | 2 | 20 | 0.6666666667 | 0.7000000000 |\n| 8 | 2 | 10 | 0.7777777778 | 0.8000000000 |\n| 9 | 4 | 20 | 0.8888888889 | 0.9000000000 |\n| 10 | 4 | 20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (partition by a order by a) as\npct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 2 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 3 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 4 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 5 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 6 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 7 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 8 | 2 | 10 | 0.0000000000 | 1.0000000000 |\n| 9 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n| 10 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+
-[PERCENT_RANK2]
-name=PERCENT_RANK
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
+description=PERCENTILE_CONT() (standing for continuous percentile) is a window function\nwhich returns a value which corresponds to the given fraction in the sort\norder. If required, it will interpolate between adjacent input items.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition, denoted by N\n* RN = p*(N-1), where p denotes the argument to the PERCENTILE_CONT function\n* calculate the FRN(floor row number) and CRN(column row number for the group(\nFRN= floor(RN) and CRN = ceil(RN))\n* look up rows FRN and CRN\n* If (CRN = FRN = RN) then the result is (value of expression from row at RN)\n* Otherwise the result is\n* (CRN - RN) * (value of expression for row at FRN) +\n* (RN - FRN) * (value of expression for row at CRN)\n\nThe MEDIAN function is a specific case of PERCENTILE_CONT, equivalent to\nPERCENTILE_CONT(0.5).\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES ('Lord of the Ladybirds', 5);\nINSERT INTO book_rating VALUES ('Lord of the Ladybirds', 3);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 1);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 2);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 5);\n\nSELECT name, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+--------------+\n\nSELECT name, PERCENTILE_CONT(1) WITHIN GROUP (ORDER BY star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 5.0000000000 |\n ...
+[PERCENTILE_DISC]
+declaration=
+category=Window Functions
+description=PERCENTILE_DISC() (standing for discrete percentile) is a window function\nwhich returns the first value in the set whose ordered position is the same or\nmore than the specified fraction.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition.\n* Walk through the partition, in order, until finding the the first row with\nCUME_DIST() >= function_argument.\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES ('Lord of the Ladybirds', 5);\nINSERT INTO book_rating VALUES ('Lord of the Ladybirds', 3);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 1);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 2);\nINSERT INTO book_rating VALUES ('Lady of the Flies', 5);\n\nSELECT name, PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY star_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n\nSELECT name, PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n\nSELECT name, PERCENTILE_DISC(1) WITHIN GROUP (ORDER BY star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n ...
+[PERCENT_RANK]
+declaration=
category=Window Functions
-description=PERCENT_RANK() is a window function that returns the\nrelative percent rank of a given row. The following formula\nis used to calculate the percent rank:\n \n(rank - 1) / (number of rows in the window or partition - 1)\n \n\ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n \ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n \nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n \n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 0.1000000000 |\n| 2 | 0 | 10 | 0.1111111111 | 0.2000000000 |\n| 3 | 1 | 10 | 0.2222222222 | 0.3000000000 |\n| 4 | 1 | 10 | 0.3333333333 | 0.4000000000 |\n| 5 | 2 | 20 | 0.4444444444 | 0.5000000000 |\n| 6 | 2 | 20 | 0.5555555556 | 0.6000000000 |\n| 7 | 2 | 20 | 0.6666666667 | 0.7000000000 |\n| 8 | 2 | 10 | 0.7777777778 | 0.8000000000 |\n| 9 | 4 | 20 | 0.8888888889 | 0.9000000000 |\n| 10 | 4 | 20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (partition by a order by a) as\npct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 2 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 3 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 4 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 5 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 6 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 7 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 8 | 2 | 10 | 0.0000000000 | 1.0000000000 |\n| 9 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n| 10 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+
+description=PERCENT_RANK() is a window function that returns the relative percent rank of\na given row. The following formula is used to calculate the percent rank:\n\n(rank - 1) / (number of rows in the window or partition - 1)\n\nExamples\n--------\n\ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n\ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n\nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n\nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n ...
[PERIOD_ADD]
declaration=P,N
category=Date and Time Functions
-description=Adds N months to period P. P is in the format YYMM or\nYYYYMM, and is not a date value. If P contains a two-digit\nyear, values from 00 to 69 are converted to from 2000 to\n2069, while values from 70 are converted to 1970 upwards.\n \nReturns a value in the format YYYYMM.\n \n\nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n| 200803 |\n+----------------------+\n \nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n| 206912 |\n+--------------------+\n \nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n| 197012 |\n+--------------------+
+description=Adds N months to period P. P is in the format YYMM or YYYYMM, and is not a\ndate value. If P contains a two-digit year, values from 00 to 69 are converted\nto from 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nReturns a value in the format YYYYMM.\n\nExamples\n--------\n\nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n| 200803 |\n+----------------------+\n\nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n| 206912 |\n+--------------------+\n\nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n| 197012 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/period_add/
[PERIOD_DIFF]
declaration=P1,P2
category=Date and Time Functions
-description=Returns the number of months between periods P1 and P2. P1\nand P2 \ncan be in the format YYMM or YYYYMM, and are not date\nvalues.\n \nIf P1 or P2 contains a two-digit year, values from 00 to 69\nare converted to from 2000 to 2069, while values from 70 are\nconverted to 1970 upwards.\n \n\nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n| 11 |\n+----------------------------+\n \nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n| 11 |\n+------------------------+\n \nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n| -1177 |\n+------------------------+
+description=Returns the number of months between periods P1 and P2. P1 and P2 can be in\nthe format YYMM or YYYYMM, and are not date values.\n\nIf P1 or P2 contains a two-digit year, values from 00 to 69 are converted to\nfrom 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nExamples\n--------\n\nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n| 11 |\n+----------------------------+\n\nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n| 11 |\n+------------------------+\n\nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n| -1177 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/period_diff/
[PI]
declaration=
category=Numeric Functions
-description=Returns the value of ? (pi). The default number of decimal\nplaces\ndisplayed is six, but MariaDB uses the full double-precision\nvalue\ninternally.\n \n\nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n \nSELECT PI()+0.0000000000000000000000;\n \n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+
+description=Returns the value of π (pi). The default number of decimal places displayed is\nsix, but MariaDB uses the full double-precision value internally.\n\nExamples\n--------\n\nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n\nSELECT PI()+0.0000000000000000000000;\n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+\n\nURL: https://mariadb.com/kb/en/pi/
[POINT]
declaration=x,y
category=Geometry Constructors
-description=Constructs a WKB Point using the given coordinates.\n \n\nSET @g = ST_GEOMFROMTEXT(''Point(1 1)'');\n \nCREATE TABLE gis_point (g POINT);\nINSERT INTO gis_point VALUES\n (PointFromText(''POINT(10 10)'')),\n (PointFromText(''POINT(20 10)'')),\n (PointFromText(''POINT(20 20)'')),\n (PointFromWKB(AsWKB(PointFromText(''POINT(10 20)''))));
+description=Constructs a WKB Point using the given coordinates.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT('Point(1 1)');\n\nCREATE TABLE gis_point (g POINT);\nINSERT INTO gis_point VALUES\n (PointFromText('POINT(10 10)')),\n (PointFromText('POINT(20 10)')),\n (PointFromText('POINT(20 20)')),\n (PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));\n\nURL: https://mariadb.com/kb/en/point/
[POLYGON]
declaration=ls1,ls2,...
category=Geometry Constructors
-description=Constructs a WKB Polygon value from a number of WKB\nLineString\narguments. If any argument does not represent the WKB of a\nLinearRing (that is,\nnot a closed and simple LineString) the return value is\nNULL.\n \nNote that according to the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB''s, permit polygons to have several\n''ExteriorRings''. In the case of there being multiple,\nnon-overlapping exterior rings ST_NUMINTERIORRINGS() will\nreturn 1.\n \n\nSET @g = ST_GEOMFROMTEXT(''POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))'');\n \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(''POLYGON((10 10,20 10,20 20,10 20,10\n10))'')),\n (PolyFromText(''POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))'')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nNon-overlapping ''polygon'':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(''POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))'')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+
+description=Constructs a WKB Polygon value from a number of WKB LineString arguments. If\nany argument does not represent the WKB of a LinearRing (that is, not a closed\nand simple LineString) the return value is NULL.\n\nNote that according to the OpenGIS standard, a POLYGON should have exactly one\nExteriorRing and all other rings should lie within that ExteriorRing and thus\nbe the InteriorRings. Practically, however, some systems, including MariaDB's,\npermit polygons to have several 'ExteriorRings'. In the case of there being\nmultiple, non-overlapping exterior rings ST_NUMINTERIORRINGS() will return 1.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT('POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))');\n\nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),\n (PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30,\n30), Point(0, 0))))));\n\nNon-overlapping 'polygon':\n\nSELECT ST_NumInteriorRings(ST_PolyFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))')) AS NumInteriorRings;\n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/polygon/
[POSITION]
declaration=substr IN str
category=String Functions
-description=POSITION(substr IN str) is a synonym for LOCATE(substr,str).\n \nIt''s part of ODBC 3.0.
-[POWER]
+description=POSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nIt's part of ODBC 3.0.\n\nURL: https://mariadb.com/kb/en/position/
+[POW]
declaration=X,Y
category=Numeric Functions
-description=This is a synonym for POW(), which returns the value of X\nraised to the power of Y.
-[POW]
+description=Returns the value of X raised to the power of Y.\n\nPOWER() is a synonym.\n\nExamples\n--------\n\nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n\nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/pow/
+[POWER]
declaration=X,Y
category=Numeric Functions
-description=Returns the value of X raised to the power of Y.\n \nPOWER() is a synonym.\n \n\nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n \nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+
+description=This is a synonym for POW(), which returns the value of X raised to the power\nof Y.\n\nURL: https://mariadb.com/kb/en/power/
[QUARTER]
declaration=date
category=Date and Time Functions
-description=Returns the quarter of the year for date, in the range 1 to\n4. Returns 0 if month contains a zero value, or NULL if the\ngiven value is not otherwise a valid date (zero values are\naccepted).\n \n\nSELECT QUARTER(''2008-04-01'');\n+-----------------------+\n| QUARTER(''2008-04-01'') |\n+-----------------------+\n| 2 |\n+-----------------------+\n \nSELECT QUARTER(''2019-00-01'');\n+-----------------------+\n| QUARTER(''2019-00-01'') |\n+-----------------------+\n| 0 |\n+-----------------------+
+description=Returns the quarter of the year for date, in the range 1 to 4. Returns 0 if\nmonth contains a zero value, or NULL if the given value is not otherwise a\nvalid date (zero values are accepted).\n\nExamples\n--------\n\nSELECT QUARTER('2008-04-01');\n+-----------------------+\n| QUARTER('2008-04-01') |\n+-----------------------+\n| 2 |\n+-----------------------+\n\nSELECT QUARTER('2019-00-01');\n+-----------------------+\n| QUARTER('2019-00-01') |\n+-----------------------+\n| 0 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/quarter/
[QUOTE]
declaration=str
category=String Functions
-description=Quotes a string to produce a result that can be used as a\nproperly escaped data\nvalue in an SQL statement. The string is returned enclosed\nby single quotes and\nwith each instance of single quote ("''"), backslash\n("\"),\nASCII NUL, and Control-Z preceded by a backslash. If the\nargument\nis NULL, the return value is the word "NULL" without\nenclosing single\nquotes.\n \n\nSELECT QUOTE("Don''t!");\n+-----------------+\n| QUOTE("Don''t!") |\n+-----------------+\n| ''Don\''t!'' |\n+-----------------+\n \nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL |\n+-------------+
+description=Quotes a string to produce a result that can be used as a properly escaped\ndata value in an SQL statement. The string is returned enclosed by single\nquotes and with each instance of single quote ("'"), backslash ("\"), ASCII\nNUL, and Control-Z preceded by a backslash. If the argument is NULL, the\nreturn value is the word "NULL" without enclosing single quotes.\n\nExamples\n--------\n\nSELECT QUOTE("Don't!");\n+-----------------+\n| QUOTE("Don't!") |\n+-----------------+\n| 'Don\'t!' |\n+-----------------+\n\nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL |\n+-------------+\n\nURL: https://mariadb.com/kb/en/quote/
[RADIANS]
declaration=X
category=Numeric Functions
-description=Returns the argument X, converted from degrees to radians.\nNote that\n? radians equals 180 degrees. \n \nThis is the converse of the DEGREES() function.\n \n\nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n \nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n \nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+
-[RAND1]
-name=RAND
+description=Returns the argument X, converted from degrees to radians. Note that π radians\nequals 180 degrees.\n\nThis is the converse of the DEGREES() function.\n\nExamples\n--------\n\nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n\nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n\nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/radians/
+[RAND]
declaration=
category=Numeric Functions
-description=Returns a random DOUBLE precision floating point value v in\nthe range 0
-[RAND2]
-name=RAND
-declaration=N
-category=Numeric Functions
-description=Returns a random DOUBLE precision floating point value v in\nthe range 0
-[RANK1]
-name=RANK
+description=Returns a random DOUBLE precision floating point value v in the range 0 <= v <\n1.0. If a constant integer argument N is specified, it is used as the seed\nvalue, which produces a repeatable sequence of column values. In the example\nbelow, note that the sequences of values produced by RAND(3) is the same both\nplaces where it occurs.\n\nIn a WHERE clause, RAND() is evaluated each time the WHERE is executed.\n\nStatements using the RAND() function are not safe for statement-based\nreplication.\n\nPractical uses\n--------------\n\nThe expression to get a random integer from a given range is the following:\n\nFLOOR(min_value + RAND() * (max_value - min_value +1))\n\nRAND() is often used to read random rows from a table, as follows:\n\nSELECT * FROM my_table ORDER BY RAND() LIMIT 10;\n\nNote, however, that this technique should never be used on a large table as it\nwill be extremely slow. MariaDB will read all rows in the table, generate a\nrandom value for each of them, order them, and finally will apply the LIMIT\nclause.\n\nExamples\n--------\n\nCREATE TABLE t (i INT);\n\nINSERT INTO t VALUES(1),(2),(3);\n\nSELECT i, RAND() FROM t;\n+------+-------------------+\n| i | RAND() |\n+------+-------------------+\n| 1 | 0.255651095188829 |\n| 2 | 0.833920199269355 |\n| 3 | 0.40264774151393 |\n+------+-------------------+\n\nSELECT i, RAND(3) FROM t;\n+------+-------------------+\n| i | RAND(3) |\n+------+-------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.373079058130345 |\n| 3 | 0.148086053457191 |\n ...
+[RANDOM_BYTES]
+declaration=length
+category=Encryption Functions
+description=Given a length from 1 to 1024, generates a binary string of length consisting\nof random bytes generated by the SSL library's random number generator.\n\nSee the RAND_bytes() function documentation of your SSL library for\ninformation on the random number generator. In the case of OpenSSL, a\ncryptographically secure pseudo random generator (CSPRNG) is used.\n\nStatements containing the RANDOM_BYTES function are unsafe for statement-based\nreplication.\n\nAn error occurs if length is outside the range 1 to 1024.\n\nURL: https://mariadb.com/kb/en/random_bytes/
+[RANK]
declaration=
category=Window Functions
-description=RANK() is a window function that displays the number of a\ngiven row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will\nreceive a different row number for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
-[RANK2]
-name=RANK
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Window Functions
-description=RANK() is a window function that displays the number of a\ngiven row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will\nreceive a different row number for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
-[REGEXP_INSTR10]
-name=REGEXP_INSTR
-declaration=''ABC'' COLLATE utf8_bin,''b''
-category=String Functions
-description=
-[REGEXP_INSTR11]
-name=REGEXP_INSTR
-declaration=BINARY''ABC'',''b''
-category=String Functions
-description=
-[REGEXP_INSTR12]
-name=REGEXP_INSTR
-declaration=''ABC'',''(?-i)b''
-category=String Functions
-description=
-[REGEXP_INSTR13]
-name=REGEXP_INSTR
-declaration=''ABC'' COLLATE utf8_bin,''(?i)b''
-category=String Functions
-description=
-[REGEXP_INSTR1]
-name=REGEXP_INSTR
+description=RANK() is a window function that displays the number of a given row, starting\nat one and following the ORDER BY sequence of the window function, with\nidentical values receiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will receive a\ndifferent row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n ('Maths', 60, 'Thulile'),\n ('Maths', 60, 'Pritha'),\n ('Maths', 70, 'Voitto'),\n ('Maths', 55, 'Chun'),\n ('Biology', 60, 'Bilal'),\n ('Biology', 70, 'Roger');\n\nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/kb/en/rank/
+[REGEXP_INSTR]
declaration=subject, pattern
category=String Functions
-description=
-[REGEXP_INSTR2]
-name=REGEXP_INSTR
-declaration=i.e. not in bytes
-category=String Functions
-description=
-[REGEXP_INSTR3]
-name=REGEXP_INSTR
-declaration=?i
-category=String Functions
-description=
-[REGEXP_INSTR4]
-name=REGEXP_INSTR
-declaration=?-i
-category=String Functions
-description=
-[REGEXP_INSTR5]
-name=REGEXP_INSTR
-declaration=''abc'',''b''
-category=String Functions
-description=
-[REGEXP_INSTR6]
-name=REGEXP_INSTR
-declaration=''abc'',''x''
-category=String Functions
-description=
-[REGEXP_INSTR7]
-name=REGEXP_INSTR
-declaration=''BJRN'',''N''
-category=String Functions
-description=
-[REGEXP_INSTR8]
-name=REGEXP_INSTR
-declaration=BINARY ''BJRN'',''N''
-category=String Functions
-description=
-[REGEXP_INSTR9]
-name=REGEXP_INSTR
-declaration=''ABC'',''b''
-category=String Functions
-description=
+description=Returns the position of the first occurrence of the regular expression pattern\nin the string subject, or 0 if pattern was not found.\n\nThe positions start with 1 and are measured in characters (i.e. not in bytes),\nwhich is important for multi-byte character sets. You can cast a multi-byte\ncharacter set to BINARY to get offsets in bytes.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_INSTR was introduced as part of this\nenhancement.\n\nExamples\n--------\n\nSELECT REGEXP_INSTR('abc','b');\n-> 2\n\nSELECT REGEXP_INSTR('abc','x');\n-> 0\n\nSELECT REGEXP_INSTR('BJÖRN','N');\n-> 5\n\nCasting a multi-byte character set as BINARY to get offsets in bytes:\n\nSELECT REGEXP_INSTR(BINARY 'BJÖRN','N') AS cast_utf8_to_binary;\n-> 6\n\nCase sensitivity:\n\nSELECT REGEXP_INSTR('ABC','b');\n-> 2\n\nSELECT REGEXP_INSTR('ABC' COLLATE utf8_bin,'b');\n-> 0\n\nSELECT REGEXP_INSTR(BINARY'ABC','b');\n-> 0\n\nSELECT REGEXP_INSTR('ABC','(?-i)b');\n-> 0\n\nSELECT REGEXP_INSTR('ABC' COLLATE utf8_bin,'(?i)b');\n-> 2\n\nURL: https://mariadb.com/kb/en/regexp_instr/
[REGEXP_REPLACE]
declaration=subject, pattern, replace
category=String Functions
-description=REGEXP_REPLACE returns the string subject with all\noccurrences of the regular expression pattern replaced by\nthe string replace. If no occurrences are found, then\nsubject is returned as is.\n \nThe replace string can have backreferences to the\nsubexpressions in the form \N, where N is a number from 1\nto 9.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_REPLACE was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \n\nSELECT REGEXP_REPLACE(''ab12cd'',''[0-9]'','''') AS\nremove_digits;\n-> abcd\n \nSELECT REGEXP_REPLACE(''titlebody'', '''','' '')\nAS strip_html;\n-> title body\n \nBackreferences to the subexpressions in the form \N, where\nN is a number from 1 to 9:\n \nSELECT REGEXP_REPLACE(''James Bond'',''^(.*)\n(.*)$'',''\\2, \\1'') AS reorder_name;\n-> Bond, James\n \nCase insensitive and case sensitive matches:\n \nSELECT REGEXP_REPLACE(''ABC'',''b'',''-'') AS\ncase_insensitive;\n-> A-C\n \nSELECT REGEXP_REPLACE(''ABC'' COLLATE utf8_bin,''b'',''-'')\nAS case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY ''ABC'',''b'',''-'') AS\nbinary_data;\n-> ABC\n \nOverwriting the collation case sensitivity using the (?i)\nand (?-i) PCRE flags.\n \nSELECT REGEXP_REPLACE(''ABC'',''(?-i)b'',''-'') AS\nforce_case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY ''ABC'',''(?i)b'',''-'') AS\nforce_case_insensitive;\n-> A-C
+description=REGEXP_REPLACE returns the string subject with all occurrences of the regular\nexpression pattern replaced by the string replace. If no occurrences are\nfound, then subject is returned as is.\n\nThe replace string can have backreferences to the subexpressions in the form\n\N, where N is a number from 1 to 9.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_REPLACE was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_REPLACE('ab12cd','[0-9]','') AS remove_digits;\n-> abcd\n\nSELECT\nREGEXP_REPLACE('
titlebody',\n'<.+?>',' ')\nAS strip_html;\n-> title body\n\nBackreferences to the subexpressions in the form \N, where N is a number from\n1 to 9:\n\nSELECT REGEXP_REPLACE('James Bond','^(.*) (.*)$','\\2, \\1') AS reorder_name;\n-> Bond, James\n\nCase insensitive and case sensitive matches:\n\nSELECT REGEXP_REPLACE('ABC','b','-') AS case_insensitive;\n-> A-C\n\nSELECT REGEXP_REPLACE('ABC' COLLATE utf8_bin,'b','-') AS case_sensitive;\n-> ABC\n\nSELECT REGEXP_REPLACE(BINARY 'ABC','b','-') AS binary_data;\n-> ABC\n\n ...
[REGEXP_SUBSTR]
declaration=subject,pattern
category=String Functions
-description=Returns the part of the string subject that matches the\nregular expression pattern, or an empty string if pattern\nwas not found.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_SUBSTR was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \n\nSELECT REGEXP_SUBSTR(''ab12cd'',''[0-9]+'');\n-> 12\n \nSELECT REGEXP_SUBSTR(\n ''See https://mariadb.org/en/foundation/ for details'',\n ''https?://[^/]*'');\n-> https://mariadb.org\n \nSELECT REGEXP_SUBSTR(''ABC'',''b'');\n-> B\n \nSELECT REGEXP_SUBSTR(''ABC'' COLLATE utf8_bin,''b'');\n->\n \nSELECT REGEXP_SUBSTR(BINARY''ABC'',''b'');\n->\n \nSELECT REGEXP_SUBSTR(''ABC'',''(?i)b'');\n-> B\n \nSELECT REGEXP_SUBSTR(''ABC'' COLLATE utf8_bin,''(?+i)b'');\n-> B
+description=Returns the part of the string subject that matches the regular expression\npattern, or an empty string if pattern was not found.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_SUBSTR was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_SUBSTR('ab12cd','[0-9]+');\n-> 12\n\nSELECT REGEXP_SUBSTR(\n 'See https://mariadb.org/en/foundation/ for details',\n 'https?://[^/]*');\n-> https://mariadb.org\n\nSELECT REGEXP_SUBSTR('ABC','b');\n-> B\n\nSELECT REGEXP_SUBSTR('ABC' COLLATE utf8_bin,'b');\n->\n\nSELECT REGEXP_SUBSTR(BINARY'ABC','b');\n->\n\nSELECT REGEXP_SUBSTR('ABC','(?i)b');\n-> B\n\nSELECT REGEXP_SUBSTR('ABC' COLLATE utf8_bin,'(?+i)b');\n-> B\n\nURL: https://mariadb.com/kb/en/regexp_substr/
+[RELEASE_ALL_LOCKS]
+declaration=
+category=Miscellaneous Functions
+description=Releases all named locks held by the current session. Returns the number of\nlocks released, or 0 if none were held.\n\nStatements using the RELEASE_ALL_LOCKS function are not safe for\nstatement-based replication.\n\nExamples\n--------\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n| 0 |\n+---------------------+\n\nSELECT GET_LOCK('lock1',10);\n+----------------------+\n| GET_LOCK('lock1',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n| 1 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/release_all_locks/
[RELEASE_LOCK]
declaration=str
category=Miscellaneous Functions
-description=Releases the lock named by the string str that was obtained\nwith GET_LOCK(). Returns 1 if the lock was released, 0 if\nthe lock was not established by this thread (in which case\nthe lock is not\nreleased), and NULL if the named lock did not exist. The\nlock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n \nMariaDB until 10.0.1\n \nBefore 10.0.2, GET_LOCK() released the existing lock, if\nany. Since 10.0.2 this does not happen, because multiple\nlocks are allowed.\n \nstr is case insensitive. If str is an empty string or NULL,\nRELEASE_LOCK() returns NULL and does nothing.\n \nStatements using the RELEASE_LOCK() function are not safe\nfor replication.\n \nThe DO statement is convenient to use with RELEASE_LOCK().\n \n\nConnection1:\n \nSELECT GET_LOCK(''lock1'',10);\n+----------------------+\n| GET_LOCK(''lock1'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(''lock2'',10);\n+----------------------+\n| GET_LOCK(''lock2'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT RELEASE_LOCK(''lock1''), RELEASE_LOCK(''lock2''),\nRELEASE_LOCK(''lock3'');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK(''lock1'') | RELEASE_LOCK(''lock2'') |\nRELEASE_LOCK(''lock3'') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(''lock3'',10);\n+----------------------+\n| GET_LOCK(''lock3'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(''lock3'',10);\n+----------------------+\n| GET_LOCK(''lock3'',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(''lock3'');\n+-----------------------+\n| RELEASE_LOCK(''lock3'') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(''lock3'');\n+-----------------------+\n| RELEASE_LOCK(''lock3'') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)
+description=Releases the lock named by the string str that was obtained with GET_LOCK().\nReturns 1 if the lock was released, 0 if the lock was not established by this\nthread (in which case the lock is not released), and NULL if the named lock\ndid not exist. The lock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n\nstr is case insensitive. If str is an empty string or NULL, RELEASE_LOCK()\nreturns NULL and does nothing.\n\nStatements using the RELEASE_LOCK function are not safe for statement-based\nreplication.\n\nThe DO statement is convenient to use with RELEASE_LOCK().\n\nExamples\n--------\n\nConnection1:\n\nSELECT GET_LOCK('lock1',10);\n+----------------------+\n| GET_LOCK('lock1',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 2:\n\nSELECT GET_LOCK('lock2',10);\n+----------------------+\n| GET_LOCK('lock2',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 1:\n\nSELECT RELEASE_LOCK('lock1'), RELEASE_LOCK('lock2'), RELEASE_LOCK('lock3');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK('lock1') | RELEASE_LOCK('lock2') | RELEASE_LOCK('lock3') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n\nIt is possible to hold the same lock recursively. This example is viewed using\nthe metadata_lock_info plugin:\n\nSELECT GET_LOCK('lock3',10);\n+----------------------+\n| GET_LOCK('lock3',10) |\n ...
+[RETURN]
+declaration=SELECT COUNT(DISTINCT User
+category=Compound Statements
+description=END;\n\nURL: https://mariadb.com/kb/en/return/
[REVERSE]
declaration=str
category=String Functions
-description=Returns the string str with the order of the characters\nreversed.\n \n\nSELECT REVERSE(''desserts'');\n+---------------------+\n| REVERSE(''desserts'') |\n+---------------------+\n| stressed |\n+---------------------+
+description=Returns the string str with the order of the characters reversed.\n\nExamples\n--------\n\nSELECT REVERSE('desserts');\n+---------------------+\n| REVERSE('desserts') |\n+---------------------+\n| stressed |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/reverse/
[RIGHT]
declaration=str,len
category=String Functions
-description=Returns the rightmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \n\nSELECT RIGHT(''MariaDB'', 2);\n+---------------------+\n| RIGHT(''MariaDB'', 2) |\n+---------------------+\n| DB |\n+---------------------+
-[ROUND1]
-name=ROUND
+description=Returns the rightmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT RIGHT('MariaDB', 2);\n+---------------------+\n| RIGHT('MariaDB', 2) |\n+---------------------+\n| DB |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/right/
+[ROLLBACK]
+declaration=the keyword WORK is simply noise and can be omitted without changing the effect
+category=Transactions
+description=The optional AND CHAIN clause is a convenience for initiating a new\ntransaction as soon as the old transaction terminates. If AND CHAIN is\nspecified, then there is effectively nothing between the old and new\ntransactions, although they remain separate. The characteristics of the new\ntransaction will be the same as the characteristics of the old one - that is,\nthe new transaction will have the same access mode, isolation level and\ndiagnostics area size (we'll discuss all of these shortly) as the transaction\njust terminated. The AND NO CHAIN option just tells your DBMS to end the\ntransaction - that is, these four SQL statements are equivalent:\n\nROLLBACK; \nROLLBACK WORK; \nROLLBACK AND NO CHAIN; \nROLLBACK WORK AND NO CHAIN;\n\nAll of them end a transaction without saving any transaction characteristics.\nThe only other options, the equivalent statements:\n\nROLLBACK AND CHAIN;\nROLLBACK WORK AND CHAIN;\n\nboth tell your DBMS to end a transaction, but to save that transaction's\ncharacteristics for the next transaction.\n\nROLLBACK is much simpler than COMMIT: it may involve no more than a few\ndeletions (of Cursors, locks, prepared SQL statements and log-file entries).\nIt's usually assumed that ROLLBACK can't fail, although such a thing is\nconceivable (for example, an encompassing transaction might reject an attempt\nto ROLLBACK because it's lining up for a COMMIT).\n\nROLLBACK cancels all effects of a transaction. It does not cancel effects on\nobjects outside the DBMS's control (for example the values in host program\nvariables or the settings made by some SQL/CLI function calls). But in\ngeneral, it is a convenient statement for those situations when you say "oops,\nthis isn't working" or when you simply don't care whether your temporary work\nbecomes permanent or not.\n\nHere is a moot question. If all you've been doing is SELECTs, so that there\nhave been no data changes, should you end the transaction with ROLLBACK or\nCOMMIT? It shouldn't really matter because both ROLLBACK and COMMIT do the\nsame transaction-terminating job. However, the popular conception is that\nROLLBACK implies failure, so after a successful series of SELECT statements\nthe convention is to end the transaction with COMMIT rather than ROLLBACK.\n\nMariaDB (and most other DBMSs) supports rollback of SQL-data change\nstatements, but not of SQL-Schema statements. This means that if you use any\nof CREATE, ALTER, DROP, GRANT, REVOKE, you are implicitly committing at\nexecution time.\n\nINSERT INTO Table_2 VALUES(5); \n ...
+[ROUND]
declaration=X
category=Numeric Functions
-description=Rounds the argument X to D decimal places. The rounding\nalgorithm\ndepends on the data type of X. D defaults to 0 if not\nspecified.\nD can be negative to cause D digits left of the decimal\npoint of the\nvalue X to become zero.\n \n\nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n \nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n \nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n \nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n \nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+
-[ROUND2]
-name=ROUND
-declaration=X,D
-category=Numeric Functions
-description=Rounds the argument X to D decimal places. The rounding\nalgorithm\ndepends on the data type of X. D defaults to 0 if not\nspecified.\nD can be negative to cause D digits left of the decimal\npoint of the\nvalue X to become zero.\n \n\nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n \nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n \nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n \nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n \nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+
+description=Rounds the argument X to D decimal places. D defaults to 0 if not specified. D\ncan be negative to cause D digits left of the decimal point of the value X to\nbecome zero.\n\nThe rounding algorithm depends on the data type of X:\n\n* for floating point types (FLOAT, DOUBLE) the C libraries rounding function\nis used, so the behavior *may* differ between operating systems\n* for fixed point types (DECIMAL, DEC/NUMBER/FIXED) the "round half up" rule\nis used, meaning that e.g. a value ending in exactly .5 is always rounded up.\n\nExamples\n--------\n\nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n\nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n\nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n\nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n\nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n\nSELECT ROUND(23.298, -1);\n ...
+[ROW]
+declaration= [{, }... ]
+category=Data Types
+description=ROW is a data type for stored procedure variables.\n\nFeatures\n--------\n\nROW fields as normal variables\n------------------------------\n\nROW fields (members) act as normal variables, and are able to appear in all\nquery parts where a stored procedure variable is allowed:\n\n* Assignment is using the := operator and the SET command:\n\na.x:= 10;\na.x:= b.x;\nSET a.x= 10, a.y=20, a.z= b.z;\n\n* Passing to functions and operators:\n\nSELECT f1(rec.a), rec.a<10;\n\n* Clauses (select list, WHERE, HAVING, LIMIT, etc...,):\n\nSELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c;\n\n* INSERT values:\n\nINSERT INTO t1 VALUES (rec.a, rec.b, rec.c);\n\n* SELECT .. INTO targets\n\nSELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10;\n\n* Dynamic SQL out parameters (EXECUTE and EXECUTE IMMEDIATE)\n\nEXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a;\n\nROW type variables as FETCH targets\n-----------------------------------\n\nROW type variables are allowed as FETCH targets:\n\nFETCH cur INTO rec;\n\nwhere cur is a CURSOR and rec is a ROW type stored procedure variable.\n\nNote, currently an attempt to use FETCH for a ROW type variable returns this\nerror:\n\nERROR 1328 (HY000): Incorrect number of FETCH variables\n ...
+[ROWNUM]
+declaration=
+category=Information Functions
+description=ROWNUM() returns the current number of accepted rows in the current context.\nIt main purpose is to emulate the ROWNUM pseudo column in Oracle. For MariaDB\nnative applications, we recommend the usage of LIMIT, as it is easier to use\nand gives more predictable results than the usage of ROWNUM().\n\nThe main difference between using LIMIT and ROWNUM() to limit the rows in the\nresult is that LIMIT works on the result set while ROWNUM works on the number\nof accepted rows (before any ORDER or GROUP BY clauses).\n\nThe following queries will return the same results:\n\nSELECT * from t1 LIMIT 10;\nSELECT * from t1 WHERE ROWNUM() <= 10;\n\nWhile the following may return different results based on in which orders the\nrows are found:\n\nSELECT * from t1 ORDER BY a LIMIT 10;\nSELECT * from t1 ORDER BY a WHERE ROWNUM() <= 10;\n\nThe recommended way to use ROWNUM to limit the number of returned rows and get\npredictable results is to have the query in a subquery and test for ROWNUM()\nin the outer query:\n\nSELECT * FROM (select * from t1 ORDER BY a) WHERE ROWNUM() <= 10;\n\nROWNUM() can be used in the following contexts:\n\n* SELECT\n* INSERT\n* UPDATE\n* DELETE\n* LOAD DATA INFILE\n\nUsed in other contexts, ROWNUM() will return 0.\n\nExamples\n--------\n\nINSERT INTO t1 VALUES (1,ROWNUM()),(2,ROWNUM()),(3,ROWNUM());\n\nINSERT INTO t1 VALUES (1),(2) returning a, ROWNUM();\n\nUPDATE t1 SET row_num_column=ROWNUM();\n\nDELETE FROM t1 WHERE a < 10 AND ROWNUM() < 2;\n\nLOAD DATA INFILE 'filename' into table t1 fields terminated by ',' \n lines terminated by "\r\n" (a,b) set c=ROWNUM();\n\n ...
[ROW_COUNT]
declaration=
category=Information Functions
-description=ROW_COUNT() returns the number of rows updated, inserted or\ndeleted\nby the preceding statement. This is the same as the row\ncount that the\nmysql client displays and the value from the\nmysql_affected_rows() C\nAPI function.\n \nGenerally:\nFor statements which return a result set (such as SELECT,\nSHOW, DESC or HELP), returns -1, even when the result set is\nempty. This is also true for administrative statements, such\nas OPTIMIZE.\nFor DML statements other than SELECT and for ALTER TABLE,\nreturns the number of affected rows.\nFor DDL statements (including TRUNCATE) and for other\nstatements which don''t return any result set (such as USE,\nDO, SIGNAL or DEALLOCATE PREPARE), returns 0.\n \nFor UPDATE, affected rows is by default the number of rows\nthat were actually changed. If the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() is specified when connecting to mysqld,\naffected rows is instead the number of rows matched by the\nWHERE clause. \n \nFor REPLACE, deleted rows are also counted. So, if REPLACE\ndeletes a row and adds a new row, ROW_COUNT() returns 2.\n \nFor INSERT ... ON DUPLICATE KEY, updated rows are counted\ntwice. So, if INSERT adds a new rows and modifies another\nrow, ROW_COUNT() returns 3.\n \nROW_COUNT() does not take into account rows that are not\ndirectly deleted/updated by the last statement. This means\nthat rows deleted by foreign keys or triggers are not\ncounted.\n \nWarning: You can use ROW_COUNT() with prepared statements,\nbut you need to call it after EXECUTE, not after DEALLOCATE\nPREPARE, because the row count for allocate prepare is\nalways 0.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows affected by the last statement in\nthe procedure, not by the whole procedure.\n \nWarning: After INSERT DELAYED, ROW_COUNT() returns the\nnumber of the rows you tried to insert, not the number of\nthe successful writes.\n \nThis information can also be found in the diagnostics area.\n \nStatements using the ROW_COUNT() function are not safe for\nreplication.\n \n\nCREATE TABLE t (A INT);\n \nINSERT INTO t VALUES(1),(2),(3);\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \nDELETE FROM t WHERE A IN(1,2);\n \nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n \nExample with prepared statements:\n \nSET @q = ''INSERT INTO t VALUES(1),(2),(3);'';\n \nPREPARE stmt FROM @q;\n \nEXECUTE stmt;\n \nQuery OK, 3 rows affected (0.39 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+
-[ROW_NUMBER1]
-name=ROW_NUMBER
+description=ROW_COUNT() returns the number of rows updated, inserted or deleted by the\npreceding statement. This is the same as the row count that the mariadb client\ndisplays and the value from the mysql_affected_rows() C API function.\n\nGenerally:\n\n* For statements which return a result set (such as SELECT, SHOW, DESC or\nHELP), returns -1, even when the result set is empty. This is also true for\nadministrative statements, such as OPTIMIZE.\n* For DML statements other than SELECT and for ALTER TABLE, returns the number\nof affected rows.\n* For DDL statements (including TRUNCATE) and for other statements which don't\nreturn any result set (such as USE, DO, SIGNAL or DEALLOCATE PREPARE), returns\n0.\n\nFor UPDATE, affected rows is by default the number of rows that were actually\nchanged. If the CLIENT_FOUND_ROWS flag to mysql_real_connect() is specified\nwhen connecting to mysqld, affected rows is instead the number of rows matched\nby the WHERE clause.\n\nFor REPLACE, deleted rows are also counted. So, if REPLACE deletes a row and\nadds a new row, ROW_COUNT() returns 2.\n\nFor INSERT ... ON DUPLICATE KEY, updated rows are counted twice. So, if INSERT\nadds a new rows and modifies another row, ROW_COUNT() returns 3.\n\nROW_COUNT() does not take into account rows that are not directly\ndeleted/updated by the last statement. This means that rows deleted by foreign\nkeys or triggers are not counted.\n\nWarning: You can use ROW_COUNT() with prepared statements, but you need to\ncall it after EXECUTE, not after DEALLOCATE PREPARE, because the row count for\nallocate prepare is always 0.\n\nWarning: When used after a CALL statement, this function returns the number of\nrows affected by the last statement in the procedure, not by the whole\nprocedure.\n\nWarning: After INSERT DELAYED, ROW_COUNT() returns the number of the rows you\ntried to insert, not the number of the successful writes.\n\nThis information can also be found in the diagnostics area.\n\nStatements using the ROW_COUNT() function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nCREATE TABLE t (A INT);\n ...
+[ROW_NUMBER]
declaration=
category=Window Functions
-description=ROW_NUMBER() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving different row numbers. It is similar to the RANK()\nand DENSE_RANK() functions except that in that function,\nidentical values will receive the same rank for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
-[ROW_NUMBER2]
-name=ROW_NUMBER
-declaration=[ PARTITION BY partition_expression ] [ ORDER BY order_list ]
-category=Window Functions
-description=ROW_NUMBER() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving different row numbers. It is similar to the RANK()\nand DENSE_RANK() functions except that in that function,\nidentical values will receive the same rank for each result.\n \n\nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (''Maths'', 60, ''Thulile''),\n (''Maths'', 60, ''Pritha''),\n (''Maths'', 70, ''Voitto''),\n (''Maths'', 55, ''Chun''),\n (''Biology'', 60, ''Bilal''),\n (''Biology'', 70, ''Roger'');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+
+description=ROW_NUMBER() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving different row numbers. It is similar to the\nRANK() and DENSE_RANK() functions except that in that function, identical\nvalues will receive the same rank for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n ('Maths', 60, 'Thulile'),\n ('Maths', 60, 'Pritha'),\n ('Maths', 70, 'Voitto'),\n ('Maths', 55, 'Chun'),\n ('Biology', 60, 'Bilal'),\n ('Biology', 70, 'Roger');\n\nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/kb/en/row_number/
[RPAD]
declaration=str, len [, padstr]
category=String Functions
-description=Returns the string str, right-padded with the string padstr\nto a\nlength of len characters. If str is longer than len, the\nreturn value\nis shortened to len characters. If padstr is omitted, the\nRPAD function pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (a length of zero), returns either an empty string,\nor, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RPAD_ORACLE as the function\nname.\n \n\nSELECT RPAD(''hello'',10,''.'');\n+----------------------+\n| RPAD(''hello'',10,''.'') |\n+----------------------+\n| hello..... |\n+----------------------+\n \nSELECT RPAD(''hello'',2,''.'');\n+---------------------+\n| RPAD(''hello'',2,''.'') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT RPAD(''hello'',30);\n+--------------------------------+\n| RPAD(''hello'',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RPAD('''',0),RPAD_ORACLE('''',0);\n+------------+-------------------+\n| RPAD('''',0) | RPAD_ORACLE('''',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+
+description=Returns the string str, right-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the RPAD function pads spaces.\n\nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n\nReturns NULL if given a NULL argument. If the result is empty (a length of\nzero), returns either an empty string, or, from MariaDB 10.3.6 with\nSQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RPAD_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT RPAD('hello',10,'.');\n+----------------------+\n| RPAD('hello',10,'.') |\n+----------------------+\n| hello..... |\n+----------------------+\n\nSELECT RPAD('hello',2,'.');\n+---------------------+\n| RPAD('hello',2,'.') |\n+---------------------+\n| he |\n+---------------------+\n\nFrom MariaDB 10.3.1, with the pad string defaulting to space.\n\nSELECT RPAD('hello',30);\n+--------------------------------+\n| RPAD('hello',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT RPAD('',0),RPAD_ORACLE('',0);\n+------------+-------------------+\n| RPAD('',0) | RPAD_ORACLE('',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n\nURL: https://mariadb.com/kb/en/rpad/
[RTRIM]
declaration=str
category=String Functions
-description=Returns the string str with trailing space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RTRIM_ORACLE as the function\nname.\n \n\nSELECT QUOTE(RTRIM(''MariaDB ''));\n+-----------------------------+\n| QUOTE(RTRIM(''MariaDB '')) |\n+-----------------------------+\n| ''MariaDB'' |\n+-----------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RTRIM(''''),RTRIM_ORACLE('''');\n+-----------+------------------+\n| RTRIM('''') | RTRIM_ORACLE('''') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+
+description=Returns the string str with trailing space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT QUOTE(RTRIM('MariaDB '));\n+-----------------------------+\n| QUOTE(RTRIM('MariaDB ')) |\n+-----------------------------+\n| 'MariaDB' |\n+-----------------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT RTRIM(''),RTRIM_ORACLE('');\n+-----------+------------------+\n| RTRIM('') | RTRIM_ORACLE('') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n\nURL: https://mariadb.com/kb/en/rtrim/
[SCHEMA]
declaration=
category=Information Functions
-description=This function is a synonym for DATABASE().
+description=This function is a synonym for DATABASE().\n\nURL: https://mariadb.com/kb/en/schema/
[SECOND]
declaration=time
category=Date and Time Functions
-description=Returns the second for a given time (which can include\nmicroseconds), in the range 0 to 59, or NULL if not given a\nvalid time value.\n \n\nSELECT SECOND(''10:05:03'');\n+--------------------+\n| SECOND(''10:05:03'') |\n+--------------------+\n| 3 |\n+--------------------+\n \nSELECT SECOND(''10:05:01.999999'');\n+---------------------------+\n| SECOND(''10:05:01.999999'') |\n+---------------------------+\n| 1 |\n+---------------------------+
+description=Returns the second for a given time (which can include microseconds), in the\nrange 0 to 59, or NULL if not given a valid time value.\n\nExamples\n--------\n\nSELECT SECOND('10:05:03');\n+--------------------+\n| SECOND('10:05:03') |\n+--------------------+\n| 3 |\n+--------------------+\n\nSELECT SECOND('10:05:01.999999');\n+---------------------------+\n| SECOND('10:05:01.999999') |\n+---------------------------+\n| 1 |\n+---------------------------+\n\nURL: https://mariadb.com/kb/en/second/
[SEC_TO_TIME]
declaration=seconds
category=Date and Time Functions
-description=Returns the seconds argument, converted to hours, minutes,\nand\nseconds, as a TIME value. The range of the result is\nconstrained to\nthat of the TIME data type. A warning occurs if the argument\ncorresponds to a value outside that range.\n \nThe time will be returned in the format hh:mm:ss, or hhmmss\nif used in a numeric calculation.\n \n\nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54 |\n+--------------------+\n \nSELECT SEC_TO_TIME(12414)+0;\n \n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n| 32654 |\n+----------------------+\n \nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59 |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-------------------------------------------+\n| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n''9999999'' |\n+---------+------+-------------------------------------------+
+description=Returns the seconds argument, converted to hours, minutes, and seconds, as a\nTIME value. The range of the result is constrained to that of the TIME data\ntype. A warning occurs if the argument corresponds to a value outside that\nrange.\n\nThe time will be returned in the format hh:mm:ss, or hhmmss if used in a\nnumeric calculation.\n\nExamples\n--------\n\nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54 |\n+--------------------+\n\nSELECT SEC_TO_TIME(12414)+0;\n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n| 32654 |\n+----------------------+\n\nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59 |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+-------------------------------------------+\n| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: '9999999' |\n+---------+------+-------------------------------------------+\n\nURL: https://mariadb.com/kb/en/sec_to_time/
[SESSION_USER]
declaration=
category=Information Functions
-description=SESSION_USER() is a synonym for USER().
+description=SESSION_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/session_user/
+[SETVAL]
+declaration=sequence_name, next_value, [is_used, [round]]
+category=Sequences
+description=Set the next value to be returned for a SEQUENCE.\n\nThis function is compatible with PostgreSQL syntax, extended with the round\nargument.\n\nIf the is_used argument is not given or is 1 or true, then the next used value\nwill one after the given value. If is_used is 0 or false then the next\ngenerated value will be the given value.\n\nIf round is used then it will set the round value (or the internal cycle\ncount, starting at zero) for the sequence. If round is not used, it's assumed\nto be 0.\n\nnext_value must be an integer literal.\n\nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE) one should use\nboth next_value and round to define the next value. In this case the current\nsequence value is defined to be round, next_value.\n\nThe result returned by SETVAL() is next_value or NULL if the given next_value\nand round is smaller than the current value.\n\nSETVAL() will not set the SEQUENCE value to a something that is less than its\ncurrent value. This is needed to ensure that SETVAL() is replication safe. If\nyou want to set the SEQUENCE to a smaller number use ALTER SEQUENCE.\n\nIf CYCLE is used, first round and then next_value are compared to see if the\nvalue is bigger than the current value.\n\nInternally, in the MariaDB server, SETVAL() is used to inform slaves that a\nSEQUENCE has changed value. The slave may get SETVAL() statements out of\norder, but this is ok as only the biggest one will have an effect.\n\nSETVAL requires the INSERT privilege.\n\nExamples\n--------\n\nSELECT setval(foo, 42); -- Next nextval will return 43\nSELECT setval(foo, 42, true); -- Same as above\nSELECT setval(foo, 42, false); -- Next nextval will return 42\n\nSETVAL setting higher and lower values on a sequence with an increment of 10:\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n ...
+[SFORMAT]
+declaration="The answer is {}.", 42
+category=String Functions
+description=+----------------------------------+\n| SFORMAT("The answer is {}.", 42) |\n+----------------------------------+\n| The answer is 42. |\n+----------------------------------+\n\nCREATE TABLE test_sformat(mdb_release char(6), mdev int, feature char(20));\n\nINSERT INTO test_sformat VALUES('10.7.0', 25015, 'Python style sformat'), \n ('10.7.0', 4958, 'UUID');\n\nSELECT * FROM test_sformat;\n+-------------+-------+----------------------+\n| mdb_release | mdev | feature |\n+-------------+-------+----------------------+\n| 10.7.0 | 25015 | Python style sformat |\n| 10.7.0 | 4958 | UUID |\n+-------------+-------+----------------------+\n\nSELECT SFORMAT('MariaDB Server {} has a preview for MDEV-{} which is about\n{}', \n mdb_release, mdev, feature) AS 'Preview Release Examples'\n FROM test_sformat;\n+------------------------------------------------------------------------------\n---------+\n| Preview Release Examples \n |\n+------------------------------------------------------------------------------\n---------+\n| MariaDB Server 10.7.0 has a preview for MDEV-25015 which is about Python\nstyle sformat |\n| MariaDB Server 10.7.0 has a preview for MDEV-4958 which is about UUID \n |\n+------------------------------------------------------------------------------\n---------+\n\nURL: https://mariadb.com/kb/en/sformat/
[SHA1]
declaration=str
category=Encryption Functions
-description=Calculates an SHA-1 160-bit checksum for the string str, as\ndescribed in\nRFC 3174 (Secure Hash Algorithm).\n \nThe value is returned as a string of 40 hex digits, or NULL\nif the argument was NULL. As of MariaDB 5.5, the return\nvalue is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \n\nSELECT SHA1(''some boring text'');\n+------------------------------------------+\n| SHA1(''some boring text'') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+
+description=Calculates an SHA-1 160-bit checksum for the string str, as described in RFC\n3174 (Secure Hash Algorithm).\n\nThe value is returned as a string of 40 hex digits, or NULL if the argument\nwas NULL. As of MariaDB 5.5, the return value is a nonbinary string in the\nconnection character set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system variables. Before\n5.5, the return value was a binary string.\n\nExamples\n--------\n\nSELECT SHA1('some boring text');\n+------------------------------------------+\n| SHA1('some boring text') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n\nURL: https://mariadb.com/kb/en/sha1/
[SHA2]
declaration=str,hash_len
category=Encryption Functions
-description=Given a string str, calculates an SHA-2 checksum, which is\nconsidered more cryptographically secure than its SHA-1\nequivalent. The SHA-2 family includes SHA-224, SHA-256,\nSHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to\n256.\n \nThe return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. \n \nNULL is returned if the hash length is not valid, or the\nstring str is NULL.\n \nSHA2 will only work if MariaDB was has been configured with\nTLS support. \n \n\nSELECT SHA2(''Maria'',224);\n+----------------------------------------------------------+\n| SHA2(''Maria'',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n \nSELECT SHA2(''Maria'',256);\n+------------------------------------------------------------------+\n| SHA2(''Maria'',256) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \nSELECT SHA2(''Maria'',0);\n+------------------------------------------------------------------+\n| SHA2(''Maria'',0) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+
+description=Given a string str, calculates an SHA-2 checksum, which is considered more\ncryptographically secure than its SHA-1 equivalent. The SHA-2 family includes\nSHA-224, SHA-256, SHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to 256.\n\nThe return value is a nonbinary string in the connection character set and\ncollation, determined by the values of the character_set_connection and\ncollation_connection system variables.\n\nNULL is returned if the hash length is not valid, or the string str is NULL.\n\nSHA2 will only work if MariaDB was has been configured with TLS support.\n\nExamples\n--------\n\nSELECT SHA2('Maria',224);\n+----------------------------------------------------------+\n| SHA2('Maria',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n\nSELECT SHA2('Maria',256);\n+------------------------------------------------------------------+\n| SHA2('Maria',256) |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nSELECT SHA2('Maria',0);\n+------------------------------------------------------------------+\n| SHA2('Maria',0) |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/sha2/
[SIGN]
declaration=X
category=Numeric Functions
-description=Returns the sign of the argument as -1, 0, or 1, depending\non whether\nX is negative, zero, or positive.\n \n\nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n \nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n \nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+
+description=Returns the sign of the argument as -1, 0, or 1, depending on whether X is\nnegative, zero, or positive.\n\nExamples\n--------\n\nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n\nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n\nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/sign/
[SIN]
declaration=X
category=Numeric Functions
-description=Returns the sine of X, where X is given in radians.\n \n\nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n \nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+
+description=Returns the sine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n\nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n\nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/sin/
[SLEEP]
declaration=duration
category=Miscellaneous Functions
-description=Sleeps (pauses) for the number of seconds given by the\nduration argument, then\nreturns 0. If SLEEP() is interrupted, it\nreturns 1. The duration may have a fractional part given in\nmicroseconds.\n \nStatements using the SLEEP() function are not safe for\nreplication.\n \nExample\n \nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)
+description=Sleeps (pauses) for the number of seconds given by the duration argument, then\nreturns 0. If SLEEP() is interrupted, it returns 1. The duration may have a\nfractional part given in microseconds.\n\nStatements using the SLEEP() function are not safe for statement-based\nreplication.\n\nExample\n-------\n\nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)\n\nURL: https://mariadb.com/kb/en/sleep/
+[SMALLINT]
+declaration=M
+category=Data Types
+description=A small integer. The signed range is -32768 to 32767. The unsigned range is 0\nto 65535.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so\nthat the SMALLINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nINT2 is a synonym for SMALLINT.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c SMALLINT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO smallints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column 'b' at row 1\n\nINSERT INTO smallints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column 'c' at row 1\n\nINSERT INTO smallints VALUES (-10,10,10);\n\nINSERT INTO smallints VALUES (32768,32768,32768);\nERROR 1264 (22003): Out of range value for column 'a' at row 1\n\nINSERT INTO smallints VALUES (32767,32768,32768);\n\nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO smallints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.09 sec)\nWarning (Code 1264): Out of range value for column 'b' at row 1\nWarning (Code 1264): Out of range value for column 'c' at row 1\n\nINSERT INTO smallints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\n ...
[SOUNDEX]
declaration=str
category=String Functions
-description=Returns a soundex string from str. Two strings that sound\nalmost the\nsame should have identical soundex strings. A standard\nsoundex string is four\ncharacters long, but the SOUNDEX() function returns an\narbitrarily long\nstring. You can use SUBSTRING() on the result to get a\nstandard soundex\nstring. All non-alphabetic characters in str are ignored.\nAll\ninternational alphabetic characters outside the A-Z range\nare treated as\nvowels.\n \nImportant: When using SOUNDEX(), you should be aware of the\nfollowing limitations:\nThis function, as currently implemented, is intended to work\nwell with\n strings that are in the English language only. Strings in\nother languages may\n not produce reliable results.\n \n\nSOUNDEX(''Hello'');\n+------------------+\n| SOUNDEX(''Hello'') |\n+------------------+\n| H400 |\n+------------------+\n \nSELECT SOUNDEX(''MariaDB'');\n+--------------------+\n| SOUNDEX(''MariaDB'') |\n+--------------------+\n| M631 |\n+--------------------+\n \nSELECT SOUNDEX(''Knowledgebase'');\n+--------------------------+\n| SOUNDEX(''Knowledgebase'') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n \nSELECT givenname, surname FROM users WHERE\nSOUNDEX(givenname) = SOUNDEX("robert");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+
+description=Returns a soundex string from str. Two strings that sound almost the same\nshould have identical soundex strings. A standard soundex string is four\ncharacters long, but the SOUNDEX() function returns an arbitrarily long\nstring. You can use SUBSTRING() on the result to get a standard soundex\nstring. All non-alphabetic characters in str are ignored. All international\nalphabetic characters outside the A-Z range are treated as vowels.\n\nImportant: When using SOUNDEX(), you should be aware of the following details:\n\n* This function, as currently implemented, is intended to work well with\n strings that are in the English language only. Strings in other languages may\n not produce reasonable results.\n\n* This function implements the original Soundex algorithm, not the more\npopular enhanced version (also described by D. Knuth). The difference is that\noriginal version discards vowels first and duplicates second, whereas the\nenhanced version discards duplicates first and vowels second.\n\nExamples\n--------\n\nSOUNDEX('Hello');\n+------------------+\n| SOUNDEX('Hello') |\n+------------------+\n| H400 |\n+------------------+\n\nSELECT SOUNDEX('MariaDB');\n+--------------------+\n| SOUNDEX('MariaDB') |\n+--------------------+\n| M631 |\n+--------------------+\n\nSELECT SOUNDEX('Knowledgebase');\n+--------------------------+\n| SOUNDEX('Knowledgebase') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n\nSELECT givenname, surname FROM users WHERE SOUNDEX(givenname) =\nSOUNDEX("robert");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n\nURL: https://mariadb.com/kb/en/soundex/
[SPACE]
declaration=N
category=String Functions
-description=Returns a string consisting of N space characters. If N is\nNULL, returns NULL.\n \n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| '' '' |\n+-----------------+
+description=Returns a string consisting of N space characters. If N is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| ' ' |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/space/
[SPIDER_BG_DIRECT_SQL]
-declaration=''sql'', ''tmp_table_list'', ''parameters''
+declaration='sql', 'tmp_table_list', 'parameters'
category=Spider Functions
-description=Executes the given SQL statement in the background on the\nremote server, as defined in the parameters listing. If the\nquery returns a result-set, it sttores the results in the\ngiven temporary table. When the given SQL statement executes\nsuccessfully, this function returns the number of called\nUDF''s. It returns 0 when the given SQL statement fails.\n \nThis function is a UDF installed with the Spider storage\nengine.\n \n\nSELECT SPIDER_BG_DIRECT_SQL(''SELECT * FROM example_table'',\n'''', \n ''srv "node1", port "8607"'') AS "Direct Query";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n \nParameters\n \nerror_rw_mode\n \nDescription: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n \nDefault Table Value: 0\nDSN Parameter Name: erwm
+description=Executes the given SQL statement in the background on the remote server, as\ndefined in the parameters listing. If the query returns a result-set, it\nsttores the results in the given temporary table. When the given SQL statement\nexecutes successfully, this function returns the number of called UDF's. It\nreturns 0 when the given SQL statement fails.\n\nThis function is a UDF installed with the Spider storage engine.\n\nExamples\n--------\n\nSELECT SPIDER_BG_DIRECT_SQL('SELECT * FROM example_table', '', \n 'srv "node1", port "8607"') AS "Direct Query";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n\nParameters\n----------\n\nerror_rw_mode\n-------------\n\n* Description: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n\n* Default Table Value: 0\n* DSN Parameter Name: erwm\n\nURL: https://mariadb.com/kb/en/spider_bg_direct_sql/
[SPIDER_COPY_TABLES]
declaration=spider_table_name, source_link_id, destination_link_id_list [,parameters]
category=Spider Functions
-description=A UDF installed with the Spider Storage Engine, this\nfunction copies table data from source_link_id to\ndestination_link_id_list. The service does not need to be\nstopped in order to copy.\n \nIf the Spider table is partitioned, the name must be of the\nformat table_name#P#partition_name. The partition name can\nbe viewed in the mysql.spider_tables table, for example:\n \nSELECT table_name FROM mysql.spider_tables;\n+-------------+\n| table_name |\n+-------------+\n| spt_a#P#pt1 |\n| spt_a#P#pt2 |\n| spt_a#P#pt3 |\n+-------------+\n \nReturns 1 if the data was copied successfully, or 0 if\ncopying the data failed.
+description=A UDF installed with the Spider Storage Engine, this function copies table\ndata from source_link_id to destination_link_id_list. The service does not\nneed to be stopped in order to copy.\n\nIf the Spider table is partitioned, the name must be of the format\ntable_name#P#partition_name. The partition name can be viewed in the\nmysql.spider_tables table, for example:\n\nSELECT table_name FROM mysql.spider_tables;\n+-------------+\n| table_name |\n+-------------+\n| spt_a#P#pt1 |\n| spt_a#P#pt2 |\n| spt_a#P#pt3 |\n+-------------+\n\nReturns 1 if the data was copied successfully, or 0 if copying the data failed.\n\nURL: https://mariadb.com/kb/en/spider_copy_tables/
[SPIDER_DIRECT_SQL]
-declaration=''sql'', ''tmp_table_list'', ''parameters''
+declaration='sql', 'tmp_table_list', 'parameters'
category=Spider Functions
-description=A UDF installed with the Spider Storage Engine, this\nfunction is used to execute the SQL string sql on the remote\nserver, as defined in parameters. If any resultsets are\nreturned, they are stored in the tmp_table_list.\n \nThe function returns 1 if the SQL executes successfully, or\n0 if it fails.\n \n\nSELECT SPIDER_DIRECT_SQL(''SELECT * FROM s'', '''', ''srv\n"node1", port "8607"'');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(''SELECT * FROM s'', '''', ''srv\n"node1", port "8607"'') |\n+----------------------------------------------------------------------+\n| 1 |\n+----------------------------------------------------------------------+
+description=A UDF installed with the Spider Storage Engine, this function is used to\nexecute the SQL string sql on the remote server, as defined in parameters. If\nany resultsets are returned, they are stored in the tmp_table_list.\n\nThe function returns 1 if the SQL executes successfully, or 0 if it fails.\n\nExamples\n--------\n\nSELECT SPIDER_DIRECT_SQL('SELECT * FROM s', '', 'srv "node1", port "8607"');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL('SELECT * FROM s', '', 'srv "node1", port "8607"') |\n+----------------------------------------------------------------------+\n| 1 |\n+----------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/spider_direct_sql/
[SPIDER_FLUSH_TABLE_MON_CACHE]
declaration=
category=Spider Functions
-description=A UDF installed with the Spider Storage Engine, this\nfunction is used for refreshing monitoring server\ninformation. It returns a value of 1.\n \n\nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\n+--------------------------------+
+description=A UDF installed with the Spider Storage Engine, this function is used for\nrefreshing monitoring server information. It returns a value of 1.\n\nExamples\n--------\n\nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/spider_flush_table_mon_cache/
[SQRT]
declaration=X
category=Numeric Functions
-description=Returns the square root of X. If X is negative, NULL is\nreturned.\n \n\nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n \nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n \nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+
+description=Returns the square root of X. If X is negative, NULL is returned.\n\nExamples\n--------\n\nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n\nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n\nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n\nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+\n\nURL: https://mariadb.com/kb/en/sqrt/
+[STD]
+declaration=expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard deviation of expr. This is an extension to\nstandard SQL. The standard SQL function STDDEV_POP() can be used instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTD() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n ...
[STDDEV]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the population standard deviation of expr. This\nfunction is\nprovided for compatibility with Oracle. The standard SQL\nfunction\nSTDDEV_POP() can be used instead.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV() can be used as a window\nfunction.\n \nThis function returns NULL if there were no matching rows.\n \n\nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+
+description=Returns the population standard deviation of expr. This function is provided\nfor compatibility with Oracle. The standard SQL function STDDEV_POP() can be\nused instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n ...
[STDDEV_POP]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the population standard deviation of expr (the\nsquare root of\nVAR_POP()). You can also use STD() or\nSTDDEV(), which are equivalent but not standard SQL.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_POP() can be used as a window\nfunction.\n \nSTDDEV_POP() returns NULL if there were no matching rows.\n \n\nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+
+description=Returns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent but not\nstandard SQL.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_POP() can be used as a window function.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n ...
[STDDEV_SAMP]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the sample standard deviation of expr (the square\nroot of VAR_SAMP()).\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_SAMP() can be used as a window\nfunction.\n \nSTDDEV_SAMP() returns NULL if there were no matching rows.
-[STD]
-declaration=expr
-category=Functions and Modifiers for Use with GROUP BY
-description=Returns the population standard deviation of expr. This is\nan extension\nto standard SQL. The standard SQL function STDDEV_POP() can\nbe used instead. \n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STD() can be used as a window function.\n \nThis function returns NULL if there were no matching rows.\n \n\nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+
+description=Returns the sample standard deviation of expr (the square root of VAR_SAMP()).\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_SAMP() can be used as a window function.\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/stddev_samp/
[STRCMP]
declaration=expr1,expr2
category=String Functions
-description=STRCMP() returns 0 if the strings are the same, -1 if the\nfirst\nargument is smaller than the second according to the current\nsort order,\nand 1 otherwise.\n \n\nSELECT STRCMP(''text'', ''text2'');\n+-------------------------+\n| STRCMP(''text'', ''text2'') |\n+-------------------------+\n| -1 |\n+-------------------------+\n \nSELECT STRCMP(''text2'', ''text'');\n+-------------------------+\n| STRCMP(''text2'', ''text'') |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT STRCMP(''text'', ''text'');\n+------------------------+\n| STRCMP(''text'', ''text'') |\n+------------------------+\n| 0 |\n+------------------------+
+description=STRCMP() returns 0 if the strings are the same, -1 if the first argument is\nsmaller than the second according to the current sort order, and 1 if the\nstrings are otherwise not the same. Returns NULL is either argument is NULL.\n\nExamples\n--------\n\nSELECT STRCMP('text', 'text2');\n+-------------------------+\n| STRCMP('text', 'text2') |\n+-------------------------+\n| -1 |\n+-------------------------+\n\nSELECT STRCMP('text2', 'text');\n+-------------------------+\n| STRCMP('text2', 'text') |\n+-------------------------+\n| 1 |\n+-------------------------+\n\nSELECT STRCMP('text', 'text');\n+------------------------+\n| STRCMP('text', 'text') |\n+------------------------+\n| 0 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/strcmp/
[STR_TO_DATE]
declaration=str,format
category=Date and Time Functions
-description=This is the inverse of the DATE_FORMAT() function. It takes\na string str and a format string format. STR_TO_DATE()\nreturns a\nDATETIME value if the format string contains both date and\ntime parts, or a\nDATE or TIME value if the string contains only date or time\nparts.\n \nThe date, time, or datetime values contained in str should\nbe given in the format indicated by format. If str contains\nan illegal date, time, or datetime value, STR_TO_DATE()\nreturns NULL. An illegal value also produces a warning.\n \nThe options that can be used by STR_TO_DATE(), as well as\nits inverse DATE_FORMAT() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix ''th'', ''nd'', ''st'' or\n''rd''''. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n''%I:%i:%S %p''. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for ''%H:%i:%S''. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \n\nSELECT STR_TO_DATE(''Wednesday, June 2, 2014'', ''%W, %M %e,\n%Y'');\n+---------------------------------------------------------+\n| STR_TO_DATE(''Wednesday, June 2, 2014'', ''%W, %M %e,\n%Y'') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n \nSELECT STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W,\n%M %e, %Y'');\n+--------------------------------------------------------------+\n| STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W, %M %e,\n%Y'') |\n+--------------------------------------------------------------+\n| NULL |\n+--------------------------------------------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------------------------------------------+\n| Warning | 1411 | Incorrect datetime value:\n''Wednesday23423, June 2, 2014'' for function str_to_date |\n+---------+------+-----------------------------------------------------------------------------------+\n \nSELECT STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W%#,\n%M %e, %Y'');\n+----------------------------------------------------------------+\n| STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W%#, %M\n%e, %Y'') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\n+----------------------------------------------------------------+
+description=This is the inverse of the DATE_FORMAT() function. It takes a string str and a\nformat string format. STR_TO_DATE() returns a DATETIME value if the format\nstring contains both date and time parts, or a DATE or TIME value if the\nstring contains only date or time parts.\n\nThe date, time, or datetime values contained in str should be given in the\nformat indicated by format. If str contains an illegal date, time, or datetime\nvalue, STR_TO_DATE() returns NULL. An illegal value also produces a warning.\n\nUnder specific SQL_MODE settings an error may also be generated if the str\nisn't a valid date:\n\n* ALLOW_INVALID_DATES\n* NO_ZERO_DATE\n* NO_ZERO_IN_DATE\n\nThe options that can be used by STR_TO_DATE(), as well as its inverse\nDATE_FORMAT() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | or Dec. |\n+---------------------------+------------------------------------------------+\n| %c | Month with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %D | Day with English suffix 'th', 'nd', 'st' or |\n| | 'rd''. (1st, 2nd, 3rd...). |\n+---------------------------+------------------------------------------------+\n| %d | Day with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %e | Day with 1 or 2 digits. |\n+---------------------------+------------------------------------------------+\n| %f | Microseconds 6 digits. |\n+---------------------------+------------------------------------------------+\n| %H | Hour with 2 digits between 00-23. |\n+---------------------------+------------------------------------------------+\n| %h | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %I | Hour with 2 digits between 01-12. |\n+---------------------------+------------------------------------------------+\n| %i | Minute with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %j | Day of the year (001-366) |\n ...
[ST_AREA]
declaration=poly
category=Polygon Properties
-description=Returns as a double-precision number the area of the Polygon\nvalue poly, as measured in its spatial reference system.\n \nST_Area() and Area() are synonyms.\n \n\nSET @poly = ''Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1\n1))'';\n \nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+
-[ST_ASBINARY]
+description=Returns as a double-precision number the area of the Polygon value poly, as\nmeasured in its spatial reference system.\n\nST_Area() and Area() are synonyms.\n\nExamples\n--------\n\nSET @poly = 'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';\n\nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n\nURL: https://mariadb.com/kb/en/st_area/
+[ST_AsBinary]
declaration=g
category=WKB
-description=Converts a value in internal geometry format to its WKB\nrepresentation and returns the binary result.\n \nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are\nsynonyms,\n \n\nSET @poly = ST_GeomFromText(''POLYGON((0 0,0 1,1 1,1 0,0\n0))'');\nSELECT ST_AsBinary(@poly);\n \nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0)) |\n+--------------------------------------------+
-[ST_ASTEXT]
+description=Converts a value in internal geometry format to its WKB representation and\nreturns the binary result.\n\nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are synonyms,\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))');\nSELECT ST_AsBinary(@poly);\n\nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0)) |\n+--------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_asbinary/
+[ST_AsGeoJSON]
+declaration=g[, max_decimals[, options]]
+category=GeoJSON
+description=Returns the given geometry g as a GeoJSON element. The optional max_decimals\nlimits the maximum number of decimals displayed.\n\nThe optional options flag can be set to 1 to add a bounding box to the output.\n\nExamples\n--------\n\nSELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.3 7.2)'));\n+-------------------------------------------------+\n| ST_AsGeoJSON(ST_GeomFromText('POINT(5.3 7.2)')) |\n+-------------------------------------------------+\n| {"type": "Point", "coordinates": [5.3, 7.2]} |\n+-------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/geojson-st_asgeojson/
+[ST_AsText]
declaration=g
category=WKT
-description=Converts a value in internal geometry format to its WKT\nrepresentation and returns the string result.\n \nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all\nsynonyms.\n \n\nSET @g = ''LineString(1 1,4 4,6 6)'';\n \nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+
+description=Converts a value in internal geometry format to its WKT representation and\nreturns the string result.\n\nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all synonyms.\n\nExamples\n--------\n\nSET @g = 'LineString(1 1,4 4,6 6)';\n\nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/st_astext/
[ST_BOUNDARY]
declaration=g
category=Geometry Properties
-description=Returns a geometry that is the closure of the combinatorial\nboundary of the geometry value g.\n \nBOUNDARY() is a synonym.\n \n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(''LINESTRING(3\n3,0 0, -3 3)'')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(''LINESTRING(3 3,0\n0, -3 3)''))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(''POLYGON((3\n3,0 0, -3 3, 3 3))'')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(''POLYGON((3 3,0 0,\n-3 3, 3 3))''))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\n+--------------------------------------------------------------------------+
+description=Returns a geometry that is the closure of the combinatorial boundary of the\ngeometry value g.\n\nBOUNDARY() is a synonym.\n\nExamples\n--------\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(3 3,0 0, -3 3)')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(3 3,0 0, -3 3)'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON((3 3,0 0, -3 3, 3\n3))')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON((3 3,0 0, -3 3, 3 3))'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\n+--------------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_boundary/
[ST_BUFFER]
declaration=g1,r
category=Geometry Constructors
-description=Returns a geometry that represents all points whose distance\nfrom geometry g1 is less than or equal to distance, or\nradius, r.\n \nUses for this function could include creating for example a\nnew geometry representing a buffer zone around an island.\n \nBUFFER() is a synonym.\n \n\nDetermining whether a point is within a buffer zone:\n \nSET @g1 = ST_GEOMFROMTEXT(''POLYGON((10 10, 10 20, 20 20, 20\n10, 10 10))'');\n \nSET @g2 = ST_GEOMFROMTEXT(''POINT(8 8)'');\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n| 0 |\n+---------------------------------+
+description=Returns a geometry that represents all points whose distance from geometry g1\nis less than or equal to distance, or radius, r.\n\nUses for this function could include creating for example a new geometry\nrepresenting a buffer zone around an island.\n\nBUFFER() is a synonym.\n\nExamples\n--------\n\nDetermining whether a point is within a buffer zone:\n\nSET @g1 = ST_GEOMFROMTEXT('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))');\n\nSET @g2 = ST_GEOMFROMTEXT('POINT(8 8)');\n\nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n\nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n| 0 |\n+---------------------------------+\n\nURL: https://mariadb.com/kb/en/st_buffer/
[ST_CENTROID]
declaration=mpoly
category=Polygon Properties
-description=Returns a point reflecting the mathematical centroid\n(geometric center) for the MultiPolygon mpoly. The resulting\npoint will not necessarily be on the MultiPolygon. \n \nST_Centroid() and Centroid() are synonyms.\n \n\nSET @poly = ST_GeomFromText(''POLYGON((0 0,20 0,20 20,0 20,0\n0))'');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n \n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+
+description=Returns a point reflecting the mathematical centroid (geometric center) for\nthe MultiPolygon mpoly. The resulting point will not necessarily be on the\nMultiPolygon.\n\nST_Centroid() and Centroid() are synonyms.\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+\n\nURL: https://mariadb.com/kb/en/st_centroid/
[ST_CONTAINS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2.\n \nST_CONTAINS() uses object shapes, while CONTAINS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))'');\n \nSET @g2 = ST_GEOMFROMTEXT(''POINT(174 149)'');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(''POINT(175 151)'');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+
+description=Returns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2.\n\nST_CONTAINS() uses object shapes, while CONTAINS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))');\n\nSET @g2 = ST_GEOMFROMTEXT('POINT(174 149)');\n\nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSET @g2 = ST_GEOMFROMTEXT('POINT(175 151)');\n\nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st-contains/
[ST_CONVEXHULL]
-declaration=g
+declaration=
category=Geometry Constructors
-description=Given a geometry, returns a geometry that is the minimum\nconvex geometry enclosing all geometries within the set.\nReturns NULL if the geometry value is NULL or an empty\nvalue.\n \nST_ConvexHull() and ConvexHull() are synonyms.\n \n\nThe ConvexHull of a single point is simply the single point:\n \nSET @g = ST_GEOMFROMTEXT(''Point(0 0)'');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(''MultiPoint(0 0, 1 2, 2 3)'');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POLYGON((0 0,1 2,2 3,0 0)) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(''MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )'');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+----------------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+
+description=Given a geometry, returns a geometry that is the minimum convex geometry\nenclosing all geometries within the set. Returns NULL if the geometry value is\nNULL or an empty value.\n\nST_ConvexHull() and ConvexHull() are synonyms.\n\nExamples\n--------\n\nThe ConvexHull of a single point is simply the single point:\n\nSET @g = ST_GEOMFROMTEXT('Point(0 0)');\n\nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n\nSET @g = ST_GEOMFROMTEXT('MultiPoint(0 0, 1 2, 2 3)');\n\nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POLYGON((0 0,1 2,2 3,0 0)) |\n+------------------------------+\n\nSET @g = ST_GEOMFROMTEXT('MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9,\n4 9, 1 5 )');\n\nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+----------------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_convexhull/
[ST_CROSSES]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 if geometry g1 spatially crosses geometry g2.\nReturns NULL if g1 is a Polygon or a MultiPolygon, or if g2\nis a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nST_CROSSES() uses object shapes, while CROSSES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(174 149, 176 151)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))'');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(176 149, 176 151)'');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+
+description=Returns 1 if geometry g1 spatially crosses geometry g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nST_CROSSES() uses object shapes, while CROSSES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('LINESTRING(174 149, 176 151)');\n\nSET @g2 = ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))');\n\nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n\nSET @g1 = ST_GEOMFROMTEXT('LINESTRING(176 149, 176 151)');\n\nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/st-crosses/
[ST_DIFFERENCE]
declaration=g1,g2
category=Geometry Relations
-description=Returns a geometry representing the point set difference of\nthe given geometry values.\n \nExample\n \nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n \nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10) |\n+------------------------------------+
+description=Returns a geometry representing the point set difference of the given geometry\nvalues.\n\nExample\n-------\n\nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n\nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10) |\n+------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_difference/
[ST_DIMENSION]
declaration=g
category=Geometry Properties
-description=Returns the inherent dimension of the geometry value g. The\nresult can\nbe\n \nDimension | Definition | \n \n -1 | empty geometry | \n \n 0 | geometry with no length or area | \n \n 1 | geometry with no area but nonzero length | \n \n 2 | geometry with nonzero area | \n \nST_Dimension() and Dimension() are synonyms.\n \n\nSELECT Dimension(GeomFromText(''LineString(1 1,2 2)''));\n+------------------------------------------------+\n| Dimension(GeomFromText(''LineString(1 1,2 2)'')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+
+description=Returns the inherent dimension of the geometry value g. The result can be\n\n+------------------------------------+---------------------------------------+\n| Dimension | Definition |\n+------------------------------------+---------------------------------------+\n| -1 | empty geometry |\n+------------------------------------+---------------------------------------+\n| 0 | geometry with no length or area |\n+------------------------------------+---------------------------------------+\n| 1 | geometry with no area but nonzero |\n| | length |\n+------------------------------------+---------------------------------------+\n| 2 | geometry with nonzero area |\n+------------------------------------+---------------------------------------+\n\nST_Dimension() and Dimension() are synonyms.\n\nExamples\n--------\n\nSELECT Dimension(GeomFromText('LineString(1 1,2 2)'));\n+------------------------------------------------+\n| Dimension(GeomFromText('LineString(1 1,2 2)')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_dimension/
[ST_DISJOINT]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 is spatially\ndisjoint from\n(does not intersect with) geometry g2.\n \nST_DISJOINT() uses object shapes, while DISJOINT(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_DISJOINT() tests the opposite relationship to\nST_INTERSECTS().\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(0 0)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 0, 0 2)'');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(0 0, 0 2)'');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+
+description=Returns 1 or 0 to indicate whether geometry g1 is spatially disjoint from\n(does not intersect with) geometry g2.\n\nST_DISJOINT() uses object shapes, while DISJOINT(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_DISJOINT() tests the opposite relationship to ST_INTERSECTS().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(0 0)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 0, 0 2)');\n\nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(0 0, 0 2)');\n\nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st_disjoint/
[ST_DISTANCE]
declaration=g1,g2
category=Geometry Relations
-description=Returns the distance between two geometries, or null if not\ngiven valid inputs.\n \nExample\n \nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n| 1 |\n+------------------------------------+
+description=Returns the distance between two geometries, or null if not given valid inputs.\n\nExample\n-------\n\nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n| 1 |\n+------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_distance/
+[ST_DISTANCE_SPHERE]
+declaration=g1,g2,[r]
+category=Geometry Relations
+description=Returns the spherical distance between two geometries (point or multipoint) on\na sphere with the optional radius r (default is the Earth radius if r is not\nspecified), or NULL if not given valid inputs.\n\nExample\n-------\n\nset @zenica = ST_GeomFromText('POINT(17.907743 44.203438)');\nset @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');\nSELECT ST_Distance_Sphere(@zenica, @sarajevo);\n55878.59337591705\n\nURL: https://mariadb.com/kb/en/st_distance_sphere/
[ST_ENDPOINT]
declaration=ls
category=LineString Properties
-description=Returns the Point that is the endpoint of the\nLineString value ls.\n \nST_EndPoint() and EndPoint() are synonyms.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+
+description=Returns the Point that is the endpoint of the LineString value ls.\n\nST_EndPoint() and EndPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_endpoint/
[ST_ENVELOPE]
declaration=g
category=Geometry Properties
-description=Returns the Minimum Bounding Rectangle (MBR) for the\ngeometry value g. The result is returned as a Polygon value.\n \nThe polygon is defined by the corner points of the bounding\nbox:\n \nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX\nMINY))\n \nST_ENVELOPE() and ENVELOPE() are synonyms.\n \n\nSELECT AsText(ST_ENVELOPE(GeomFromText(''LineString(1 1,4\n4)'')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(''LineString(1 1,4 4)'')))\n|\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\n+----------------------------------------------------------+
+description=Returns the Minimum Bounding Rectangle (MBR) for the geometry value g. The\nresult is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nST_ENVELOPE() and ENVELOPE() are synonyms.\n\nExamples\n--------\n\nSELECT AsText(ST_ENVELOPE(GeomFromText('LineString(1 1,4 4)')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText('LineString(1 1,4 4)'))) |\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\n+----------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_envelope/
[ST_EQUALS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 is spatially\nequal to geometry g2.\n \nST_EQUALS() uses object shapes, while EQUALS(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(174 149, 176 151)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(176 151, 174 149)'');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(''POINT(0 2)'');\n \nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 0)'');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+
-[ST_EXTERIORRING]
+description=Returns 1 or 0 to indicate whether geometry g1 is spatially equal to geometry\ng2.\n\nST_EQUALS() uses object shapes, while EQUALS(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('LINESTRING(174 149, 176 151)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(176 151, 174 149)');\n\nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(0 2)');\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(2 0)');\n\nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/st-equals/
+[ST_ExteriorRing]
declaration=poly
category=Polygon Properties
-description=Returns the exterior ring of the Polygon value poly as a\nLineString.\n \nST_ExteriorRing() and ExteriorRing() are synonyms.\n \n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))'';\n \nSELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+
-[ST_GEOMCOLLFROMTEXT]
-declaration=wkt[,srid]
-category=WKT
-description=Constructs a GEOMETRYCOLLECTION value using its WKT \nrepresentation and SRID.\n \nST_GeomCollFromText(), ST_GeometryCollectionFromText(),\nGeomCollFromText() and GeometryCollectionFromText() are all\nsynonyms.\n \nExample\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(''GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))'')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(''GeometryCollection()'')),\n (GeomFromText(''GeometryCollection EMPTY''));
-[ST_GEOMCOLLFROMWKB]
-declaration=wkb[,srid]
-category=WKB
-description=Constructs a GEOMETRYCOLLECTION value using its WKB\nrepresentation and SRID.\n \nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(),\nGeomCollFromWKB() and GeometryCollectionFromWKB() are\nsynonyms.\n \n\nSET @g =\nST_AsBinary(ST_GeomFromText(''GEOMETRYCOLLECTION(POLYGON((5\n5,10 5,10 10,5 5)),POINT(10 10))''));\n \nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g)) |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10\n10)) |\n+----------------------------------------------------------------+
+description=Returns the exterior ring of the Polygon value poly as a LineString.\n\nST_ExteriorRing() and ExteriorRing() are synonyms.\n\nExamples\n--------\n\nSET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\n\nSELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_exteriorring/
[ST_GEOMETRYN]
declaration=gc,N
category=Geometry Properties
-description=Returns the N-th geometry in the GeometryCollection gc.\nGeometries are numbered beginning with 1.\n \nST_GeometryN() and GeometryN() are synonyms.\n \nExample\n \nSET @gc = ''GeometryCollection(Point(1 1),LineString(12 14,\n9 11))'';\n \nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+
+description=Returns the N-th geometry in the GeometryCollection gc. Geometries are\nnumbered beginning with 1.\n\nST_GeometryN() and GeometryN() are synonyms.\n\nExample\n-------\n\nSET @gc = 'GeometryCollection(Point(1 1),LineString(12 14, 9 11))';\n\nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geometryn/
[ST_GEOMETRYTYPE]
declaration=g
category=Geometry Properties
-description=Returns as a string the name of the geometry type of which\nthe\ngeometry instance g is a member. The name corresponds to one\nof the\ninstantiable Geometry subclasses.\n \nST_GeometryType() and GeometryType() are synonyms.\n \n\nSELECT GeometryType(GeomFromText(''POINT(1 1)''));\n+------------------------------------------+\n| GeometryType(GeomFromText(''POINT(1 1)'')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+
-[ST_GEOMFROMTEXT]
+description=Returns as a string the name of the geometry type of which the geometry\ninstance g is a member. The name corresponds to one of the instantiable\nGeometry subclasses.\n\nST_GeometryType() and GeometryType() are synonyms.\n\nExamples\n--------\n\nSELECT GeometryType(GeomFromText('POINT(1 1)'));\n+------------------------------------------+\n| GeometryType(GeomFromText('POINT(1 1)')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geometrytype/
+[ST_GeomCollFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a geometry value of any type using its WKT\nrepresentation and SRID.\n \nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n \nExample\n \nSET @g = ST_GEOMFROMTEXT(''POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))'');
-[ST_GEOMFROMWKB]
+description=Constructs a GEOMETRYCOLLECTION value using its WKT representation and SRID.\n\nST_GeomCollFromText(), ST_GeometryCollectionFromText(), GeomCollFromText() and\nGeometryCollectionFromText() are all synonyms.\n\nExample\n-------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText('GeometryCollection()')),\n (GeomFromText('GeometryCollection EMPTY'));\n\nURL: https://mariadb.com/kb/en/st_geomcollfromtext/
+[ST_GeomCollFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a geometry value of any type using its WKB\nrepresentation and SRID.\n \nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and\nGeometryFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(ST_LineFromText(''LINESTRING(0 4, 4\n6)''));\n \nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\n+-------------------------------+
-[ST_INTERIORRINGN]
-declaration=poly,N
-category=Polygon Properties
-description=Returns the N-th interior ring for the Polygon value poly as\na LineString. Rings are numbered beginning with 1.\n \nST_InteriorRingN() and InteriorRingN() are synonyms.\n \n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))'';\n \nSELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+
+description=Constructs a GEOMETRYCOLLECTION value using its WKB representation and SRID.\n\nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(), GeomCollFromWKB() and\nGeometryCollectionFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_GeomFromText('GEOMETRYCOLLECTION(\n POLYGON((5 5,10 5,10 10,5 5)),POINT(10 10))'));\n\nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g)) |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10 10)) |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geomcollfromwkb/
+[ST_GeomFromGeoJSON]
+declaration=g[, option]
+category=GeoJSON
+description=Given a GeoJSON input g, returns a geometry object. The option specifies what\nto do if g contains geometries with coordinate dimensions higher than 2.\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| 1 | Return an error (the default) |\n+---------------------------+------------------------------------------------+\n| 2 - 4 | The document is accepted, but the coordinates |\n| | for higher coordinate dimensions are stripped |\n| | off. |\n+---------------------------+------------------------------------------------+\n\nNote that this function did not work correctly before MariaDB 10.2.8 - see\nMDEV-12180.\n\nExamples\n--------\n\nSET @j = '{ "type": "Point", "coordinates": [5.3, 15.0]}';\n\nSELECT ST_AsText(ST_GeomFromGeoJSON(@j));\n+-----------------------------------+\n| ST_AsText(ST_GeomFromGeoJSON(@j)) |\n+-----------------------------------+\n| POINT(5.3 15) |\n+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geomfromgeojson/
+[ST_GeomFromText]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a geometry value of any type using its WKT representation and SRID.\n\nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n\nExample\n-------\n\nSET @g = ST_GEOMFROMTEXT('POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))');\n\nURL: https://mariadb.com/kb/en/st_geomfromtext/
+[ST_GeomFromWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a geometry value of any type using its WKB representation and SRID.\n\nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and GeometryFromWKB()\nare synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText('LINESTRING(0 4, 4 6)'));\n\nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\n+-------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geomfromwkb/
[ST_INTERSECTION]
declaration=g1,g2
category=Geometry Constructors
-description=Returns a geometry that is the intersection, or shared\nportion, of geometry g1 and geometry g2.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 1)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 1, 0 2)'');\n \nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1) |\n+----------------------------------+
+description=Returns a geometry that is the intersection, or shared portion, of geometry g1\nand geometry g2.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(2 1)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 1, 0 2)');\n\nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1) |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_intersection/
[ST_INTERSECTS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nST_INTERSECTS() uses object shapes, while INTERSECTS(),\nbased on the original MySQL implementation, uses object\nbounding rectangles.\n \nST_INTERSECTS() tests the opposite relationship to\nST_DISJOINT().\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(0 0)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(0 0, 0 2)'');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 0, 0 2)'');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+
+description=Returns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nST_INTERSECTS() uses object shapes, while INTERSECTS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_INTERSECTS() tests the opposite relationship to ST_DISJOINT().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(0 0)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(0 0, 0 2)');\n\nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 0, 0 2)');\n\nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/st-intersects/
[ST_ISCLOSED]
declaration=g
category=Geometry Properties
-description=Returns 1 if a given LINESTRING''s start and end points are\nthe same, or 0 if they are not the same. Before MariaDB\n10.1.5, returns NULL if not given a LINESTRING. After\nMariaDB 10.1.5, returns -1.\n \nST_IsClosed() and IsClosed() are synonyms.\n \n\nSET @ls = ''LineString(0 0, 0 4, 4 4, 0 0)'';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \nSET @ls = ''LineString(0 0, 0 4, 4 4, 0 1)'';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\n+--------------------------------+
+description=Returns 1 if a given LINESTRING's start and end points are the same, or 0 if\nthey are not the same. Before MariaDB 10.1.5, returns NULL if not given a\nLINESTRING. After MariaDB 10.1.5, returns -1.\n\nST_IsClosed() and IsClosed() are synonyms.\n\nExamples\n--------\n\nSET @ls = 'LineString(0 0, 0 4, 4 4, 0 0)';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n\nSET @ls = 'LineString(0 0, 0 4, 4 4, 0 1)';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/st_isclosed/
[ST_ISEMPTY]
declaration=g
category=Geometry Properties
-description=IsEmpty is a function defined by the OpenGIS specification,\nbut is not fully implemented by MariaDB or MySQL. \n \nSince MariaDB and MySQL do not support GIS EMPTY values such\nas POINT EMPTY, as implemented it simply returns 1 if the\ngeometry value g is invalid, 0 if it is valid, and NULL if\nthe argument is NULL.\n \nST_IsEmpty() and IsEmpty() are synonyms.
-[ST_ISRING]
+description=IsEmpty is a function defined by the OpenGIS specification, but is not fully\nimplemented by MariaDB or MySQL.\n\nSince MariaDB and MySQL do not support GIS EMPTY values such as POINT EMPTY,\nas implemented it simply returns 1 if the geometry value g is invalid, 0 if it\nis valid, and NULL if the argument is NULL.\n\nST_IsEmpty() and IsEmpty() are synonyms.\n\nURL: https://mariadb.com/kb/en/st_isempty/
+[ST_InteriorRingN]
+declaration=poly,N
+category=Polygon Properties
+description=Returns the N-th interior ring for the Polygon value poly as a LineString.\nRings are numbered beginning with 1.\n\nST_InteriorRingN() and InteriorRingN() are synonyms.\n\nExamples\n--------\n\nSET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\n\nSELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_interiorringn/
+[ST_IsRing]
declaration=g
category=Geometry Properties
-description=Returns true if a given LINESTRING is a ring, that is, both\nST_IsClosed and ST_IsSimple. A simple curve does not pass\nthrough the same point more than once. However, see\nMDEV-7510.\n \nSt_IsRing() and IsRing() are synonyms.
-[ST_ISSIMPLE]
+description=Returns true if a given LINESTRING is a ring, that is, both ST_IsClosed and\nST_IsSimple. A simple curve does not pass through the same point more than\nonce. However, see MDEV-7510.\n\nSt_IsRing() and IsRing() are synonyms.\n\nURL: https://mariadb.com/kb/en/st_isring/
+[ST_IsSimple]
declaration=g
category=Geometry Properties
-description=Returns true if the given Geometry has no anomalous\ngeometric points, false if it does, or NULL if given a NULL\nvalue.\n \nST_IsSimple() and IsSimple() are synonyms.\n \n\nA POINT is always simple.\n \nSET @g = ''Point(1 2)'';\n \nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n| 1 |\n+-------------------------------+
+description=Returns true if the given Geometry has no anomalous geometric points, false if\nit does, or NULL if given a NULL value.\n\nST_IsSimple() and IsSimple() are synonyms.\n\nExamples\n--------\n\nA POINT is always simple.\n\nSET @g = 'Point(1 2)';\n\nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n| 1 |\n+-------------------------------+\n\nURL: https://mariadb.com/kb/en/st_issimple/
[ST_LENGTH]
declaration=ls
category=Geometry Relations
-description=Returns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n| 2.82842712474619 |\n+---------------------------------+
-[ST_LINEFROMTEXT]
+description=Returns as a double-precision number the length of the LineString value ls in\nits associated spatial reference.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n| 2.82842712474619 |\n+---------------------------------+\n\nURL: https://mariadb.com/kb/en/st_length/
+[ST_LineFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a LINESTRING value using its WKT representation\nand SRID.\n \nST_LineFromText(), ST_LineStringFromText(),\nST_LineFromText() and ST_LineStringFromText() are all\nsynonyms.\n \n\nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(''LINESTRING(0 0,0 10,10 0)'')),\n (LineStringFromText(''LINESTRING(10 10,20 10,20 20,10 20,10\n10)'')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));
-[ST_LINEFROMWKB]
+description=Constructs a LINESTRING value using its WKT representation and SRID.\n\nST_LineFromText(), ST_LineStringFromText(), ST_LineFromText() and\nST_LineStringFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\nINSERT INTO gis_line VALUES\n (LineFromText('LINESTRING(0 0,0 10,10 0)')),\n (LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nURL: https://mariadb.com/kb/en/st_linefromtext/
+[ST_LineFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a LINESTRING value using its WKB representation\nand SRID.\n \nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(ST_LineFromText(''LineString(0 4,4\n6)''));\n \nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n \n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+
+description=Constructs a LINESTRING value using its WKB representation and SRID.\n\nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText('LineString(0 4,4 6)'));\n\nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/st_linefromwkb/
[ST_NUMGEOMETRIES]
declaration=gc
category=Geometry Properties
-description=Returns the number of geometries in the GeometryCollection\ngc.\n \nST_NumGeometries() and NumGeometries() are synonyms.\n \nExample\n \nSET @gc = ''GeometryCollection(Point(1 1),LineString(2 2, 3\n3))'';\n \nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+
-[ST_NUMINTERIORRINGS]
-declaration=poly
-category=Polygon Properties
-description=Returns an integer containing the number of interior rings\nin the Polygon value poly.\n \nNote that according the the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB''s, permit polygons to have several\n''ExteriorRings''. In the case of there being multiple,\nnon-overlapping exterior rings ST_NumInteriorRings() will\nreturn 1.\n \nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n \n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))'';\n \nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n \nNon-overlapping ''polygon'':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(''POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))'')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+
+description=Returns the number of geometries in the GeometryCollection gc.\n\nST_NumGeometries() and NumGeometries() are synonyms.\n\nExample\n-------\n\nSET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';\n\nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_numgeometries/
[ST_NUMPOINTS]
declaration=ls
category=LineString Properties
-description=Returns the number of Point objects in the LineString\nvalue ls.\n \nST_NumPoints() and NumPoints() are synonyms.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+
+description=Returns the number of Point objects in the LineString value ls.\n\nST_NumPoints() and NumPoints() are synonyms.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/st_numpoints/
+[ST_NumInteriorRings]
+declaration=poly
+category=Polygon Properties
+description=Returns an integer containing the number of interior rings in the Polygon\nvalue poly.\n\nNote that according the the OpenGIS standard, a POLYGON should have exactly\none ExteriorRing and all other rings should lie within that ExteriorRing and\nthus be the InteriorRings. Practically, however, some systems, including\nMariaDB's, permit polygons to have several 'ExteriorRings'. In the case of\nthere being multiple, non-overlapping exterior rings ST_NumInteriorRings()\nwill return 1.\n\nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n\nExamples\n--------\n\nSET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\n\nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n\nNon-overlapping 'polygon':\n\nSELECT ST_NumInteriorRings(ST_PolyFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))')) AS NumInteriorRings;\n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/st_numinteriorrings/
[ST_OVERLAPS]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 spatially\noverlaps geometry g2.\n \nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.
-[ST_POINTFROMTEXT]
-declaration=wkt[,srid]
-category=WKT
-description=Constructs a POINT value using its WKT representation and\nSRID.\n \nST_PointFromText() and PointFromText() are synonyms.\n \n\nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(''POINT(10 10)'')),\n (PointFromText(''POINT(20 10)'')),\n (PointFromText(''POINT(20 20)'')),\n (PointFromWKB(AsWKB(PointFromText(''POINT(10 20)''))));
-[ST_POINTFROMWKB]
-declaration=wkb[,srid]
-category=WKB
-description=Constructs a POINT value using its WKB representation and\nSRID.\n \nST_PointFromWKB() and PointFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(ST_PointFromText(''POINT(0 4)''));\n \nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n \n+------------+\n| p |\n+------------+\n| POINT(0 4) |\n+------------+
+description=Returns 1 or 0 to indicate whether geometry g1 spatially overlaps geometry g2.\n\nThe term spatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal to\neither of the given geometries.\n\nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nURL: https://mariadb.com/kb/en/st-overlaps/
[ST_POINTN]
declaration=ls,N
category=LineString Properties
-description=Returns the N-th Point in the LineString value ls.\nPoints are numbered beginning with 1.\n \nST_PointN() and PointN() are synonyms.\n \n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n \nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+
+description=Returns the N-th Point in the LineString value ls. Points are numbered\nbeginning with 1.\n\nST_PointN() and PointN() are synonyms.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_pointn/
[ST_POINTONSURFACE]
-declaration=g
+declaration=
category=Geometry Constructors
-description=Given a geometry, returns a POINT guaranteed to intersect a\nsurface. However, see MDEV-7514.\n \nST_PointOnSurface() and PointOnSurface() are synonyms.
-[ST_POLYFROMTEXT]
+description=Given a geometry, returns a POINT guaranteed to intersect a surface. However,\nsee MDEV-7514.\n\nST_PointOnSurface() and PointOnSurface() are synonyms.\n\nURL: https://mariadb.com/kb/en/st_pointonsurface/
+[ST_PointFromText]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a POINT value using its WKT representation and SRID.\n\nST_PointFromText() and PointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\nINSERT INTO gis_point VALUES\n (PointFromText('POINT(10 10)')),\n (PointFromText('POINT(20 10)')),\n (PointFromText('POINT(20 20)')),\n (PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));\n\nURL: https://mariadb.com/kb/en/st_pointfromtext/
+[ST_PointFromWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a POINT value using its WKB representation and SRID.\n\nST_PointFromWKB() and PointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PointFromText('POINT(0 4)'));\n\nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n+------------+\n| p |\n+------------+\n| POINT(0 4) |\n+------------+\n\nURL: https://mariadb.com/kb/en/st_pointfromwkb/
+[ST_PolyFromText]
declaration=wkt[,srid]
category=WKT
-description=Constructs a POLYGON value using its WKT representation and\nSRID.\n \nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n \n\nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(''POLYGON((10 10,20 10,20 20,10 20,10\n10))'')),\n (PolyFromText(''POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))''));
-[ST_POLYFROMWKB]
+description=Constructs a POLYGON value using its WKT representation and SRID.\n\nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),\n (PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))'));\n\nURL: https://mariadb.com/kb/en/st_polyfromtext/
+[ST_PolyFromWKB]
declaration=wkb[,srid]
category=WKB
-description=Constructs a POLYGON value using its WKB representation and\nSRID.\n \nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and\nPolygonFromWKB() are synonyms.\n \n\nSET @g = ST_AsBinary(ST_PolyFromText(''POLYGON((1 1,1 5,4\n9,6 9,9 3,7 2,1 1))''));\n \nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n \n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+
+description=Constructs a POLYGON value using its WKB representation and SRID.\n\nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and PolygonFromWKB() are\nsynonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PolyFromText('POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1\n1))'));\n\nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_polyfromwkb/
[ST_RELATE]
-declaration=g1, g2, i
+declaration=
category=Geometry Properties
-description=Returns true if Geometry g1 is spatially related to\nGeometryg2 by testing for intersections between the\ninterior, boundary and exterior of the two geometries as\nspecified by the values in intersection matrix pattern i.
+description=Returns true if Geometry g1 is spatially related to Geometryg2 by testing for\nintersections between the interior, boundary and exterior of the two\ngeometries as specified by the values in intersection matrix pattern i.\n\nURL: https://mariadb.com/kb/en/st_relate/
[ST_SRID]
declaration=g
category=Geometry Properties
-description=Returns an integer indicating the Spatial Reference System\nID for the\ngeometry value g.\n \nIn MariaDB, the SRID value is just an integer associated\nwith the\ngeometry value. All calculations are done assuming Euclidean\n(planar)\ngeometry.\n \nST_SRID() and SRID() are synonyms.\n \n\nSELECT SRID(GeomFromText(''LineString(1 1,2 2)'',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(''LineString(1 1,2 2)'',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+
+description=Returns an integer indicating the Spatial Reference System ID for the geometry\nvalue g.\n\nIn MariaDB, the SRID value is just an integer associated with the geometry\nvalue. All calculations are done assuming Euclidean (planar) geometry.\n\nST_SRID() and SRID() are synonyms.\n\nExamples\n--------\n\nSELECT SRID(GeomFromText('LineString(1 1,2 2)',101));\n+-----------------------------------------------+\n| SRID(GeomFromText('LineString(1 1,2 2)',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_srid/
+[ST_STARTPOINT]
+declaration=ls
+category=LineString Properties
+description=Returns the Point that is the start point of the LineString value ls.\n\nST_StartPoint() and StartPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = 'LineString(1 1,2 2,3 3)';\n\nSELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_startpoint/
[ST_SYMDIFFERENCE]
declaration=g1,g2
category=Geometry Constructors
-description=Returns a geometry that represents the portions of geometry\ng1 and geometry g2 that don''t intersect.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(10 20, 10 40)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(10 15, 10 25)'');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n \nSET @g2 = ST_GeomFromText(''LINESTRING(10 20, 10 41)'');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41) |\n+-----------------------------------+
+description=Returns a geometry that represents the portions of geometry g1 and geometry g2\nthat don't intersect.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('LINESTRING(10 20, 10 40)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(10 15, 10 25)');\n\nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n\nSET @g2 = ST_GeomFromText('LINESTRING(10 20, 10 41)');\n\nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41) |\n+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_symdifference/
[ST_TOUCHES]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 spatially\ntouches geometry g2. Two geometries spatially touch if the\ninteriors of the geometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nST_TOUCHES() uses object shapes, while TOUCHES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 0)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 0, 0 2)'');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 1)'');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+
+description=Returns 1 or 0 to indicate whether geometry g1 spatially touches geometry g2.\nTwo geometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either the\nboundary or the interior of the other.\n\nST_TOUCHES() uses object shapes, while TOUCHES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(2 0)');\n\nSET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 0, 0 2)');\n\nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(2 1)');\n\nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/st-touches/
[ST_UNION]
declaration=g1,g2
category=Geometry Constructors
-description=Returns a geometry that is the union of the geometry g1 and\ngeometry g2.\n \n\nSET @g1 = GEOMFROMTEXT(''POINT (0 2)'');\n \nSET @g2 = GEOMFROMTEXT(''POINT (2 0)'');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2) |\n+---------------------------+\n \nSET @g1 = GEOMFROMTEXT(''POLYGON((0 0,0 3,3 3,3 0,0 0))'');\n \nSET @g2 = GEOMFROMTEXT(''POLYGON((2 2,4 2,4 4,2 4,2 2))'');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+------------------------------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+------------------------------------------------+\n| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |\n+------------------------------------------------+
+description=Returns a geometry that is the union of the geometry g1 and geometry g2.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT('POINT (0 2)');\n\nSET @g2 = GEOMFROMTEXT('POINT (2 0)');\n\nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2) |\n+---------------------------+\n\nSET @g1 = GEOMFROMTEXT('POLYGON((0 0,0 3,3 3,3 0,0 0))');\n\nSET @g2 = GEOMFROMTEXT('POLYGON((2 2,4 2,4 4,2 4,2 2))');\n\nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+------------------------------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+------------------------------------------------+\n| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_union/
[ST_WITHIN]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether geometry g1 is spatially\nwithin geometry g2.\n \nThis tests the opposite relationship as ST_CONTAINS().\n \nST_WITHIN() uses object shapes, while WITHIN(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(174 149)'');\n \nSET @g2 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))'');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(''POINT(176 151)'');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+
+description=Returns 1 or 0 to indicate whether geometry g1 is spatially within geometry g2.\n\nThis tests the opposite relationship as ST_CONTAINS().\n\nST_WITHIN() uses object shapes, while WITHIN(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(174 149)');\n\nSET @g2 = ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))');\n\nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n\nSET @g1 = ST_GEOMFROMTEXT('POINT(176 151)');\n\nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/st-within/
[ST_X]
declaration=p
category=Point Properties
-description=Returns the X-coordinate value for the point p as a\ndouble-precision number.\n \nST_X() and X() are synonyms.\n \n\nSET @pt = ''Point(56.7 53.34)'';\n \nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+
+description=Returns the X-coordinate value for the point p as a double-precision number.\n\nST_X() and X() are synonyms.\n\nExamples\n--------\n\nSET @pt = 'Point(56.7 53.34)';\n\nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st_x/
[ST_Y]
declaration=p
category=Point Properties
-description=Returns the Y-coordinate value for the point p as a\ndouble-precision number.\n \nST_Y() and Y() are synonyms.\n \n\nSET @pt = ''Point(56.7 53.34)'';\n \nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+
-[SUBDATE1]
-name=SUBDATE
+description=Returns the Y-coordinate value for the point p as a double-precision number.\n\nST_Y() and Y() are synonyms.\n\nExamples\n--------\n\nSET @pt = 'Point(56.7 53.34)';\n\nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st_y/
+[SUBDATE]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument,\nSUBDATE()\nis a synonym for DATE_SUB(). See Date and Time Units for a\ncomplete list of permitted units. \n \nThe second form allows the use of an integer value for days.\nIn such\ncases, it is interpreted as the number of days to be\nsubtracted from\nthe date or datetime expression expr.\n \n\nSELECT DATE_SUB(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n \nSELECT SUBDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n \nSELECT SUBDATE(''2008-01-02 12:00:00'', 31);\n+------------------------------------+\n| SUBDATE(''2008-01-02 12:00:00'', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, SUBDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-09-27 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, SUBDATE(d, INTERVAL 10 MINUTE) from t1;\n \n+---------------------+--------------------------------+\n| d | SUBDATE(d, INTERVAL 10 MINUTE) |\n+---------------------+--------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-30 21:21:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 06:32:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 12:24:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 06:21:41 |\n| 2011-01-30 14:03:25 | 2011-01-30 13:53:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 11:09:34 |\n+---------------------+--------------------------------+
-[SUBDATE2]
-name=SUBDATE
-declaration=expr,days
-category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument,\nSUBDATE()\nis a synonym for DATE_SUB(). See Date and Time Units for a\ncomplete list of permitted units. \n \nThe second form allows the use of an integer value for days.\nIn such\ncases, it is interpreted as the number of days to be\nsubtracted from\nthe date or datetime expression expr.\n \n\nSELECT DATE_SUB(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n \nSELECT SUBDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n \nSELECT SUBDATE(''2008-01-02 12:00:00'', 31);\n+------------------------------------+\n| SUBDATE(''2008-01-02 12:00:00'', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, SUBDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-09-27 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, SUBDATE(d, INTERVAL 10 MINUTE) from t1;\n \n+---------------------+--------------------------------+\n| d | SUBDATE(d, INTERVAL 10 MINUTE) |\n+---------------------+--------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-30 21:21:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 06:32:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 12:24:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 06:21:41 |\n| 2011-01-30 14:03:25 | 2011-01-30 13:53:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 11:09:34 |\n+---------------------+--------------------------------+
-[SUBSTRING1]
-name=SUBSTRING
-declaration=str,pos
-category=String Functions
-description=The forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to ''oracle'', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT SUBSTRING(''Knowledgebase'',5);\n+------------------------------+\n| SUBSTRING(''Knowledgebase'',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(''MariaDB'' FROM 6);\n+-----------------------------+\n| SUBSTRING(''MariaDB'' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'',3,7);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -4);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -8, 4);\n+-----------------------------------+\n| SUBSTRING(''Knowledgebase'', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(''Knowledgebase'' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=''oracle'';\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+
-[SUBSTRING2]
-name=SUBSTRING
-declaration=str FROM pos
-category=String Functions
-description=The forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to ''oracle'', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT SUBSTRING(''Knowledgebase'',5);\n+------------------------------+\n| SUBSTRING(''Knowledgebase'',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(''MariaDB'' FROM 6);\n+-----------------------------+\n| SUBSTRING(''MariaDB'' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'',3,7);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -4);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -8, 4);\n+-----------------------------------+\n| SUBSTRING(''Knowledgebase'', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(''Knowledgebase'' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=''oracle'';\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+
-[SUBSTRING3]
-name=SUBSTRING
-declaration=str,pos,len
+description=When invoked with the INTERVAL form of the second argument, SUBDATE() is a\nsynonym for DATE_SUB(). See Date and Time Units for a complete list of\npermitted units.\n\nThe second form allows the use of an integer value for days. In such cases, it\nis interpreted as the number of days to be subtracted from the date or\ndatetime expression expr.\n\nExamples\n--------\n\nSELECT DATE_SUB('2008-01-02', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB('2008-01-02', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n\nSELECT SUBDATE('2008-01-02', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE('2008-01-02', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n\nSELECT SUBDATE('2008-01-02 12:00:00', 31);\n+------------------------------------+\n| SUBDATE('2008-01-02 12:00:00', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d, SUBDATE(d, 10) from t1;\n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n ...
+[SUBSTR]
+declaration=
category=String Functions
-description=The forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to ''oracle'', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT SUBSTRING(''Knowledgebase'',5);\n+------------------------------+\n| SUBSTRING(''Knowledgebase'',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(''MariaDB'' FROM 6);\n+-----------------------------+\n| SUBSTRING(''MariaDB'' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'',3,7);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -4);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -8, 4);\n+-----------------------------------+\n| SUBSTRING(''Knowledgebase'', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(''Knowledgebase'' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=''oracle'';\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+
-[SUBSTRING4]
-name=SUBSTRING
-declaration=str FROM pos FOR len
+description=URL: https://mariadb.com/kb/en/substr/
+[SUBSTRING]
+declaration=str,pos
category=String Functions
-description=The forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to ''oracle'', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT SUBSTRING(''Knowledgebase'',5);\n+------------------------------+\n| SUBSTRING(''Knowledgebase'',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(''MariaDB'' FROM 6);\n+-----------------------------+\n| SUBSTRING(''MariaDB'' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'',3,7);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -4);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'', -8, 4);\n+-----------------------------------+\n| SUBSTRING(''Knowledgebase'', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(''Knowledgebase'' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(''Knowledgebase'' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=''oracle'';\n \nSELECT SUBSTR(''abc'',0,3);\n+-------------------+\n| SUBSTR(''abc'',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(''abc'',1,2);\n+-------------------+\n| SUBSTR(''abc'',1,2) |\n+-------------------+\n| ab |\n+-------------------+
+description=The forms without a len argument return a substring from string str starting\nat position pos.\n\nThe forms with a len argument return a substring len characters long from\nstring str, starting at position pos.\n\nThe forms that use FROM are standard SQL syntax.\n\nIt is also possible to use a negative value for pos. In this case, the\nbeginning of the substring is pos characters from the end of the string,\nrather than the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nBy default, the position of the first character in the string from which the\nsubstring is to be extracted is reckoned as 1. For Oracle-compatibility, from\nMariaDB 10.3.3, when sql_mode is set to 'oracle', position zero is treated as\nposition 1 (although the first character is still reckoned as 1).\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT SUBSTRING('Knowledgebase',5);\n+------------------------------+\n| SUBSTRING('Knowledgebase',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n\nSELECT SUBSTRING('MariaDB' FROM 6);\n+-----------------------------+\n| SUBSTRING('MariaDB' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n\nSELECT SUBSTRING('Knowledgebase',3,7);\n+--------------------------------+\n| SUBSTRING('Knowledgebase',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n\nSELECT SUBSTRING('Knowledgebase', -4);\n+--------------------------------+\n| SUBSTRING('Knowledgebase', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n ...
[SUBSTRING_INDEX]
declaration=str,delim,count
category=String Functions
-description=Returns the substring from string str before count\noccurrences of the\ndelimiter delim. If count is positive, everything to the\nleft\nof the final delimiter (counting from the left) is returned.\nIf count\nis negative, everything to the right of the final delimiter\n(counting from the\nright) is returned. SUBSTRING_INDEX() performs a\ncase-sensitive match when\nsearching for delim.\n \nIf any argument is NULL, returns NULL.\n \n\nSELECT SUBSTRING_INDEX(''www.mariadb.org'', ''.'', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX(''www.mariadb.org'', ''.'', 2) |\n+--------------------------------------------+\n| www.mariadb |\n+--------------------------------------------+\n \nSELECT SUBSTRING_INDEX(''www.mariadb.org'', ''.'', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX(''www.mariadb.org'', ''.'', -2) |\n+---------------------------------------------+\n| mariadb.org |\n+---------------------------------------------+
+description=Returns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the final\ndelimiter (counting from the left) is returned. If count is negative,\neverything to the right of the final delimiter (counting from the right) is\nreturned. SUBSTRING_INDEX() performs a case-sensitive match when searching for\ndelim.\n\nIf any argument is NULL, returns NULL.\n\nFor example\n\nSUBSTRING_INDEX('www.mariadb.org', '.', 2)\n\nmeans "Return all of the characters up to the 2nd occurrence of ."\n\nExamples\n--------\n\nSELECT SUBSTRING_INDEX('www.mariadb.org', '.', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX('www.mariadb.org', '.', 2) |\n+--------------------------------------------+\n| www.mariadb |\n+--------------------------------------------+\n\nSELECT SUBSTRING_INDEX('www.mariadb.org', '.', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX('www.mariadb.org', '.', -2) |\n+---------------------------------------------+\n| mariadb.org |\n+---------------------------------------------+\n\nURL: https://mariadb.com/kb/en/substring_index/
[SUBTIME]
declaration=expr1,expr2
category=Date and Time Functions
-description=SUBTIME() returns expr1 - expr2 expressed as a value in the\nsame\nformat as expr1. expr1 is a time or datetime expression, and\nexpr2 is\na time expression.\n \n\nSELECT SUBTIME(''2007-12-31 23:59:59.999999'',''1\n1:1:1.000002'');\n+--------------------------------------------------------+\n| SUBTIME(''2007-12-31 23:59:59.999999'',''1 1:1:1.000002'')\n|\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997 |\n+--------------------------------------------------------+\n \nSELECT SUBTIME(''01:00:00.999999'', ''02:00:00.999998'');\n+-----------------------------------------------+\n| SUBTIME(''01:00:00.999999'', ''02:00:00.999998'') |\n+-----------------------------------------------+\n| -00:59:59.999999 |\n+-----------------------------------------------+
+description=SUBTIME() returns expr1 - expr2 expressed as a value in the same format as\nexpr1. expr1 is a time or datetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT SUBTIME('2007-12-31 23:59:59.999999','1 1:1:1.000002');\n+--------------------------------------------------------+\n| SUBTIME('2007-12-31 23:59:59.999999','1 1:1:1.000002') |\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997 |\n+--------------------------------------------------------+\n\nSELECT SUBTIME('01:00:00.999999', '02:00:00.999998');\n+-----------------------------------------------+\n| SUBTIME('01:00:00.999999', '02:00:00.999998') |\n+-----------------------------------------------+\n| -00:59:59.999999 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/subtime/
[SUM]
declaration=[DISTINCT] expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the sum of expr. If the return set has no rows,\nSUM() returns\nNULL. The DISTINCT keyword can be used to sum only the\ndistinct values\nof expr.\n \nFrom MariaDB 10.2.0, SUM() can be used as a window function,\nalthough not with the DISTINCT specifier.\n \n\nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT SUM(sales_value) FROM sales;\n \n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n \nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n \nCommonly, SUM is used with a GROUP BY clause:\n \nCREATE TABLE sales (name CHAR(10), month CHAR(10), units\nINT);\n \nINSERT INTO sales VALUES \n (''Chun'', ''Jan'', 75), (''Chun'', ''Feb'', 73),\n (''Esben'', ''Jan'', 43), (''Esben'', ''Feb'', 31),\n (''Kaolin'', ''Jan'', 56), (''Kaolin'', ''Feb'', 88),\n (''Tatiana'', ''Jan'', 87), (''Tatiana'', ''Feb'', 83);\n \nSELECT name, SUM(units) FROM sales GROUP BY name;\n \n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n \nThe GROUP BY clause is required when using an aggregate\nfunction along with regular column data, otherwise the\nresult will be a mismatch, as in the following common type\nof mistake:\n \nSELECT name,SUM(units) FROM sales\n;\n+------+------------+\n| name | SUM(units) |\n+------+------------+\n| Chun | 536 |\n+------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, SUM(score) OVER (PARTITION BY\nname) AS total_score FROM student_test;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 148 |\n| Chun | Tuning | 73 | 148 |\n| Esben | SQL | 43 | 74 |\n| Esben | Tuning | 31 | 74 |\n| Kaolin | SQL | 56 | 144 |\n| Kaolin | Tuning | 88 | 144 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+-------------+
+description=Returns the sum of expr. If the return set has no rows, SUM() returns NULL.\nThe DISTINCT keyword can be used to sum only the distinct values of expr.\n\nSUM() can be used as a window function, although not with the DISTINCT\nspecifier.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT SUM(sales_value) FROM sales;\n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n\nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n\nCommonly, SUM is used with a GROUP BY clause:\n\nCREATE TABLE sales (name CHAR(10), month CHAR(10), units INT);\n\nINSERT INTO sales VALUES \n ('Chun', 'Jan', 75), ('Chun', 'Feb', 73),\n ('Esben', 'Jan', 43), ('Esben', 'Feb', 31),\n ('Kaolin', 'Jan', 56), ('Kaolin', 'Feb', 88),\n ('Tatiana', 'Jan', 87), ('Tatiana', 'Feb', 83);\n\nSELECT name, SUM(units) FROM sales GROUP BY name;\n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n\nThe GROUP BY clause is required when using an aggregate function along with\nregular column data, otherwise the result will be a mismatch, as in the\nfollowing common type of mistake:\n\n ...
[SYSDATE]
declaration=[precision]
category=Date and Time Functions
-description=Returns the current date and time as a value in ''YYYY-MM-DD\nHH:MM:SS''\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nSYSDATE() returns the time at which it executes. This\ndiffers from the\nbehavior for NOW(), which returns a constant time that\nindicates the\ntime at which the statement began to execute. (Within a\nstored routine\nor trigger, NOW() returns the time at which the routine or\ntriggering\nstatement began to execute.)\n \nIn addition, changing the timestamp system variable with a\nSET timestamp statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp\nsettings in the\nbinary log have no effect on invocations of SYSDATE().\n \nBecause SYSDATE() can return different values even within\nthe same\nstatement, and is not affected by SET TIMESTAMP, it is\nnon-deterministic and therefore unsafe for replication if\nstatement-based binary logging is used. If that is a\nproblem, you can\nuse row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias\nfor NOW(). The non-deterministic nature of SYSDATE() also\nmeans that indexes cannot be used for evaluating expressions\nthat refer to it, and that statements using the SYSDATE()\nfunction are unsafe for statement-based replication.\n \n\nDifference between NOW() and SYSDATE():\n \nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n \nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n \nWith precision:\n \nSELECT SYSDATE(4);\n+--------------------------+\n| SYSDATE(4) |\n+--------------------------+\n| 2018-07-10 10:17:13.1689 |\n+--------------------------+
+description=Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the time at\nwhich the statement began to execute. (Within a stored routine or trigger,\nNOW() returns the time at which the routine or triggering statement began to\nexecute.)\n\nIn addition, changing the timestamp system variable with a SET timestamp\nstatement affects the value returned by NOW() but not by SYSDATE(). This means\nthat timestamp settings in the binary log have no effect on invocations of\nSYSDATE().\n\nBecause SYSDATE() can return different values even within the same statement,\nand is not affected by SET TIMESTAMP, it is non-deterministic and therefore\nunsafe for replication if statement-based binary logging is used. If that is a\nproblem, you can use row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias for NOW(). The\nnon-deterministic nature of SYSDATE() also means that indexes cannot be used\nfor evaluating expressions that refer to it, and that statements using the\nSYSDATE() function are unsafe for statement-based replication.\n\nExamples\n--------\n\nDifference between NOW() and SYSDATE():\n\nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n\nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n\nWith precision:\n\nSELECT SYSDATE(4);\n+--------------------------+\n ...
[SYSTEM_USER]
declaration=
category=Information Functions
-description=SYSTEM_USER() is a synonym for USER().
+description=SYSTEM_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/system_user/
+[SYS_GUID]
+declaration=
+category=Miscellaneous Functions
+description=Returns a 16-byte globally unique identifier (GUID), similar to the UUID\nfunction, but without the - character.\n\nExample\n-------\n\nSELECT SYS_GUID();\n+----------------------------------+\n| SYS_GUID() |\n+----------------------------------+\n| 2C574E45BA2811EBB265F859713E4BE4 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/sys_guid/
[TAN]
declaration=X
category=Numeric Functions
-description=Returns the tangent of X, where X is given in radians.\n \n\nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n \nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n \nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n \nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+
+description=Returns the tangent of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n\nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n\nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n\nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/tan/
+[TEXT]
+declaration=M
+category=Data Types
+description=A TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte characters.\nEach TEXT value is stored using a two-byte length prefix that indicates the\nnumber of bytes in the value. If you need a bigger storage, consider using\nMEDIUMTEXT instead.\n\nAn optional length M can be given for this type. If this is done, MariaDB\ncreates the column as the smallest TEXT type large enough to hold values M\ncharacters long.\n\nBefore MariaDB 10.2, all MariaDB collations were of type PADSPACE, meaning\nthat TEXT (as well as VARCHAR and CHAR values) are compared without regard for\ntrailing spaces. This does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces.\n\nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be assigned a DEFAULT\nvalue. This restriction was lifted in MariaDB 10.2.1.\n\nExamples\n--------\n\nTrailing spaces:\n\nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES('Maria ');\n\nSELECT d='Maria',d='Maria ' FROM strtest;\n+-----------+--------------+\n| d='Maria' | d='Maria ' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n\nSELECT d LIKE 'Maria',d LIKE 'Maria ' FROM strtest;\n+----------------+-------------------+\n| d LIKE 'Maria' | d LIKE 'Maria ' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n\nIndexing\n--------\n\nTEXT columns can only be indexed over a specified length. This means that they\ncannot be used as the primary key of a table norm until MariaDB 10.4, can a\nunique index be created on them.\n\nMariaDB starting with 10.4\n--------------------------\nStarting with MariaDB 10.4, a unique index can be created on a TEXT column.\n ...
+[TIME]
+declaration=
+category=Data Types
+description=A time. The range is '-838:59:59.999999' to '838:59:59.999999'. Microsecond\nprecision can be from 0-6; if not specified 0 is used. Microseconds have been\navailable since MariaDB 5.3.\n\nMariaDB displays TIME values in 'HH:MM:SS.ssssss' format, but allows\nassignment of times in looser formats, including 'D HH:MM:SS', 'HH:MM:SS',\n'HH:MM', 'D HH:MM', 'D HH', 'SS', or 'HHMMSS', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for example '3:9:10'. For\ndetails, see date and time literals.\n\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store TIMEs using the same low-level format MySQL 5.6\nuses.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable's tablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIME column in your table:\n\nSHOW VARIABLES LIKE 'mysql56_temporal_format';\n\n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIME;\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\n ...
[TIMEDIFF]
declaration=expr1,expr2
category=Date and Time Functions
-description=TIMEDIFF() returns expr1 - expr2 expressed as a time value.\nexpr1 and\nexpr2 are time or date-and-time expressions, but both must\nbe of the\nsame type.\n \n\nSELECT TIMEDIFF(''2000:01:01 00:00:00'', ''2000:01:01\n00:00:00.000001'');\n+---------------------------------------------------------------+\n| TIMEDIFF(''2000:01:01 00:00:00'', ''2000:01:01\n00:00:00.000001'') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n \nSELECT TIMEDIFF(''2008-12-31 23:59:59.000001'', ''2008-12-30\n01:01:01.000002'');\n+----------------------------------------------------------------------+\n| TIMEDIFF(''2008-12-31 23:59:59.000001'', ''2008-12-30\n01:01:01.000002'') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\n+----------------------------------------------------------------------+
+description=TIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and expr2\nare time or date-and-time expressions, but both must be of the same type.\n\nExamples\n--------\n\nSELECT TIMEDIFF('2000:01:01 00:00:00', '2000:01:01 00:00:00.000001');\n+---------------------------------------------------------------+\n| TIMEDIFF('2000:01:01 00:00:00', '2000:01:01 00:00:00.000001') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n\nSELECT TIMEDIFF('2008-12-31 23:59:59.000001', '2008-12-30 01:01:01.000002');\n+----------------------------------------------------------------------+\n| TIMEDIFF('2008-12-31 23:59:59.000001', '2008-12-30 01:01:01.000002') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\n+----------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/timediff/
+[TIMESTAMP]
+declaration==3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n ...
+[UNIX_TIMESTAMP]
declaration=
category=Date and Time Functions
-description=If called with no argument, returns a Unix timestamp\n(seconds since\n''1970-01-01 00:00:00'' UTC) as an unsigned integer. If\nUNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the\nargument as seconds\nsince ''1970-01-01 00:00:00'' UTC. date may be a DATE\nstring, a\nDATETIME string, a TIMESTAMP, or a number in\nthe format YYMMDD or YYYYMMDD. The server interprets date as\na value in the\ncurrent time zone and converts it to an internal value in\nUTC. Clients can set\ntheir time zone as described in time zones.\n \nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n \nUNIX_TIMESTAMP() supports microseconds.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a date\nbeyond this will result in NULL being returned. Use DATETIME\nas a storage type if you require dates beyond this.\n \nError Handling\n \nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In\nMySQL and MariaDB before 5.3 wrong arguments to\nUNIX_TIMESTAMP() returned 0. \n \nCompatibility\n \nAs you can see in the examples above,\nUNIX_TIMESTAMP(constant-date-string) returns a timestamp\nwith 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using\nUNIX_TIMESTAMP() as a partitioning function. You can fix\nthis by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date\nstring to a date number, like 20080101000000. \n \n\nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n \nSELECT UNIX_TIMESTAMP(''2007-11-30 10:30:19'');\n+---------------------------------------+\n| UNIX_TIMESTAMP(''2007-11-30 10:30:19'') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n \nSELECT UNIX_TIMESTAMP("2007-11-30 10:30:19.123456");\n+----------------------------------------------+\n| unix_timestamp("2007-11-30 10:30:19.123456") |\n+----------------------------------------------+\n| 1196411419.123456 |\n+----------------------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30\n10:30:19''));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30 10:30:19'')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+------------------------------------------------------+\n \nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30\n10:30:19'')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30\n10:30:19''))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\n+-------------------------------------------------------------+
-[UNIX_TIMESTAMP2]
-name=UNIX_TIMESTAMP
-declaration=date
-category=Date and Time Functions
-description=If called with no argument, returns a Unix timestamp\n(seconds since\n''1970-01-01 00:00:00'' UTC) as an unsigned integer. If\nUNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the\nargument as seconds\nsince ''1970-01-01 00:00:00'' UTC. date may be a DATE\nstring, a\nDATETIME string, a TIMESTAMP, or a number in\nthe format YYMMDD or YYYYMMDD. The server interprets date as\na value in the\ncurrent time zone and converts it to an internal value in\nUTC. Clients can set\ntheir time zone as described in time zones.\n \nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n \nUNIX_TIMESTAMP() supports microseconds.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a date\nbeyond this will result in NULL being returned. Use DATETIME\nas a storage type if you require dates beyond this.\n \nError Handling\n \nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In\nMySQL and MariaDB before 5.3 wrong arguments to\nUNIX_TIMESTAMP() returned 0. \n \nCompatibility\n \nAs you can see in the examples above,\nUNIX_TIMESTAMP(constant-date-string) returns a timestamp\nwith 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using\nUNIX_TIMESTAMP() as a partitioning function. You can fix\nthis by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date\nstring to a date number, like 20080101000000. \n \n\nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n \nSELECT UNIX_TIMESTAMP(''2007-11-30 10:30:19'');\n+---------------------------------------+\n| UNIX_TIMESTAMP(''2007-11-30 10:30:19'') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n \nSELECT UNIX_TIMESTAMP("2007-11-30 10:30:19.123456");\n+----------------------------------------------+\n| unix_timestamp("2007-11-30 10:30:19.123456") |\n+----------------------------------------------+\n| 1196411419.123456 |\n+----------------------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30\n10:30:19''));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30 10:30:19'')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+------------------------------------------------------+\n \nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30\n10:30:19'')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30\n10:30:19''))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\n+-------------------------------------------------------------+
+description=If called with no argument, returns a Unix timestamp (seconds since\n'1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is\ncalled with a date argument, it returns the value of the argument as seconds\nsince '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string,\na TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server\ninterprets date as a value in the current time zone and converts it to an\ninternal value in UTC. Clients can set their time zone as described in time\nzones.\n\nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n\nUNIX_TIMESTAMP() supports microseconds.\n\nTimestamps in MariaDB have a maximum value of 2147483647, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a date beyond this will result in NULL being returned. Use\nDATETIME as a storage type if you require dates beyond this.\n\nError Handling\n--------------\n\nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In MySQL and MariaDB\nbefore 5.3 wrong arguments to UNIX_TIMESTAMP() returned 0.\n\nCompatibility\n-------------\n\nAs you can see in the examples above, UNIX_TIMESTAMP(constant-date-string)\nreturns a timestamp with 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using UNIX_TIMESTAMP()\nas a partitioning function. You can fix this by using\nFLOOR(UNIX_TIMESTAMP(..)) or changing the date string to a date number, like\n20080101000000.\n\nExamples\n--------\n\nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n\nSELECT UNIX_TIMESTAMP('2007-11-30 10:30:19');\n+---------------------------------------+\n| UNIX_TIMESTAMP('2007-11-30 10:30:19') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n ...
[UPDATEXML]
declaration=xml_target, xpath_expr, new_xml
category=String Functions
-description=This function replaces a single portion of a given fragment\nof XML markup\nxml_target with a new XML fragment new_xml, and then returns\nthe\nchanged XML. The portion of xml_target that is replaced\nmatches an XPath\nexpression xpath_expr supplied by the user. If no expression\nmatching\nxpath_expr is found, or if multiple matches are found, the\nfunction returns\nthe original xml_target XML fragment. All three arguments\nshould be\nstrings.\n \n\nSELECT\n UpdateXML(''ccc'', ''/a'', ''fff'') AS val1,\n UpdateXML(''ccc'', ''/b'', ''fff'') AS val2,\n UpdateXML(''ccc'', ''//b'', ''fff'') AS val3,\n UpdateXML(''ccc'', ''/a/d'', ''fff'') AS val4,\n UpdateXML(''ccc'', ''/a/d'', ''fff'') AS val5\n \G\n*************************** 1. row\n***************************\nval1: fff\nval2: ccc\nval3: fff\nval4: cccfff\nval5: ccc\n1 row in set (0.00 sec)
+description=This function replaces a single portion of a given fragment of XML markup\nxml_target with a new XML fragment new_xml, and then returns the changed XML.\nThe portion of xml_target that is replaced matches an XPath expression\nxpath_expr supplied by the user. If no expression matching xpath_expr is\nfound, or if multiple matches are found, the function returns the original\nxml_target XML fragment. All three arguments should be strings.\n\nExamples\n--------\n\nSELECT\n UpdateXML('ccc', '/a', 'fff') AS val1,\n UpdateXML('ccc', '/b', 'fff') AS val2,\n UpdateXML('ccc', '//b', 'fff') AS val3,\n UpdateXML('ccc', '/a/d', 'fff') AS val4,\n UpdateXML('ccc', '/a/d', 'fff') AS val5\n \G\n*************************** 1. row ***************************\nval1: fff\nval2: ccc\nval3: fff\nval4: cccfff\nval5: ccc\n1 row in set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/updatexml/
[UPPER]
declaration=str
category=String Functions
-description=Returns the string str with all characters changed to\nuppercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nSELECT UPPER(surname), givenname FROM users ORDER BY\nsurname;\n \n+----------------+------------+\n| UPPER(surname) | givenname |\n+----------------+------------+\n| ABEL | Jacinto |\n| CASTRO | Robert |\n| COSTA | Phestos |\n| MOSCHELLA | Hippolytos |\n+----------------+------------+\n \nUPPER() is ineffective when applied to binary strings\n(BINARY,\nVARBINARY, BLOB). The description of \nLOWER() shows how to\nperform lettercase conversion of binary strings.
+description=Returns the string str with all characters changed to uppercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nUCASE is a synonym.\n\nSELECT UPPER(surname), givenname FROM users ORDER BY surname;\n+----------------+------------+\n| UPPER(surname) | givenname |\n+----------------+------------+\n| ABEL | Jacinto |\n| CASTRO | Robert |\n| COSTA | Phestos |\n| MOSCHELLA | Hippolytos |\n+----------------+------------+\n\nUPPER() is ineffective when applied to binary strings (BINARY, VARBINARY,\nBLOB). The description of LOWER() shows how to perform lettercase conversion\nof binary strings.\n\nPrior to MariaDB 11.3, the query optimizer did not handle queries of the\nformat UCASE(varchar_col)=.... An optimizer_switch option,\nsargable_casefold=ON, was added in MariaDB 11.3.0 to handle this case.\n(MDEV-31496)\n\nURL: https://mariadb.com/kb/en/upper/
[USER]
declaration=
category=Information Functions
-description=Returns the current MariaDB user name and host name, given\nwhen authenticating to MariaDB, as a string in the utf8\ncharacter set.\n \nNote that the value of USER() may differ from the value of\nCURRENT_USER(), which is the user used to authenticate the\ncurrent client. \nCURRENT_ROLE() returns the current active role.\n \nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n \nStatements using the USER() function or one of its synonyms\nare not safe for statement level replication.\n \n\nshell> mysql --user="anonymous"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+
+description=Returns the current MariaDB user name and host name, given when authenticating\nto MariaDB, as a string in the utf8 character set.\n\nNote that the value of USER() may differ from the value of CURRENT_USER(),\nwhich is the user used to authenticate the current client. CURRENT_ROLE()\nreturns the current active role.\n\nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n\nStatements using the USER() function or one of its synonyms are not safe for\nstatement level replication.\n\nExamples\n--------\n\nshell> mysql --user="anonymous"\n\nSELECT USER(),CURRENT_USER();\n+---------------------+----------------+\n| USER() | CURRENT_USER() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n\nTo select only the IP address, use SUBSTRING_INDEX(),\n\nSELECT SUBSTRING_INDEX(USER(), '@', -1);\n+----------------------------------+\n| SUBSTRING_INDEX(USER(), '@', -1) |\n+----------------------------------+\n| 192.168.0.101 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/user/
+[UTC_DATE]
+declaration=
+category=Date and Time Functions
+description=Returns the current UTC date as a value in 'YYYY-MM-DD' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric context.\n\nExamples\n--------\n\nSELECT UTC_DATE(), UTC_DATE() + 0;\n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\n+------------+----------------+\n\nURL: https://mariadb.com/kb/en/utc_date/
+[UTC_TIME]
+declaration=[precision]
+category=Date and Time Functions
+description=Returns the current UTC time as a value in 'HH:MM:SS' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIME(), UTC_TIME() + 0;\n+------------+----------------+\n| UTC_TIME() | UTC_TIME() + 0 |\n+------------+----------------+\n| 17:32:34 | 173234.000000 |\n+------------+----------------+\n\nWith precision:\n\nSELECT UTC_TIME(5);\n+----------------+\n| UTC_TIME(5) |\n+----------------+\n| 07:52:50.78369 |\n+----------------+\n\nURL: https://mariadb.com/kb/en/utc_time/
+[UTC_TIMESTAMP]
+declaration=[precision]
+category=Date and Time Functions
+description=Returns the current UTC date and time as a value in 'YYYY-MM-DD HH:MM:SS' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n+---------------------+-----------------------+\n| UTC_TIMESTAMP() | UTC_TIMESTAMP() + 0 |\n+---------------------+-----------------------+\n| 2010-03-27 17:33:16 | 20100327173316.000000 |\n+---------------------+-----------------------+\n\nWith precision:\n\nSELECT UTC_TIMESTAMP(4);\n+--------------------------+\n| UTC_TIMESTAMP(4) |\n+--------------------------+\n| 2018-07-10 07:51:09.1019 |\n+--------------------------+\n\nURL: https://mariadb.com/kb/en/utc_timestamp/
[UUID]
declaration=
category=Miscellaneous Functions
-description=Returns a Universal Unique Identifier (UUID) generated\naccording to "DCE 1.1:\nRemote Procedure Call" (Appendix A) CAE (Common\nApplications Environment)\nSpecifications published by The Open Group in October\n1997 \n(Document Number C706).\n \nA UUID is designed as a number that is globally unique in\nspace and time. Two\ncalls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate\ncomputers that are\nnot connected to each other.\n \nA UUID is a 128-bit number represented by a utf8 string of\nfive\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\nThe first three numbers are generated from a timestamp.\nThe fourth number preserves temporal uniqueness in case the\ntimestamp value\n loses monotonicity (for example, due to daylight saving\ntime).\nThe fifth number is an IEEE 802 node number that provides\nspatial uniqueness.\n A random number is substituted if the latter is not\navailable (for example,\n because the host computer has no Ethernet card, or we do\nnot know how to find\n the hardware address of an interface on your operating\nsystem). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a\ncollision should\n have very low probability.\n \nCurrently, the MAC address of an interface is taken into\naccount only on FreeBSD and Linux. On other operating\nsystems, MariaDB uses a randomly generated 48-bit number.\n \nStatements using the UUID() function are not safe for\nreplication.\n \nUUID() results are intended to be unique, but cannot always\nbe relied upon to unpredictable and unguessable, so should\nnot be relied upon for these purposes.\n \n\nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+
+description=Returns a Universally Unique Identifier (UUID).\n\nA UUID is designed as a number that is globally unique in space and time. Two\ncalls to UUID() are expected to generate two different values, even if these\ncalls are performed on two separate computers that are not connected to each\nother.\n\nUUID() results are intended to be unique, but cannot always be relied upon to\nbe unpredictable and unguessable.\n\nA UUID is a 128-bit number represented by a utf8 string of five hexadecimal\nnumbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\n* The first three numbers are generated from a timestamp.\n* The fourth number preserves temporal uniqueness in case the timestamp value\n loses monotonicity (for example, due to daylight saving time).\n* The fifth number is an IEEE 802 node number that provides spatial uniqueness.\n A random number is substituted if the latter is not available (for example,\n because the host computer has no Ethernet card, or we do not know how to find\n the hardware address of an interface on your operating system). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a collision should\n have very low probability.\n\nCurrently, the MAC address of an interface is taken into account only on\nFreeBSD and Linux. On other operating systems, MariaDB uses a randomly\ngenerated 48-bit number.\n\nStatements using the UUID() function are not safe for statement-based\nreplication.\n\nThe function generates a UUIDv1 and the results are generated according to the\n"DCE 1.1:Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706).\n\nExamples\n--------\n\nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/uuid/
[UUID_SHORT]
declaration=
category=Miscellaneous Functions
-description=Returns a "short" universal identifier as a 64-bit\nunsigned integer (rather\nthan a string-form 128-bit identifier as returned by the\nUUID() function).\n \nThe value of UUID_SHORT() is guaranteed to be unique if the\nfollowing conditions hold:\nThe server_id of the current host is unique among your set\nof master and\n slave servers\nserver_id is between 0 and 255\nYou don''t set back your system time for your server between\nmysqld restarts\nYou do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n \nThe UUID_SHORT() return value is constructed this way:\n \n (server_id & 255)
+description=Returns a "short" universally unique identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\n* The server_id of the current host is unique among your set of master and\n slave servers\n* server_id is between 0 and 255\n* You don't set back your system time for your server between mysqld restarts\n* You do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n(server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nStatements using the UUID_SHORT() function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nSELECT UUID_SHORT();\n+-------------------+\n| UUID_SHORT() |\n+-------------------+\n| 21517162376069120 |\n+-------------------+\n\ncreate table t1 (a bigint unsigned default(uuid_short()) primary key);\ninsert into t1 values(),();\nselect * from t1;\n+-------------------+\n| a |\n+-------------------+\n| 98113699159474176 |\n| 98113699159474177 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/uuid_short/
[VARBINARY]
declaration=M
category=Data Types
-description=The VARBINARY type is similar to the VARCHAR type, but\nstores binary byte strings rather than non-binary character\nstrings. M represents the maximum column length in bytes. \n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nUnlike BINARY values, VARBINARYs are not right-padded when\ninserting.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, RAW is a synonym for\nVARBINARY.\n \n\nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE varbins (a VARBINARY(10));\n \nINSERT INTO varbins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM varbins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=''STRICT_ALL_TABLES'';\n \nINSERT INTO varbins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE varbins;\n \nINSERT INTO varbins VALUES(''A''),(''B''),(''a''),(''b'');\n \nSELECT * FROM varbins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM varbins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+
+description=The VARBINARY type is similar to the VARCHAR type, but stores binary byte\nstrings rather than non-binary character strings. M represents the maximum\ncolumn length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the\nnumeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the\nextra characters will be dropped with a warning. If strict mode is enabled, an\nerror will occur.\n\nUnlike BINARY values, VARBINARYs are not right-padded when inserting.\n\nOracle Mode\n-----------\n\nIn Oracle mode from MariaDB 10.3, RAW is a synonym for VARBINARY.\n\nExamples\n--------\n\nInserting too many characters, first with strict mode off, then with it on:\n\nCREATE TABLE varbins (a VARBINARY(10));\n\nINSERT INTO varbins VALUES('12345678901');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM varbins;\n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode='STRICT_ALL_TABLES';\n\nINSERT INTO varbins VALUES('12345678901');\nERROR 1406 (22001): Data too long for column 'a' at row 1\n\nSorting is performed with the byte value:\n\nTRUNCATE varbins;\n\nINSERT INTO varbins VALUES('A'),('B'),('a'),('b');\n\nSELECT * FROM varbins ORDER BY a;\n+------+\n| a |\n+------+\n ...
+[VARCHAR]
+declaration=M
+category=Data Types
+description=A variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,532. The effective maximum length of a\nVARCHAR is subject to the maximum row size and the character set used. For\nexample, utf8 characters can require up to three bytes per character, so a\nVARCHAR column that uses the utf8 character set can be declared to be a\nmaximum of 21,844 characters.\n\nNote: For the ColumnStore engine, M represents the maximum column length in\nbytes.\n\nMariaDB stores VARCHAR values as a one-byte or two-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A VARCHAR\ncolumn uses one length byte if values require no more than 255 bytes, two\nlength bytes if values may require more than 255 bytes.\n\nMariaDB follows the standard SQL specification, and does not remove trailing\nspaces from VARCHAR values.\n\nVARCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns\ncannot be part of an index. The CONNECT storage engine does not support\nVARCHAR(0).\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the standard\nSQL way to define that a VARCHAR column should use some predefined character\nset. MariaDB uses utf8 as this predefined character set, as does MySQL 4.1 and\nup. NVARCHAR is shorthand for NATIONAL VARCHAR.\n\nBefore MariaDB 10.2, all MariaDB collations were of type PADSPACE, meaning\nthat VARCHAR (as well as CHAR and TEXT values) are compared without regard for\ntrailing spaces. This does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2, a number of NO\nPAD collations are available.\n\nIf a unique index consists of a column where trailing pad characters are\nstripped or ignored, inserts into that column where values differ only by the\nnumber of trailing pad characters will result in a duplicate-key error.\n\nExamples\n--------\n\nThe following are equivalent:\n\nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n\nTrailing spaces:\n ...
[VARIANCE]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the population standard variance of expr. This is an\nextension to\nstandard SQL. The standard SQL function VAR_POP() can be\nused\ninstead.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VARIANCE() can be used as a window\nfunction.\n \nVARIANCE() returns NULL if there were no matching rows.\n \n\nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+
+description=Returns the population standard variance of expr. This is an extension to\nstandard SQL. The standard SQL function VAR_POP() can be used instead.\n\nVariance is calculated by\n\n* working out the mean for the set\n* for each number, subtracting the mean and squaring the result\n* calculate the average of the resulting differences\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVARIANCE() can be used as a window function.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n ...
[VAR_POP]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the population standard variance of expr. It\nconsiders rows as\nthe whole population, not as a sample, so it has the number\nof rows as\nthe denominator. You can also use VARIANCE(), which is\nequivalent but\nis not standard SQL.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_POP() can be used as a window\nfunction.\n \nVAR_POP() returns NULL if there were no matching rows.\n \n\nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+
+description=Returns the population standard variance of expr. It considers rows as the\nwhole population, not as a sample, so it has the number of rows as the\ndenominator. You can also use VARIANCE(), which is equivalent but is not\nstandard SQL.\n\nVariance is calculated by\n\n* working out the mean for the set\n* for each number, subtracting the mean and squaring the result\n* calculate the average of the resulting differences\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_POP() can be used as a window function.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n ...
[VAR_SAMP]
declaration=expr
category=Functions and Modifiers for Use with GROUP BY
-description=Returns the sample variance of expr. That is, the\ndenominator is the number of rows minus one.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_SAMP() can be used as a window\nfunction.\n \nVAR_SAMP() returns NULL if there were no matching rows.\n \n\nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (''a'',1),(''a'',2),(''a'',3),\n (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n (''Tatiana'', ''SQL'', 87);\n \nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n| Kaolin | Tuning | 88 | 873.0000 |\n| Tatiana | SQL | 87 | 382.9167 |\n+---------+--------+-------+------------------+
+description=Returns the sample variance of expr. That is, the denominator is the number of\nrows minus one.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_SAMP() can be used as a window function.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n ('a',1),('a',2),('a',3),\n ('b',11),('b',12),('b',20),('b',30),('b',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n ('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),\n ('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),\n ('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),\n ('Tatiana', 'SQL', 87);\n\nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM student_test;\n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n ...
[VERSION]
declaration=
category=Information Functions
-description=Returns a string that indicates the MariaDB server version.\nThe string\nuses the utf8 character set.\n \n\nSELECT VERSION();\n+------------------------------+\n| VERSION() |\n+------------------------------+\n| 10.0.3-MariaDB-1~precise-log |\n+------------------------------+\n \nThe VERSION() string may have one or more of the following\nsuffixes:\n \nSuffix | Description | \n \n-embedded | The server is an embedded server (libmysqld). | \n \n-log | General logging, slow logging or binary (replication)\nlogging is enabled. | \n \n-debug | The server is compiled for debugging. | \n \n-valgrind | The server is compiled to be instrumented with\nvalgrind. | \n \nChanging the Version String\n \nSome old legacy code may break because they are parsing the\nVERSION string and expecting a MySQL string or a simple\nversion\nstring like Joomla til API17, see MDEV-7780.\n \nIn MariaDB 10.2 one can fool these applications by setting\nthe version string from the command line or the my.cnf files\nwith --version=....
+description=Returns a string that indicates the MariaDB server version. The string uses\nthe utf8 character set.\n\nExamples\n--------\n\nSELECT VERSION();\n+----------------+\n| VERSION() |\n+----------------+\n| 10.4.7-MariaDB |\n+----------------+\n\nThe VERSION() string may have one or more of the following suffixes:\n\n+---------------------------+------------------------------------------------+\n| Suffix | Description |\n+---------------------------+------------------------------------------------+\n| -embedded | The server is an embedded server |\n| | (libmariadbd). |\n+---------------------------+------------------------------------------------+\n| -log | General logging, slow logging or binary |\n| | (replication) logging is enabled. |\n+---------------------------+------------------------------------------------+\n| -debug | The server is compiled for debugging. |\n+---------------------------+------------------------------------------------+\n| -valgrind | The server is compiled to be instrumented |\n| | with valgrind. |\n+---------------------------+------------------------------------------------+\n\nChanging the Version String\n---------------------------\n\nSome old legacy code may break because they are parsing the VERSION string and\nexpecting a MySQL string or a simple version string like Joomla til API17, see\nMDEV-7780.\n\nOne can fool these applications by setting the version string from the command\nline or the my.cnf files with --version=....\n\nURL: https://mariadb.com/kb/en/version/
+[WEEK]
+declaration=date[,mode]
+category=Date and Time Functions
+description=This function returns the week number for date. The two-argument form of\nWEEK() allows you to specify whether the week starts on Sunday or Monday and\nwhether the return value should be in the range from 0 to 53 or from 1 to 53.\nIf the mode argument is omitted, the value of the default_week_format system\nvariable is used.\n\nModes\n-----\n\n+-------+---------------------+--------+------------------------------------+\n| Mode | 1st day of week | Range | Week 1 is the 1st week with |\n+-------+---------------------+--------+------------------------------------+\n| 0 | Sunday | 0-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 1 | Monday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 2 | Sunday | 1-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 3 | Monday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 4 | Sunday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 5 | Monday | 0-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 6 | Sunday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 7 | Monday | 1-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n\nWith the mode value of 3, which means 'more than 3 days this year', weeks are\nnumbered according to ISO 8601:1988.\n\nExamples\n--------\n\nSELECT WEEK('2008-02-20');\n+--------------------+\n| WEEK('2008-02-20') |\n+--------------------+\n| 7 |\n+--------------------+\n\nSELECT WEEK('2008-02-20',0);\n+----------------------+\n| WEEK('2008-02-20',0) |\n+----------------------+\n| 7 |\n+----------------------+\n\nSELECT WEEK('2008-02-20',1);\n ...
[WEEKDAY]
declaration=date
category=Date and Time Functions
-description=Returns the weekday index for date \n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nThis contrasts with DAYOFWEEK() which follows the ODBC\nstandard\n(1 = Sunday, 2 = Monday, ..., 7 = Saturday).\n \n\nSELECT WEEKDAY(''2008-02-03 22:23:00'');\n+--------------------------------+\n| WEEKDAY(''2008-02-03 22:23:00'') |\n+--------------------------------+\n| 6 |\n+--------------------------------+\n \nSELECT WEEKDAY(''2007-11-06'');\n+-----------------------+\n| WEEKDAY(''2007-11-06'') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d FROM t1 where WEEKDAY(d) = 6;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+
+description=Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n\nThis contrasts with DAYOFWEEK() which follows the ODBC standard (1 = Sunday, 2\n= Monday, ..., 7 = Saturday).\n\nExamples\n--------\n\nSELECT WEEKDAY('2008-02-03 22:23:00');\n+--------------------------------+\n| WEEKDAY('2008-02-03 22:23:00') |\n+--------------------------------+\n| 6 |\n+--------------------------------+\n\nSELECT WEEKDAY('2007-11-06');\n+-----------------------+\n| WEEKDAY('2007-11-06') |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT d FROM t1 where WEEKDAY(d) = 6;\n+---------------------+\n| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/weekday/
[WEEKOFYEAR]
declaration=date
category=Date and Time Functions
-description=Returns the calendar week of the date as a number in the\nrange from 1\nto 53. WEEKOFYEAR() is a compatibility function that is\nequivalent to\nWEEK(date,3).\n \n\nSELECT WEEKOFYEAR(''2008-02-20'');\n+--------------------------+\n| WEEKOFYEAR(''2008-02-20'') |\n+--------------------------+\n| 8 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \n select * from t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1;\n \n+---------------------+---------------+-----------+\n| d | WEEKOFYEAR(d) | WEEK(d,3) |\n+---------------------+---------------+-----------+\n| 2007-01-30 21:31:07 | 5 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 43 | 43 |\n| 2011-01-30 14:03:25 | 4 | 4 |\n| 2004-10-07 11:19:34 | 41 | 41 |\n+---------------------+---------------+-----------+
-[WEEK]
-declaration=date[,mode]
-category=Date and Time Functions
-description=This function returns the week number for date. The\ntwo-argument form of\nWEEK() allows you to specify whether the week starts on\nSunday or Monday\nand whether the return value should be in the range from 0\nto 53 or from 1 to\n53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used.\n \nModes\n \nMode | 1st day of week | Range | Week 1 is the 1st week with\n| \n \n0 | Sunday | 0-53 | a Sunday in this year | \n \n1 | Monday | 0-53 | more than 3 days this year | \n \n2 | Sunday | 1-53 | a Sunday in this year | \n \n3 | Monday | 1-53 | more than 3 days this year | \n \n4 | Sunday | 0-53 | more than 3 days this year | \n \n5 | Monday | 0-53 | a Monday in this year | \n \n6 | Sunday | 1-53 | more than 3 days this year | \n \n7 | Monday | 1-53 | a Monday in this year | \n \n\nSELECT WEEK(''2008-02-20'');\n+--------------------+\n| WEEK(''2008-02-20'') |\n+--------------------+\n| 7 |\n+--------------------+\n \nSELECT WEEK(''2008-02-20'',0);\n+----------------------+\n| WEEK(''2008-02-20'',0) |\n+----------------------+\n| 7 |\n+----------------------+\n \nSELECT WEEK(''2008-02-20'',1);\n+----------------------+\n| WEEK(''2008-02-20'',1) |\n+----------------------+\n| 8 |\n+----------------------+\n \nSELECT WEEK(''2008-12-31'',0);\n+----------------------+\n| WEEK(''2008-12-31'',0) |\n+----------------------+\n| 52 |\n+----------------------+\n \nSELECT WEEK(''2008-12-31'',1);\n+----------------------+\n| WEEK(''2008-12-31'',1) |\n+----------------------+\n| 53 |\n+----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT d, WEEK(d,0), WEEK(d,1) from t1;\n \n+---------------------+-----------+-----------+\n| d | WEEK(d,0) | WEEK(d,1) |\n+---------------------+-----------+-----------+\n| 2007-01-30 21:31:07 | 4 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 44 | 43 |\n| 2011-01-30 14:03:25 | 5 | 4 |\n| 2004-10-07 11:19:34 | 40 | 41 |\n+---------------------+-----------+-----------+
+description=Returns the calendar week of the date as a number in the range from 1 to 53.\nWEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).\n\nExamples\n--------\n\nSELECT WEEKOFYEAR('2008-02-20');\n+--------------------------+\n| WEEKOFYEAR('2008-02-20') |\n+--------------------------+\n| 8 |\n+--------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nselect * from t1;\n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n\nSELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1;\n+---------------------+---------------+-----------+\n| d | WEEKOFYEAR(d) | WEEK(d,3) |\n+---------------------+---------------+-----------+\n| 2007-01-30 21:31:07 | 5 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 43 | 43 |\n| 2011-01-30 14:03:25 | 4 | 4 |\n| 2004-10-07 11:19:34 | 41 | 41 |\n+---------------------+---------------+-----------+\n\nURL: https://mariadb.com/kb/en/weekofyear/
[WEIGHT_STRING]
-declaration=str [AS {CHAR|BINARY}(N)] [LEVEL levels] [flags]
+declaration=str [AS {CHAR|BINARY}(N
category=String Functions
-description=Returns a binary string representing the string''s sorting\nand comparison value. A string with a lower result means\nthat for sorting purposes the string appears before a string\nwith a higher result.\n \nWEIGHT_STRING() is particularly useful when adding new\ncollations, for testing purposes.\n \nIf str is a non-binary string (CHAR, VARCHAR or TEXT),\nWEIGHT_STRING returns the string''s collation weight. If str\nis a binary string (BINARY, VARBINARY or BLOB), the return\nvalue is simply the input value, since the weight for each\nbyte in a binary string is the byte value.\n \nWEIGHT_STRING() returns NULL if given a NULL input. \n \nThe optional AS clause permits casting the input string to a\nbinary or non-binary string, as well as to a particular\nlength.\n \nAS BINARY(N) measures the length in bytes rather than\ncharacters, and right pads with 0x00 bytes to the desired\nlength. \n \nAS CHAR(N) measures the length in characters, and right pads\nwith spaces to the desired length.\n \nN has a minimum value of 1, and if it is less than the\nlength of the input string, the string is truncated without\nwarning.\n \nThe optional LEVEL clause specifies that the return value\nshould contain weights for specific collation levels. The\nlevels specifier can either be a single integer, a\ncomma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can\nrange from 1 to a maximum of 6, dependent on the collation,\nand need to be listed in ascending order.\n \nIf the LEVEL clause is no provided, a default of 1 to the\nmaximum for the collation is assumed.\n \nIf the LEVEL is specified without using a range, an optional\nmodifier is permitted.\n \nASC, the default, returns the weights without any\nmodification.\n \nDESC returns bitwise-inverted weights.\n \nREVERSE returns the weights in reverse order.\n \n\nThe examples below use the HEX() function to represent\nnon-printable results in hexadecimal format.\n \nSELECT HEX(WEIGHT_STRING(''x''));\n+-------------------------+\n| HEX(WEIGHT_STRING(''x'')) |\n+-------------------------+\n| 0058 |\n+-------------------------+\n \nSELECT HEX(WEIGHT_STRING(''x'' AS BINARY(4)));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(''x'' AS BINARY(4))) |\n+--------------------------------------+\n| 78000000 |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(''x'' AS CHAR(4)));\n+------------------------------------+\n| HEX(WEIGHT_STRING(''x'' AS CHAR(4))) |\n+------------------------------------+\n| 0058002000200020 |\n+------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1)) |\n+--------------------------------------+\n| AA22EE |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC));\n+-------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC)) |\n+-------------------------------------------+\n| 55DD11 |\n+-------------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE));\n+----------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE)) |\n+----------------------------------------------+\n| EE22AA |\n+----------------------------------------------+
+description=Returns a binary string representing the string's sorting and comparison\nvalue. A string with a lower result means that for sorting purposes the string\nappears before a string with a higher result.\n\nWEIGHT_STRING() is particularly useful when adding new collations, for testing\npurposes.\n\nIf str is a non-binary string (CHAR, VARCHAR or TEXT), WEIGHT_STRING returns\nthe string's collation weight. If str is a binary string (BINARY, VARBINARY or\nBLOB), the return value is simply the input value, since the weight for each\nbyte in a binary string is the byte value.\n\nWEIGHT_STRING() returns NULL if given a NULL input.\n\nThe optional AS clause permits casting the input string to a binary or\nnon-binary string, as well as to a particular length.\n\nAS BINARY(N) measures the length in bytes rather than characters, and right\npads with 0x00 bytes to the desired length.\n\nAS CHAR(N) measures the length in characters, and right pads with spaces to\nthe desired length.\n\nN has a minimum value of 1, and if it is less than the length of the input\nstring, the string is truncated without warning.\n\nThe optional LEVEL clause specifies that the return value should contain\nweights for specific collation levels. The levels specifier can either be a\nsingle integer, a comma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can range from 1 to a\nmaximum of 6, dependent on the collation, and need to be listed in ascending\norder.\n\nIf the LEVEL clause is no provided, a default of 1 to the maximum for the\ncollation is assumed.\n\nIf the LEVEL is specified without using a range, an optional modifier is\npermitted.\n\nASC, the default, returns the weights without any modification.\n\nDESC returns bitwise-inverted weights.\n\nREVERSE returns the weights in reverse order.\n\nExamples\n--------\n\nThe examples below use the HEX() function to represent non-printable results\nin hexadecimal format.\n ...
[WITHIN]
declaration=g1,g2
category=Geometry Relations
-description=Returns 1 or 0 to indicate whether g1 is spatially within\ng2.\nThis tests the opposite relationship as Contains().\n \nWITHIN() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_WITHIN() uses\nobject shapes.\n \n\nSET @g1 = GEOMFROMTEXT(''POINT(174 149)'');\nSET @g2 = GEOMFROMTEXT(''POINT(176 151)'');\nSET @g3 = GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60, 125\n100, 175 150))'');\n \nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n| 0 |\n+-----------------+
-[YEARWEEK1]
-name=YEARWEEK
+description=Returns 1 or 0 to indicate whether g1 is spatially within g2. This tests the\nopposite relationship as Contains().\n\nWITHIN() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_WITHIN() uses object shapes.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT('POINT(174 149)');\nSET @g2 = GEOMFROMTEXT('POINT(176 151)');\nSET @g3 = GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))');\n\nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n| 1 |\n+-----------------+\n\nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n| 0 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/within/
+[WSREP_LAST_SEEN_GTID]
+declaration=
+category=Galera Functions
+description=Returns the Global Transaction ID of the most recent write transaction\nobserved by the client.\n\nThe result can be useful to determine the transaction to provide to\nWSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking purposes.\n\nURL: https://mariadb.com/kb/en/wsrep_last_seen_gtid/
+[WSREP_LAST_WRITTEN_GTID]
+declaration=
+category=Galera Functions
+description=Returns the Global Transaction ID of the most recent write transaction\nperformed by the client.\n\nURL: https://mariadb.com/kb/en/wsrep_last_written_gtid/
+[WSREP_SYNC_WAIT_UPTO_GTID]
+declaration=gtid[,timeout]
+category=Galera Functions
+description=Blocks the client until the transaction specified by the given Global\nTransaction ID is applied and committed by the node.\n\nThe optional timeout argument can be used to specify a block timeout in\nseconds. If not provided, the timeout will be indefinite.\n\nReturns the node that applied and committed the Global Transaction ID,\nER_LOCAL_WAIT_TIMEOUT if the function is timed out before this, or\nER_WRONG_ARGUMENTS if the function is given an invalid GTID.\n\nThe result from WSREP_LAST_SEEN_GTID can be useful to determine the\ntransaction to provide to WSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking\npurposes.\n\nURL: https://mariadb.com/kb/en/wsrep_sync_wait_upto_gtid/
+[YEAR]
declaration=date
category=Date and Time Functions
-description=Returns year and week for a date. The mode argument works\nexactly like the mode\nargument to WEEK(). The year in the result may be different\nfrom the\nyear in the date argument for the first and the last week of\nthe year.\n \n\nSELECT YEARWEEK(''1987-01-01'');\n+------------------------+\n| YEARWEEK(''1987-01-01'') |\n+------------------------+\n| 198652 |\n+------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n \nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n \n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)
-[YEARWEEK2]
-name=YEARWEEK
-declaration=date,mode
-category=Date and Time Functions
-description=Returns year and week for a date. The mode argument works\nexactly like the mode\nargument to WEEK(). The year in the result may be different\nfrom the\nyear in the date argument for the first and the last week of\nthe year.\n \n\nSELECT YEARWEEK(''1987-01-01'');\n+------------------------+\n| YEARWEEK(''1987-01-01'') |\n+------------------------+\n| 198652 |\n+------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n \nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n \n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)
-[YEAR]
+description=Returns the year for the given date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT * FROM t1;\n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n\nSELECT * FROM t1 WHERE YEAR(d) = 2011;\n+---------------------+\n| d |\n+---------------------+\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n\nSELECT YEAR('1987-01-01');\n+--------------------+\n| YEAR('1987-01-01') |\n+--------------------+\n| 1987 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/year/
+[YEARWEEK]
declaration=date
category=Date and Time Functions
-description=Returns the year for the given date, in the range 1000 to\n9999, or 0 for the\n"zero" date.\n \n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT * FROM t1 WHERE YEAR(d) = 2011;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \nSELECT YEAR(''1987-01-01'');\n+--------------------+\n| YEAR(''1987-01-01'') |\n+--------------------+\n| 1987 |\n+--------------------+
\ No newline at end of file
+description=Returns year and week for a date. The mode argument works exactly like the\nmode argument to WEEK(). The year in the result may be different from the year\nin the date argument for the first and the last week of the year.\n\nExamples\n--------\n\nSELECT YEARWEEK('1987-01-01');\n+------------------------+\n| YEARWEEK('1987-01-01') |\n+------------------------+\n| 198652 |\n+------------------------+\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n ("2007-01-30 21:31:07"),\n ("1983-10-15 06:42:51"),\n ("2011-04-21 12:34:56"),\n ("2011-10-30 06:31:41"),\n ("2011-01-30 14:03:25"),\n ("2004-10-07 11:19:34");\n\nSELECT * FROM t1;\n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n\nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\n\nURL: https://mariadb.com/kb/en/yearweek/
\ No newline at end of file
diff --git a/out/functions-mysql.ini b/out/functions-mysql.ini
index 4d8f4a233..9a47ab288 100644
--- a/out/functions-mysql.ini
+++ b/out/functions-mysql.ini
@@ -1,1363 +1,1340 @@
[ABS]
declaration=X
category=Numeric Functions
-description=Returns the absolute value of X, or NULL if X is NULL
+description=Returns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[ACOS]
declaration=X
category=Numeric Functions
-description=Returns the arc cosine of X, that is, the value whose cosine is X
+description=Returns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[ADDDATE]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument, ADDDATE() is a\nsynonym for DATE_ADD()
+description=When invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee the discussion for DATE_ADD().\n\nmysql> SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);\n -> '2008-02-02'\nmysql> SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);\n -> '2008-02-02'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[ADDTIME]
declaration=expr1,expr2
category=Date and Time Functions
-description=ADDTIME() adds expr2 to expr1 and returns the result
+description=ADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[AES_DECRYPT]
declaration=crypt_str,key_str[,init_vector]
category=Encryption Functions
-description=This function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm
+description=This function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nThe optional initialization vector argument, init_vector, is available\nas of MySQL 5.7.4. As of that version, statements that use\nAES_DECRYPT() are unsafe for statement-based replication and cannot be\nstored in the query cache.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[AES_ENCRYPT]
declaration=str,key_str[,init_vector]
category=Encryption Functions
-description=AES_ENCRYPT() and AES_DECRYPT() implement encryption and decryption of data\nusing the official AES (Advanced Encryption Standard) algorithm, previously\nknown as "Rijndael
+description=AES_ENCRYPT() and AES_DECRYPT() implement encryption and decryption of\ndata using the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." The AES standard permits various key\nlengths. By default these functions implement AES with a 128-bit key\nlength. As of MySQL 5.7.4, key lengths of 196 or 256 bits can be used,\nas described later. The key length is a trade off between performance\nand security.\n\nAES_ENCRYPT() encrypts the string str using the key string key_str and\nreturns a binary string containing the encrypted output. AES_DECRYPT()\ndecrypts the encrypted string crypt_str using the key string key_str\nand returns the original plaintext string. If either function argument\nis NULL, the function returns NULL.\n\nThe str and crypt_str arguments can be any length, and padding is\nautomatically added to str so it is a multiple of a block as required\nby block-based algorithms such as AES. This padding is automatically\nremoved by the AES_DECRYPT() function. The length of crypt_str can be\ncalculated using this formula:\n\n16 * (trunc(string_length / 16) + 1)\n\nFor a key length of 128 bits, the most secure way to pass a key to the\nkey_str argument is to create a truly random 128-bit value and pass it\nas a binary value. For example:\n\nINSERT INTO t\nVALUES (1,AES_ENCRYPT('text',UNHEX('F3229A0B371ED2D9441B830D21A390C3')));\n\nA passphrase can be used to generate an AES key by hashing the\npassphrase. For example:\n\nINSERT INTO t VALUES (1,AES_ENCRYPT('text', SHA2('My secret passphrase',512)));\n\nDo not pass a password or passphrase directly to crypt_str, hash it\nfirst. Previous versions of this documentation suggested the former\napproach, but it is no longer recommended as the examples shown here\nare more secure.\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns\nNULL. However, it is possible for AES_DECRYPT() to return a non-NULL\nvalue (possibly garbage) if the input data or the key is invalid.\n\nAs of MySQL 5.7.4, AES_ENCRYPT() and AES_DECRYPT() permit control of\nthe block encryption mode and take an optional init_vector\ninitialization vector argument:\n\no The block_encryption_mode system variable controls the mode for\n block-based encryption algorithms. Its default value is aes-128-ecb,\n which signifies encryption using a key length of 128 bits and ECB\n ...
[ANY_VALUE]
declaration=arg
category=Miscellaneous Functions
-description=This function is useful for GROUP BY queries when the ONLY_FULL_GROUP_BY\nSQL mode is enabled, for cases when MySQL rejects a query that you know is\nvalid for reasons that MySQL cannot determine
+description=This function is useful for GROUP BY queries when the\nONLY_FULL_GROUP_BY SQL mode is enabled, for cases when MySQL rejects a\nquery that you know is valid for reasons that MySQL cannot determine.\nThe function return value and type are the same as the return value and\ntype of its argument, but the function result is not checked for the\nONLY_FULL_GROUP_BY SQL mode.\n\nFor example, if name is a nonindexed column, the following query fails\nwith ONLY_FULL_GROUP_BY enabled:\n\nmysql> SELECT name, address, MAX(age) FROM t GROUP BY name;\nERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP\nBY clause and contains nonaggregated column 'mydb.t.address' which\nis not functionally dependent on columns in GROUP BY clause; this\nis incompatible with sql_mode=only_full_group_by\n\nThe failure occurs because address is a nonaggregated column that is\nneither named among GROUP BY columns nor functionally dependent on\nthem. As a result, the address value for rows within each name group is\nnondeterministic. There are multiple ways to cause MySQL to accept the\nquery:\n\no Alter the table to make name a primary key or a unique NOT NULL\n column. This enables MySQL to determine that address is functionally\n dependent on name; that is, address is uniquely determined by name.\n (This technique is inapplicable if NULL must be permitted as a valid\n name value.)\n\no Use ANY_VALUE() to refer to address:\n\nSELECT name, ANY_VALUE(address), MAX(age) FROM t GROUP BY name;\n\n In this case, MySQL ignores the nondeterminism of address values\n within each name group and accepts the query. This may be useful if\n you simply do not care which value of a nonaggregated column is\n chosen for each group. ANY_VALUE() is not an aggregate function,\n unlike functions such as SUM() or COUNT(). It simply acts to suppress\n the test for nondeterminism.\n\no Disable ONLY_FULL_GROUP_BY. This is equivalent to using ANY_VALUE()\n with ONLY_FULL_GROUP_BY enabled, as described in the previous item.\n\nANY_VALUE() is also useful if functional dependence exists between\ncolumns but MySQL cannot determine it. The following query is valid\nbecause age is functionally dependent on the grouping column age-1, but\nMySQL cannot tell that and rejects the query with ONLY_FULL_GROUP_BY\nenabled:\n\nSELECT age FROM t GROUP BY age-1;\n\n ...
+[AREA]
+declaration=poly
+category=Polygon properties
+description=ST_Area() and Area() are synonyms. For more information, see the\ndescription of ST_Area().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html
+[ASBINARY]
+declaration=g
+category=WKB
+description=Converts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-format-conversion-functions.html
[ASCII]
declaration=str
category=String Functions
-description=Returns the numeric value of the leftmost character of the string str
+description=Returns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[ASIN]
declaration=X
category=Numeric Functions
-description=Returns the arc sine of X, that is, the value whose sine is X
-[ASYMMETRIC_DECRYPT]
-declaration=algorithm, crypt_str, key_str
-category=Enterprise Encryption Functions
-description=Decrypts an encrypted string using the given algorithm and key string, and\nreturns the resulting plaintext as a binary string
-[ASYMMETRIC_DERIVE]
-declaration=pub_key_str, priv_key_str
-category=Enterprise Encryption Functions
-description=Derives a symmetric key using the private key of one party and the public\nkey of another, and returns the resulting key as a binary string
-[ASYMMETRIC_ENCRYPT]
-declaration=algorithm, str, key_str
-category=Enterprise Encryption Functions
-description=Encrypts a string using the given algorithm and key string, and returns the\nresulting ciphertext as a binary string
-[ASYMMETRIC_SIGN]
-declaration=algorithm, digest_str, priv_key_str, digest_type
-category=Enterprise Encryption Functions
-description=Signs a digest string using a private key string, and returns the signature\nas a binary string
-[ASYMMETRIC_VERIFY]
-declaration=algorithm, digest_str, sig_str, pub_key_str,
-digest_type
-category=Enterprise Encryption Functions
-description=Verifies whether the signature string matches the digest string, and\nreturns 1 or 0 to indicate whether verification succeeded or failed
+description=Returns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[ASTEXT]
+declaration=g
+category=WKT
+description=Converts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-format-conversion-functions.html
[ATAN]
declaration=X
category=Numeric Functions
-description=Returns the arc tangent of X, that is, the value whose tangent is X
+description=Returns the arc tangent of X, that is, the value whose tangent is X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[ATAN2]
+declaration=Y,X
+category=Numeric Functions
+description=Returns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[AVG]
declaration=[DISTINCT] expr
-category=Aggregate Functions and Modifiers
-description=Returns the average value of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nAVG() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[BENCHMARK]
declaration=count,expr
category=Information Functions
-description=The BENCHMARK() function executes the expression expr repeatedly count\ntimes
+description=The BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is always 0. The intended use is from\nwithin the mysql client, which reports query execution times:\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
+[BIGINT]
+declaration=M
+category=Data Types
+description=A large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[BIN]
declaration=N
category=String Functions
-description=Returns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number
-[BIN_TO_UUID]
-declaration=binary_uuid
-category=Miscellaneous Functions
-description=BIN_TO_UUID() is the inverse of UUID_TO_BIN()
+description=Returns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[BINARY]
+declaration=M
+category=Data Types
+description=The BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. M represents the\ncolumn length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
+[BIT]
+declaration=M
+category=Data Types
+description=A bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[BIT_AND]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the bitwise AND of all bits in expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[BIT_COUNT]
declaration=N
category=Bit Functions
-description=Returns the number of bits that are set in the argument N as an unsigned\n64-bit integer, or NULL if the argument is NULL
+description=Returns the number of bits that are set in the argument N.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/bit-functions.html
[BIT_LENGTH]
declaration=str
category=String Functions
-description=Returns the length of the string str in bits
+description=Returns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[BIT_OR]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the bitwise OR of all bits in expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[BIT_XOR]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the bitwise XOR of all bits in expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
+[BLOB]
+declaration=M
+category=Data Types
+description=A BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each\nBLOB value is stored using a 2-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
+[BUFFER]
+declaration=g,d
+category=GeometryCollection properties
+description=Returns a geometry that represents all points whose distance from the\ngeometry value g is less than or equal to a distance of d.\n\nBuffer() supports negative distances for polygons, multipolygons, and\ngeometry collections containing polygons or multipolygons. For point,\nmultipoint, linestring, multilinestring, and geometry collections not\ncontaining any polygons or multipolygons, Buffer() with a negative\ndistance returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[CAST]
-declaration=expr AS type [ARRAY]
-category=Cast Functions and Operators
-description=The CAST() function takes an expression of any type and produces a result\nvalue of the specified type, similar to CONVERT()
+declaration=expr AS type
+category=String Functions
+description=The CAST() function takes an expression of any type and produces a\nresult value of a specified type, similar to CONVERT(). See the\ndescription of CONVERT() for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/cast-functions.html
[CEIL]
declaration=X
category=Numeric Functions
-description=CEIL() is a synonym for CEILING()
+description=CEIL() is a synonym for CEILING().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[CEILING]
declaration=X
category=Numeric Functions
-description=Returns the smallest integer value not less than X
+description=Returns the smallest integer value not less than X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[CENTROID]
+declaration=mpoly
+category=Polygon properties
+description=ST_Centroid() and Centroid() are synonyms. For more information, see\nthe description of ST_Centroid().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-multipolygon-property-functions.html
+[CHAR]
+declaration=M
+category=Data Types
+description=collation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
[CHARACTER_LENGTH]
declaration=str
category=String Functions
-description=CHARACTER_LENGTH() is a synonym for CHAR_LENGTH()
+description=CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[CHARSET]
declaration=str
category=Information Functions
-description=Returns the character set of the string argument
+description=Returns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[CHAR_LENGTH]
declaration=str
category=String Functions
-description=Returns the length of the string str, measured in characters
+description=Returns the length of the string str, measured in characters. A\nmultibyte character counts as a single character. This means that for a\nstring containing five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[COALESCE]
declaration=value,...
-category=Comparison Operators
-description=Returns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values
+category=Comparison operators
+description=Returns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
[COERCIBILITY]
declaration=str
category=Information Functions
-description=Returns the collation coercibility value of the string argument
+description=Returns the collation coercibility value of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[COLLATION]
declaration=str
category=Information Functions
-description=Returns the collation of the string argument
+description=Returns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[COMPRESS]
declaration=string_to_compress
category=Encryption Functions
-description=Compresses a string and returns the result as a binary string
+description=Compresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[CONCAT]
declaration=str1,str2,...
category=String Functions
-description=Returns the string that results from concatenating the arguments
+description=Returns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent nonbinary string form.\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[CONCAT_WS]
declaration=separator,str1,str2,...
category=String Functions
-description=CONCAT_WS() stands for Concatenate With Separator and is a special form of\nCONCAT()
+description=CONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[CONNECTION_ID]
+declaration=
+category=Information Functions
+description=Returns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nThe value returned by CONNECTION_ID() is the same type of value as\ndisplayed in the ID column of the INFORMATION_SCHEMA.PROCESSLIST table,\nthe Id column of SHOW PROCESSLIST output, and the PROCESSLIST_ID column\nof the Performance Schema threads table.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
+[CONTAINS]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as Within().\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBRContains() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
[CONV]
declaration=N,from_base,to_base
category=Numeric Functions
-description=Converts numbers between different number bases
+description=Converts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If to_base is\na negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[CONVERT]
-declaration=expr USING transcoding_name
-category=Cast Functions and Operators
-description=The CONVERT() function takes an expression of any type and produces a\nresult value of the specified type
+declaration=expr,type
+category=String Functions
+description=The CONVERT() and CAST() functions take an expression of any type and\nproduce a result value of a specified type.\n\nThe type for the result can be one of the following values:\n\no BINARY[(N)]\n\no CHAR[(N)]\n\no DATE\n\no DATETIME\n\no DECIMAL[(M[,D])]\n\no SIGNED [INTEGER]\n\no TIME\n\no UNSIGNED [INTEGER]\n\nBINARY produces a string with the BINARY data type. See\nhttp://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html for a\ndescription of how this affects comparisons. If the optional length N\nis given, BINARY(N) causes the cast to use no more than N bytes of the\nargument. Values shorter than N bytes are padded with 0x00 bytes to a\nlength of N.\n\nCHAR(N) causes the cast to use no more than N characters of the\nargument.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string 'abc' in the default character set to the corresponding\nstring in the utf8 character set:\n\nSELECT CONVERT('abc' USING utf8);\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/cast-functions.html
[CONVERT_TZ]
declaration=dt,from_tz,to_tz
category=Date and Time Functions
-description=CONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting value
+description=CONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttp://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html. This\nfunction returns NULL if the arguments are invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[CONVEXHULL]
+declaration=g
+category=GeometryCollection properties
+description=ST_ConvexHull() and ConvexHull() are synonyms. For more information,\nsee the description of ST_ConvexHull().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[COS]
declaration=X
category=Numeric Functions
-description=Returns the cosine of X, where X is given in radians
+description=Returns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[COT]
declaration=X
category=Numeric Functions
-description=Returns the cotangent of X
+description=Returns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[COUNT]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nCOUNT() returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[CRC32]
declaration=expr
category=Numeric Functions
-description=Computes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue
-[CREATE_ASYMMETRIC_PRIV_KEY]
-declaration=algorithm, {key_len|dh_secret}
-category=Enterprise Encryption Functions
-description=Creates a private key using the given algorithm and key length or DH\nsecret, and returns the key as a binary string in PEM format
-[CREATE_ASYMMETRIC_PUB_KEY]
-declaration=algorithm, priv_key_str
-category=Enterprise Encryption Functions
-description=Derives a public key from the given private key using the given algorithm,\nand returns the key as a binary string in PEM format
-[CREATE_DH_PARAMETERS]
-declaration=key_len
-category=Enterprise Encryption Functions
-description=Creates a shared secret for generating a DH private/public key pair and\nreturns a binary string that can be passed to create_asymmetric_priv_key()
-[CREATE_DIGEST]
-declaration=digest_type, str
-category=Enterprise Encryption Functions
-description=Creates a digest from the given string using the given digest type, and\nreturns the digest as a binary string
-[CURRENT_TIMESTAMP]
-name=CURRENT_TIMESTAMP
+description=Computes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[CROSSES]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
+[CURDATE]
declaration=
category=Date and Time Functions
-description=CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().
-[CURDATE]
+description=Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[CURRENT_DATE]
declaration=
category=Date and Time Functions
-description=Returns the current date as a value in ''YYYY-MM-DD'' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or\nnumeric context.\n \n\nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n \nIn a numeric context (note this is not performing date\ncalculations):\n \nSELECT CURDATE() +0;\n \n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n \nData calculation:\n \nSELECT CURDATE() - INTERVAL 5 DAY;\n \n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+
+description=CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[CURRENT_TIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[CURRENT_TIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[CURRENT_USER]
+declaration=
+category=Information Functions
+description=Returns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[CURTIME]
declaration=[fsp]
category=Date and Time Functions
-description=Returns the current time as a value in 'hh:mm:ss' or hhmmss format,\ndepending on whether the function is used in string or numeric context
+description=Returns the current time as a value in 'HH:MM:SS' or HHMMSS format,\ndepending on whether the function is used in a string or numeric\ncontext. The value is expressed in the current time zone.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[DATABASE]
+declaration=
+category=Information Functions
+description=Returns the default (current) database name as a string in the utf8\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[DATEDIFF]
declaration=expr1,expr2
category=Date and Time Functions
-description=DATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other
+description=DATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[DATETIME]
+declaration=fsp
+category=Data Types
+description=A date and time combination. The supported range is '1000-01-01\n00:00:00.000000' to '9999-12-31 23:59:59.999999'. MySQL displays\nDATETIME values in 'YYYY-MM-DD HH:MM:SS[.fraction]' format, but permits\nassignment of values to DATETIME columns using either strings or\nnumbers.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nAutomatic initialization and updating to the current date and time for\nDATETIME columns can be specified using DEFAULT and ON UPDATE column\ndefinition clauses, as described in\nhttp://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html
[DATE_ADD]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=These functions perform date arithmetic
+description=These functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is a string; it may start with a "-" for negative intervals. unit\nis a keyword indicating the units in which the expression should be\ninterpreted.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DATE_FORMAT]
declaration=date,format
category=Date and Time Functions
-description=Formats the date value according to the format string
+description=Formats the date value according to the format string.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DATE_SUB]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=See the description for DATE_ADD()
+description=See the description for DATE_ADD().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DAY]
declaration=date
category=Date and Time Functions
-description=DAY() is a synonym for DAYOFMONTH()
+description=DAY() is a synonym for DAYOFMONTH().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DAYNAME]
declaration=date
category=Date and Time Functions
-description=Returns the name of the weekday for date
+description=Returns the name of the weekday for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.7/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DAYOFMONTH]
declaration=date
category=Date and Time Functions
-description=Returns the day of the month for date, in the range 1 to 31, or 0 for dates\nsuch as '0000-00-00' or '2008-00-00' that have a zero day part
+description=Returns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as '0000-00-00' or '2008-00-00' that have a zero day part.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DAYOFWEEK]
declaration=date
category=Date and Time Functions
-description=Returns the weekday index for date (1 = Sunday, 2 = Monday,
+description=Returns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[DAYOFYEAR]
declaration=date
category=Date and Time Functions
-description=Returns the day of the year for date, in the range 1 to 366
+description=Returns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[DEC]
+declaration=M[,D]
+category=Data Types
+description=[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
+[DECIMAL]
+declaration=M[,D]
+category=Data Types
+description=A packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the "-" sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
+[DECODE]
+declaration=crypt_str,pass_str
+category=Encryption Functions
+description=DECODE() decrypts the encrypted string crypt_str using pass_str as the\npassword. crypt_str should be a string returned from ENCODE().\n\n*Note*: The ENCODE() and DECODE() functions are deprecated in MySQL\n5.7, will be removed in a future MySQL release, and should no longer be\nused. Consider using AES_ENCRYPT() and AES_DECRYPT() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[DEFAULT]
declaration=col_name
category=Miscellaneous Functions
-description=Returns the default value for a table column
+description=Returns the default value for a table column. An error results if the\ncolumn has no default value.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[DEGREES]
declaration=X
category=Numeric Functions
-description=Returns the argument X, converted from radians to degrees
+description=Returns the argument X, converted from radians to degrees.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[DES_DECRYPT]
+declaration=crypt_str[,key_str]
+category=Encryption Functions
+description=Decrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.7/en/ssl-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\n*Note*: The DES_ENCRYPT() and DES_DECRYPT() functions are deprecated as\nof MySQL 5.7.6, will be removed in a future MySQL release, and should\nno longer be used. Consider using AES_ENCRYPT() and AES_DECRYPT()\ninstead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[DES_ENCRYPT]
+declaration=str[,{key_num|key_str}]
+category=Encryption Functions
+description=Encrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.7/en/ssl-connections.html.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from\nthe DES key file is used. With a key_num argument, the given key number\n(0 to 9) from the DES key file is used. With a key_str argument, the\ngiven key string is used to encrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is\nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If\nyou use a string key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in\nthe file may be in any order. des_key_str is the string that is used to\nencrypt the message. There should be at least one space between the\nnumber and the key. The first key is the default key that is used if\nyou do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MySQL to read new key values from the key file with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted column\nvalues, without giving the end user the right to decrypt those values.\n\n*Note*: The DES_ENCRYPT() and DES_DECRYPT() functions are deprecated as\nof MySQL 5.7.6, will be removed in a future MySQL release, and should\nno longer be used. Consider using AES_ENCRYPT() and AES_DECRYPT()\ninstead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[DIMENSION]
+declaration=g
+category=Geometry properties
+description=Returns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.7/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
+[DISJOINT]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBRDisjoint() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
+[DISTANCE]
+declaration=g1,g2
+category=Geometry relations
+description=ST_Distance() and Distance() are synonyms. For more information, see\nthe description of ST_Distance().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
+[DOUBLE]
+declaration=M,D
+category=Data Types
+description=A normal-size (double-precision) floating-point number. Permissible\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[ELT]
declaration=N,str1,str2,str3,...
category=String Functions
-description=ELT() returns the Nth element of the list of strings: str1 if N = 1, str2\nif N = 2, and so on
+description=ELT() returns the Nth element of the list of strings: str1 if N = 1,\nstr2 if N = 2, and so on. Returns NULL if N is less than 1 or greater\nthan the number of arguments. ELT() is the complement of FIELD().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[ENCODE]
+declaration=str,pass_str
+category=Encryption Functions
+description=ENCODE() encrypts str using pass_str as the password. The result is a\nbinary string of the same length as str. To decrypt the result, use\nDECODE().\n\n*Note*: The ENCODE() and DECODE() functions are deprecated in MySQL\n5.7, will be removed in a future MySQL release, and should no longer be\nused.\n\nIf you still need to use ENCODE(), a salt value must be used with it to\nreduce risk. For example:\n\nENCODE('plaintext', CONCAT('my_random_salt','my_secret_password'))\n\nA new random salt value must be used whenever a password is updated.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[ENCRYPT]
+declaration=str[,salt]
+category=Encryption Functions
+description=Encrypts str using the Unix crypt() system call and returns a binary\nstring. The salt argument must be a string with at least two characters\nor the result will be NULL. If no salt argument is given, a random\nvalue is used.\n\n*Note*: The ENCRYPT() function is deprecated as of MySQL 5.7.6, will be\nremoved in a future MySQL release, and should no longer be used.\nConsider using AES_ENCRYPT() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[ENDPOINT]
+declaration=ls
+category=LineString properties
+description=Returns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
[ENUM]
declaration='value1','value2',...
category=Data Types
-description=collation_name] An enumeration
+description=collation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values 'value1', 'value2', ..., NULL or the special ''\nerror value. ENUM values are represented internally as integers.\n\nAn ENUM column can have a maximum of 65,535 distinct elements. (The\npractical limit is less than 3000.) A table can have no more than 255\nunique element list definitions among its ENUM and SET columns\nconsidered as a group. For more information on these limits, see\nhttp://dev.mysql.com/doc/refman/5.7/en/limits-frm-file.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
+[ENVELOPE]
+declaration=g
+category=Geometry properties
+description=ST_Envelope() and Envelope() are synonyms. For more information, see\nthe description of ST_Envelope().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
+[EQUALS]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBREquals() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
[EXP]
declaration=X
category=Numeric Functions
-description=Returns the value of e (the base of natural logarithms) raised to the power\nof X
+description=Returns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[EXPORT_SET]
declaration=bits,on,off[,separator[,number_of_bits]]
category=String Functions
-description=Returns a string such that for every bit set in the value bits, you get an\non string and for every bit not set in the value, you get an off string
+description=Returns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ","). The number of bits examined is given by number_of_bits,\nwhich has a default of 64 if not specified. number_of_bits is silently\nclipped to 64 if larger than 64. It is treated as an unsigned integer,\nso a value of -1 is effectively the same as 64.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[EXTERIORRING]
+declaration=poly
+category=Polygon properties
+description=Returns the exterior ring of the Polygon value poly as a LineString.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html
[EXTRACT]
declaration=unit FROM date
category=Date and Time Functions
-description=The EXTRACT() function uses the same kinds of unit specifiers as DATE_ADD()\nor DATE_SUB(), but extracts parts from the date rather than performing date\narithmetic
+description=The EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[EXTRACTVALUE]
declaration=xml_frag, xpath_expr
-category=XML
-description=ExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator); it\nreturns the text (CDATA) of the first text node which is a child of the\nelement or elements matched by the XPath expression
+category=String Functions
+description=ExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe elements or elements matched by the XPath expression.\n\nUsing this function is the equivalent of performing a match using the\nxpath_expr after appending /text(). In other words,\nExtractValue('Sakila', '/a/b') and\nExtractValue('Sakila', '/a/b/text()') produce the same\nresult.\n\nIf multiple matches are found, the content of the first child text node\nof each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text())---for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed---an empty string is returned. No distinction is made between a\nmatch on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue('', '/a/b');\n+-------------------------------------+\n| ExtractValue('', '/a/b') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue('', '/a/b');\n+-------------------------------------+\n| ExtractValue('', '/a/b') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue('', 'count(/a/b)');\n+-------------------------------------+\n| ExtractValue('', 'count(/a/b)') |\n+-------------------------------------+\n ...
[FIELD]
declaration=str,str1,str2,str3,...
category=String Functions
-description=Returns the index (position) of str in the str1, str2, str3,
+description=Returns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[FIND_IN_SET]
declaration=str,strlist
category=String Functions
-description=Returns a value in the range of 1 to N if the string str is in the string\nlist strlist consisting of N substrings
-[FIRST_VALUE]
-declaration=expr
-category=Window Functions
-description=Returns the value of expr from the first row of the window frame
+description=Returns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[FLOAT]
+declaration=M,D
+category=Data Types
+description=A small (single-precision) floating-point number. Permissible values\nare -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.7/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[FLOOR]
declaration=X
category=Numeric Functions
-description=Returns the largest integer value not greater than X
+description=Returns the largest integer value not greater than X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[FORMAT]
declaration=X,D[,locale]
category=String Functions
-description=Formats the number X to a format like '#,###,###
-[FORMAT_BYTES]
-declaration=count
-category=Performance Schema Functions
-description=Given a numeric byte count, converts it to human-readable format and\nreturns a string consisting of a value and a units indicator
-[FORMAT_PICO_TIME]
-declaration=time_val
-category=Performance Schema Functions
-description=Given a numeric Performance Schema latency or wait time in picoseconds,\nconverts it to human-readable format and returns a string consisting of a\nvalue and a units indicator
-[FROM_BASE64]
-declaration=str
-category=String Functions
-description=Takes a string encoded with the base-64 encoded rules used by TO_BASE64()\nand returns the decoded result as a binary string
+description=Formats the number X to a format like '#,###,###.##', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nThe optional third parameter enables a locale to be specified to be\nused for the result number's decimal point, thousands separator, and\ngrouping between separators. Permissible locale values are the same as\nthe legal values for the lc_time_names system variable (see\nhttp://dev.mysql.com/doc/refman/5.7/en/locale-support.html). If no\nlocale is specified, the default is 'en_US'.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[FOUND_ROWS]
+declaration=
+category=Information Functions
+description=A SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[FROM_DAYS]
declaration=N
category=Date and Time Functions
-description=Given a day number N, returns a DATE value
+description=Given a day number N, returns a DATE value.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[FROM_UNIXTIME]
-declaration=unix_timestamp[,format]
+declaration=unix_timestamp
category=Date and Time Functions
-description=Returns a representation of the unix_timestamp argument as a value in\n'YYYY-MM-DD hh:mm:ss' or YYYYMMDDhhmmss format, depending on whether the\nfunction is used in a string or numeric context
-[GEOMCOLLECTION]
-declaration=g [, g] ...
-category=Geometry Constructors
-description=Constructs a GeomCollection value from the geometry arguments
+description=Returns a representation of the unix_timestamp argument as a value in\n'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether\nthe function is used in a string or numeric context. The value is\nexpressed in the current time zone. unix_timestamp is an internal\ntimestamp value such as is produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format\nstring, which is used the same way as listed in the entry for the\nDATE_FORMAT() function.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[GEOMCOLLFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a GeometryCollection value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[GEOMCOLLFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a GeometryCollection value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[GEOMETRYCOLLECTION]
-declaration=g [, g] ...
-category=Geometry Constructors
-description=Constructs a GeomCollection value from the geometry arguments
+declaration=g1,g2,...
+category=Geometry constructors
+description=Constructs a GeometryCollection.\n\nAs of MySQL 5.7.5, GeometryCollection() returns all the proper\ngeometries contained in the argument even if a nonsupported geometry is\npresent. Before 5.7.5, if the argument contains a nonsupported\ngeometry, the return value is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
+[GEOMETRYN]
+declaration=gc,N
+category=GeometryCollection properties
+description=Returns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-geometrycollection-property-functions.html
+[GEOMETRYTYPE]
+declaration=g
+category=Geometry properties
+description=Returns a binary string indicating the name of the geometry type of\nwhich the geometry instance g is a member. The name corresponds to one\nof the instantiable Geometry subclasses.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
+[GEOMFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a geometry value of any type using its WKT representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[GEOMFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a geometry value of any type using its WKB representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[GET_FORMAT]
declaration={DATE|TIME|DATETIME}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'}
category=Date and Time Functions
-description=Returns a format string
+description=Returns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[GET_LOCK]
declaration=str,timeout
-category=Locking Functions
-description=Tries to obtain a lock with a name given by the string str, using a timeout\nof timeout seconds
+category=Miscellaneous Functions
+description=Tries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. A negative timeout value means infinite\ntimeout.\n\nReturns 1 if the lock was obtained successfully, 0 if the attempt timed\nout (for example, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of memory or\nthe thread was killed with mysqladmin kill). If you have a lock\nobtained with GET_LOCK(), it is released when you execute\nRELEASE_LOCK() or your connection terminates (either normally or\nabnormally). Lock release may also occur with another call to\nGET_LOCK():\n\no Before 5.7.5, only a single simultaneous lock can be acquired and\n GET_LOCK() releases any existing lock.\n\no In MySQL 5.7.5, GET_LOCK() was reimplemented using the metadata\n locking (MDL) subsystem and its capabilities were extended. Multiple\n simultaneous locks can be acquired and GET_LOCK() does not release\n any existing locks. It is even possible for a given session to\n acquire multiple locks for the same name. Other sessions cannot\n acquire a lock with that name until the acquiring session releases\n all its locks for the name.\n\n As a result of the MDL reimplementation, locks acquired with\n GET_LOCK() appear in the Performance Schema metadata_locks table. The\n OBJECT_TYPE column says USER LEVEL LOCK and the OBJECT_NAME column\n indicates the lock name. Also, the capability of acquiring multiple\n locks introduces the possibility of deadlock among clients. An\n ER_USER_LOCK_DEADLOCK error is returned when this occurs.\n\nThe difference in lock acquisition behavior as of MySQL 5.7.5 can be\nseen by the following example. Suppose that you execute these\nstatements:\n\nSELECT GET_LOCK('lock1',10);\nSELECT GET_LOCK('lock2',10);\nSELECT RELEASE_LOCK('lock2');\nSELECT RELEASE_LOCK('lock1');\n\nIn MySQL 5.7.5 or later, the second GET_LOCK() acquires a second lock\nand both RELEASE_LOCK() calls return 1 (success). Before MySQL 5.7.5,\nthe second GET_LOCK() releases the first lock ('lock1') and the second\nRELEASE_LOCK() returns NULL (failure) because there is no 'lock1' to\nrelease.\n\nMySQL 5.7.5 and later enforces a maximum length on lock names of 64\ncharacters. Previously, no limit was enforced.\n\nLocks obtained with GET_LOCK() do not interact with transactions. That\n ...
+[GLENGTH]
+declaration=ls
+category=LineString properties
+description=Returns a double-precision number indicating the length of the\nLineString value ls in its associated spatial reference.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
[GREATEST]
declaration=value1,value2,...
-category=Comparison Operators
-description=With two or more arguments, returns the largest (maximum-valued) argument
-[GROUPING]
-declaration=expr [, expr] ...
-category=Miscellaneous Functions
-description=For GROUP BY queries that include a WITH ROLLUP modifier, the ROLLUP\noperation produces super-aggregate output rows where NULL represents the\nset of all values
+category=Comparison operators
+description=With two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
[GROUP_CONCAT]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=This function returns a string result with the concatenated non-NULL values\nfrom a group
+category=Functions and Modifiers for Use with GROUP BY
+description=This function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[GTID_SUBSET]
-declaration=set1,set2
-category=GTID
-description=Given two sets of global transaction identifiers set1 and set2, returns\ntrue if all GTIDs in set1 are also in set2
+declaration=subset,set
+category=MBR
+description=Given two sets of global transaction IDs subset and set, returns true\nif all GTIDs in subset are also in set. Returns false otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gtid-functions.html
[GTID_SUBTRACT]
-declaration=set1,set2
-category=GTID
-description=Given two sets of global transaction identifiers set1 and set2, returns\nonly those GTIDs from set1 that are not in set2
+declaration=set,subset
+category=MBR
+description=Given two sets of global transaction IDs subset and set, returns only\nthose GTIDs from set that are not in subset.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gtid-functions.html
[HEX]
declaration=str
category=String Functions
-description=For a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each byte of each character in str is converted\nto two hexadecimal digits
+description=For a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each byte of each character in str is\nconverted to two hexadecimal digits. (Multibyte characters therefore\nbecome more than two digits.) The inverse of this operation is\nperformed by the UNHEX() function.\n\nFor a numeric argument N, HEX() returns a hexadecimal string\nrepresentation of the value of N treated as a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16). The inverse of this operation is\nperformed by CONV(HEX(N),16,10).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[HOUR]
declaration=time
category=Date and Time Functions
-description=Returns the hour for time
+description=Returns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[IFNULL]
declaration=expr1,expr2
-category=Flow Control Functions
-description=If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2
+category=Control flow functions
+description=If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2. IFNULL() returns a numeric or string value, depending on the\ncontext in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html
+[IN]
+declaration=value,...
+category=Comparison operators
+description=Returns 1 if expr is equal to any of the values in the IN list, else\nreturns 0. If all values are constants, they are evaluated according to\nthe type of expr and sorted. The search for the item then is done using\na binary search. This means IN is very quick if the IN value list\nconsists entirely of constants. Otherwise, type conversion takes place\naccording to the rules described in\nhttp://dev.mysql.com/doc/refman/5.7/en/type-conversion.html, but\napplied to all the arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
[INET6_ATON]
declaration=expr
category=Miscellaneous Functions
-description=Given an IPv6 or IPv4 network address as a string, returns a binary string\nthat represents the numeric value of the address in network byte order (big\nendian)
+description=Given an IPv6 or IPv4 network address as a string, returns a binary\nstring that represents the numeric value of the address in network byte\norder (big endian). Because numeric-format IPv6 addresses require more\nbytes than the largest integer type, the representation returned by\nthis function has the VARBINARY data type: VARBINARY(16) for IPv6\naddresses and VARBINARY(4) for IPv4 addresses. If the argument is not a\nvalid address, INET6_ATON() returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[INET6_NTOA]
declaration=expr
category=Miscellaneous Functions
-description=Given an IPv6 or IPv4 network address represented in numeric form as a\nbinary string, returns the string representation of the address as a string\nin the connection character set
+description=Given an IPv6 or IPv4 network address represented in numeric form as a\nbinary string, returns the string representation of the address as a\nnonbinary string in the connection character set. If the argument is\nnot a valid address, INET6_NTOA() returns NULL.\n\nINET6_NTOA() has these properties:\n\no It does not use operating system functions to perform conversions,\n thus the output string is platform independent.\n\no The return string has a maximum length of 39 (4 x 8 + 7). Given this\n statement:\n\nCREATE TABLE t AS SELECT INET6_NTOA(expr) AS c1;\n\n The resulting table would have this definition:\n\nCREATE TABLE t (c1 VARCHAR(39) CHARACTER SET utf8 DEFAULT NULL);\n\no The return string uses lowercase letters for IPv6 addresses.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[INET_ATON]
declaration=expr
category=Miscellaneous Functions
-description=Given the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the address\nin network byte order (big endian)
+description=Given the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the\naddress in network byte order (big endian). INET_ATON() returns NULL if\nit does not understand its argument.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[INET_NTOA]
declaration=expr
category=Miscellaneous Functions
-description=Given a numeric IPv4 network address in network byte order, returns the\ndotted-quad string representation of the address as a string in the\nconnection character set
+description=Given a numeric IPv4 network address in network byte order, returns the\ndotted-quad string representation of the address as a nonbinary string\nin the connection character set. INET_NTOA() returns NULL if it does\nnot understand its argument.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[INSTR]
declaration=str,substr
category=String Functions
-description=Returns the position of the first occurrence of substring substr in string\nstr
+description=Returns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[INT]
+declaration=M
+category=Data Types
+description=A normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
+[INTEGER]
+declaration=M
+category=Data Types
+description=This type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
+[INTERIORRINGN]
+declaration=poly,N
+category=Polygon properties
+description=Returns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html
+[INTERSECTS]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBRIntersects() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
[INTERVAL]
declaration=N,N1,N2,N3,...
-category=Comparison Operators
-description=Returns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL
+category=Comparison operators
+description=Returns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because a binary\nsearch is used (very fast).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
+[ISCLOSED]
+declaration=ls
+category=LineString properties
+description=Returns 1 if the LineString value ls is closed (that is, its\nStartPoint() and EndPoint() values are the same) and is simple (does\nnot pass through the same point more than once). Returns 0 if ls is not\nclosed, and -1 if it is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
+[ISEMPTY]
+declaration=g
+category=Geometry properties
+description=This function is a placeholder that returns 0 for any valid geometry\nvalue, 1 for any invalid geometry value or NULL.\n\nMySQL does not support GIS EMPTY values such as POINT EMPTY.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
[ISNULL]
declaration=expr
-category=Comparison Operators
-description=If expr is NULL, ISNULL() returns 1, otherwise it returns 0
+category=Comparison operators
+description=If expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
+[ISSIMPLE]
+declaration=g
+category=Geometry properties
+description=Returns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and NULL if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple. (See [HELP Geometry\nhierarchy].)\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
[IS_FREE_LOCK]
declaration=str
-category=Locking Functions
-description=Checks whether the lock named str is free to use (that is, not locked)
+category=Miscellaneous Functions
+description=Checks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[IS_IPV4]
declaration=expr
category=Miscellaneous Functions
-description=Returns 1 if the argument is a valid IPv4 address specified as a string, 0\notherwise
+description=Returns 1 if the argument is a valid IPv4 address specified as a\nstring, 0 otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[IS_IPV4_COMPAT]
declaration=expr
category=Miscellaneous Functions
-description=This function takes an IPv6 address represented in numeric form as a binary\nstring, as returned by INET6_ATON()
+description=This function takes an IPv6 address represented in numeric form as a\nbinary string, as returned by INET6_ATON(). It returns 1 if the\nargument is a valid IPv4-compatible IPv6 address, 0 otherwise.\nIPv4-compatible addresses have the form ::ipv4_address.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[IS_IPV4_MAPPED]
declaration=expr
category=Miscellaneous Functions
-description=This function takes an IPv6 address represented in numeric form as a binary\nstring, as returned by INET6_ATON()
+description=This function takes an IPv6 address represented in numeric form as a\nbinary string, as returned by INET6_ATON(). It returns 1 if the\nargument is a valid IPv4-mapped IPv6 address, 0 otherwise. IPv4-mapped\naddresses have the form ::ffff:ipv4_address.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[IS_IPV6]
declaration=expr
category=Miscellaneous Functions
-description=Returns 1 if the argument is a valid IPv6 address specified as a string, 0\notherwise
+description=Returns 1 if the argument is a valid IPv6 address specified as a\nstring, 0 otherwise. This function does not consider IPv4 addresses to\nbe valid IPv6 addresses.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[IS_USED_LOCK]
declaration=str
-category=Locking Functions
-description=Checks whether the lock named str is in use (that is, locked)
-[IS_UUID]
-declaration=string_uuid
category=Miscellaneous Functions
-description=Returns 1 if the argument is a valid string-format UUID, 0 if the argument\nis not a valid UUID, and NULL if the argument is NULL
-[JSON_ARRAY]
-declaration=[val[, val] ...]
-category=MBR Functions
-description=Evaluates a (possibly empty) list of values and returns a JSON array\ncontaining those values
-[JSON_ARRAYAGG]
-declaration=col_or_expr
-category=Aggregate Functions and Modifiers
-description=Aggregates a result set as a single JSON array whose elements consist of\nthe rows
-[JSON_ARRAY_APPEND]
-declaration=json_doc, path, val[, path, val] ...
-category=MBR Functions
-description=Appends values to the end of the indicated arrays within a JSON document\nand returns the result
-[JSON_ARRAY_INSERT]
-declaration=json_doc, path, val[, path, val] ...
-category=MBR Functions
-description=Updates a JSON document, inserting into an array within the document and\nreturning the modified document
-[JSON_CONTAINS]
-declaration=target, candidate[, path]
-category=MBR Functions
-description=Indicates by returning 1 or 0 whether a given candidate JSON document is\ncontained within a target JSON document, or---if a path argument was\nsupplied---whether the candidate is found at a specific path within the\ntarget
-[JSON_CONTAINS_PATH]
-declaration=json_doc, one_or_all, path[, path] ...
-category=MBR Functions
-description=Returns 0 or 1 to indicate whether a JSON document contains data at a given\npath or paths
-[JSON_DEPTH]
-declaration=json_doc
-category=MBR Functions
-description=Returns the maximum depth of a JSON document
-[JSON_EXTRACT]
-declaration=json_doc, path[, path] ...
-category=MBR Functions
-description=Returns data from a JSON document, selected from the parts of the document\nmatched by the path arguments
-[JSON_INSERT]
-declaration=json_doc, path, val[, path, val] ...
-category=MBR Functions
-description=Inserts data into a JSON document and returns the result
-[JSON_KEYS]
-declaration=json_doc[, path]
-category=MBR Functions
-description=Returns the keys from the top-level value of a JSON object as a JSON array,\nor, if a path argument is given, the top-level keys from the selected path
-[JSON_LENGTH]
-declaration=json_doc[, path]
-category=MBR Functions
-description=Returns the length of a JSON document, or, if a path argument is given, the\nlength of the value within the document identified by the path
-[JSON_MERGE]
-declaration=json_doc, json_doc[, json_doc] ...
-category=MBR Functions
-description=Merges two or more JSON documents
-[JSON_OBJECT]
-declaration=[key, val[, key, val] ...]
-category=MBR Functions
-description=Evaluates a (possibly empty) list of key-value pairs and returns a JSON\nobject containing those pairs
-[JSON_OBJECTAGG]
-declaration=key, value
-category=Aggregate Functions and Modifiers
-description=Takes two column names or expressions as arguments, the first of these\nbeing used as a key and the second as a value, and returns a JSON object\ncontaining key-value pairs
-[JSON_OVERLAPS]
-declaration=json_doc1, json_doc2
-category=MBR Functions
-description=Compares two JSON documents
-[JSON_PRETTY]
-declaration=json_val
-category=MBR Functions
-description=Provides pretty-printing of JSON values similar to that implemented in PHP\nand by other languages and database systems
-[JSON_QUOTE]
-declaration=string
-category=MBR Functions
-description=Quotes a string as a JSON value by wrapping it with double quote characters\nand escaping interior quote and other characters, then returning the result\nas a utf8mb4 string
-[JSON_REMOVE]
-declaration=json_doc, path[, path] ...
-category=MBR Functions
-description=Removes data from a JSON document and returns the result
-[JSON_REPLACE]
-declaration=json_doc, path, val[, path, val] ...
-category=MBR Functions
-description=Replaces existing values in a JSON document and returns the result
-[JSON_SCHEMA_VALID]
-declaration=schema,document
-category=MBR Functions
-description=Validates a JSON document against a JSON schema
-[JSON_SCHEMA_VALIDATION_REPORT]
-declaration=schema,document
-category=MBR Functions
-description=Validates a JSON document against a JSON schema
-[JSON_SEARCH]
-declaration=json_doc, one_or_all, search_str[, escape_char[, path] ...]
-category=MBR Functions
-description=Returns the path to the given string within a JSON document
-[JSON_SET]
-declaration=json_doc, path, val[, path, val] ...
-category=MBR Functions
-description=Inserts or updates data in a JSON document and returns the result
-[JSON_STORAGE_FREE]
-declaration=json_val
-category=MBR Functions
-description=For a JSON column value, this function shows how much storage space was\nfreed in its binary representation after it was updated in place using\nJSON_SET(), JSON_REPLACE(), or JSON_REMOVE()
-[JSON_STORAGE_SIZE]
-declaration=json_val
-category=MBR Functions
-description=This function returns the number of bytes used to store the binary\nrepresentation of a JSON document
-[JSON_TABLE]
-declaration=expr, path COLUMNS (column_list
-category=MBR Functions
-description=Extracts data from a JSON document and returns it as a relational table\nhaving the specified columns
-[JSON_TYPE]
-declaration=json_val
-category=MBR Functions
-description=Returns a utf8mb4 string indicating the type of a JSON value
-[JSON_UNQUOTE]
-declaration=json_val
-category=MBR Functions
-description=Unquotes JSON value and returns the result as a utf8mb4 string
-[JSON_VALID]
-declaration=val
-category=MBR Functions
-description=Returns 0 or 1 to indicate whether a value is valid JSON
-[JSON_VALUE]
-declaration=json_doc, path
-category=MBR Functions
-description=Extracts a value from a JSON document at the path given in the specified\ndocument, and returns the extracted value, optionally converting it to a\ndesired type
-[LAG]
-declaration=expr [, N[, default]]
-category=Window Functions
-description=Returns the value of expr from the row that lags (precedes) the current row\nby N rows within its partition
+description=Checks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
+[JOIN]
+declaration=t2, t3, t4
+category=Data Manipulation
+description=ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents\n(they can replace each other). In standard SQL, they are not\nequivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used\notherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations. MySQL also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.7/en/nested-join-optimization.html).\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttp://dev.mysql.com/doc/refman/5.7/en/index-hints.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/join.html
[LAST_DAY]
declaration=date
category=Date and Time Functions
-description=Takes a date or datetime value and returns the corresponding value for the\nlast day of the month
-[LAST_VALUE]
-declaration=expr
-category=Window Functions
-description=Returns the value of expr from the last row of the window frame
+description=Takes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[LAST_INSERT_ID]
+declaration=
+category=Information Functions
+description=With no argument, LAST_INSERT_ID() returns a BIGINT UNSIGNED (64-bit)\nvalue representing the first automatically generated value successfully\ninserted for an AUTO_INCREMENT column as a result of the most recently\nexecuted INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nWith an argument, LAST_INSERT_ID() returns an unsigned integer.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nmysql> SELECT LAST_INSERT_ID();\n -> 195\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain\nstable in the second statement; its value for the second and later rows\nis not affected by the earlier row insertions. (However, if you mix\nreferences to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the effect is\nundefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nPrior to MySQL 5.7.3, this function was not replicated correctly if\nreplication filtering rules were in use. (Bug #17234370, Bug #69861)\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value is seen by statements that follow\n the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so following statements\n will not see a changed value.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[LCASE]
declaration=str
category=String Functions
-description=LCASE() is a synonym for LOWER()
-[LEAD]
-declaration=expr [, N[, default]]
-category=Window Functions
-description=Returns the value of expr from the row that leads (follows) the current row\nby N rows within its partition
+description=LCASE() is a synonym for LOWER().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[LEAST]
declaration=value1,value2,...
-category=Comparison Operators
-description=With two or more arguments, returns the smallest (minimum-valued) argument
+category=Comparison operators
+description=With two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If any argument is NULL, the result is NULL. No comparison is needed.\n\no If the return value is used in an INTEGER context or all arguments\n are integer-valued, they are compared as integers.\n\no If the return value is used in a REAL context or all arguments are\n real-valued, they are compared as reals.\n\no If the arguments comprise a mix of numbers and strings, they are\n compared as numbers.\n\no If any argument is a nonbinary (character) string, the arguments are\n compared as nonbinary strings.\n\no In all other cases, the arguments are compared as binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html
[LEFT]
declaration=str,len
category=String Functions
-description=Returns the leftmost len characters from the string str, or NULL if any\nargument is NULL
+description=Returns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[LENGTH]
declaration=str
category=String Functions
-description=Returns the length of the string str, measured in bytes
+description=Returns the length of the string str, measured in bytes. A multibyte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[LINEFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a LineString value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[LINEFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a LineString value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[LINESTRING]
-declaration=pt [, pt] ...
-category=Geometry Constructors
-description=Constructs a LineString value from a number of Point or WKB Point arguments
+declaration=pt1,pt2,...
+category=Geometry constructors
+description=Constructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
[LN]
declaration=X
category=Numeric Functions
-description=Returns the natural logarithm of X; that is, the base-e logarithm of X
+description=Returns the natural logarithm of X; that is, the base-e logarithm of X.\nAs of MySQL 5.7.4, if X is less than or equal to 0.0E0, the error\n"Invalid argument for logarithm" is reported in strict SQL mode, and\nNULL is returned in non-strict mode. Before MySQL 5.7.4, if X is less\nthan or equal to 0.0E0, NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[LOAD_FILE]
declaration=file_name
category=String Functions
-description=Reads the file and returns the file contents as a string
+description=Reads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by all and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable controls interpretation of\nfile names that are given as literal strings.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[LOCALTIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=LOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[LOCALTIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=LOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[LOCATE]
declaration=substr,str
category=String Functions
-description=The first syntax returns the position of the first occurrence of substring\nsubstr in string str
+description=The first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[LOG]
declaration=X
category=Numeric Functions
-description=If called with one parameter, this function returns the natural logarithm\nof X
+description=If called with one parameter, this function returns the natural\nlogarithm of X. As of MySQL 5.7.4, if X is less than or equal to 0.0E0,\nthe error "Invalid argument for logarithm" is reported in strict SQL\nmode, and NULL is returned in non-strict mode. Before MySQL 5.7.4, if X\nis less than or equal to 0.0E0, NULL is returned.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[LOG10]
declaration=X
category=Numeric Functions
-description=Returns the base-10 logarithm of X
+description=Returns the base-10 logarithm of X. As of MySQL 5.7.4, if X is less\nthan or equal to 0.0E0, the error "Invalid argument for logarithm" is\nreported in strict SQL mode, and NULL is returned in non-strict mode.\nBefore MySQL 5.7.4, if X is less than or equal to 0.0E0, NULL is\nreturned.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[LOG2]
declaration=X
category=Numeric Functions
-description=Returns the base-2 logarithm of X
+description=Returns the base-2 logarithm of X. As of MySQL 5.7.4, if X is less than\nor equal to 0.0E0, the error "Invalid argument for logarithm" is\nreported in strict SQL mode, and NULL is returned in non-strict mode.\nBefore MySQL 5.7.4, if X is less than or equal to 0.0E0, NULL is\nreturned.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[LOWER]
declaration=str
category=String Functions
-description=Returns the string str with all characters changed to lowercase according\nto the current character set mapping
+description=Returns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER('QUADRATICALLY');\n -> 'quadratically'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY 'New York';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nFor Unicode character sets, LOWER() and UPPER() work accounting to\nUnicode Collation Algorithm (UCA) 5.2.0 for xxx_unicode_520_ci\ncollations and for language-specific collations that are derived from\nthem. For other Unicode collations, LOWER() and UPPER() work accounting\nto Unicode Collation Algorithm (UCA) 4.0.0. See\nhttp://dev.mysql.com/doc/refman/5.7/en/charset-unicode-sets.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[LPAD]
declaration=str,len,padstr
category=String Functions
-description=Returns the string str, left-padded with the string padstr to a length of\nlen characters
+description=Returns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[LTRIM]
declaration=str
category=String Functions
-description=Returns the string str with leading space characters removed
+description=Returns the string str with leading space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[MAKEDATE]
declaration=year,dayofyear
category=Date and Time Functions
-description=Returns a date, given year and day-of-year values
+description=Returns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[MAKETIME]
declaration=hour,minute,second
category=Date and Time Functions
-description=Returns a time value calculated from the hour, minute, and second arguments
+description=Returns a time value calculated from the hour, minute, and second\narguments.\n\nThe second argument can have a fractional part.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[MAKE_SET]
declaration=bits,str1,str2,...
category=String Functions
-description=Returns a set value (a string containing substrings separated by ,\ncharacters) consisting of the strings that have the corresponding bit in\nbits set
+description=Returns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[MASTER_POS_WAIT]
-declaration=log_name,log_pos[,timeout][,channel]
+declaration=log_name,log_pos[,timeout]
category=Miscellaneous Functions
-description=This function is useful for control of source/replica synchronization
+description=This function is useful for control of master/slave synchronization. It\nblocks until the slave has read and applied all updates up to the\nspecified position in the master log. The return value is the number of\nlog events the slave had to wait for to advance to the specified\nposition. The function returns NULL if the slave SQL thread is not\nstarted, the slave's master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave\nis past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than 0; a zero or\nnegative timeout means no timeout.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[MAX]
declaration=[DISTINCT] expr
-category=Aggregate Functions and Modifiers
-description=Returns the maximum value of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.7/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[MBRCONTAINS]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncontains the minimum bounding rectangle of g2
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncontains the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRCOVEREDBY]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1 is\ncovered by the minimum bounding rectangle of g2
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\nis covered by the minimum bounding rectangle of g2. This tests the\nopposite relationship as MBRCovers().\n\nMBRCoveredBy() and MBRCovers() handle their arguments and return a\nvalue as follows:\n\no Return NULL if either argument is NULL or an empty geometry\n\no Return ER_GIS_INVALID_DATA if either argument is not a valid geometry\n byte string (SRID plus WKB value)\n\no Otherwise, return non-NULL\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRCOVERS]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncovers the minimum bounding rectangle of g2
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncovers the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRCoveredBy(). See the description of MBRCoveredBy()\nfor examples and information about argument handling.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRDISJOINT]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of the\ntwo geometries g1 and g2 are disjoint (do not intersect)
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
+[MBREQUAL]
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 are the same.\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBREquals() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBREQUALS]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of the\ntwo geometries g1 and g2 are the same
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 are the same.\n\nThis function was added in MySQL 5.7.6. It should be used in preference\nto MBREqual().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRINTERSECTS]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of the\ntwo geometries g1 and g2 intersect
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 intersect.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBROVERLAPS]
-declaration=g1, g2
-category=MBR Functions
-description=Two geometries spatially overlap if they intersect and their intersection\nresults in a geometry of the same dimension but not equal to either of the\ngiven geometries
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 overlap. The term spatially overlaps is\nused if two geometries intersect and their intersection results in a\ngeometry of the same dimension but not equal to either of the given\ngeometries.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRTOUCHES]
-declaration=g1, g2
-category=MBR Functions
-description=Two geometries spatially touch if their interiors do not intersect, but the\nboundary of one of the geometries intersects either the boundary or the\ninterior of the other
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially touch if\nthe interiors of the geometries do not intersect, but the boundary of\none of the geometries intersects either the boundary or the interior of\nthe other.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MBRWITHIN]
-declaration=g1, g2
-category=MBR Functions
-description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1 is\nwithin the minimum bounding rectangle of g2
+declaration=g1,g2
+category=MBR
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\nis within the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mysql-specific.html
[MD5]
declaration=str
category=Encryption Functions
-description=Calculates an MD5 128-bit checksum for the string
+description=Calculates an MD5 128-bit checksum for the string. The value is\nreturned as a string of 32 hex digits, or NULL if the argument was\nNULL. The return value can, for example, be used as a hash key. See the\nnotes at the beginning of this section about storing hash values\nefficiently.\n\nThe return value is a nonbinary string in the connection character set.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[MEDIUMINT]
+declaration=M
+category=Data Types
+description=A medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[MICROSECOND]
declaration=expr
category=Date and Time Functions
-description=Returns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999
+description=Returns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[MID]
declaration=str,pos,len
category=String Functions
-description=MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len)
+description=MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[MIN]
declaration=[DISTINCT] expr
-category=Aggregate Functions and Modifiers
-description=Returns the minimum value of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value. See\nhttp://dev.mysql.com/doc/refman/5.7/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the minimum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMIN() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[MINUTE]
declaration=time
category=Date and Time Functions
-description=Returns the minute for time, in the range 0 to 59
+description=Returns the minute for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[MLINEFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a MultiLineString value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[MLINEFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a MultiLineString value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[MOD]
declaration=N,M
category=Numeric Functions
-description=Modulo operation
+description=Modulo operation. Returns the remainder of N divided by M.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[MONTH]
declaration=date
category=Date and Time Functions
-description=Returns the month for date, in the range 1 to 12 for January to December,\nor 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero month\npart
+description=Returns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as '0000-00-00' or '2008-00-00' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[MONTHNAME]
declaration=date
category=Date and Time Functions
-description=Returns the full name of the month for date
+description=Returns the full name of the month for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.7/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[MPOINTFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a MultiPoint value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[MPOINTFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a MultiPoint value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
+[MPOLYFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a MultiPolygon value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[MPOLYFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a MultiPolygon value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[MULTILINESTRING]
-declaration=ls [, ls] ...
-category=Geometry Constructors
-description=Constructs a MultiLineString value using LineString or WKB LineString\narguments
+declaration=ls1,ls2,...
+category=Geometry constructors
+description=Constructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
[MULTIPOINT]
-declaration=pt [, pt2] ...
-category=Geometry Constructors
-description=Constructs a MultiPoint value using Point or WKB Point arguments
+declaration=pt1,pt2,...
+category=Geometry constructors
+description=Constructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
[MULTIPOLYGON]
-declaration=poly [, poly] ...
-category=Geometry Constructors
-description=Constructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments
+declaration=poly1,poly2,...
+category=Geometry constructors
+description=Constructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
[NAME_CONST]
declaration=name,value
category=Miscellaneous Functions
-description=Returns the given value
+description=Returns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nmysql> SELECT NAME_CONST('myname', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[NOW]
declaration=[fsp]
category=Date and Time Functions
-description=Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss' or\nYYYYMMDDhhmmss format, depending on whether the function is used in string\nor numeric context
-[NTH_VALUE]
-declaration=expr, N
-category=Window Functions
-description=Returns the value of expr from the N-th row of the window frame
-[NTILE]
-declaration=N
-category=Window Functions
-description=Divides a partition into N groups (buckets), assigns each row in the\npartition its bucket number, and returns the bucket number of the current\nrow within its partition
+description=Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'\nor YYYYMMDDHHMMSS format, depending on whether the function is used in\na string or numeric context. The value is expressed in the current time\nzone.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[NULLIF]
declaration=expr1,expr2
-category=Flow Control Functions
-description=Returns NULL if expr1 = expr2 is true, otherwise returns expr1
+category=Control flow functions
+description=Returns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html
+[NUMGEOMETRIES]
+declaration=gc
+category=GeometryCollection properties
+description=Returns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-geometrycollection-property-functions.html
+[NUMINTERIORRINGS]
+declaration=poly
+category=Polygon properties
+description=Returns the number of interior rings in the Polygon value poly.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html
+[NUMPOINTS]
+declaration=ls
+category=LineString properties
+description=Returns the number of Point objects in the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
[OCT]
declaration=N
category=String Functions
-description=Returns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number
+description=Returns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[OCTET_LENGTH]
declaration=str
category=String Functions
-description=OCTET_LENGTH() is a synonym for LENGTH()
+description=OCTET_LENGTH() is a synonym for LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[OLD_PASSWORD]
+declaration=str
+category=Encryption Functions
+description=OLD_PASSWORD() was added when the implementation of PASSWORD() was\nchanged in MySQL 4.1 to improve security. OLD_PASSWORD() returns the\nvalue of the pre-4.1 implementation of PASSWORD() as a string, and is\nintended to permit you to reset passwords for any pre-4.1 clients that\nneed to connect to your version 5.7 MySQL server without locking them\nout. See http://dev.mysql.com/doc/refman/5.7/en/password-hashing.html.\n\nThe return value is a nonbinary string in the connection character set.\n\n*Note*: Passwords that use the pre-4.1 hashing method are less secure\nthan passwords that use the native password hashing method and should\nbe avoided. Pre-4.1 passwords are deprecated and support for them is\nremoved in MySQL 5.7.5. Consequently, OLD_PASSWORD() is deprecated and\nis removed in MySQL 5.7.5.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[ORD]
declaration=str
category=String Functions
-description=If the leftmost character of the string str is a multibyte character,\nreturns the code for that character, calculated from the numeric values of\nits constituent bytes using this formula: (1st byte code) + (2nd byte\ncode * 256) + (3rd byte code * 256^2)
+description=If the leftmost character of the string str is a multibyte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 2562) ...\n\nIf the leftmost character is not a multibyte character, ORD() returns\nthe same value as the ASCII() function.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[OVERLAPS]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBROverlaps() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
+[PASSWORD]
+declaration=str
+category=Encryption Functions
+description=*Note*: This function is deprecated as of MySQL 5.7.6 and will be\nremoved in a future MySQL release.\n\nReturns a hashed password string calculated from the cleartext password\nstr. The return value is a nonbinary string in the connection character\nset, or NULL if the argument is NULL. This function is the SQL\ninterface to the algorithm used by the server to encrypt MySQL\npasswords for storage in the mysql.user grant table.\n\nThe old_passwords system variable controls the password hashing method\nused by the PASSWORD() function. It also influences password hashing\nperformed by CREATE USER and GRANT statements that specify a password\nusing an IDENTIFIED BY clause.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[PERIOD_ADD]
declaration=P,N
category=Date and Time Functions
-description=Adds N months to period P (in the format YYMM or YYYYMM)
+description=Adds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM. Note that the period argument P is not a\ndate value.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[PERIOD_DIFF]
declaration=P1,P2
category=Date and Time Functions
-description=Returns the number of months between periods P1 and P2
+description=Returns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[PI]
+declaration=
+category=Numeric Functions
+description=Returns the value of ? (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[POINT]
-declaration=x, y
-category=Geometry Constructors
-description=Constructs a Point using its coordinates
+declaration=x,y
+category=Geometry constructors
+description=Constructs a Point using its coordinates.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
+[POINTFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a Point value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[POINTFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a Point value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
+[POINTN]
+declaration=ls,N
+category=LineString properties
+description=Returns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
+[POLYFROMTEXT]
+declaration=wkt[,srid]
+category=WKT
+description=Constructs a Polygon value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkt-functions.html
+[POLYFROMWKB]
+declaration=wkb[,srid]
+category=WKB
+description=Constructs a Polygon value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-wkb-functions.html
[POLYGON]
-declaration=ls [, ls] ...
-category=Geometry Constructors
-description=Constructs a Polygon value from a number of LineString or WKB LineString\narguments
+declaration=ls1,ls2,...
+category=Geometry constructors
+description=Constructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-mysql-specific-functions.html
[POSITION]
declaration=substr IN str
category=String Functions
-description=POSITION(substr IN str) is a synonym for LOCATE(substr,str)
+description=POSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[POW]
declaration=X,Y
category=Numeric Functions
-description=Returns the value of X raised to the power of Y
+description=Returns the value of X raised to the power of Y.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[POWER]
declaration=X,Y
category=Numeric Functions
-description=This is a synonym for POW()
-[PS_THREAD_ID]
-declaration=connection_id
-category=Performance Schema Functions
-description=Given a connection ID, returns a BIGINT UNSIGNED value representing the\nPerformance Schema thread ID assigned to the connection ID, or NULL if no\nthread ID exists for the connection ID
+description=This is a synonym for POW().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[QUARTER]
declaration=date
category=Date and Time Functions
-description=Returns the quarter of the year for date, in the range 1 to 4
+description=Returns the quarter of the year for date, in the range 1 to 4.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[QUOTE]
declaration=str
category=String Functions
-description=Quotes a string to produce a result that can be used as a properly escaped\ndata value in an SQL statement
+description=Quotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotation marks and with each instance of backslash ("\"),\nsingle quote ("'"), ASCII NUL, and Control+Z preceded by a backslash.\nIf the argument is NULL, the return value is the word "NULL" without\nenclosing single quotation marks.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[RADIANS]
declaration=X
category=Numeric Functions
-description=Returns the argument X, converted from degrees to radians
+description=Returns the argument X, converted from degrees to radians. (Note that\n? radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[RAND]
-declaration=[N]
+declaration=
category=Numeric Functions
-description=Returns a random floating-point value v in the range 0 <= v < 1
+description=Returns a random floating-point value v in the range 0 <= v < 1.0. If a\nconstant integer argument N is specified, it is used as the seed value,\nwhich produces a repeatable sequence of column values. In the following\nexample, note that the sequences of values produced by RAND(3) is the\nsame both places where it occurs.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[RANDOM_BYTES]
declaration=len
category=Encryption Functions
-description=This function returns a binary string of len random bytes generated using\nthe random number generator of the SSL library
-[REGEXP_INSTR]
-declaration=expr, pat[, pos[, occurrence[, return_option[,
-match_type]]]]
-category=String Functions
-description=Returns the starting index of the substring of the string expr that matches\nthe regular expression specified by the pattern pat, 0 if there is no match
-[REGEXP_LIKE]
-declaration=expr, pat[, match_type]
-category=String Functions
-description=Returns 1 if the string expr matches the regular expression specified by\nthe pattern pat, 0 otherwise
-[REGEXP_REPLACE]
-declaration=expr, pat, repl[, pos[, occurrence[, match_type]]]
-category=String Functions
-description=Replaces occurrences in the string expr that match the regular expression\nspecified by the pattern pat with the replacement string repl, and returns\nthe resulting string
-[REGEXP_SUBSTR]
-declaration=expr, pat[, pos[, occurrence[, match_type]]]
-category=String Functions
-description=Returns the substring of the string expr that matches the regular\nexpression specified by the pattern pat, NULL if there is no match
+description=This function returns a binary string of len random bytes generated\nusing the random number generator of the SSL library (OpenSSL or\nyaSSL). Permitted values of len range from 1 to 1024. For values\noutside that range, RANDOM_BYTES() generates a warning and returns\nNULL.\n\nRANDOM_BYTES() can be used to provide the initialization vector for the\nAES_DECRYPT() and AES_ENCRYPT() functions. For use in that context, len\nmust be at least 16. Larger values are permitted, but bytes in excess\nof 16 are ignored.\n\nRANDOM_BYTES() generates a random value, which makes its result\nnondeterministic. Consequently, statements that use this function are\nunsafe for statement-based replication and cannot be stored in the\nquery cache.\n\nThis function is available as of MySQL 5.7.4.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
+[RELEASE_ALL_LOCKS]
+declaration=
+category=Miscellaneous Functions
+description=Releases all named locks held by the current session and returns the\nnumber of locks released (0 if there were none)\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[RELEASE_LOCK]
declaration=str
-category=Locking Functions
-description=Releases the lock named by the string str that was obtained with GET_LOCK()
+category=Miscellaneous Functions
+description=Releases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[REVERSE]
declaration=str
category=String Functions
-description=Returns the string str with the order of the characters reversed
+description=Returns the string str with the order of the characters reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[RIGHT]
declaration=str,len
category=String Functions
-description=Returns the rightmost len characters from the string str, or NULL if any\nargument is NULL
+description=Returns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[ROUND]
declaration=X
category=Numeric Functions
-description=Rounds the argument X to D decimal places
+description=Rounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[ROW_COUNT]
+declaration=
+category=Information Functions
+description=In MySQL 5.7, ROW_COUNT() returns a value as follows:\n\no DDL statements: 0. This applies to statements such as CREATE TABLE or\n DROP TABLE.\n\no DML statements other than SELECT: The number of affected rows. This\n applies to statements such as UPDATE, INSERT, or DELETE (as before),\n but now also to statements such as ALTER TABLE and LOAD DATA INFILE.\n\no SELECT: -1 if the statement returns a result set, or the number of\n rows "affected" if it does not. For example, for SELECT * FROM t1,\n ROW_COUNT() returns -1. For SELECT * FROM t1 INTO OUTFILE\n 'file_name', ROW_COUNT() returns the number of rows written to the\n file.\n\no SIGNAL statements: 0.\n\nFor UPDATE statements, the affected-rows value by default is the number\nof rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() when connecting to mysqld, the affected-rows value\nis the number of rows "found"; that is, matched by the WHERE clause.\n\nFor REPLACE statements, the affected-rows value is 2 if the new row\nreplaced an old row, because in this case, one row was inserted after\nthe duplicate was deleted.\n\nFor INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows\nvalue per row is 1 if the row is inserted as a new row, 2 if an\nexisting row is updated, and 0 if an existing row is set to its current\nvalues. If you specify the CLIENT_FOUND_ROWS flag, the affected-rows\nvalue is 1 (not 0) if an existing row is set to its current values.\n\nThe ROW_COUNT() value is similar to the value from the\nmysql_affected_rows() C API function and the row count that the mysql\nclient displays following statement execution.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[RPAD]
declaration=str,len,padstr
category=String Functions
-description=Returns the string str, right-padded with the string padstr to a length of\nlen characters
+description=Returns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[RTRIM]
declaration=str
category=String Functions
-description=Returns the string str with trailing space characters removed
+description=Returns the string str with trailing space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[SCHEMA]
+declaration=
+category=Information Functions
+description=This function is a synonym for DATABASE().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[SECOND]
declaration=time
category=Date and Time Functions
-description=Returns the second for time, in the range 0 to 59
+description=Returns the second for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[SEC_TO_TIME]
declaration=seconds
category=Date and Time Functions
-description=Returns the seconds argument, converted to hours, minutes, and seconds, as\na TIME value
+description=Returns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[SESSION_USER]
+declaration=
+category=Information Functions
+description=SESSION_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[SHA1]
declaration=str
category=Encryption Functions
-description=Calculates an SHA-1 160-bit checksum for the string, as described in RFC\n3174 (Secure Hash Algorithm)
+description=Calculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of\n40 hex digits, or NULL if the argument was NULL. One of the possible\nuses for this function is as a hash key. See the notes at the beginning\nof this section about storing hash values efficiently. You can also use\nSHA1() as a cryptographic function for storing passwords. SHA() is\nsynonymous with SHA1().\n\nThe return value is a nonbinary string in the connection character set.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[SHA2]
declaration=str, hash_length
category=Encryption Functions
-description=Calculates the SHA-2 family of hash functions (SHA-224, SHA-256, SHA-384,\nand SHA-512)
+description=Calculates the SHA-2 family of hash functions (SHA-224, SHA-256,\nSHA-384, and SHA-512). The first argument is the cleartext string to be\nhashed. The second argument indicates the desired bit length of the\nresult, which must have a value of 224, 256, 384, 512, or 0 (which is\nequivalent to 256). If either argument is NULL or the hash length is\nnot one of the permitted values, the return value is NULL. Otherwise,\nthe function result is a hash value containing the desired number of\nbits. See the notes at the beginning of this section about storing hash\nvalues efficiently.\n\nThe return value is a nonbinary string in the connection character set.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[SIGN]
declaration=X
category=Numeric Functions
-description=Returns the sign of the argument as -1, 0, or 1, depending on whether X is\nnegative, zero, or positive
+description=Returns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[SIN]
declaration=X
category=Numeric Functions
-description=Returns the sine of X, where X is given in radians
+description=Returns the sine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[SLEEP]
declaration=duration
category=Miscellaneous Functions
-description=Sleeps (pauses) for the number of seconds given by the duration argument,\nthen returns 0
+description=Sleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. If SLEEP() is interrupted, it returns 1. The\nduration may have a fractional part. If the argument is NULL or\nnegative, SLEEP() produces a warning, or an error in strict SQL mode.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
+[SMALLINT]
+declaration=M
+category=Data Types
+description=A small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
[SOUNDEX]
declaration=str
category=String Functions
-description=Returns a soundex string from str
+description=Returns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get a\nstandard soundex string. All nonalphabetic characters in str are\nignored. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n\n*Important*: When using SOUNDEX(), you should be aware of the following\nlimitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multibyte character sets, including utf-8.\n\n We hope to remove these limitations in a future release. See Bug\n #22638 for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[SPACE]
declaration=N
category=String Functions
-description=Returns a string consisting of N space characters
+description=Returns a string consisting of N space characters.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[SQRT]
declaration=X
category=Numeric Functions
-description=Returns the square root of a nonnegative number X
-[STATEMENT_DIGEST]
-declaration=statement
-category=Encryption Functions
-description=Given an SQL statement as a string, returns the statement digest hash value\nas a string in the connection character set, or NULL if the argument is\nNULL
-[STATEMENT_DIGEST_TEXT]
-declaration=statement
-category=Encryption Functions
-description=Given an SQL statement as a string, returns the normalized statement digest\nas a string in the connection character set, or NULL if the argument is\nNULL
+description=Returns the square root of a nonnegative number X.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[SRID]
+declaration=g
+category=Geometry properties
+description=Returns an integer indicating the Spatial Reference System ID for the\ngeometry value g.\n\nIn MySQL, the SRID value is just an integer associated with the\ngeometry value. All calculations are done assuming Euclidean (planar)\ngeometry.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
+[STARTPOINT]
+declaration=ls
+category=LineString properties
+description=Returns the Point that is the start point of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
[STD]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the population standard deviation of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[STDDEV]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the population standard deviation of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard deviation of expr. This function is\nprovided for compatibility with Oracle. The standard SQL function\nSTDDEV_POP() can be used instead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[STDDEV_POP]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the population standard deviation of expr (the square root of\nVAR_POP())
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[STDDEV_SAMP]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the sample standard deviation of expr (the square root of\nVAR_SAMP()
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[STRCMP]
declaration=expr1,expr2
category=String Functions
-description=STRCMP() returns 0 if the strings are the same, -1 if the first argument is\nsmaller than the second according to the current sort order, and 1\notherwise
+description=STRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and 1 otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html
[STR_TO_DATE]
declaration=str,format
category=Date and Time Functions
-description=This is the inverse of the DATE_FORMAT() function
+description=This is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If the date,\ntime, or datetime value extracted from str is illegal, STR_TO_DATE()\nreturns NULL and produces a warning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nmysql> SELECT STR_TO_DATE('01,5,2013','%d,%m,%Y');\n -> '2013-05-01'\nmysql> SELECT STR_TO_DATE('May 1, 2013','%M %d,%Y');\n -> '2013-05-01'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nmysql> SELECT STR_TO_DATE('a09:30:17','a%h:%i:%s');\n -> '09:30:17'\nmysql> SELECT STR_TO_DATE('a09:30:17','%h:%i:%s');\n -> NULL\nmysql> SELECT STR_TO_DATE('09:30:17a','%h:%i:%s');\n -> '09:30:17'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nmysql> SELECT STR_TO_DATE('abc','abc');\n -> '0000-00-00'\nmysql> SELECT STR_TO_DATE('9','%m');\n -> '0000-09-00'\nmysql> SELECT STR_TO_DATE('9','%s');\n -> '00:00:09'\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[ST_AREA]
-declaration={poly|mpoly}
-category=Polygon Property Functions
-description=Returns a double-precision number indicating the area of the Polygon or\nMultiPolygon argument, as measured in its spatial reference system
-[ST_ASBINARY]
-declaration=g [, options]
-category=WKB Functions
-description=Converts a value in internal geometry format to its WKB representation and\nreturns the binary result
+declaration=poly
+category=Polygon properties
+description=Returns a double-precision number indicating the area of the argument,\nas measured in its spatial reference system. For arguments of dimension\n0 or 1, the result is 0.\n\nAdditionally, as of MySQL 5.7.5: The result is the sum of the area\nvalues of all components for a geometry collection. If a geometry\ncollection is empty, its area is returned as 0.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html
[ST_ASGEOJSON]
declaration=g [, max_dec_digits [, options]]
-category=MBR Functions
-description=Generates a GeoJSON object from the geometry g
-[ST_ASTEXT]
-declaration=g [, options]
-category=WKB Functions
-description=Converts a value in internal geometry format to its WKT representation and\nreturns the string result
-[ST_BUFFER]
-declaration=g, d [, strategy1 [, strategy2 [, strategy3]]]
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents all points whose distance from the\ngeometry value g is less than or equal to a distance of d
-[ST_BUFFER_STRATEGY]
-declaration=strategy [, points_per_circle]
-category=GeometryCollection Property Functions
-description=This function returns a strategy byte string for use with ST_Buffer() to\ninfluence buffer computation
+category=MBR
+description=Generates a GeoJSON object from the geometry g. The object string has\nthe connection character set and collation.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geojson-functions.html
[ST_CENTROID]
-declaration={poly|mpoly}
-category=Polygon Property Functions
-description=Returns the mathematical centroid for the Polygon or MultiPolygon argument\nas a Point
-[ST_COLLECT]
-declaration=[DISTINCT] g
-category=MBR Functions
-description=Aggregates geometry values and returns a single geometry collection value
+declaration=mpoly
+category=Polygon properties
+description=Returns the mathematical centroid for the MultiPolygon value mpoly as a\nPoint. The result is not guaranteed to be on the MultiPolygon.\n\nAs of MySQL 5.7.5, this function processes geometry collections by\ncomputing the centroid point for components of highest dimension in the\ncollection. Such components are extracted and made into a single\nMultiPolygon, MultiLineString, or MultiPoint for centroid computation.\nIf the argument is an empty geometry collection, the return value is\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-multipolygon-property-functions.html
[ST_CONTAINS]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Returns 1 or 0 to indicate whether g1 completely contains g2
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as ST_Within().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_CONVEXHULL]
declaration=g
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents the convex hull of the geometry value g
+category=GeometryCollection properties
+description=Returns a geometry that represents the convex hull of the geometry\nvalue g.\n\nThis function computes a geometry's convex hull by first checking\nwhether its vertex points are colinear. The function returns a linear\nhull if so, a polygon hull otherwise. This function processes geometry\ncollections by extracting all vertex points of all components of the\ncollection, creating a MultiPoint value from them, and computing its\nconvex hull. If the argument is an empty geometry collection, the\nreturn value is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[ST_CROSSES]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Two geometries spatially cross if their spatial relation has the following\nproperties: o Unless g1 and g2 are both of dimension 1: g1 crosses g2 if\nthe interior of g2 has points in common with the interior of g1, but g2 \ndoes not cover the entire interior of g1
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nAs of MySQL 5.7.5, this function returns 0 if called with an\ninapplicable geometry argument type combination. For example, it\nreturns 0 if the first argument is a Polygon or MultiPolygon and/or the\nsecond argument is a Point or MultiPoint.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_DIFFERENCE]
declaration=g1, g2
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents the point set difference of the geometry\nvalues g1 and g2
-[ST_DIMENSION]
-declaration=g
-category=Geometry Property Functions
-description=Returns the inherent dimension of the geometry value g
+category=GeometryCollection properties
+description=Returns a geometry that represents the point set difference of the\ngeometry values g1 and g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[ST_DISJOINT]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does not\nintersect) g2
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_DISTANCE]
-declaration=g1, g2 [, unit]
-category=Geometry Relation Functions
-description=Returns the distance between g1 and g2, measured in the length unit of the\nspatial reference system (SRS) of the geometry arguments, or in the unit of\nthe optional unit argument if that is specified
+declaration=g1,g2
+category=Geometry relations
+description=Returns the distance between g1 and g2.\n\nAs of MySQL 5.7.5, this function processes geometry collections by\nreturning the shortest distance among all combinations of the\ncomponents of the two geometry arguments. If either argument is an\nempty geometry collection, the return value is NULL.\n\nAs of MySQL 5.7.6, if an intermediate or final result produces NaN or a\nnegative number, this function produces a ER_GIS_INVALID_DATA error.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_DISTANCE_SPHERE]
declaration=g1, g2 [, radius]
-category=MBR Functions
-description=Returns the mimimum spherical distance between Point or MultiPoint\narguments on a sphere, in meters
-[ST_ENDPOINT]
-declaration=ls
-category=LineString Property Functions
-description=Returns the Point that is the endpoint of the LineString value ls
+category=MBR
+description=Returns the mimimum spherical distance between two points and/or\nmultipoints on a sphere, in meters, or NULL if any geometry argument is\nNULL or empty.\n\nCalculations use a spherical earth and a configurable radius. The\noptional radius argument should be given in meters. If omitted, the\ndefault radius is 6,370,986 meters. An ER_WRONG_ARGUMENTS error occurs\nif the radius argument is present but not positive.\n\nThe geometry arguments should consist of points that specify\n(longitude, latitude) coordinate values:\n\no Longitude and latitude are the first and second coordinates of the\n point, respectively.\n\no Both coordinates are in degrees.\n\no Longitude values must be in the range (-180, 180]. Positive values\n are east of the prime meridian.\n\no Latitude values must be in the range [-90, 90]. Positive values are\n north of the equator.\n\nSupported argument combinations are (Point, Point), (Point,\nMultiPoint), and (MultiPoint, Point). An ER_GIS_UNSUPPORTED_ARGUMENT\nerror occurs for other combinations.\n\nAn ER_GIS_INVALID_DATA error occurs if any geometry argument is not a\nvalid geometry byte string.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html
[ST_ENVELOPE]
declaration=g
-category=Geometry Property Functions
-description=Returns the minimum bounding rectangle (MBR) for the geometry value g
+category=Geometry properties
+description=Returns the minimum bounding rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value that is defined by the corner\npoints of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nAs of MySQL 5.7.6, if the argument is a point or a vertical or\nhorizontal line segment, ST_Envelope() returns the point or the line\nsegment as its MBR rather than returning an invalid polygon.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-general-property-functions.html
[ST_EQUALS]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Returns 1 or 0 to indicate whether g1 is spatially equal to g2
-[ST_EXTERIORRING]
-declaration=poly
-category=Polygon Property Functions
-description=Returns the exterior ring of the Polygon value poly as a LineString
-[ST_FRECHETDISTANCE]
-declaration=g1, g2 [, unit]
-category=Geometry Relation Functions
-description=Returns the discrete Fr├®chet distance between two geometries, reflecting\nhow similar the geometries are
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_GEOHASH]
declaration=longitude, latitude, max_length
-category=MBR Functions
-description=max_length) Returns a geohash string in the connection character set and\ncollation
-[ST_GEOMCOLLFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=ST_GeometryCollectionFromText(wkt [, srid [, options]]),\nST_GeomCollFromTxt(wkt [, srid [, options]]) Constructs a\nGeometryCollection value using its WKT representation and SRID
-[ST_GEOMCOLLFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=ST_GeometryCollectionFromWKB(wkb [, srid [, options]]) Constructs a\nGeometryCollection value using its WKB representation and SRID
-[ST_GEOMETRYN]
-declaration=gc, N
-category=GeometryCollection Property Functions
-description=Returns the N-th geometry in the GeometryCollection value gc
-[ST_GEOMETRYTYPE]
-declaration=g
-category=Geometry Property Functions
-description=Returns a binary string indicating the name of the geometry type of which\nthe geometry instance g is a member
+category=MBR
+description=max_length)\n\nReturns a geohash string in the connection character set and collation.\nThe result is NULL if any argument is NULL. An error occurs if any\nargument is invalid.\n\nFor the first syntax, the longitude must be a number in the range\n[-180, 180], and the latitude must be a number in the range [-90, 90].\nFor the second syntax, a POINT value is required, where the X and Y\ncoordinates are in the valid ranges for longitude and latitude,\nrespectively.\n\nThe resulting string is no longer than max_length characters, which has\nan upper limit of 100. The string might be shorter than max_length\ncharacters because the algorithm that creates the geohash value\ncontinues until it has created a string that is either an exact\nrepresentation of the location or max_length characters, whichever\ncomes first.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geohash-functions.html
[ST_GEOMFROMGEOJSON]
declaration=str [, options [, srid]]
-category=MBR Functions
-description=Parses a string str representing a GeoJSON object and returns a geometry
-[ST_GEOMFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=srid [, options]]) Constructs a geometry value of any type using its WKT\nrepresentation and SRID
-[ST_GEOMFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=srid [, options]]) Constructs a geometry value of any type using its WKB\nrepresentation and SRID
-[ST_HAUSDORFFDISTANCE]
-declaration=g1, g2 [, unit]
-category=Geometry Relation Functions
-description=Returns the discrete Hausdorff distance between two geometries, reflecting\nhow similar the geometries are
-[ST_INTERIORRINGN]
-declaration=poly, N
-category=Polygon Property Functions
-description=Returns the N-th interior ring for the Polygon value poly as a LineString
+category=MBR
+description=Parses a string str representing a GeoJSON object and returns a\ngeometry.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geojson-functions.html
[ST_INTERSECTION]
declaration=g1, g2
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents the point set intersection of the\ngeometry values g1 and g2
+category=GeometryCollection properties
+description=Returns a geometry that represents the point set intersection of the\ngeometry values g1 and g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[ST_INTERSECTS]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Returns 1 or 0 to indicate whether g1 spatially intersects g2
-[ST_ISCLOSED]
-declaration=ls
-category=LineString Property Functions
-description=For a LineString value ls, ST_IsClosed() returns 1 if ls is closed (that\nis, its ST_StartPoint() and ST_EndPoint() values are the same)
-[ST_ISEMPTY]
-declaration=g
-category=Geometry Property Functions
-description=This function is a placeholder that returns 1 for an empty geometry\ncollection value or 0 otherwise
-[ST_ISSIMPLE]
-declaration=g
-category=Geometry Property Functions
-description=Returns 1 if the geometry value g is simple according to the ISO SQL/MM\nPart 3: Spatial standard
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_ISVALID]
declaration=g
-category=MBR Functions
-description=Returns 1 if the argument is geometrically valid, 0 if the argument is not\ngeometrically valid
+category=MBR
+description=Checks whether a geometry is valid, as defined by the OGC\nspecification. ST_IsValid() returns 1 if the argument is a valid\ngeometry byte string and is geometrically valid, 0 if the argument is\nnot a valid geometry byte string or is not geometrically valid, NULL if\nthe argument is NULL.\n\nThe only valid empty geometry is represented in the form of an empty\ngeometry collection value. ST_IsValid() returns 1 in this case.\n\nST_IsValid() works only for the cartesian coordinate system and\nrequires a geometry argument with an SRID of 0. An ER_WRONG_ARGUMENTS\nerror occurs otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html
[ST_LATFROMGEOHASH]
declaration=geohash_str
-category=MBR Functions
-description=Returns the latitude from a geohash string value, as a double-precision\nnumber in the range [90, 90]
-[ST_LATITUDE]
-declaration=p [, new_latitude_val]
-category=Point Property Functions
-description=With a single argument representing a valid Point object p that has a\ngeographic spatial reference system (SRS), ST_Latitude() returns the\nlatitude value of p as a double-precision number
+category=MBR
+description=Returns the latitude from a geohash string value, as a DOUBLE value in\nthe range [-90, 90]. The result is NULL if any argument is NULL. An\nerror occurs if the argument is invalid.\n\nThe ST_LatFromGeoHash() decoding function reads no more than 433\ncharacters from the geohash_str argument. That represents the upper\nlimit on information in the internal representation of coordinate\nvalues. Characters past the 433rd are ignored, even if they are\notherwise illegal and produce an error.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geohash-functions.html
[ST_LENGTH]
-declaration=ls [, unit]
-category=LineString Property Functions
-description=Returns a double-precision number indicating the length of the LineString\nor MultiLineString value ls in its associated spatial reference system
-[ST_LINEFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=srid [, options]]) Constructs a LineString value using its WKT\nrepresentation and SRID
-[ST_LINEFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=srid [, options]]) Constructs a LineString value using its WKB\nrepresentation and SRID
-[ST_LINEINTERPOLATEPOINT]
-declaration=ls, fractional_distance
-category=GeometryCollection Property Functions
-description=This function takes a LineString geometry and a fractional distance in the\nrange [0
-[ST_LINEINTERPOLATEPOINTS]
-declaration=ls, fractional_distance
-category=GeometryCollection Property Functions
-description=This function takes a LineString geometry and a fractional distance in the\nrange (0
+declaration=ls
+category=LineString properties
+description=Returns a double-precision number indicating the length of the\nLineString value ls in its associated spatial reference.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-linestring-property-functions.html
[ST_LONGFROMGEOHASH]
declaration=geohash_str
-category=MBR Functions
-description=Returns the longitude from a geohash string value, as a double-precision\nnumber in the range [180, 180]
-[ST_LONGITUDE]
-declaration=p [, new_longitude_val]
-category=Point Property Functions
-description=With a single argument representing a valid Point object p that has a\ngeographic spatial reference system (SRS), ST_Longitude() returns the\nlongitude value of p as a double-precision number
+category=MBR
+description=Returns the longitude from a geohash string value, as a DOUBLE value in\nthe range [-180, 180]. The result is NULL if any argument is NULL. An\nerror occurs if the argument is invalid.\n\nThe remarks in the description of ST_LatFromGeoHash() regarding the\nmaximum number of characters processed from the geohash_str argument\nalso apply to ST_LongFromGeoHash().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geohash-functions.html
[ST_MAKEENVELOPE]
declaration=pt1, pt2
-category=MBR Functions
-description=Returns the rectangle that forms the envelope around two points, as a\nPoint, LineString, or Polygon
-[ST_MLINEFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=ST_MultiLineStringFromText(wkt [, srid [, options]]) Constructs a\nMultiLineString value using its WKT representation and SRID
-[ST_MLINEFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=ST_MultiLineStringFromWKB(wkb [, srid [, options]]) Constructs a\nMultiLineString value using its WKB representation and SRID
-[ST_MPOINTFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=[, srid [, options]]) Constructs a MultiPoint value using its WKT\nrepresentation and SRID
-[ST_MPOINTFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=srid [, options]]) Constructs a MultiPoint value using its WKB\nrepresentation and SRID
-[ST_MPOLYFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=[, srid [, options]]) Constructs a MultiPolygon value using its WKT\nrepresentation and SRID
-[ST_MPOLYFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=[, srid [, options]]) Constructs a MultiPolygon value using its WKB\nrepresentation and SRID
-[ST_NUMGEOMETRIES]
-declaration=gc
-category=GeometryCollection Property Functions
-description=Returns the number of geometries in the GeometryCollection value gc
-[ST_NUMPOINTS]
-declaration=ls
-category=LineString Property Functions
-description=Returns the number of Point objects in the LineString value ls
+category=MBR
+description=Returns the rectangle that forms the envelope around two points. The\nreturned geometry is a Point, LineString, or Polygon, or NULL if any\nargument is NULL.\n\nCalculations are done using the cartesian coordinate system rather than\non a sphere, spheroid, or on earth.\n\nGiven two points pt1 and pt2, ST_MakeEnvelope() creates the result\ngeometry on an abstract plane like this:\n\no If pt1 and pt2 are equal, the result is the point pt1.\n\no Otherwise, if (pt1, pt2) is a vertical or horizontal line segment,\n the result is the line segment (pt1, pt2).\n\no Otherwise, the result is a polygon using pt1 and pt2 as diagonal\n points. Either or both of pt1 and pt2 can be vertex points.\n\nThe result geometry has an SRID of 0.\n\nST_MakeEnvelope() requires Point geometry arguments with an SRID of 0.\nAn ER_WRONG_ARGUMENTS error occurs otherwise.\n\nAn ER_GIS_INVALID_DATA occurs if any argument is not a valid geometry\nbyte string, or if any coordinate value of the two points is infinite\n(that is, NaN).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html
[ST_OVERLAPS]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Two geometries spatially overlap if they intersect and their intersection\nresults in a geometry of the same dimension but not equal to either of the\ngiven geometries
-[ST_POINTATDISTANCE]
-declaration=ls, distance
-category=GeometryCollection Property Functions
-description=This function takes a LineString geometry and a distance in the range [0
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nAs of MySQL 5.7.5, this function returns 0 if called with an\ninapplicable geometry argument type combination. For example, it\nreturns 0 if called with geometries of different dimensions or any\nargument is a Point.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_POINTFROMGEOHASH]
declaration=geohash_str, srid
-category=MBR Functions
-description=Returns a POINT value containing the decoded geohash value, given a geohash\nstring value
-[ST_POINTFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=Constructs a Point value using its WKT representation and SRID
-[ST_POINTFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=Constructs a Point value using its WKB representation and SRID
-[ST_POINTN]
-declaration=ls, N
-category=LineString Property Functions
-description=Returns the N-th Point in the Linestring value ls
-[ST_POLYFROMTEXT]
-declaration=wkt [, srid [, options]]
-category=WKT Functions
-description=srid [, options]]) Constructs a Polygon value using its WKT representation\nand SRID
-[ST_POLYFROMWKB]
-declaration=wkb [, srid [, options]]
-category=WKB Functions
-description=[, options]]) Constructs a Polygon value using its WKB representation and\nSRID
+category=MBR
+description=Returns a POINT value containing the decoded geohash value, given a\ngeohash string value. The X and Y coordinates of the point are the\nlongitude in the range [-180, 180] and the latitude in the range [-90,\n90], respectively. The srid value is an unsigned 32-bit integer. The\nresult is NULL if any argument is NULL. An error occurs if any argument\nis invalid.\n\nThe remarks in the description of ST_LatFromGeoHash() regarding the\nmaximum number of characters processed from the geohash_str argument\nalso apply to ST_PointFromGeoHash().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-geohash-functions.html
[ST_SIMPLIFY]
declaration=g, max_distance
-category=MBR Functions
-description=Simplifies a geometry using the Douglas-Peucker algorithm and returns a\nsimplified value of the same type
-[ST_SRID]
-declaration=g [, srid]
-category=Geometry Property Functions
-description=With a single argument representing a valid geometry object g, ST_SRID()\nreturns an integer indicating the ID of the spatial reference system (SRS)\nassociated with g
-[ST_STARTPOINT]
-declaration=ls
-category=LineString Property Functions
-description=Returns the Point that is the start point of the LineString value ls
-[ST_SWAPXY]
-declaration=g
-category=WKB Functions
-description=Accepts an argument in internal geometry format, swaps the X and Y values\nof each coordinate pair within the geometry, and returns the result
+category=MBR
+description=Simplifies a geometry using the Douglas-Peucker algorithm and returns a\nsimplified value of the same type, or NULL if any argument is NULL.\n\nThe geometry may be any geometry type, although the Douglas-Peucker\nalgorithm may not actually process every type. A geometry collection is\nprocessed by giving its components one by one to the simplification\nalgorithm, and the returned geometries are put into a geometry\ncollection as result.\n\nThe max_distance argument is the distance (in units of the input\ncoordinates) of a vertex to other segments to be removed. Vertices\nwithin this distance of the simplified linestring are removed. An\nER_WRONG_ARGUMENTS error occurs if the max_distance argument is not\npositive, or is NaN.\n\nAccording to Boost.Geometry, geometries might become invalid as a\nresult of the simplification process, and the process might create\nself-intersections. If you want to check the validity of the result,\npass it to ST_IsValid().\n\nAn ER_GIS_INVALID_DATA error occurs if the geometry argument is not a\nvalid geometry byte string.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html
[ST_SYMDIFFERENCE]
declaration=g1, g2
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents the point set symmetric difference of\nthe geometry values g1 and g2, which is defined as: g1 symdifference g2 :=\n(g1 union g2) difference (g1 intersection g2) Or, in function call\nnotation: ST_SymDifference(g1, g2) = ST_Difference(ST_Union(g1, g2),\nST_Intersection(g1, g2)) ST_SymDifference() handles its arguments as\ndescribed in the introduction to this section
+category=GeometryCollection properties
+description=Returns a geometry that represents the point set symmetric difference\nof the geometry values g1 and g2, which is defined as:\n\ng1 symdifference g2 := (g1 union g2) difference (g1 intersection g2)\n\nOr, in function call notation:\n\nST_SymDifference(g1, g2) = ST_Difference(ST_Union(g1, g2), ST_Intersection(g1, g2))\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[ST_TOUCHES]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Two geometries spatially touch if their interiors do not intersect, but the\nboundary of one of the geometries intersects either the boundary or the\ninterior of the other
-[ST_TRANSFORM]
-declaration=g, target_srid
-category=GeometryCollection Property Functions
-description=Transforms a geometry from one spatial reference system (SRS) to another
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nAs of MySQL 5.7.5, this function returns 0 if called with an\ninapplicable geometry argument type combination. For example, it\nreturns 0 if either of the arguments is a Point or MultiPoint.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[ST_UNION]
declaration=g1, g2
-category=GeometryCollection Property Functions
-description=Returns a geometry that represents the point set union of the geometry\nvalues g1 and g2
+category=GeometryCollection properties
+description=Returns a geometry that represents the point set union of the geometry\nvalues g1 and g2.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-operator-functions.html
[ST_VALIDATE]
declaration=g
-category=MBR Functions
-description=Validates a geometry according to the OGC specification
+category=MBR
+description=Validates a geometry according to the OGC specification. ST_Validate()\nreturns the geometry if it is a valid geometry byte string and is\ngeometrically valid, NULL if the argument is not a valid geometry byte\nstring or is not geometrically valid or is NULL.\n\nA geometry can be a valid geometry byte string (WKB value plus SRID)\nbut geometrically invalid. For example, this polygon is geometrically\ninvalid: POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))\n\nST_Validate() can be used to filter out invalid geometry data, although\nat a cost. For applications that require more precise results not\ntainted by invalid data, this penalty may be worthwhile.\n\nIf the geometry argument is valid, it is returned as is, except that if\nan input Polygon or MultiPolygon has clockwise rings, those rings are\nreversed before checking for validity. If the geometry is valid, the\nvalue with the reversed rings is returned.\n\nThe only valid empty geometry is represented in the form of an empty\ngeometry collection value. ST_Validate() returns it directly without\nfurther checks in this case.\n\nST_Validate() works only for the cartesian coordinate system and\nrequires a geometry argument with an SRID of 0. An ER_WRONG_ARGUMENTS\nerror occurs otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html
[ST_WITHIN]
-declaration=g1, g2
-category=Geometry Relation Functions
-description=Returns 1 or 0 to indicate whether g1 is spatially within g2
-[ST_X]
-declaration=p [, new_x_val]
-category=Point Property Functions
-description=With a single argument representing a valid Point object p, ST_X() returns\nthe X-coordinate value of p as a double-precision number
-[ST_Y]
-declaration=p [, new_y_val]
-category=Point Property Functions
-description=With a single argument representing a valid Point object p, ST_Y() returns\nthe Y-coordinate value of p as a double-precision number
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as ST_Contains().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html
[SUBDATE]
declaration=date,INTERVAL expr unit
category=Date and Time Functions
-description=When invoked with the INTERVAL form of the second argument, SUBDATE() is a\nsynonym for DATE_SUB()
+description=When invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB('2008-01-02', INTERVAL 31 DAY);\n -> '2007-12-02'\nmysql> SELECT SUBDATE('2008-01-02', INTERVAL 31 DAY);\n -> '2007-12-02'\n\nThe second form enables the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE('2008-01-02 12:00:00', 31);\n -> '2007-12-02 12:00:00'\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[SUBSTR]
declaration=str,pos
category=String Functions
-description=FROM pos FOR len) SUBSTR() is a synonym for SUBSTRING()
+description=FROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[SUBSTRING]
declaration=str,pos
category=String Functions
-description=SUBSTRING(str FROM pos FOR len) The forms without a len argument return a\nsubstring from string str starting at position pos
+description=SUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[SUBSTRING_INDEX]
declaration=str,delim,count
category=String Functions
-description=Returns the substring from string str before count occurrences of the\ndelimiter delim
+description=Returns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[SUBTIME]
declaration=expr1,expr2
category=Date and Time Functions
-description=SUBTIME() returns expr1  expr2 expressed as a value in the same format\nas expr1
+description=SUBTIME() returns expr1 - expr2 expressed as a value in the same format\nas expr1. expr1 is a time or datetime expression, and expr2 is a time\nexpression.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[SUM]
declaration=[DISTINCT] expr
-category=Aggregate Functions and Modifiers
-description=Returns the sum of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used to sum only the distinct values\nof expr.\n\nSUM() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[SYSDATE]
declaration=[fsp]
category=Date and Time Functions
-description=Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss' or\nYYYYMMDDhhmmss format, depending on whether the function is used in string\nor numeric context
+description=Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'\nor YYYYMMDDHHMMSS format, depending on whether the function is used in\na string or numeric context.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits. Before 5.6.4, any argument is ignored.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nmysql> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nmysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the master and the slave.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[SYSTEM_USER]
+declaration=
+category=Information Functions
+description=SYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[TAN]
declaration=X
category=Numeric Functions
-description=Returns the tangent of X, where X is given in radians
+description=Returns the tangent of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
+[TEXT]
+declaration=M
+category=Data Types
+description=A TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multibyte\ncharacters. Each TEXT value is stored using a 2-byte length prefix that\nindicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
+[TIME]
+declaration=fsp
+category=Data Types
+description=A time. The range is '-838:59:59.000000' to '838:59:59.000000'. MySQL\ndisplays TIME values in 'HH:MM:SS[.fraction]' format, but permits\nassignment of values to TIME columns using either strings or numbers.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html
[TIMEDIFF]
declaration=expr1,expr2
category=Date and Time Functions
-description=TIMEDIFF() returns expr1  expr2 expressed as a time value
+description=TIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and\nexpr2 are time or date-and-time expressions, but both must be of the\nsame type.\n\nThe result returned by TIMEDIFF() is limited to the range allowed for\nTIME values. Alternatively, you can use either of the functions\nTIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[TIMESTAMP]
+declaration=fsp
+category=Data Types
+description=A timestamp. The range is '1970-01-01 00:00:01.000000' UTC to\n'2038-01-19 03:14:07.999999' UTC. TIMESTAMP values are stored as the\nnumber of seconds since the epoch ('1970-01-01 00:00:00' UTC). A\nTIMESTAMP cannot represent the value '1970-01-01 00:00:00' because that\nis equivalent to 0 seconds from the epoch and the value 0 is reserved\nfor representing '0000-00-00 00:00:00', the "zero" TIMESTAMP value.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nThe way the server handles TIMESTAMP definitions depends on the value\nof the explicit_defaults_for_timestamp system variable (see\nhttp://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html).\nBy default, explicit_defaults_for_timestamp is disabled and the server\nhandles TIMESTAMP as follows:\n\nUnless specified otherwise, the first TIMESTAMP column in a table is\ndefined to be automatically set to the date and time of the most recent\nmodification if not explicitly assigned a value. This makes TIMESTAMP\nuseful for recording the timestamp of an INSERT or UPDATE operation.\nYou can also set any TIMESTAMP column to the current date and time by\nassigning it a NULL value, unless it has been defined with the NULL\nattribute to permit NULL values.\n\nAutomatic initialization and updating to the current date and time can\nbe specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE\nCURRENT_TIMESTAMP column definition clauses. By default, the first\nTIMESTAMP column has these properties, as previously noted. However,\nany TIMESTAMP column in a table can be defined to have these\nproperties.\n\nIf explicit_defaults_for_timestamp is enabled, there is no automatic\nassignment of the DEFAULT CURRENT_TIMESTAMP or ON UPDATE\nCURRENT_TIMESTAMP attributes to any TIMESTAMP column. They must be\nincluded explicitly in the column definition. Also, any TIMESTAMP not\nexplicitly declared as NOT NULL permits NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html
[TIMESTAMPADD]
declaration=unit,interval,datetime_expr
category=Date and Time Functions
-description=Adds the integer expression interval to the date or datetime expression\ndatetime_expr
+description=Adds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: MICROSECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[TIMESTAMPDIFF]
declaration=unit,datetime_expr1,datetime_expr2
category=Date and Time Functions
-description=Returns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions
+description=Returns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part '00:00:00' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[TIME_FORMAT]
declaration=time,format
category=Date and Time Functions
-description=This is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds
+description=This is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL value or 0.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[TIME_TO_SEC]
declaration=time
category=Date and Time Functions
-description=Returns the time argument, converted to seconds
-[TO_BASE64]
-declaration=str
-category=String Functions
-description=Converts the string argument to base-64 encoded form and returns the result\nas a character string with the connection character set and collation
+description=Returns the time argument, converted to seconds.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[TINYINT]
+declaration=M
+category=Data Types
+description=A very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
+[TOUCHES]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
[TO_DAYS]
declaration=date
category=Date and Time Functions
-description=Given a date date, returns a day number (the number of days since year 0)
+description=Given a date date, returns a day number (the number of days since year\n0).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[TO_SECONDS]
declaration=expr
category=Date and Time Functions
-description=Given a date or datetime expr, returns the number of seconds since the year\n0
+description=Given a date or datetime expr, returns the number of seconds since the\nyear 0. If expr is not a valid date or datetime value, returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[TRIM]
declaration=[{BOTH | LEADING | TRAILING} [remstr] FROM] str
category=String Functions
-description=FROM] str) Returns the string str with all remstr prefixes or suffixes\nremoved
+description=FROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[TRUNCATE]
declaration=X,D
category=Numeric Functions
-description=Returns the number X, truncated to D decimal places
+description=Returns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html
[UCASE]
declaration=str
category=String Functions
-description=UCASE() is a synonym for UPPER()
+description=UCASE() is a synonym for UPPER().\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[UNCOMPRESS]
declaration=string_to_uncompress
category=Encryption Functions
-description=Uncompresses a string compressed by the COMPRESS() function
+description=Uncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[UNCOMPRESSED_LENGTH]
declaration=compressed_string
category=Encryption Functions
-description=Returns the length that the compressed string had before being compressed
+description=Returns the length that the compressed string had before being\ncompressed.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[UNHEX]
declaration=str
category=String Functions
-description=For a string argument str, UNHEX(str) interprets each pair of characters in\nthe argument as a hexadecimal number and converts it to the byte\nrepresented by the number
+description=For a string argument str, UNHEX(str) interprets each pair of\ncharacters in the argument as a hexadecimal number and converts it to\nthe byte represented by the number. The return value is a binary\nstring.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
[UNIX_TIMESTAMP]
-declaration=[date]
+declaration=
category=Date and Time Functions
-description=If UNIX_TIMESTAMP() is called with no date argument, it returns a Unix\ntimestamp representing seconds since '1970-01-01 00:00:00' UTC
+description=If called with no argument, returns a Unix timestamp (seconds since\n'1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the argument as\nseconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format YYMMDD or\nYYYYMMDD. The server interprets date as a value in the current time\nzone and converts it to an internal value in UTC. Clients can set their\ntime zone as described in\nhttp://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[UPDATEXML]
declaration=xml_target, xpath_expr, new_xml
-category=XML
-description=This function replaces a single portion of a given fragment of XML markup\nxml_target with a new XML fragment new_xml, and then returns the changed\nXML
+category=String Functions
+description=This function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user.\n\nIf no expression matching xpath_expr is found, or if multiple matches\nare found, the function returns the original xml_target XML fragment.\nAll three arguments should be strings.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/xml-functions.html
[UPPER]
declaration=str
category=String Functions
-description=Returns the string str with all characters changed to uppercase according\nto the current character set mapping
-[UUID_TO_BIN]
-declaration=string_uuid
+description=Returns the string str with all characters changed to uppercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT UPPER('Hej');\n -> 'HEJ'\n\nSee the description of LOWER() for information that also applies to\nUPPER(). This included information about how to perform lettercase\nconversion of binary strings (BINARY, VARBINARY, BLOB) for which these\nfunctions are ineffective, and information about case folding for\nUnicode character sets.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-functions.html
+[USER]
+declaration=
+category=Information Functions
+description=Returns the current MySQL user name and host name as a string in the\nutf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
+[UTC_DATE]
+declaration=
+category=Date and Time Functions
+description=Returns the current UTC date as a value in 'YYYY-MM-DD' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[UTC_TIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current UTC time as a value in 'HH:MM:SS' or HHMMSS format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[UTC_TIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current UTC date and time as a value in 'YYYY-MM-DD\nHH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function\nis used in a string or numeric context.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
+[UUID]
+declaration=
+category=Miscellaneous Functions
+description=Returns a Universal Unique Identifier (UUID) generated according to\n"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706,\nhttp://www.opengroup.org/public/pubs/catalog/c706.htm).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers\nthat are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\no The first three numbers are generated from a timestamp.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host computer has no Ethernet\n card, or we do not know how to find the hardware address of an\n interface on your operating system). In this case, spatial uniqueness\n cannot be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n Currently, the MAC address of an interface is taken into account only\n on FreeBSD and Linux. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
+[UUID_SHORT]
+declaration=
category=Miscellaneous Functions
-description=Converts a string UUID to a binary UUID and returns the result
+description=Returns a "short" universal identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\no The server_id of the current host is unique among your set of master\n and slave servers\n\no server_id is between 0 and 255\n\no You do not set back your system time for your server between mysqld\n restarts\n\no You do not invoke UUID_SHORT() on average more than 16 million times\n per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[VALIDATE_PASSWORD_STRENGTH]
declaration=str
category=Encryption Functions
-description=Given an argument representing a plaintext password, this function returns\nan integer to indicate how strong the password is
+description=Given an argument representing a cleartext password, this function\nreturns an integer to indicate how strong the password is. The return\nvalue ranges from 0 (weak) to 100 (strong).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html
[VALUES]
declaration=col_name
category=Miscellaneous Functions
-description=In an INSERT
+description=In an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in the ON DUPLICATE KEY UPDATE clause of\nINSERT statements and returns NULL otherwise. See\nhttp://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
[VARBINARY]
declaration=M
category=Data Types
-description=The VARBINARY type is similar to the VARCHAR type, but stores binary byte\nstrings rather than nonbinary character strings
+description=The VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
+[VARCHAR]
+declaration=M
+category=Data Types
+description=collation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters. See\nhttp://dev.mysql.com/doc/refman/5.7/en/column-count-limit.html.\n\nMySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A\nVARCHAR column uses one length byte if values require no more than 255\nbytes, two length bytes if values may require more than 255 bytes.\n\n*Note*: MySQL 5.7 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.7/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
[VARIANCE]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the population standard variance of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard variance of expr. This is an extension\nto standard SQL. The standard SQL function VAR_POP() can be used\ninstead.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[VAR_POP]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the population standard variance of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
[VAR_SAMP]
declaration=expr
-category=Aggregate Functions and Modifiers
-description=Returns the sample variance of expr
+category=Functions and Modifiers for Use with GROUP BY
+description=Returns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
+[VERSION]
+declaration=
+category=Information Functions
+description=Returns a string that indicates the MySQL server version. The string\nuses the utf8 character set. The value might have a suffix in addition\nto the version number. See the description of the version system\nvariable in\nhttp://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/information-functions.html
[WAIT_FOR_EXECUTED_GTID_SET]
declaration=gtid_set[, timeout]
-category=GTID
-description=Wait until the server has applied all of the transactions whose global\ntransaction identifiers are contained in gtid_set; that is, until the\ncondition GTID_SUBSET(gtid_subset, @@GLOBAL
+category=MBR
+description=Introduced in MySQL 5.7.5, WAIT_FOR_EXECUTED_GTID_SET() is similar to\nWAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() in that it waits until a server has\nexecuted all of the transactions whose global transaction identifiers\nare contained in gtid_set, or until timeout seconds have elapsed,\nwhichever occurs first. Unlike WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(),\nWAIT_FOR_EXECUTED_GTID_SET() does not take into account whether the\nslave is running or not, and an error is returned if GTID-based\nreplication is not enabled.\n\nIn addition, WAIT_FOR_EXECUTED_GTID_SET() returns only the state of the\nquery, where 0 represents success, 1 represents timeout, and any other\nfailures return the error message.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gtid-functions.html
[WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS]
declaration=gtid_set[, timeout][,channel]
-category=GTID
-description=WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() is deprecated
+category=MBR
+description=Wait until the slave SQL thread has executed all of the transactions\nwhose global transaction identifiers are contained in gtid_set (see\nhttp://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html,\nfor a definition of "GTID sets"), or until timeout seconds have\nelapsed, whichever occurs first. timeout is optional; the default\ntimeout is 0 seconds, in which case the function waits until all of the\ntransactions in the GTID set have been executed.\n\nFor more information, see\nhttp://dev.mysql.com/doc/refman/5.7/en/replication-gtids.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gtid-functions.html
[WEEK]
declaration=date[,mode]
category=Date and Time Functions
-description=This function returns the week number for date
+description=This function returns the week number for date. The two-argument form\nof WEEK() enables you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttp://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[WEEKDAY]
declaration=date
category=Date and Time Functions
-description=Returns the weekday index for date (0 = Monday, 1 = Tuesday,
+description=Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[WEEKOFYEAR]
declaration=date
category=Date and Time Functions
-description=Returns the calendar week of the date as a number in the range from 1 to 53
+description=Returns the calendar week of the date as a number in the range from 1\nto 53. WEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[WEIGHT_STRING]
-declaration=str [AS {CHAR|BINARY}(N)] [flags]
+declaration=str [AS {CHAR|BINARY}(N
category=String Functions
-description=This function returns the weight string for the input string
+description=levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ...\n\nThis function returns the weight string for the input string. The\nreturn value is a binary string that represents the sorting and\ncomparison value of the string. It has these properties:\n\no If WEIGHT_STRING(str1) = WEIGHT_STRING(str2), then str1 = str2 (str1\n and str2 are considered equal)\n\no If WEIGHT_STRING(str1) < WEIGHT_STRING(str2), then str1 < str2 (str1\n sorts before str2)\n\nWEIGHT_STRING() can be used for testing and debugging of collations,\nespecially if you are adding a new collation. See\nhttp://dev.mysql.com/doc/refman/5.7/en/adding-collation.html.\n\nThe input string, str, is a string expression. If the input is a\nnonbinary (character) string such as a CHAR, VARCHAR, or TEXT value,\nthe return value contains the collation weights for the string. If the\ninput is a binary (byte) string such as a BINARY, VARBINARY, or BLOB\nvalue, the return value is the same as the input (the weight for each\nbyte in a binary string is the byte value). If the input is NULL,\nWEIGHT_STRING() returns NULL.\n\nExamples:\n\nmysql> SET @s = _latin1 'AB' COLLATE latin1_swedish_ci;\nmysql> SELECT @s, HEX(@s), HEX(WEIGHT_STRING(@s));\n+------+---------+------------------------+\n| @s | HEX(@s) | HEX(WEIGHT_STRING(@s)) |\n+------+---------+------------------------+\n| AB | 4142 | 4142 |\n+------+---------+------------------------+\n\nmysql> SET @s = _latin1 'ab' COLLATE latin1_swedish_ci;\nmysql> SELECT @s, HEX(@s), HEX(WEIGHT_STRING(@s));\n+------+---------+------------------------+\n| @s | HEX(@s) | HEX(WEIGHT_STRING(@s)) |\n+------+---------+------------------------+\n| ab | 6162 | 4142 |\n+------+---------+------------------------+\n\nmysql> SET @s = CAST('AB' AS BINARY);\nmysql> SELECT @s, HEX(@s), HEX(WEIGHT_STRING(@s));\n+------+---------+------------------------+\n| @s | HEX(@s) | HEX(WEIGHT_STRING(@s)) |\n+------+---------+------------------------+\n| AB | 4142 | 4142 |\n+------+---------+------------------------+\n\n ...
+[WITHIN]
+declaration=g1,g2
+category=Geometry relations
+description=Returns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as Contains().\n\nThis function is deprecated as of MySQL 5.7.6 and will be removed in a\nfuture MySQL release. Use MBRWithin() instead.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-mbr.html
+[X]
+declaration=p
+category=Point properties
+description=Returns the X-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-point-property-functions.html
+[Y]
+declaration=p
+category=Point properties
+description=Returns the Y-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/gis-point-property-functions.html
[YEAR]
declaration=date
category=Date and Time Functions
-description=Returns the year for date, in the range 1000 to 9999, or 0 for the "zero"\ndate
+description=Returns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
[YEARWEEK]
declaration=date
category=Date and Time Functions
-description=Returns year and week for a date
+description=Returns year and week for a date. The mode argument works exactly like\nthe mode argument to WEEK(). The year in the result may be different\nfrom the year in the date argument for the first and the last week of\nthe year.\n\nURL: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
\ No newline at end of file
diff --git a/out/functions-mysql8.ini b/out/functions-mysql8.ini
new file mode 100644
index 000000000..1fbca7787
--- /dev/null
+++ b/out/functions-mysql8.ini
@@ -0,0 +1,1572 @@
+[ABS]
+declaration=X
+category=Numeric Functions
+description=Returns the absolute value of X, or NULL if X is NULL.\n\nThe result type is derived from the argument type. An implication of\nthis is that ABS(-9223372036854775808) produces an error because the\nresult cannot be stored in a signed BIGINT value.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[ACOS]
+declaration=X
+category=Numeric Functions
+description=Returns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1, or if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[ADDDATE]
+declaration=date,INTERVAL expr unit
+category=Date and Time Functions
+description=When invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee\nhttps://dev.mysql.com/doc/refman/8.3/en/expressions.html#temporal-inter\nvals.\n\nmysql> SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);\n -> '2008-02-02'\nmysql> SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);\n -> '2008-02-02'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[ADDTIME]
+declaration=expr1,expr2
+category=Date and Time Functions
+description=ADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression. Returns NULL if\nexpr1or expr2 is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[AES_DECRYPT]
+declaration=crypt_str,key_str[,init_vector][,kdf_name][,salt][,info | iterations]
+category=Encryption Functions
+description=This function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nStatements that use AES_DECRYPT() are unsafe for statement-based\nreplication.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[AES_ENCRYPT]
+declaration=str,key_str[,init_vector][,kdf_name][,salt][,info | iterations]
+category=Encryption Functions
+description=AES_ENCRYPT() and AES_DECRYPT() implement encryption and decryption of\ndata using the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." The AES standard permits various key\nlengths. By default these functions implement AES with a 128-bit key\nlength. Key lengths of 196 or 256 bits can be used, as described later.\nThe key length is a trade off between performance and security.\n\nAES_ENCRYPT() encrypts the string str using the key string key_str, and\nreturns a binary string containing the encrypted output. AES_DECRYPT()\ndecrypts the encrypted string crypt_str using the key string key_str,\nand returns the original (binary) string in hexadecimal format. (To\nobtain the string as plaintext, cast the result to CHAR. Alternatively,\nstart the mysql client with --skip-binary-as-hex to cause all binary\nvalues to be displayed as text.) If either function argument is NULL,\nthe function returns NULL. If AES_DECRYPT() detects invalid data or\nincorrect padding, it returns NULL. However, it is possible for\nAES_DECRYPT() to return a non-NULL value (possibly garbage) if the\ninput data or the key is invalid.\n\nThese functions support the use of a key derivation function (KDF) to\ncreate a cryptographically strong secret key from the information\npassed in key_str. The derived key is used to encrypt and decrypt the\ndata, and it remains in the MySQL Server instance and is not accessible\nto users. Using a KDF is highly recommended, as it provides better\nsecurity than specifying your own premade key or deriving it by a\nsimpler method as you use the function. The functions support HKDF\n(available from OpenSSL 1.1.0), for which you can specify an optional\nsalt and context-specific information to include in the keying\nmaterial, and PBKDF2 (available from OpenSSL 1.0.2), for which you can\nspecify an optional salt and set the number of iterations used to\nproduce the key.\n\nAES_ENCRYPT() and AES_DECRYPT() permit control of the block encryption\nmode. The block_encryption_mode system variable controls the mode for\nblock-based encryption algorithms. Its default value is aes-128-ecb,\nwhich signifies encryption using a key length of 128 bits and ECB mode.\nFor a description of the permitted values of this variable, see\nhttps://dev.mysql.com/doc/refman/8.3/en/server-system-variables.html.\nThe optional init_vector argument is used to provide an initialization\nvector for block encryption modes that require it.\n\nStatements that use AES_ENCRYPT() or AES_DECRYPT() are unsafe for\nstatement-based replication.\n\nIf AES_ENCRYPT() is invoked from within the mysql client, binary\nstrings display using hexadecimal notation, depending on the value of\nthe --binary-as-hex. For more information about that option, see\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql.html.\n\nThe arguments for the AES_ENCRYPT() and AES_DECRYPT() functions are as\n ...
+[ANY_VALUE]
+declaration=arg
+category=Miscellaneous Functions
+description=This function is useful for GROUP BY queries when the\nONLY_FULL_GROUP_BY SQL mode is enabled, for cases when MySQL rejects a\nquery that you know is valid for reasons that MySQL cannot determine.\nThe function return value and type are the same as the return value and\ntype of its argument, but the function result is not checked for the\nONLY_FULL_GROUP_BY SQL mode.\n\nFor example, if name is a nonindexed column, the following query fails\nwith ONLY_FULL_GROUP_BY enabled:\n\nmysql> SELECT name, address, MAX(age) FROM t GROUP BY name;\nERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP\nBY clause and contains nonaggregated column 'mydb.t.address' which\nis not functionally dependent on columns in GROUP BY clause; this\nis incompatible with sql_mode=only_full_group_by\n\nThe failure occurs because address is a nonaggregated column that is\nneither named among GROUP BY columns nor functionally dependent on\nthem. As a result, the address value for rows within each name group is\nnondeterministic. There are multiple ways to cause MySQL to accept the\nquery:\n\no Alter the table to make name a primary key or a unique NOT NULL\n column. This enables MySQL to determine that address is functionally\n dependent on name; that is, address is uniquely determined by name.\n (This technique is inapplicable if NULL must be permitted as a valid\n name value.)\n\no Use ANY_VALUE() to refer to address:\n\nSELECT name, ANY_VALUE(address), MAX(age) FROM t GROUP BY name;\n\n In this case, MySQL ignores the nondeterminism of address values\n within each name group and accepts the query. This may be useful if\n you simply do not care which value of a nonaggregated column is\n chosen for each group. ANY_VALUE() is not an aggregate function,\n unlike functions such as SUM() or COUNT(). It simply acts to suppress\n the test for nondeterminism.\n\no Disable ONLY_FULL_GROUP_BY. This is equivalent to using ANY_VALUE()\n with ONLY_FULL_GROUP_BY enabled, as described in the previous item.\n\nANY_VALUE() is also useful if functional dependence exists between\ncolumns but MySQL cannot determine it. The following query is valid\nbecause age is functionally dependent on the grouping column age-1, but\nMySQL cannot tell that and rejects the query with ONLY_FULL_GROUP_BY\nenabled:\n\nSELECT age FROM t GROUP BY age-1;\n\n ...
+[ASCII]
+declaration=str
+category=String Functions
+description=Returns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[ASIN]
+declaration=X
+category=Numeric Functions
+description=Returns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1, or if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[ASYMMETRIC_DECRYPT]
+declaration=algorithm, data_str, priv_key_str
+category=Enterprise Encryption Functions
+description=Decrypts an encrypted string using the given algorithm and key string,\nand returns the resulting plaintext as a binary string. If decryption\nfails, the result is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nBy default, the component_enterprise_encryption function assumes that\nencrypted text uses the RSAES-OAEP padding scheme. The function\nsupports decryption for content encrypted by the legacy openssl_udf\nshared library functions if the system variable\nenterprise_encryption.rsa_support_legacy_padding is set to ON (the\ndefault is OFF). When ON is set, the function also supports the\nRSAES-PKCS1-v1_5 padding scheme, as used by the legacy openssl_udf\nshared library functions. When OFF is set, content encrypted by the\nlegacy functions cannot be decrypted, and the function returns null\noutput for such content.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\ndata_str is the encrypted string to decrypt, which was encrypted with\nasymmetric_encrypt().\n\npriv_key_str is a valid PEM encoded RSA private key. For successful\ndecryption, the key string must correspond to the public key string\nused with asymmetric_encrypt() to produce the encrypted string. The\nasymmetric_encrypt() component function only supports encryption using\na public key, so decryption takes place with the corresponding private\nkey.\n\nFor a usage example, see the description of asymmetric_encrypt().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[ASYMMETRIC_DERIVE]
+declaration=pub_key_str, priv_key_str
+category=Enterprise Encryption Functions
+description=Derives a symmetric key using the private key of one party and the\npublic key of another, and returns the resulting key as a binary\nstring. If key derivation fails, the result is NULL.\n\npub_key_str and priv_key_str are valid PEM encoded key strings that\nwere created using the DH algorithm.\n\nSuppose that you have two pairs of public and private keys:\n\nSET @dhp = create_dh_parameters(1024);\nSET @priv1 = create_asymmetric_priv_key('DH', @dhp);\nSET @pub1 = create_asymmetric_pub_key('DH', @priv1);\nSET @priv2 = create_asymmetric_priv_key('DH', @dhp);\nSET @pub2 = create_asymmetric_pub_key('DH', @priv2);\n\nSuppose further that you use the private key from one pair and the\npublic key from the other pair to create a symmetric key string. Then\nthis symmetric key identity relationship holds:\n\nasymmetric_derive(@pub1, @priv2) = asymmetric_derive(@pub2, @priv1)\n\nThis example requires DH private/public keys as inputs, created using a\nshared symmetric secret. Create the secret by passing the key length to\ncreate_dh_parameters(), then pass the secret as the "key length" to\ncreate_asymmetric_priv_key().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions-legacy.html
+[ASYMMETRIC_ENCRYPT]
+declaration=algorithm, data_str, pub_key_str
+category=Enterprise Encryption Functions
+description=Encrypts a string using the given algorithm and key string, and returns\nthe resulting ciphertext as a binary string. If encryption fails, the\nresult is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\ndata_str is the string to encrypt. The length of this string cannot be\ngreater than the key string length in bytes, minus 42 (to account for\nthe padding).\n\npub_key_str is a valid PEM encoded RSA public key. The\nasymmetric_encrypt() component function only supports encryption using\na public key.\n\nTo recover the original unencrypted string, pass the encrypted string\nto asymmetric_decrypt(), along with the other part of the key pair used\nfor encryption, as in the following example:\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[ASYMMETRIC_SIGN]
+declaration=algorithm, text, priv_key_str, digest_type
+category=Enterprise Encryption Functions
+description=Signs a digest string or data string using a private key, and returns\nthe signature as a binary string. If signing fails, the result is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\ntext is a data string or digest string. The function accepts digests\nbut does not require them, as it is also capable of handling data\nstrings of an arbitrary length. A digest string can be generated by\ncalling create_digest().\n\npriv_key_str is the private key string to use for signing the digest\nstring. It must be a valid PEM encoded RSA private key.\n\ndigest_type is the algorithm to be used to sign the data. The supported\ndigest_type values are 'SHA224', 'SHA256', 'SHA384', and 'SHA512' when\nOpenSSL 1.0.1 is in use. If OpenSSL 1.1.1 is in use, the additional\ndigest_type values 'SHA3-224', 'SHA3-256', 'SHA3-384', and 'SHA3-512'\nare available.\n\nFor a usage example, see the description of asymmetric_verify().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[ASYMMETRIC_VERIFY]
+declaration=algorithm, text, sig_str, pub_key_str, digest_type
+category=Enterprise Encryption Functions
+description=Verifies whether the signature string matches the digest string, and\nreturns 1 or 0 to indicate whether verification succeeded or failed. If\nverification fails, the result is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nBy default, the component_enterprise_encryption function assumes that\nsignatures use the RSASSA-PSS signature scheme. The function supports\nverification for signatures produced by the legacy openssl_udf shared\nlibrary functions if the system variable\nenterprise_encryption.rsa_support_legacy_padding is set to ON (the\ndefault is OFF). When ON is set, the function also supports the\nRSASSA-PKCS1-v1_5 signature scheme, as used by the legacy openssl_udf\nshared library functions. When OFF is set, signatures produced by the\nlegacy functions cannot be verified, and the function returns null\noutput for such content.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\ntext is a data string or digest string. The component function accepts\ndigests but does not require them, as it is also capable of handling\ndata strings of an arbitrary length. A digest string can be generated\nby calling create_digest().\n\nsig_str is the signature string to be verified. A signature string can\nbe generated by calling asymmetric_sign().\n\npub_key_str is the public key string of the signer. It corresponds to\nthe private key passed to asymmetric_sign() to generate the signature\nstring. It must be a valid PEM encoded RSA public key.\n\ndigest_type is the algorithm that was used to sign the data. The\nsupported digest_type values are 'SHA224', 'SHA256', 'SHA384', and\n'SHA512' when OpenSSL 1.0.1 is in use. If OpenSSL 1.1.1 is in use, the\nadditional digest_type values 'SHA3-224', 'SHA3-256', 'SHA3-384', and\n'SHA3-512' are available.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[ATAN]
+declaration=X
+category=Numeric Functions
+description=Returns the arc tangent of X, that is, the value whose tangent is X.\nReturns NULL if X is NULL\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[ATAN2]
+declaration=Y,X
+category=Numeric Functions
+description=Returns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result. Returns\nNULL if X or Y is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[AVG]
+declaration=[DISTINCT] expr
+category=Aggregate Functions and Modifiers
+description=Returns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nIf there are no matching rows, AVG() returns NULL. The function also\nreturns NULL if expr is NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html; it\ncannot be used with DISTINCT.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[BENCHMARK]
+declaration=count,expr
+category=Information Functions
+description=The BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is 0, or NULL for inappropriate arguments\nsuch as a NULL or negative repeat count.\n\nThe intended use is from within the mysql client, which reports query\nexecution times:\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[BIGINT]
+declaration=M
+category=Data Types
+description=A large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[BIN]
+declaration=N
+category=String Functions
+description=Returns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[BINARY]
+declaration=M
+category=Data Types
+description=The BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. An optional length M\nrepresents the column length in bytes. If omitted, M defaults to 1.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[BIN_TO_UUID]
+declaration=binary_uuid
+category=Miscellaneous Functions
+description=BIN_TO_UUID() is the inverse of UUID_TO_BIN(). It converts a binary\nUUID to a string UUID and returns the result. The binary value should\nbe a UUID as a VARBINARY(16) value. The return value is a string of\nfive hexadecimal numbers separated by dashes. (For details about this\nformat, see the UUID() function description.) If the UUID argument is\nNULL, the return value is NULL. If any argument is invalid, an error\noccurs.\n\nBIN_TO_UUID() takes one or two arguments:\n\no The one-argument form takes a binary UUID value. The UUID value is\n assumed not to have its time-low and time-high parts swapped. The\n string result is in the same order as the binary argument.\n\no The two-argument form takes a binary UUID value and a swap-flag\n value:\n\n o If swap_flag is 0, the two-argument form is equivalent to the\n one-argument form. The string result is in the same order as the\n binary argument.\n\n o If swap_flag is 1, the UUID value is assumed to have its time-low\n and time-high parts swapped. These parts are swapped back to their\n original position in the result value.\n\nFor usage examples and information about time-part swapping, see the\nUUID_TO_BIN() function description.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[BIT]
+declaration=M
+category=Data Types
+description=A bit-value type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[BIT_AND]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the bitwise AND of all bits in expr.\n\nThe result type depends on whether the function argument values are\nevaluated as binary strings or numbers:\n\no Binary-string evaluation occurs when the argument values have a\n binary string type, and the argument is not a hexadecimal literal,\n bit literal, or NULL literal. Numeric evaluation occurs otherwise,\n with argument value conversion to unsigned 64-bit integers as\n necessary.\n\no Binary-string evaluation produces a binary string of the same length\n as the argument values. If argument values have unequal lengths, an\n ER_INVALID_BITWISE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_operands_size) error occurs. If the\n argument size exceeds 511 bytes, an\n ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_aggregate_operands_size) error occurs.\n Numeric evaluation produces an unsigned 64-bit integer.\n\nIf there are no matching rows, BIT_AND() returns a neutral value (all\nbits set to 1) having the same length as the argument values.\n\nNULL values do not affect the result unless all values are NULL. In\nthat case, the result is a neutral value having the same length as the\nargument values.\n\nFor more information discussion about argument evaluation and result\ntypes, see the introductory discussion in\nhttps://dev.mysql.com/doc/refman/8.3/en/bit-functions.html.\n\nIf BIT_AND() is invoked from within the mysql client, binary string\nresults display using hexadecimal notation, depending on the value of\nthe --binary-as-hex. For more information about that option, see\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql.html.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[BIT_LENGTH]
+declaration=str
+category=String Functions
+description=Returns the length of the string str in bits. Returns NULL if str is\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[BIT_OR]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the bitwise OR of all bits in expr.\n\nThe result type depends on whether the function argument values are\nevaluated as binary strings or numbers:\n\no Binary-string evaluation occurs when the argument values have a\n binary string type, and the argument is not a hexadecimal literal,\n bit literal, or NULL literal. Numeric evaluation occurs otherwise,\n with argument value conversion to unsigned 64-bit integers as\n necessary.\n\no Binary-string evaluation produces a binary string of the same length\n as the argument values. If argument values have unequal lengths, an\n ER_INVALID_BITWISE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_operands_size) error occurs. If the\n argument size exceeds 511 bytes, an\n ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_aggregate_operands_size) error occurs.\n Numeric evaluation produces an unsigned 64-bit integer.\n\nIf there are no matching rows, BIT_OR() returns a neutral value (all\nbits set to 0) having the same length as the argument values.\n\nNULL values do not affect the result unless all values are NULL. In\nthat case, the result is a neutral value having the same length as the\nargument values.\n\nFor more information discussion about argument evaluation and result\ntypes, see the introductory discussion in\nhttps://dev.mysql.com/doc/refman/8.3/en/bit-functions.html.\n\nIf BIT_OR() is invoked from within the mysql client, binary string\nresults display using hexadecimal notation, depending on the value of\nthe --binary-as-hex. For more information about that option, see\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql.html.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[BIT_XOR]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the bitwise XOR of all bits in expr.\n\nThe result type depends on whether the function argument values are\nevaluated as binary strings or numbers:\n\no Binary-string evaluation occurs when the argument values have a\n binary string type, and the argument is not a hexadecimal literal,\n bit literal, or NULL literal. Numeric evaluation occurs otherwise,\n with argument value conversion to unsigned 64-bit integers as\n necessary.\n\no Binary-string evaluation produces a binary string of the same length\n as the argument values. If argument values have unequal lengths, an\n ER_INVALID_BITWISE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_operands_size) error occurs. If the\n argument size exceeds 511 bytes, an\n ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_invalid_bitwise_aggregate_operands_size) error occurs.\n Numeric evaluation produces an unsigned 64-bit integer.\n\nIf there are no matching rows, BIT_XOR() returns a neutral value (all\nbits set to 0) having the same length as the argument values.\n\nNULL values do not affect the result unless all values are NULL. In\nthat case, the result is a neutral value having the same length as the\nargument values.\n\nFor more information discussion about argument evaluation and result\ntypes, see the introductory discussion in\nhttps://dev.mysql.com/doc/refman/8.3/en/bit-functions.html.\n\nIf BIT_XOR() is invoked from within the mysql client, binary string\nresults display using hexadecimal notation, depending on the value of\nthe --binary-as-hex. For more information about that option, see\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql.html.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[BLOB]
+declaration=M
+category=Data Types
+description=A BLOB column with a maximum length of 65,535 (216 − 1) bytes. Each\nBLOB value is stored using a 2-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[CAST]
+declaration=expr AS type [ARRAY]
+category=Cast Functions and Operators
+description=CAST(timestamp_value AT TIME ZONE timezone_specifier AS\nDATETIME[(precision)])\n\ntimezone_specifier: [INTERVAL] '+00:00' | 'UTC'\n\nWith CAST(expr AS type syntax, the CAST() function takes an expression\nof any type and produces a result value of the specified type. This\noperation may also be expressed as CONVERT(expr, type), which is\nequivalent. If expr is NULL, CAST() returns NULL.\n\nThese type values are permitted:\n\no BINARY[(N)]\n\n Produces a string with the VARBINARY data type, except that when the\n expression expr is empty (zero length), the result type is BINARY(0).\n If the optional length N is given, BINARY(N) causes the cast to use\n no more than N bytes of the argument. Values shorter than N bytes are\n padded with 0x00 bytes to a length of N. If the optional length N is\n not given, MySQL calculates the maximum length from the expression.\n If the supplied or calculated length is greater than an internal\n threshold, the result type is BLOB. If the length is still too long,\n the result type is LONGBLOB.\n\n For a description of how casting to BINARY affects comparisons, see\n https://dev.mysql.com/doc/refman/8.3/en/binary-varbinary.html.\n\no CHAR[(N)] [charset_info]\n\n Produces a string with the VARCHAR data type, unless the expression\n expr is empty (zero length), in which case the result type is\n CHAR(0). If the optional length N is given, CHAR(N) causes the cast\n to use no more than N characters of the argument. No padding occurs\n for values shorter than N characters. If the optional length N is not\n given, MySQL calculates the maximum length from the expression. If\n the supplied or calculated length is greater than an internal\n threshold, the result type is TEXT. If the length is still too long,\n the result type is LONGTEXT.\n\n With no charset_info clause, CHAR produces a string with the default\n character set. To specify the character set explicitly, these\n charset_info values are permitted:\n\n o CHARACTER SET charset_name: Produces a string with the given\n character set.\n\n o ASCII: Shorthand for CHARACTER SET latin1.\n\n o UNICODE: Shorthand for CHARACTER SET ucs2.\n\n ...
+[CEIL]
+declaration=X
+category=Numeric Functions
+description=CEIL() is a synonym for CEILING().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[CEILING]
+declaration=X
+category=Numeric Functions
+description=Returns the smallest integer value not less than X. Returns NULL if X\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[CHAR]
+declaration=M
+category=Data Types
+description=collation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*:\n\nTrailing spaces are removed when CHAR values are retrieved unless the\nPAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[CHARACTER_LENGTH]
+declaration=str
+category=String Functions
+description=CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[CHARSET]
+declaration=str
+category=Information Functions
+description=Returns the character set of the string argument, or NULL if the\nargument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[CHAR_LENGTH]
+declaration=str
+category=String Functions
+description=Returns the length of the string str, measured in code points. A\nmultibyte character counts as a single code point. This means that, for\na string containing two 3-byte characters, LENGTH() returns 6, whereas\nCHAR_LENGTH() returns 2, as shown here:\n\nmysql> SET @dolphin:='海豚';\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SELECT LENGTH(@dolphin), CHAR_LENGTH(@dolphin);\n+------------------+-----------------------+\n| LENGTH(@dolphin) | CHAR_LENGTH(@dolphin) |\n+------------------+-----------------------+\n| 6 | 2 |\n+------------------+-----------------------+\n1 row in set (0.00 sec)\n\nCHAR_LENGTH() returns NULL if str is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[COALESCE]
+declaration=value,...
+category=Comparison Operators
+description=Returns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nThe return type of COALESCE() is the aggregated type of the argument\ntypes.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[COERCIBILITY]
+declaration=str
+category=Information Functions
+description=Returns the collation coercibility value of the string argument.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[COLLATION]
+declaration=str
+category=Information Functions
+description=Returns the collation of the string argument.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[COMPRESS]
+declaration=string_to_compress
+category=Encryption Functions
+description=Compresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\nreturn value is also NULL if string_to_compress is NULL. The compressed\nstring can be uncompressed with UNCOMPRESS().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[CONCAT]
+declaration=str1,str2,...
+category=String Functions
+description=Returns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent nonbinary string form.\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[CONCAT_WS]
+declaration=separator,str1,str2,...
+category=String Functions
+description=CONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[CONNECTION_ID]
+declaration=
+category=Information Functions
+description=Returns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nThe value returned by CONNECTION_ID() is the same type of value as\ndisplayed in the ID column of the Information Schema PROCESSLIST table,\nthe Id column of SHOW PROCESSLIST output, and the PROCESSLIST_ID column\nof the Performance Schema threads table.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[CONV]
+declaration=N,from_base,to_base
+category=Numeric Functions
+description=Converts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If from_base\nis a negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nCONV() returns NULL if any of its arguments are NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[CONVERT]
+declaration=expr USING transcoding_name
+category=Cast Functions and Operators
+description=CONVERT(expr,type)\n\nCONVERT(expr USING transcoding_name) is standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax. Regardless of the syntax\nused, the function returns NULL if expr is NULL.\n\nCONVERT(expr USING transcoding_name) converts data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string 'abc' in the default character set to the corresponding\nstring in the utf8mb4 character set:\n\nSELECT CONVERT('abc' USING utf8mb4);\n\nCONVERT(expr, type) syntax (without USING) takes an expression and a\ntype value specifying a result type, and produces a result value of the\nspecified type. This operation may also be expressed as CAST(expr AS\ntype), which is equivalent. For more information, see the description\nof CAST().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/cast-functions.html
+[CONVERT_TZ]
+declaration=dt,from_tz,to_tz
+category=Date and Time Functions
+description=CONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/time-zone-support.html. This\nfunction returns NULL if any of the arguments are invalid, or if any of\nthem are NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[COS]
+declaration=X
+category=Numeric Functions
+description=Returns the cosine of X, where X is given in radians. Returns NULL if X\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[COT]
+declaration=X
+category=Numeric Functions
+description=Returns the cotangent of X. Returns NULL if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[COUNT]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nIf there are no matching rows, COUNT() returns 0. COUNT(NULL) returns\n0.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[CRC32]
+declaration=expr
+category=Numeric Functions
+description=Computes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[CREATE_ASYMMETRIC_PRIV_KEY]
+declaration=algorithm, key_length
+category=Enterprise Encryption Functions
+description=Creates a private key using the given algorithm and key length, and\nreturns the key as a binary string in PEM format. The key is in PKCS #8\nformat. If key generation fails, the result is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\nkey_length is the key length in bits. If you exceed the maximum allowed\nkey length or specify less than the minimum, key generation fails and\nthe result is null output. The minimum allowed key length in bits is\n2048. The maximum allowed key length is the value of the\nenterprise_encryption.maximum_rsa_key_size system variable, which\ndefaults to 4096. It has a maximum setting of 16384, which is the\nmaximum key length allowed for the RSA algorithm. See\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-configuri\nng.html.\n\n*Note*:\n\nGenerating longer keys can consume significant CPU resources. Limiting\nthe key length using the enterprise_encryption.maximum_rsa_key_size\nsystem variable lets you provide adequate security for your\nrequirements while balancing this with resource usage.\n\nThis example creates a 2048-bit RSA private key, then derives a public\nkey from the private key:\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[CREATE_ASYMMETRIC_PUB_KEY]
+declaration=algorithm, priv_key_str
+category=Enterprise Encryption Functions
+description=Derives a public key from the given private key using the given\nalgorithm, and returns the key as a binary string in PEM format. The\nkey is in PKCS #8 format. If key derivation fails, the result is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nalgorithm is the encryption algorithm used to create the key. The\nsupported algorithm value is 'RSA'.\n\npriv_key_str is a valid PEM encoded RSA private key.\n\nFor a usage example, see the description of\ncreate_asymmetric_priv_key().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[CREATE_DH_PARAMETERS]
+declaration=key_len
+category=Enterprise Encryption Functions
+description=Creates a shared secret for generating a DH private/public key pair and\nreturns a binary string that can be passed to\ncreate_asymmetric_priv_key(). If secret generation fails, the result is\nNULL.\n\nkey_len is the key length. The minimum and maximum key lengths in bits\nare 1,024 and 10,000. These key-length limits are constraints imposed\nby OpenSSL. Server administrators can impose additional limits on\nmaximum key length by setting the MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLD,\nMYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLD, and\nMYSQL_OPENSSL_UDF_DH_BITS_THRESHOLD environment variables. See\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-configuri\nng.html.\n\nFor an example showing how to use the return value for generating\nsymmetric keys, see the description of asymmetric_derive().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions-legacy.html
+[CREATE_DIGEST]
+declaration=digest_type, str
+category=Enterprise Encryption Functions
+description=Creates a digest from the given string using the given digest type, and\nreturns the digest as a binary string. If digest generation fails, the\nresult is NULL.\n\nFor the legacy version of this function in use before MySQL 8.0.29, see\nhttps://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions\n-legacy.html.\n\nThe resulting digest string is suitable for use with asymmetric_sign()\nand asymmetric_verify(). The component versions of these functions\naccept digests but do not require them, as they are capable of handling\ndata of an arbitrary length.\n\ndigest_type is the digest algorithm to be used to generate the digest\nstring. The supported digest_type values are 'SHA224', 'SHA256',\n'SHA384', and 'SHA512' when OpenSSL 1.0.1 is in use. If OpenSSL 1.1.1\nis in use, the additional digest_type values 'SHA3-224', 'SHA3-256',\n'SHA3-384', and 'SHA3-512' are available.\n\nstr is the non-null data string for which the digest is to be\ngenerated.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/enterprise-encryption-functions.html
+[CUME_DIST]
+declaration=
+category=Window Functions
+description=Returns the cumulative distribution of a value within a group of\nvalues; that is, the percentage of partition values less than or equal\nto the value in the current row. This represents the number of rows\npreceding or peer with the current row in the window ordering of the\nwindow partition divided by the total number of rows in the window\npartition. Return values range from 0 to 1.\n\nThis function should be used with ORDER BY to sort partition rows into\nthe desired order. Without ORDER BY, all rows are peers and have value\nN/N = 1, where N is the partition size.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[CURDATE]
+declaration=
+category=Date and Time Functions
+description=Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format,\ndepending on whether the function is used in string or numeric context.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[CURRENT_DATE]
+declaration=
+category=Date and Time Functions
+description=CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[CURRENT_ROLE]
+declaration=
+category=Information Functions
+description=Returns a utf8mb3 string containing the current active roles for the\ncurrent session, separated by commas, or NONE if there are none. The\nvalue reflects the setting of the sql_quote_show_create system\nvariable.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[CURRENT_TIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[CURRENT_TIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[CURRENT_USER]
+declaration=
+category=Information Functions
+description=Returns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8mb3 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[CURTIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current time as a value in 'hh:mm:ss' or hhmmss format,\ndepending on whether the function is used in string or numeric context.\nThe value is expressed in the session time zone.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DATABASE]
+declaration=
+category=Information Functions
+description=Returns the default (current) database name as a string in the utf8mb3\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[DATEDIFF]
+declaration=expr1,expr2
+category=Date and Time Functions
+description=DATEDIFF() returns expr1 − expr2 expressed as a value in days from\none date to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DATETIME]
+declaration=fsp
+category=Data Types
+description=A date and time combination. The supported range is '1000-01-01\n00:00:00.000000' to '9999-12-31 23:59:59.499999'. MySQL displays\nDATETIME values in 'YYYY-MM-DD hh:mm:ss[.fraction]' format, but permits\nassignment of values to DATETIME columns using either strings or\nnumbers.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nAutomatic initialization and updating to the current date and time for\nDATETIME columns can be specified using DEFAULT and ON UPDATE column\ndefinition clauses, as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/timestamp-initialization.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-type-syntax.html
+[DATE_ADD]
+declaration=date,INTERVAL expr unit
+category=Date and Time Functions
+description=These functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is evaluated as a string; it may start with a - for negative\nintervals. unit is a keyword indicating the units in which the\nexpression should be interpreted.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DATE_FORMAT]
+declaration=date,format
+category=Date and Time Functions
+description=Formats the date value according to the format string. If either\nargument is NULL, the function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DATE_SUB]
+declaration=date,INTERVAL expr unit
+category=Date and Time Functions
+description=See the description for DATE_ADD().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DAY]
+declaration=date
+category=Date and Time Functions
+description=DAY() is a synonym for DAYOFMONTH().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DAYNAME]
+declaration=date
+category=Date and Time Functions
+description=Returns the name of the weekday for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(see https://dev.mysql.com/doc/refman/8.3/en/locale-support.html).\nReturns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DAYOFMONTH]
+declaration=date
+category=Date and Time Functions
+description=Returns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as '0000-00-00' or '2008-00-00' that have a zero day part.\nReturns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DAYOFWEEK]
+declaration=date
+category=Date and Time Functions
+description=Returns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard. Returns\nNULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DAYOFYEAR]
+declaration=date
+category=Date and Time Functions
+description=Returns the day of the year for date, in the range 1 to 366. Returns\nNULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[DEC]
+declaration=M[,D]
+category=Data Types
+description=[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[DECIMAL]
+declaration=M[,D]
+category=Data Types
+description=A packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the - sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10. (There is also a\nlimit on how long the text of DECIMAL literals can be; see\nhttps://dev.mysql.com/doc/refman/8.3/en/precision-math-expressions.html\n.)\n\nUNSIGNED, if specified, disallows negative values. The UNSIGNED\nattribute is deprecated for columns of type DECIMAL (and any synonyms);\nyou should expect support for it to be removed in a future version of\nMySQL. Consider using a simple CHECK constraint instead for such\ncolumns.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[DEFAULT]
+declaration=col_name
+category=Miscellaneous Functions
+description=Returns the default value for a table column. An error results if the\ncolumn has no default value.\n\nThe use of DEFAULT(col_name) to specify the default value for a named\ncolumn is permitted only for columns that have a literal default value,\nnot for columns that have an expression default value.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[DEGREES]
+declaration=X
+category=Numeric Functions
+description=Returns the argument X, converted from radians to degrees. Returns NULL\nif X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[DENSE_RANK]
+declaration=
+category=Window Functions
+description=Returns the rank of the current row within its partition, without gaps.\nPeers are considered ties and receive the same rank. This function\nassigns consecutive ranks to peer groups; the result is that groups of\nsize greater than one do not produce noncontiguous rank numbers. For an\nexample, see the RANK() function description.\n\nThis function should be used with ORDER BY to sort partition rows into\nthe desired order. Without ORDER BY, all rows are peers.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[DOUBLE]
+declaration=M,D
+category=Data Types
+description=A normal-size (double-precision) floating-point number. Permissible\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nDOUBLE(M,D) is a nonstandard MySQL extension; and is deprecated. You\nshould expect support for this syntax to be removed in a future version\nof MySQL.\n\nUNSIGNED, if specified, disallows negative values. The UNSIGNED\nattribute is deprecated for columns of type DOUBLE (and any synonyms)\nand you should expect support for it to be removed in a future version\nof MySQL. Consider using a simple CHECK constraint instead for such\ncolumns.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[ELT]
+declaration=N,str1,str2,str3,...
+category=String Functions
+description=ELT() returns the Nth element of the list of strings: str1 if N = 1,\nstr2 if N = 2, and so on. Returns NULL if N is less than 1, greater\nthan the number of arguments, or NULL. ELT() is the complement of\nFIELD().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[ENUM]
+declaration='value1','value2',...
+category=Data Types
+description=collation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values 'value1', 'value2', ..., NULL or the special ''\nerror value. ENUM values are represented internally as integers.\n\nAn ENUM column can have a maximum of 65,535 distinct elements.\n\nThe maximum supported length of an individual ENUM element is M <= 255\nand (M x w) <= 1020, where M is the element literal length and w is the\nnumber of bytes required for the maximum-length character in the\ncharacter set.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[EXP]
+declaration=X
+category=Numeric Functions
+description=Returns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nIf X is NULL, this function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[EXPORT_SET]
+declaration=bits,on,off[,separator[,number_of_bits]]
+category=String Functions
+description=Returns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ,). The number of bits examined is given by number_of_bits,\nwhich has a default of 64 if not specified. number_of_bits is silently\nclipped to 64 if larger than 64. It is treated as an unsigned integer,\nso a value of −1 is effectively the same as 64.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[EXTRACT]
+declaration=unit FROM date
+category=Date and Time Functions
+description=The EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic. For information on the unit argument, see\nhttps://dev.mysql.com/doc/refman/8.3/en/expressions.html#temporal-inter\nvals. Returns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[EXTRACTVALUE]
+declaration=xml_frag, xpath_expr
+category=XML
+description=ExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe element or elements matched by the XPath expression.\n\nUsing this function is the equivalent of performing a match using the\nxpath_expr after appending /text(). In other words,\nExtractValue('Sakila', '/a/b') and\nExtractValue('Sakila', '/a/b/text()') produce the same\nresult. If xml_frag or xpath_expr is NULL, the function returns NULL.\n\nIf multiple matches are found, the content of the first child text node\nof each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text())---for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed---an empty string is returned. No distinction is made between a\nmatch on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue('', '/a/b');\n+-------------------------------------+\n| ExtractValue('', '/a/b') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue('', '/a/b');\n+-------------------------------------+\n| ExtractValue('', '/a/b') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue('', 'count(/a/b)');\n+-------------------------------------+\n| ExtractValue('', 'count(/a/b)') |\n+-------------------------------------+\n ...
+[FIELD]
+declaration=str,str1,str2,str3,...
+category=String Functions
+description=Returns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[FIND_IN_SET]
+declaration=str,strlist
+category=String Functions
+description=Returns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by , characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (,) character.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[FIRST_VALUE]
+declaration=expr
+category=Window Functions
+description=Returns the value of expr from the first row of the window frame.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\nnull_treatment is as described in the section introduction.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[FLOAT]
+declaration=M,D
+category=Data Types
+description=A small (single-precision) floating-point number. Permissible values\nare -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nFLOAT(M,D) is a nonstandard MySQL extension. This syntax is deprecated,\nand you should expect support for it to be removed in a future version\nof MySQL.\n\nUNSIGNED, if specified, disallows negative values. The UNSIGNED\nattribute is deprecated for columns of type FLOAT (and any synonyms)\nand you should expect support for it to be removed in a future version\nof MySQL. Consider using a simple CHECK constraint instead for such\ncolumns.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttps://dev.mysql.com/doc/refman/8.3/en/no-matching-rows.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[FLOOR]
+declaration=X
+category=Numeric Functions
+description=Returns the largest integer value not greater than X. Returns NULL if X\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[FORMAT]
+declaration=X,D[,locale]
+category=String Functions
+description=Formats the number X to a format like '#,###,###.##', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part. If X or D is NULL, the\nfunction returns NULL.\n\nThe optional third parameter enables a locale to be specified to be\nused for the result number's decimal point, thousands separator, and\ngrouping between separators. Permissible locale values are the same as\nthe legal values for the lc_time_names system variable (see\nhttps://dev.mysql.com/doc/refman/8.3/en/locale-support.html). If the\nlocale is NULL or not specified, the default locale is 'en_US'.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[FORMAT_BYTES]
+declaration=count
+category=Performance Schema Functions
+description=Given a numeric byte count, converts it to human-readable format and\nreturns a string consisting of a value and a units indicator. The\nstring contains the number of bytes rounded to 2 decimal places and a\nminimum of 3 significant digits. Numbers less than 1024 bytes are\nrepresented as whole numbers and are not rounded. Returns NULL if count\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/performance-schema-functions.html
+[FORMAT_PICO_TIME]
+declaration=time_val
+category=Performance Schema Functions
+description=Given a numeric Performance Schema latency or wait time in picoseconds,\nconverts it to human-readable format and returns a string consisting of\na value and a units indicator. The string contains the decimal time\nrounded to 2 decimal places and a minimum of 3 significant digits.\nTimes under 1 nanosecond are represented as whole numbers and are not\nrounded.\n\nIf time_val is NULL, this function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/performance-schema-functions.html
+[FOUND_ROWS]
+declaration=
+category=Information Functions
+description=*Note*:\n\nThe SQL_CALC_FOUND_ROWS query modifier and accompanying FOUND_ROWS()\nfunction are deprecated; expect them to be removed in a future version\nof MySQL. Execute the query with LIMIT, and then a second query with\nCOUNT(*) and without LIMIT to determine whether there are additional\nrows. For example, instead of these queries:\n\nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100 LIMIT 10;\nSELECT FOUND_ROWS();\n\nUse these queries instead:\n\nSELECT * FROM tbl_name WHERE id > 100 LIMIT 10;\nSELECT COUNT(*) FROM tbl_name WHERE id > 100;\n\nCOUNT(*) is subject to certain optimizations. SQL_CALC_FOUND_ROWS\ncauses some optimizations to be disabled.\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include an SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[FROM_BASE64]
+declaration=str
+category=String Functions
+description=Takes a string encoded with the base-64 encoded rules used by\nTO_BASE64() and returns the decoded result as a binary string. The\nresult is NULL if the argument is NULL or not a valid base-64 string.\nSee the description of TO_BASE64() for details about the encoding and\ndecoding rules.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[FROM_DAYS]
+declaration=N
+category=Date and Time Functions
+description=Given a day number N, returns a DATE value. Returns NULL if N is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[FROM_UNIXTIME]
+declaration=unix_timestamp[,format]
+category=Date and Time Functions
+description=Returns a representation of unix_timestamp as a datetime or character\nstring value. The value returned is expressed using the session time\nzone. (Clients can set the session time zone as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/time-zone-support.html.)\nunix_timestamp is an internal timestamp value representing seconds\nsince '1970-01-01 00:00:00' UTC, such as produced by the\nUNIX_TIMESTAMP() function.\n\nIf format is omitted, this function returns a DATETIME value.\n\nIf unix_timestamp or format is NULL, this function returns NULL.\n\nIf unix_timestamp is an integer, the fractional seconds precision of\nthe DATETIME is zero. When unix_timestamp is a decimal value, the\nfractional seconds precision of the DATETIME is the same as the\nprecision of the decimal value, up to a maximum of 6. When\nunix_timestamp is a floating point number, the fractional seconds\nprecision of the datetime is 6.\n\nOn 32-bit platforms, the maximum useful value for unix_timestamp is\n2147483647.999999, which returns '2038-01-19 03:14:07.999999' UTC. On\n64-bit platforms, the effective maximum is 32536771199.999999, which\nreturns '3001-01-18 23:59:59.999999' UTC. Regardless of platform or\nversion, a greater value for unix_timestamp than the effective maximum\nreturns 0.\n\nformat is used to format the result in the same way as the format\nstring used for the DATE_FORMAT() function. If format is supplied, the\nvalue returned is a VARCHAR.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[GEOMCOLLECTION]
+declaration=g [, g] ...
+category=Geometry Constructors
+description=Constructs a GeomCollection value from the geometry arguments.\n\nGeomCollection() returns all the proper geometries contained in the\narguments even if a nonsupported geometry is present.\n\nGeomCollection() with no arguments is permitted as a way to create an\nempty geometry. Also, functions such as ST_GeomFromText() that accept\nWKT geometry collection arguments understand both OpenGIS\n'GEOMETRYCOLLECTION EMPTY' standard syntax and MySQL\n'GEOMETRYCOLLECTION()' nonstandard syntax.\n\nGeomCollection() and GeometryCollection() are synonymous, with\nGeomCollection() the preferred function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[GEOMETRYCOLLECTION]
+declaration=g [, g] ...
+category=Geometry Constructors
+description=Constructs a GeomCollection value from the geometry arguments.\n\nGeometryCollection() returns all the proper geometries contained in the\narguments even if a nonsupported geometry is present.\n\nGeometryCollection() with no arguments is permitted as a way to create\nan empty geometry. Also, functions such as ST_GeomFromText() that\naccept WKT geometry collection arguments understand both OpenGIS\n'GEOMETRYCOLLECTION EMPTY' standard syntax and MySQL\n'GEOMETRYCOLLECTION()' nonstandard syntax.\n\nGeomCollection() and GeometryCollection() are synonymous, with\nGeomCollection() the preferred function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[GET_FORMAT]
+declaration={DATE|TIME|DATETIME}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'}
+category=Date and Time Functions
+description=Returns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nIf format is NULL, this function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[GET_LOCK]
+declaration=str,timeout
+category=Locking Functions
+description=Tries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. A negative timeout value means infinite\ntimeout. The lock is exclusive. While held by one session, other\nsessions cannot obtain a lock of the same name.\n\nReturns 1 if the lock was obtained successfully, 0 if the attempt timed\nout (for example, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of memory or\nthe thread was killed with mysqladmin kill).\n\nA lock obtained with GET_LOCK() is released explicitly by executing\nRELEASE_LOCK() or implicitly when your session terminates (either\nnormally or abnormally). Locks obtained with GET_LOCK() are not\nreleased when transactions commit or roll back.\n\nGET_LOCK() is implemented using the metadata locking (MDL) subsystem.\nMultiple simultaneous locks can be acquired and GET_LOCK() does not\nrelease any existing locks. For example, suppose that you execute these\nstatements:\n\nSELECT GET_LOCK('lock1',10);\nSELECT GET_LOCK('lock2',10);\nSELECT RELEASE_LOCK('lock2');\nSELECT RELEASE_LOCK('lock1');\n\nThe second GET_LOCK() acquires a second lock and both RELEASE_LOCK()\ncalls return 1 (success).\n\nIt is even possible for a given session to acquire multiple locks for\nthe same name. Other sessions cannot acquire a lock with that name\nuntil the acquiring session releases all its locks for the name.\n\nUniquely named locks acquired with GET_LOCK() appear in the Performance\nSchema metadata_locks table. The OBJECT_TYPE column says USER LEVEL\nLOCK and the OBJECT_NAME column indicates the lock name. In the case\nthat multiple locks are acquired for the same name, only the first lock\nfor the name registers a row in the metadata_locks table. Subsequent\nlocks for the name increment a counter in the lock but do not acquire\nadditional metadata locks. The metadata_locks row for the lock is\ndeleted when the last lock instance on the name is released.\n\nThe capability of acquiring multiple locks means there is the\npossibility of deadlock among clients. When this happens, the server\nchooses a caller and terminates its lock-acquisition request with an\nER_USER_LOCK_DEADLOCK\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_user_lock_deadlock) error. This error does not cause\ntransactions to roll back.\n\nMySQL enforces a maximum length on lock names of 64 characters.\n ...
+[GREATEST]
+declaration=value1,value2,...
+category=Comparison Operators
+description=With two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[GROUPING]
+declaration=expr [, expr] ...
+category=Miscellaneous Functions
+description=For GROUP BY queries that include a WITH ROLLUP modifier, the ROLLUP\noperation produces super-aggregate output rows where NULL represents\nthe set of all values. The GROUPING() function enables you to\ndistinguish NULL values for super-aggregate rows from NULL values in\nregular grouped rows.\n\nGROUPING() is permitted in the select list, HAVING clause, and ORDER BY\nclause.\n\nEach argument to GROUPING() must be an expression that exactly matches\nan expression in the GROUP BY clause. The expression cannot be a\npositional specifier. For each expression, GROUPING() produces 1 if the\nexpression value in the current row is a NULL representing a\nsuper-aggregate value. Otherwise, GROUPING() produces 0, indicating\nthat the expression value is a NULL for a regular result row or is not\nNULL.\n\nSuppose that table t1 contains these rows, where NULL indicates\nsomething like "other" or "unknown":\n\nmysql> SELECT * FROM t1;\n+------+-------+----------+\n| name | size | quantity |\n+------+-------+----------+\n| ball | small | 10 |\n| ball | large | 20 |\n| ball | NULL | 5 |\n| hoop | small | 15 |\n| hoop | large | 5 |\n| hoop | NULL | 3 |\n+------+-------+----------+\n\nA summary of the table without WITH ROLLUP looks like this:\n\nmysql> SELECT name, size, SUM(quantity) AS quantity\n FROM t1\n GROUP BY name, size;\n+------+-------+----------+\n| name | size | quantity |\n+------+-------+----------+\n| ball | small | 10 |\n| ball | large | 20 |\n| ball | NULL | 5 |\n| hoop | small | 15 |\n| hoop | large | 5 |\n| hoop | NULL | 3 |\n+------+-------+----------+\n\nThe result contains NULL values, but those do not represent\nsuper-aggregate rows because the query does not include WITH ROLLUP.\n ...
+[GROUP_CONCAT]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=This function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[GTID_SUBSET]
+declaration=set1,set2
+category=GTID
+description=Given two sets of global transaction identifiers set1 and set2, returns\ntrue if all GTIDs in set1 are also in set2. Returns NULL if set1 or\nset2 is NULL. Returns false otherwise.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gtid-functions.html
+[GTID_SUBTRACT]
+declaration=set1,set2
+category=GTID
+description=Given two sets of global transaction identifiers set1 and set2, returns\nonly those GTIDs from set1 that are not in set2. Returns NULL if set1\nor set2 is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gtid-functions.html
+[HEX]
+declaration=str
+category=String Functions
+description=For a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each byte of each character in str is\nconverted to two hexadecimal digits. (Multibyte characters therefore\nbecome more than two digits.) The inverse of this operation is\nperformed by the UNHEX() function.\n\nFor a numeric argument N, HEX() returns a hexadecimal string\nrepresentation of the value of N treated as a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16). The inverse of this operation is\nperformed by CONV(HEX(N),16,10).\n\nFor a NULL argument, this function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[HOUR]
+declaration=time
+category=Date and Time Functions
+description=Returns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23. Returns NULL if time\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[ICU_VERSION]
+declaration=
+category=Information Functions
+description=The version of the International Components for Unicode (ICU) library\nused to support regular expression operations (see\nhttps://dev.mysql.com/doc/refman/8.3/en/regexp.html). This function is\nprimarily intended for use in test cases.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[IFNULL]
+declaration=expr1,expr2
+category=Flow Control Functions
+description=If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/flow-control-functions.html
+[IN]
+declaration=value,...
+category=Comparison Operators
+description=Returns 1 (true) if expr is equal to any of the values in the IN()\nlist, else returns 0 (false).\n\nType conversion takes place according to the rules described in\nhttps://dev.mysql.com/doc/refman/8.3/en/type-conversion.html, applied\nto all the arguments. If no type conversion is needed for the values in\nthe IN() list, they are all non-JSON constants of the same type, and\nexpr can be compared to each of them as a value of the same type\n(possibly after type conversion), an optimization takes place. The\nvalues the list are sorted and the search for expr is done using a\nbinary search, which makes the IN() operation very quick.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[INET6_ATON]
+declaration=expr
+category=Miscellaneous Functions
+description=Given an IPv6 or IPv4 network address as a string, returns a binary\nstring that represents the numeric value of the address in network byte\norder (big endian). Because numeric-format IPv6 addresses require more\nbytes than the largest integer type, the representation returned by\nthis function has the VARBINARY data type: VARBINARY(16) for IPv6\naddresses and VARBINARY(4) for IPv4 addresses. If the argument is not a\nvalid address, or if it is NULL, INET6_ATON() returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[INET6_NTOA]
+declaration=expr
+category=Miscellaneous Functions
+description=Given an IPv6 or IPv4 network address represented in numeric form as a\nbinary string, returns the string representation of the address as a\nstring in the connection character set. If the argument is not a valid\naddress, or if it is NULL, INET6_NTOA() returns NULL.\n\nINET6_NTOA() has these properties:\n\no It does not use operating system functions to perform conversions,\n thus the output string is platform independent.\n\no The return string has a maximum length of 39 (4 x 8 + 7). Given this\n statement:\n\nCREATE TABLE t AS SELECT INET6_NTOA(expr) AS c1;\n\n The resulting table would have this definition:\n\nCREATE TABLE t (c1 VARCHAR(39) CHARACTER SET utf8mb3 DEFAULT NULL);\n\no The return string uses lowercase letters for IPv6 addresses.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[INET_ATON]
+declaration=expr
+category=Miscellaneous Functions
+description=Given the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the\naddress in network byte order (big endian). INET_ATON() returns NULL if\nit does not understand its argument, or if expr is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[INET_NTOA]
+declaration=expr
+category=Miscellaneous Functions
+description=Given a numeric IPv4 network address in network byte order, returns the\ndotted-quad string representation of the address as a string in the\nconnection character set. INET_NTOA() returns NULL if it does not\nunderstand its argument.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[INSTR]
+declaration=str,substr
+category=String Functions
+description=Returns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[INT]
+declaration=M
+category=Data Types
+description=A normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[INTEGER]
+declaration=M
+category=Data Types
+description=This type is a synonym for INT.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[INTERVAL]
+declaration=N,N1,N2,N3,...
+category=Comparison Operators
+description=Returns 0 if N <= N1, 1 if N <= N2 and so on, or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 <= N2 <= N3\n<= ... <= Nn for this function to work correctly. This is because a\nbinary search is used (very fast).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[ISNULL]
+declaration=expr
+category=Comparison Operators
+description=If expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[IS_FREE_LOCK]
+declaration=str
+category=Locking Functions
+description=Checks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/locking-functions.html
+[IS_IPV4]
+declaration=expr
+category=Miscellaneous Functions
+description=Returns 1 if the argument is a valid IPv4 address specified as a\nstring, 0 otherwise. Returns NULL if expr is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[IS_IPV4_COMPAT]
+declaration=expr
+category=Miscellaneous Functions
+description=This function takes an IPv6 address represented in numeric form as a\nbinary string, as returned by INET6_ATON(). It returns 1 if the\nargument is a valid IPv4-compatible IPv6 address, 0 otherwise (unless\nexpr is NULL, in which case the function returns NULL). IPv4-compatible\naddresses have the form ::ipv4_address.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[IS_IPV4_MAPPED]
+declaration=expr
+category=Miscellaneous Functions
+description=This function takes an IPv6 address represented in numeric form as a\nbinary string, as returned by INET6_ATON(). It returns 1 if the\nargument is a valid IPv4-mapped IPv6 address, 0 otherwise, unless expr\nis NULL, in which case the function returns NULL. IPv4-mapped addresses\nhave the form ::ffff:ipv4_address.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[IS_IPV6]
+declaration=expr
+category=Miscellaneous Functions
+description=Returns 1 if the argument is a valid IPv6 address specified as a\nstring, 0 otherwise, unless expr is NULL, in which case the function\nreturns NULL. This function does not consider IPv4 addresses to be\nvalid IPv6 addresses.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[IS_USED_LOCK]
+declaration=str
+category=Locking Functions
+description=Checks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client session that holds\nthe lock. Otherwise, it returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/locking-functions.html
+[IS_UUID]
+declaration=string_uuid
+category=Miscellaneous Functions
+description=Returns 1 if the argument is a valid string-format UUID, 0 if the\nargument is not a valid UUID, and NULL if the argument is NULL.\n\n"Valid" means that the value is in a format that can be parsed. That\nis, it has the correct length and contains only the permitted\ncharacters (hexadecimal digits in any lettercase and, optionally,\ndashes and curly braces). This format is most common:\n\naaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\n\nThese other formats are also permitted:\n\naaaaaaaabbbbccccddddeeeeeeeeeeee\n{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}\n\nFor the meanings of fields within the value, see the UUID() function\ndescription.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[JOIN]
+declaration=t2, t3, t4
+category=Data Manipulation
+description=ON (t2.a = t1.a AND t3.b = t1.b AND t4.c = t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a = t1.a AND t3.b = t1.b AND t4.c = t1.c)\n\nIn MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents\n(they can replace each other). In standard SQL, they are not\nequivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used\notherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations. MySQL also supports nested joins. See\nhttps://dev.mysql.com/doc/refman/8.3/en/nested-join-optimization.html.\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttps://dev.mysql.com/doc/refman/8.3/en/index-hints.html. Optimizer\nhints and the optimizer_switch system variable are other ways to\ninfluence optimizer use of indexes. See\nhttps://dev.mysql.com/doc/refman/8.3/en/optimizer-hints.html, and\nhttps://dev.mysql.com/doc/refman/8.3/en/switchable-optimizations.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/join.html
+[JSON_ARRAY]
+declaration=[val[, val] ...]
+category=MBR Functions
+description=Evaluates a (possibly empty) list of values and returns a JSON array\ncontaining those values.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-creation-functions.html
+[JSON_ARRAYAGG]
+declaration=col_or_expr
+category=Aggregate Functions and Modifiers
+description=Aggregates a result set as a single JSON array whose elements consist\nof the rows. The order of elements in this array is undefined. The\nfunction acts on a column or an expression that evaluates to a single\nvalue. Returns NULL if the result contains no rows, or in the event of\nan error. If col_or_expr is NULL, the function returns an array of JSON\n[null] elements.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[JSON_ARRAY_APPEND]
+declaration=json_doc, path, val[, path, val] ...
+category=MBR Functions
+description=Appends values to the end of the indicated arrays within a JSON\ndocument and returns the result. Returns NULL if any argument is NULL.\nAn error occurs if the json_doc argument is not a valid JSON document\nor any path argument is not a valid path expression or contains a * or\n** wildcard.\n\nThe path-value pairs are evaluated left to right. The document produced\nby evaluating one pair becomes the new value against which the next\npair is evaluated.\n\nIf a path selects a scalar or object value, that value is autowrapped\nwithin an array and the new value is added to that array. Pairs for\nwhich the path does not identify any value in the JSON document are\nignored.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_ARRAY_INSERT]
+declaration=json_doc, path, val[, path, val] ...
+category=MBR Functions
+description=Updates a JSON document, inserting into an array within the document\nand returning the modified document. Returns NULL if any argument is\nNULL. An error occurs if the json_doc argument is not a valid JSON\ndocument or any path argument is not a valid path expression or\ncontains a * or ** wildcard or does not end with an array element\nidentifier.\n\nThe path-value pairs are evaluated left to right. The document produced\nby evaluating one pair becomes the new value against which the next\npair is evaluated.\n\nPairs for which the path does not identify any array in the JSON\ndocument are ignored. If a path identifies an array element, the\ncorresponding value is inserted at that element position, shifting any\nfollowing values to the right. If a path identifies an array position\npast the end of an array, the value is inserted at the end of the\narray.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_CONTAINS]
+declaration=target, candidate[, path]
+category=MBR Functions
+description=Indicates by returning 1 or 0 whether a given candidate JSON document\nis contained within a target JSON document, or---if a path argument was\nsupplied---whether the candidate is found at a specific path within the\ntarget. Returns NULL if any argument is NULL, or if the path argument\ndoes not identify a section of the target document. An error occurs if\ntarget or candidate is not a valid JSON document, or if the path\nargument is not a valid path expression or contains a * or ** wildcard.\n\nTo check only whether any data exists at the path, use\nJSON_CONTAINS_PATH() instead.\n\nThe following rules define containment:\n\no A candidate scalar is contained in a target scalar if and only if\n they are comparable and are equal. Two scalar values are comparable\n if they have the same JSON_TYPE() types, with the exception that\n values of types INTEGER and DECIMAL are also comparable to each\n other.\n\no A candidate array is contained in a target array if and only if every\n element in the candidate is contained in some element of the target.\n\no A candidate nonarray is contained in a target array if and only if\n the candidate is contained in some element of the target.\n\no A candidate object is contained in a target object if and only if for\n each key in the candidate there is a key with the same name in the\n target and the value associated with the candidate key is contained\n in the value associated with the target key.\n\nOtherwise, the candidate value is not contained in the target document.\n\nQueries using JSON_CONTAINS() on InnoDB tables can be optimized using\nmulti-valued indexes; see\nhttps://dev.mysql.com/doc/refman/8.3/en/create-index.html#create-index-\nmulti-valued, for more information.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_CONTAINS_PATH]
+declaration=json_doc, one_or_all, path[, path] ...
+category=MBR Functions
+description=Returns 0 or 1 to indicate whether a JSON document contains data at a\ngiven path or paths. Returns NULL if any argument is NULL. An error\noccurs if the json_doc argument is not a valid JSON document, any path\nargument is not a valid path expression, or one_or_all is not 'one' or\n'all'.\n\nTo check for a specific value at a path, use JSON_CONTAINS() instead.\n\nThe return value is 0 if no specified path exists within the document.\nOtherwise, the return value depends on the one_or_all argument:\n\no 'one': 1 if at least one path exists within the document, 0\n otherwise.\n\no 'all': 1 if all paths exist within the document, 0 otherwise.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_DEPTH]
+declaration=json_doc
+category=MBR Functions
+description=Returns the maximum depth of a JSON document. Returns NULL if the\nargument is NULL. An error occurs if the argument is not a valid JSON\ndocument.\n\nAn empty array, empty object, or scalar value has depth 1. A nonempty\narray containing only elements of depth 1 or nonempty object containing\nonly member values of depth 1 has depth 2. Otherwise, a JSON document\nhas depth greater than 2.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-attribute-functions.html
+[JSON_EXTRACT]
+declaration=json_doc, path[, path] ...
+category=MBR Functions
+description=Returns data from a JSON document, selected from the parts of the\ndocument matched by the path arguments. Returns NULL if any argument is\nNULL or no paths locate a value in the document. An error occurs if the\njson_doc argument is not a valid JSON document or any path argument is\nnot a valid path expression.\n\nThe return value consists of all values matched by the path arguments.\nIf it is possible that those arguments could return multiple values,\nthe matched values are autowrapped as an array, in the order\ncorresponding to the paths that produced them. Otherwise, the return\nvalue is the single matched value.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_INSERT]
+declaration=json_doc, path, val[, path, val] ...
+category=MBR Functions
+description=Inserts data into a JSON document and returns the result. Returns NULL\nif any argument is NULL. An error occurs if the json_doc argument is\nnot a valid JSON document or any path argument is not a valid path\nexpression or contains a * or ** wildcard.\n\nThe path-value pairs are evaluated left to right. The document produced\nby evaluating one pair becomes the new value against which the next\npair is evaluated.\n\nA path-value pair for an existing path in the document is ignored and\ndoes not overwrite the existing document value. A path-value pair for a\nnonexisting path in the document adds the value to the document if the\npath identifies one of these types of values:\n\no A member not present in an existing object. The member is added to\n the object and associated with the new value.\n\no A position past the end of an existing array. The array is extended\n with the new value. If the existing value is not an array, it is\n autowrapped as an array, then extended with the new value.\n\nOtherwise, a path-value pair for a nonexisting path in the document is\nignored and has no effect.\n\nFor a comparison of JSON_INSERT(), JSON_REPLACE(), and JSON_SET(), see\nthe discussion of JSON_SET().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_KEYS]
+declaration=json_doc[, path]
+category=MBR Functions
+description=Returns the keys from the top-level value of a JSON object as a JSON\narray, or, if a path argument is given, the top-level keys from the\nselected path. Returns NULL if any argument is NULL, the json_doc\nargument is not an object, or path, if given, does not locate an\nobject. An error occurs if the json_doc argument is not a valid JSON\ndocument or the path argument is not a valid path expression or\ncontains a * or ** wildcard.\n\nThe result array is empty if the selected object is empty. If the\ntop-level value has nested subobjects, the return value does not\ninclude keys from those subobjects.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_LENGTH]
+declaration=json_doc[, path]
+category=MBR Functions
+description=Returns the length of a JSON document, or, if a path argument is given,\nthe length of the value within the document identified by the path.\nReturns NULL if any argument is NULL or the path argument does not\nidentify a value in the document. An error occurs if the json_doc\nargument is not a valid JSON document or the path argument is not a\nvalid path expression.\n\nThe length of a document is determined as follows:\n\no The length of a scalar is 1.\n\no The length of an array is the number of array elements.\n\no The length of an object is the number of object members.\n\no The length does not count the length of nested arrays or objects.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-attribute-functions.html
+[JSON_MERGE]
+declaration=json_doc, json_doc[, json_doc] ...
+category=MBR Functions
+description=Deprecated synonym for JSON_MERGE_PRESERVE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_OBJECT]
+declaration=[key, val[, key, val] ...]
+category=MBR Functions
+description=Evaluates a (possibly empty) list of key-value pairs and returns a JSON\nobject containing those pairs. An error occurs if any key name is NULL\nor the number of arguments is odd.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-creation-functions.html
+[JSON_OBJECTAGG]
+declaration=key, value
+category=Aggregate Functions and Modifiers
+description=Takes two column names or expressions as arguments, the first of these\nbeing used as a key and the second as a value, and returns a JSON\nobject containing key-value pairs. Returns NULL if the result contains\nno rows, or in the event of an error. An error occurs if any key name\nis NULL or the number of arguments is not equal to 2.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[JSON_OVERLAPS]
+declaration=json_doc1, json_doc2
+category=MBR Functions
+description=Compares two JSON documents. Returns true (1) if the two document have\nany key-value pairs or array elements in common. If both arguments are\nscalars, the function performs a simple equality test. If either\nargument is NULL, the function returns NULL.\n\nThis function serves as counterpart to JSON_CONTAINS(), which requires\nall elements of the array searched for to be present in the array\nsearched in. Thus, JSON_CONTAINS() performs an AND operation on search\nkeys, while JSON_OVERLAPS() performs an OR operation.\n\nQueries on JSON columns of InnoDB tables using JSON_OVERLAPS() in the\nWHERE clause can be optimized using multi-valued indexes.\nhttps://dev.mysql.com/doc/refman/8.3/en/create-index.html#create-index-\nmulti-valued, provides detailed information and examples.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_PRETTY]
+declaration=json_val
+category=MBR Functions
+description=Provides pretty-printing of JSON values similar to that implemented in\nPHP and by other languages and database systems. The value supplied\nmust be a JSON value or a valid string representation of a JSON value.\nExtraneous whitespaces and newlines present in this value have no\neffect on the output. For a NULL value, the function returns NULL. If\nthe value is not a JSON document, or if it cannot be parsed as one, the\nfunction fails with an error.\n\nFormatting of the output from this function adheres to the following\nrules:\n\no Each array element or object member appears on a separate line,\n indented by one additional level as compared to its parent.\n\no Each level of indentation adds two leading spaces.\n\no A comma separating individual array elements or object members is\n printed before the newline that separates the two elements or\n members.\n\no The key and the value of an object member are separated by a colon\n followed by a space (': ').\n\no An empty object or array is printed on a single line. No space is\n printed between the opening and closing brace.\n\no Special characters in string scalars and key names are escaped\n employing the same rules used by the JSON_QUOTE() function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-utility-functions.html
+[JSON_QUOTE]
+declaration=string
+category=MBR Functions
+description=Quotes a string as a JSON value by wrapping it with double quote\ncharacters and escaping interior quote and other characters, then\nreturning the result as a utf8mb4 string. Returns NULL if the argument\nis NULL.\n\nThis function is typically used to produce a valid JSON string literal\nfor inclusion within a JSON document.\n\nCertain special characters are escaped with backslashes per the escape\nsequences shown in\nhttps://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html\n#json-unquote-character-escape-sequences.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-creation-functions.html
+[JSON_REMOVE]
+declaration=json_doc, path[, path] ...
+category=MBR Functions
+description=Removes data from a JSON document and returns the result. Returns NULL\nif any argument is NULL. An error occurs if the json_doc argument is\nnot a valid JSON document or any path argument is not a valid path\nexpression or is $ or contains a * or ** wildcard.\n\nThe path arguments are evaluated left to right. The document produced\nby evaluating one path becomes the new value against which the next\npath is evaluated.\n\nIt is not an error if the element to be removed does not exist in the\ndocument; in that case, the path does not affect the document.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_REPLACE]
+declaration=json_doc, path, val[, path, val] ...
+category=MBR Functions
+description=Replaces existing values in a JSON document and returns the result.\nReturns NULL if any argument is NULL. An error occurs if the json_doc\nargument is not a valid JSON document or any path argument is not a\nvalid path expression or contains a * or ** wildcard.\n\nThe path-value pairs are evaluated left to right. The document produced\nby evaluating one pair becomes the new value against which the next\npair is evaluated.\n\nA path-value pair for an existing path in the document overwrites the\nexisting document value with the new value. A path-value pair for a\nnonexisting path in the document is ignored and has no effect.\n\nThe optimizer can perform a partial, in-place update of a JSON column\ninstead of removing the old document and writing the new document in\nits entirety to the column. This optimization can be performed for an\nupdate statement that uses the JSON_REPLACE() function and meets the\nconditions outlined in\nhttps://dev.mysql.com/doc/refman/8.3/en/json.html#json-partial-updates.\n\nFor a comparison of JSON_INSERT(), JSON_REPLACE(), and JSON_SET(), see\nthe discussion of JSON_SET().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_SCHEMA_VALID]
+declaration=schema,document
+category=MBR Functions
+description=Validates a JSON document against a JSON schema. Both schema and\ndocument are required. The schema must be a valid JSON object; the\ndocument must be a valid JSON document. Provided that these conditions\nare met: If the document validates against the schema, the function\nreturns true (1); otherwise, it returns false (0).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-validation-functions.html
+[JSON_SCHEMA_VALIDATION_REPORT]
+declaration=schema,document
+category=MBR Functions
+description=Validates a JSON document against a JSON schema. Both schema and\ndocument are required. As with JSON_VALID_SCHEMA(), the schema must be\na valid JSON object, and the document must be a valid JSON document.\nProvided that these conditions are met, the function returns a report,\nas a JSON document, on the outcome of the validation. If the JSON\ndocument is considered valid according to the JSON Schema, the function\nreturns a JSON object with one property valid having the value "true".\nIf the JSON document fails validation, the function returns a JSON\nobject which includes the properties listed here:\n\no valid: Always "false" for a failed schema validation\n\no reason: A human-readable string containing the reason for the failure\n\no schema-location: A JSON pointer URI fragment identifier indicating\n where in the JSON schema the validation failed (see Note following\n this list)\n\no document-location: A JSON pointer URI fragment identifier indicating\n where in the JSON document the validation failed (see Note following\n this list)\n\no schema-failed-keyword: A string containing the name of the keyword or\n property in the JSON schema that was violated\n\n*Note*:\n\nJSON pointer URI fragment identifiers are defined in RFC 6901 -\nJavaScript Object Notation (JSON) Pointer\n(https://tools.ietf.org/html/rfc6901#page-5). (These are not the same\nas the JSON path notation used by JSON_EXTRACT() and other MySQL JSON\nfunctions.) In this notation, # represents the entire document, and\n#/myprop represents the portion of the document included in the\ntop-level property named myprop. See the specification just cited and\nthe examples shown later in this section for more information.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-validation-functions.html
+[JSON_SEARCH]
+declaration=json_doc, one_or_all, search_str[, escape_char[, path] ...]
+category=MBR Functions
+description=Returns the path to the given string within a JSON document. Returns\nNULL if any of the json_doc, search_str, or path arguments are NULL; no\npath exists within the document; or search_str is not found. An error\noccurs if the json_doc argument is not a valid JSON document, any path\nargument is not a valid path expression, one_or_all is not 'one' or\n'all', or escape_char is not a constant expression.\n\nThe one_or_all argument affects the search as follows:\n\no 'one': The search terminates after the first match and returns one\n path string. It is undefined which match is considered first.\n\no 'all': The search returns all matching path strings such that no\n duplicate paths are included. If there are multiple strings, they are\n autowrapped as an array. The order of the array elements is\n undefined.\n\nWithin the search_str search string argument, the % and _ characters\nwork as for the LIKE operator: % matches any number of characters\n(including zero characters), and _ matches exactly one character.\n\nTo specify a literal % or _ character in the search string, precede it\nby the escape character. The default is \ if the escape_char argument\nis missing or NULL. Otherwise, escape_char must be a constant that is\nempty or one character.\n\nFor more information about matching and escape character behavior, see\nthe description of LIKE in\nhttps://dev.mysql.com/doc/refman/8.3/en/string-comparison-functions.html\n. For escape character handling, a difference from the LIKE behavior\nis that the escape character for JSON_SEARCH() must evaluate to a\nconstant at compile time, not just at execution time. For example, if\nJSON_SEARCH() is used in a prepared statement and the escape_char\nargument is supplied using a ? parameter, the parameter value might be\nconstant at execution time, but is not at compile time.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html
+[JSON_SET]
+declaration=json_doc, path, val[, path, val] ...
+category=MBR Functions
+description=Inserts or updates data in a JSON document and returns the result.\nReturns NULL if json_doc or path is NULL, or if path, when given, does\nnot locate an object. Otherwise, an error occurs if the json_doc\nargument is not a valid JSON document or any path argument is not a\nvalid path expression or contains a * or ** wildcard.\n\nThe path-value pairs are evaluated left to right. The document produced\nby evaluating one pair becomes the new value against which the next\npair is evaluated.\n\nA path-value pair for an existing path in the document overwrites the\nexisting document value with the new value. A path-value pair for a\nnonexisting path in the document adds the value to the document if the\npath identifies one of these types of values:\n\no A member not present in an existing object. The member is added to\n the object and associated with the new value.\n\no A position past the end of an existing array. The array is extended\n with the new value. If the existing value is not an array, it is\n autowrapped as an array, then extended with the new value.\n\nOtherwise, a path-value pair for a nonexisting path in the document is\nignored and has no effect.\n\nThe optimizer can perform a partial, in-place update of a JSON column\ninstead of removing the old document and writing the new document in\nits entirety to the column. This optimization can be performed for an\nupdate statement that uses the JSON_SET() function and meets the\nconditions outlined in\nhttps://dev.mysql.com/doc/refman/8.3/en/json.html#json-partial-updates.\n\nThe JSON_SET(), JSON_INSERT(), and JSON_REPLACE() functions are\nrelated:\n\no JSON_SET() replaces existing values and adds nonexisting values.\n\no JSON_INSERT() inserts values without replacing existing values.\n\no JSON_REPLACE() replaces only existing values.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_STORAGE_FREE]
+declaration=json_val
+category=MBR Functions
+description=For a JSON column value, this function shows how much storage space was\nfreed in its binary representation after it was updated in place using\nJSON_SET(), JSON_REPLACE(), or JSON_REMOVE(). The argument can also be\na valid JSON document or a string which can be parsed as one---either\nas a literal value or as the value of a user variable---in which case\nthe function returns 0. It returns a positive, nonzero value if the\nargument is a JSON column value which has been updated as described\npreviously, such that its binary representation takes up less space\nthan it did prior to the update. For a JSON column which has been\nupdated such that its binary representation is the same as or larger\nthan before, or if the update was not able to take advantage of a\npartial update, it returns 0; it returns NULL if the argument is NULL.\n\nIf json_val is not NULL, and neither is a valid JSON document nor can\nbe successfully parsed as one, an error results.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-utility-functions.html
+[JSON_STORAGE_SIZE]
+declaration=json_val
+category=MBR Functions
+description=This function returns the number of bytes used to store the binary\nrepresentation of a JSON document. When the argument is a JSON column,\nthis is the space used to store the JSON document as it was inserted\ninto the column, prior to any partial updates that may have been\nperformed on it afterwards. json_val must be a valid JSON document or a\nstring which can be parsed as one. In the case where it is string, the\nfunction returns the amount of storage space in the JSON binary\nrepresentation that is created by parsing the string as JSON and\nconverting it to binary. It returns NULL if the argument is NULL.\n\nAn error results when json_val is not NULL, and is not---or cannot be\nsuccessfully parsed as---a JSON document.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-utility-functions.html
+[JSON_TABLE]
+declaration=expr, path COLUMNS (column_list
+category=MBR Functions
+description=Extracts data from a JSON document and returns it as a relational table\nhaving the specified columns. The complete syntax for this function is\nshown here:\n\nJSON_TABLE(\n expr,\n path COLUMNS (column_list)\n) [AS] alias\n\ncolumn_list:\n column[, column][, ...]\n\ncolumn:\n name FOR ORDINALITY\n | name type PATH string path [on_empty] [on_error]\n | name type EXISTS PATH string path\n | NESTED [PATH] path COLUMNS (column_list)\n\non_empty:\n {NULL | DEFAULT json_string | ERROR} ON EMPTY\n\non_error:\n {NULL | DEFAULT json_string | ERROR} ON ERROR\n\nexpr: This is an expression that returns JSON data. This can be a\nconstant ('{"a":1}'), a column (t1.json_data, given table t1 specified\nprior to JSON_TABLE() in the FROM clause), or a function call\n(JSON_EXTRACT(t1.json_data,'$.post.comments')).\n\npath: A JSON path expression, which is applied to the data source. We\nrefer to the JSON value matching the path as the row source; this is\nused to generate a row of relational data. The COLUMNS clause evaluates\nthe row source, finds specific JSON values within the row source, and\nreturns those JSON values as SQL values in individual columns of a row\nof relational data.\n\nThe alias is required. The usual rules for table aliases apply (see\nhttps://dev.mysql.com/doc/refman/8.3/en/identifiers.html).\n\nThis function compares column names in case-insensitive fashion.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-table-functions.html
+[JSON_TYPE]
+declaration=json_val
+category=MBR Functions
+description=Returns a utf8mb4 string indicating the type of a JSON value. This can\nbe an object, an array, or a scalar type, as shown here:\n\nmysql> SET @j = '{"a": [10, true]}';\nmysql> SELECT JSON_TYPE(@j);\n+---------------+\n| JSON_TYPE(@j) |\n+---------------+\n| OBJECT |\n+---------------+\nmysql> SELECT JSON_TYPE(JSON_EXTRACT(@j, '$.a'));\n+------------------------------------+\n| JSON_TYPE(JSON_EXTRACT(@j, '$.a')) |\n+------------------------------------+\n| ARRAY |\n+------------------------------------+\nmysql> SELECT JSON_TYPE(JSON_EXTRACT(@j, '$.a[0]'));\n+---------------------------------------+\n| JSON_TYPE(JSON_EXTRACT(@j, '$.a[0]')) |\n+---------------------------------------+\n| INTEGER |\n+---------------------------------------+\nmysql> SELECT JSON_TYPE(JSON_EXTRACT(@j, '$.a[1]'));\n+---------------------------------------+\n| JSON_TYPE(JSON_EXTRACT(@j, '$.a[1]')) |\n+---------------------------------------+\n| BOOLEAN |\n+---------------------------------------+\n\nJSON_TYPE() returns NULL if the argument is NULL:\n\nmysql> SELECT JSON_TYPE(NULL);\n+-----------------+\n| JSON_TYPE(NULL) |\n+-----------------+\n| NULL |\n+-----------------+\n\nAn error occurs if the argument is not a valid JSON value:\n\nmysql> SELECT JSON_TYPE(1);\nERROR 3146 (22032): Invalid data type for JSON data in argument 1\nto function json_type; a JSON string or JSON type is required.\n\nFor a non-NULL, non-error result, the following list describes the\npossible JSON_TYPE() return values:\n\no Purely JSON types:\n\n o OBJECT: JSON objects\n ...
+[JSON_UNQUOTE]
+declaration=json_val
+category=MBR Functions
+description=Unquotes JSON value and returns the result as a utf8mb4 string. Returns\nNULL if the argument is NULL. An error occurs if the value starts and\nends with double quotes but is not a valid JSON string literal.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-modification-functions.html
+[JSON_VALID]
+declaration=val
+category=MBR Functions
+description=Returns 0 or 1 to indicate whether a value is valid JSON. Returns NULL\nif the argument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/json-attribute-functions.html
+[JSON_VALUE]
+declaration=json_doc, path
+category=MBR Functions
+description=Extracts a value from a JSON document at the path given in the\nspecified document, and returns the extracted value, optionally\nconverting it to a desired type. The complete syntax is shown here:\n\nJSON_VALUE(json_doc, path [RETURNING type] [on_empty] [on_error])\n\non_empty:\n {NULL | ERROR | DEFAULT value} ON EMPTY\n\non_error:\n {NULL | ERROR | DEFAULT value} ON ERROR\n\njson_doc is a valid JSON document. If this is NULL, the function\nreturns NULL.\n\npath is a JSON path pointing to a location in the document. This must\nbe a string literal value.\n\ntype is one of the following data types:\n\no FLOAT\n\no DOUBLE\n\no DECIMAL\n\no SIGNED\n\no UNSIGNED\n\no DATE\n\no TIME\n\no DATETIME\n\no YEAR\n\n YEAR values of one or two digits are not supported.\n\no CHAR\n\no JSON\n\nThe types just listed are the same as the (non-array) types supported\nby the CAST() function.\n\nIf not specified by a RETURNING clause, the JSON_VALUE() function's\nreturn type is VARCHAR(512). When no character set is specified for the\nreturn type, JSON_VALUE() uses utf8mb4 with the binary collation, which\n ...
+[LAG]
+declaration=expr [, N[, default]]
+category=Window Functions
+description=Returns the value of expr from the row that lags (precedes) the current\nrow by N rows within its partition. If there is no such row, the return\nvalue is default. For example, if N is 3, the return value is default\nfor the first three rows. If N or default are missing, the defaults are\n1 and NULL, respectively.\n\nN must be a literal nonnegative integer. If N is 0, expr is evaluated\nfor the current row.\n\nN cannot be NULL, and must be an integer in the range 0 to 263,\ninclusive, in any of the following forms:\n\no an unsigned integer constant literal\n\no a positional parameter marker (?)\n\no a user-defined variable\n\no a local variable in a stored routine\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\nnull_treatment is as described in the section introduction.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[LAST_DAY]
+declaration=date
+category=Date and Time Functions
+description=Takes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid or\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[LAST_INSERT_ID]
+declaration=
+category=Information Functions
+description=With no argument, LAST_INSERT_ID() returns a BIGINT UNSIGNED (64-bit)\nvalue representing the first automatically generated value successfully\ninserted for an AUTO_INCREMENT column as a result of the most recently\nexecuted INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nWith an argument, LAST_INSERT_ID() returns an unsigned integer, or NULL\nif the argument is NULL.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nmysql> SELECT LAST_INSERT_ID();\n -> 195\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() remains stable\nin the second statement; its value for the second and later rows is not\naffected by the earlier row insertions. (You should be aware that, if\nyou mix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the\neffect is undefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value is seen by statements that follow\n the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so statements coming\n after it do not see a changed value.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[LAST_VALUE]
+declaration=expr
+category=Window Functions
+description=Returns the value of expr from the last row of the window frame.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\nnull_treatment is as described in the section introduction.\n\nFor an example, see the FIRST_VALUE() function description.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[LCASE]
+declaration=str
+category=String Functions
+description=LCASE() is a synonym for LOWER().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LEAD]
+declaration=expr [, N[, default]]
+category=Window Functions
+description=Returns the value of expr from the row that leads (follows) the current\nrow by N rows within its partition. If there is no such row, the return\nvalue is default. For example, if N is 3, the return value is default\nfor the last three rows. If N or default are missing, the defaults are\n1 and NULL, respectively.\n\nN must be a literal nonnegative integer. If N is 0, expr is evaluated\nfor the current row.\n\nN cannot be NULL, and must be an integer in the range 0 to 263,\ninclusive, in any of the following forms:\n\no an unsigned integer constant literal\n\no a positional parameter marker (?)\n\no a user-defined variable\n\no a local variable in a stored routine\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\nnull_treatment is as described in the section introduction.\n\nFor an example, see the LAG() function description.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[LEAST]
+declaration=value1,value2,...
+category=Comparison Operators
+description=With two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If any argument is NULL, the result is NULL. No comparison is needed.\n\no If all arguments are integer-valued, they are compared as integers.\n\no If at least one argument is double precision, they are compared as\n double-precision values. Otherwise, if at least one argument is a\n DECIMAL value, they are compared as DECIMAL values.\n\no If the arguments comprise a mix of numbers and strings, they are\n compared as strings.\n\no If any argument is a nonbinary (character) string, the arguments are\n compared as nonbinary strings.\n\no In all other cases, the arguments are compared as binary strings.\n\nThe return type of LEAST() is the aggregated type of the comparison\nargument types.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/comparison-operators.html
+[LEFT]
+declaration=str,len
+category=String Functions
+description=Returns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LENGTH]
+declaration=str
+category=String Functions
+description=Returns the length of the string str, measured in bytes. A multibyte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5. Returns NULL if str is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LINESTRING]
+declaration=pt [, pt] ...
+category=Geometry Constructors
+description=Constructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[LN]
+declaration=X
+category=Numeric Functions
+description=Returns the natural logarithm of X; that is, the base-e logarithm of X.\nIf X is less than or equal to 0.0E0, the function returns NULL and a\nwarning "Invalid argument for logarithm" is reported. Returns NULL if X\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[LOAD_FILE]
+declaration=file_name
+category=String Functions
+description=Reads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by the server and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable controls interpretation of\nfile names that are given as literal strings.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LOCALTIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=LOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[LOCALTIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=LOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[LOCATE]
+declaration=substr,str
+category=String Functions
+description=The first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str. Returns NULL if any\nargument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LOG]
+declaration=X
+category=Numeric Functions
+description=If called with one parameter, this function returns the natural\nlogarithm of X. If X is less than or equal to 0.0E0, the function\nreturns NULL and a warning "Invalid argument for logarithm" is\nreported. Returns NULL if X or B is NULL.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[LOG10]
+declaration=X
+category=Numeric Functions
+description=Returns the base-10 logarithm of X. If X is less than or equal to\n0.0E0, the function returns NULL and a warning "Invalid argument for\nlogarithm" is reported. Returns NULL if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[LOG2]
+declaration=X
+category=Numeric Functions
+description=Returns the base-2 logarithm of X. If X is less than or equal to 0.0E0,\nthe function returns NULL and a warning "Invalid argument for\nlogarithm" is reported. Returns NULL if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[LOWER]
+declaration=str
+category=String Functions
+description=Returns the string str with all characters changed to lowercase\naccording to the current character set mapping, or NULL if str is NULL.\nThe default character set is utf8mb4.\n\nmysql> SELECT LOWER('QUADRATICALLY');\n -> 'quadratically'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion of a binary\nstring, first convert it to a nonbinary string using a character set\nappropriate for the data stored in the string:\n\nmysql> SET @str = BINARY 'New York';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING utf8mb4));\n+-------------+------------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING utf8mb4)) |\n+-------------+------------------------------------+\n| New York | new york |\n+-------------+------------------------------------+\n\nFor collations of Unicode character sets, LOWER() and UPPER() work\naccording to the Unicode Collation Algorithm (UCA) version in the\ncollation name, if there is one, and UCA 4.0.0 if no version is\nspecified. For example, utf8mb4_0900_ai_ci and utf8mb3_unicode_520_ci\nwork according to UCA 9.0.0 and 5.2.0, respectively, whereas\nutf8mb3_unicode_ci works according to UCA 4.0.0. See\nhttps://dev.mysql.com/doc/refman/8.3/en/charset-unicode-sets.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LPAD]
+declaration=str,len,padstr
+category=String Functions
+description=Returns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[LTRIM]
+declaration=str
+category=String Functions
+description=Returns the string str with leading space characters removed. Returns\nNULL if str is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[MAKEDATE]
+declaration=year,dayofyear
+category=Date and Time Functions
+description=Returns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL. The result is also NULL if either\nargument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MAKETIME]
+declaration=hour,minute,second
+category=Date and Time Functions
+description=Returns a time value calculated from the hour, minute, and second\narguments. Returns NULL if any of its arguments are NULL.\n\nThe second argument can have a fractional part.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MAKE_SET]
+declaration=bits,str1,str2,...
+category=String Functions
+description=Returns a set value (a string containing substrings separated by ,\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[MASTER_POS_WAIT]
+declaration=log_name,log_pos[,timeout][,channel]
+category=GTID
+description=Deprecated alias for SOURCE_POS_WAIT().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/replication-functions-synchronization.html
+[MAX]
+declaration=[DISTINCT] expr
+category=Aggregate Functions and Modifiers
+description=Returns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql-indexes.html. The\nDISTINCT keyword can be used to find the maximum of the distinct values\nof expr, however, this produces the same result as omitting DISTINCT.\n\nIf there are no matching rows, or if expr is NULL, MAX() returns NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html; it\ncannot be used with DISTINCT.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[MBRCONTAINS]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncontains the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nMBRContains() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRCOVEREDBY]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\nis covered by the minimum bounding rectangle of g2. This tests the\nopposite relationship as MBRCovers().\n\nMBRCoveredBy() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRCOVERS]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\ncovers the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRCoveredBy(). See the description of MBRCoveredBy()\nfor examples.\n\nMBRCovers() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRDISJOINT]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nMBRDisjoint() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBREQUALS]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 are the same.\n\nMBREquals() handles its arguments as described in the introduction to\nthis section, except that it does not return NULL for empty geometry\narguments.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRINTERSECTS]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangles of\nthe two geometries g1 and g2 intersect.\n\nMBRIntersects() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBROVERLAPS]
+declaration=g1, g2
+category=MBR Functions
+description=Two geometries spatially overlap if they intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nThis function returns 1 or 0 to indicate whether the minimum bounding\nrectangles of the two geometries g1 and g2 overlap.\n\nMBROverlaps() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRTOUCHES]
+declaration=g1, g2
+category=MBR Functions
+description=Two geometries spatially touch if their interiors do not intersect, but\nthe boundary of one of the geometries intersects either the boundary or\nthe interior of the other.\n\nThis function returns 1 or 0 to indicate whether the minimum bounding\nrectangles of the two geometries g1 and g2 touch.\n\nMBRTouches() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MBRWITHIN]
+declaration=g1, g2
+category=MBR Functions
+description=Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1\nis within the minimum bounding rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nMBRWithin() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-mbr.html
+[MD5]
+declaration=str
+category=Encryption Functions
+description=Calculates an MD5 128-bit checksum for the string. The value is\nreturned as a string of 32 hexadecimal digits, or NULL if the argument\nwas NULL. The return value can, for example, be used as a hash key. See\nthe notes at the beginning of this section about storing hash values\nefficiently.\n\nThe return value is a string in the connection character set.\n\nIf FIPS mode is enabled, MD5() returns NULL. See\nhttps://dev.mysql.com/doc/refman/8.3/en/fips-mode.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[MEDIUMINT]
+declaration=M
+category=Data Types
+description=A medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[MICROSECOND]
+declaration=expr
+category=Date and Time Functions
+description=Returns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999. Returns NULL if expr is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MID]
+declaration=str,pos,len
+category=String Functions
+description=MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[MIN]
+declaration=[DISTINCT] expr
+category=Aggregate Functions and Modifiers
+description=Returns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value. See\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql-indexes.html. The\nDISTINCT keyword can be used to find the minimum of the distinct values\nof expr, however, this produces the same result as omitting DISTINCT.\n\nIf there are no matching rows, or if expr is NULL, MIN() returns NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html; it\ncannot be used with DISTINCT.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[MINUTE]
+declaration=time
+category=Date and Time Functions
+description=Returns the minute for time, in the range 0 to 59, or NULL if time is\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MOD]
+declaration=N,M
+category=Numeric Functions
+description=Modulo operation. Returns the remainder of N divided by M. Returns NULL\nif M or N is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[MONTH]
+declaration=date
+category=Date and Time Functions
+description=Returns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as '0000-00-00' or '2008-00-00' that have\na zero month part. Returns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MONTHNAME]
+declaration=date
+category=Date and Time Functions
+description=Returns the full name of the month for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(https://dev.mysql.com/doc/refman/8.3/en/locale-support.html). Returns\nNULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[MULTILINESTRING]
+declaration=ls [, ls] ...
+category=Geometry Constructors
+description=Constructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[MULTIPOINT]
+declaration=pt [, pt2] ...
+category=Geometry Constructors
+description=Constructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[MULTIPOLYGON]
+declaration=poly [, poly] ...
+category=Geometry Constructors
+description=Constructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[NAME_CONST]
+declaration=name,value
+category=Miscellaneous Functions
+description=Returns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nmysql> SELECT NAME_CONST('myname', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[NOW]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss'\nor YYYYMMDDhhmmss format, depending on whether the function is used in\nstring or numeric context. The value is expressed in the session time\nzone.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[NTH_VALUE]
+declaration=expr, N
+category=Window Functions
+description=Returns the value of expr from the N-th row of the window frame. If\nthere is no such row, the return value is NULL.\n\nN must be a literal positive integer.\n\nfrom_first_last is part of the SQL standard, but the MySQL\nimplementation permits only FROM FIRST (which is also the default).\nThis means that calculations begin at the first row of the window. FROM\nLAST is parsed, but produces an error. To obtain the same effect as\nFROM LAST (begin calculations at the last row of the window), use ORDER\nBY to sort in reverse order.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\nnull_treatment is as described in the section introduction.\n\nFor an example, see the FIRST_VALUE() function description.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[NTILE]
+declaration=N
+category=Window Functions
+description=Divides a partition into N groups (buckets), assigns each row in the\npartition its bucket number, and returns the bucket number of the\ncurrent row within its partition. For example, if N is 4, NTILE()\ndivides rows into four buckets. If N is 100, NTILE() divides rows into\n100 buckets.\n\nN must be a literal positive integer. Bucket number return values range\nfrom 1 to N.\n\nN cannot be NULL, and must be an integer in the range 0 to 263,\ninclusive, in any of the following forms:\n\no an unsigned integer constant literal\n\no a positional parameter marker (?)\n\no a user-defined variable\n\no a local variable in a stored routine\n\nThis function should be used with ORDER BY to sort partition rows into\nthe desired order.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[NULLIF]
+declaration=expr1,expr2
+category=Flow Control Functions
+description=Returns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nThe return value has the same type as the first argument.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/flow-control-functions.html
+[OCT]
+declaration=N
+category=String Functions
+description=Returns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[OCTET_LENGTH]
+declaration=str
+category=String Functions
+description=OCTET_LENGTH() is a synonym for LENGTH().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[ORD]
+declaration=str
+category=String Functions
+description=If the leftmost character of the string str is a multibyte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 256^2) ...\n\nIf the leftmost character is not a multibyte character, ORD() returns\nthe same value as the ASCII() function. The function returns NULL if\nstr is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[PERCENT_RANK]
+declaration=
+category=Window Functions
+description=Returns the percentage of partition values less than the value in the\ncurrent row, excluding the highest value. Return values range from 0 to\n1 and represent the row relative rank, calculated as the result of this\nformula, where rank is the row rank and rows is the number of partition\nrows:\n\n(rank - 1) / (rows - 1)\n\nThis function should be used with ORDER BY to sort partition rows into\nthe desired order. Without ORDER BY, all rows are peers.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nFor an example, see the CUME_DIST() function description.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[PERIOD_ADD]
+declaration=P,N
+category=Date and Time Functions
+description=Adds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM.\n\n*Note*:\n\nThe period argument P is not a date value.\n\nThis function returns NULL if P or N is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[PERIOD_DIFF]
+declaration=P1,P2
+category=Date and Time Functions
+description=Returns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nThis function returns NULL if P1 or P2 is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[PI]
+declaration=
+category=Numeric Functions
+description=Returns the value of π (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nBecause the return value of this function is a double-precision value,\nits exact representation may vary between platforms or implementations.\nThis also applies to any expressions making use of PI(). See\nhttps://dev.mysql.com/doc/refman/8.3/en/floating-point-types.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[POINT]
+declaration=x, y
+category=Geometry Constructors
+description=Constructs a Point using its coordinates.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[POLYGON]
+declaration=ls [, ls] ...
+category=Geometry Constructors
+description=Constructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-mysql-specific-functions.html
+[POSITION]
+declaration=substr IN str
+category=String Functions
+description=POSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[POW]
+declaration=X,Y
+category=Numeric Functions
+description=Returns the value of X raised to the power of Y. Returns NULL if X or Y\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[POWER]
+declaration=X,Y
+category=Numeric Functions
+description=This is a synonym for POW().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[PS_CURRENT_THREAD_ID]
+declaration=
+category=Performance Schema Functions
+description=Returns a BIGINT UNSIGNED value representing the Performance Schema\nthread ID assigned to the current connection.\n\nThe thread ID return value is a value of the type given in the\nTHREAD_ID column of Performance Schema tables.\n\nPerformance Schema configuration affects PS_CURRENT_THREAD_ID() the\nsame way as for PS_THREAD_ID(). For details, see the description of\nthat function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/performance-schema-functions.html
+[PS_THREAD_ID]
+declaration=connection_id
+category=Performance Schema Functions
+description=Given a connection ID, returns a BIGINT UNSIGNED value representing the\nPerformance Schema thread ID assigned to the connection ID, or NULL if\nno thread ID exists for the connection ID. The latter can occur for\nthreads that are not instrumented, or if connection_id is NULL.\n\nThe connection ID argument is a value of the type given in the\nPROCESSLIST_ID column of the Performance Schema threads table or the Id\ncolumn of SHOW PROCESSLIST output.\n\nThe thread ID return value is a value of the type given in the\nTHREAD_ID column of Performance Schema tables.\n\nPerformance Schema configuration affects PS_THREAD_ID() operation as\nfollows. (These remarks also apply to PS_CURRENT_THREAD_ID().)\n\no Disabling the thread_instrumentation consumer disables statistics\n from being collected and aggregated at the thread level, but has no\n effect on PS_THREAD_ID().\n\no If performance_schema_max_thread_instances is not 0, the Performance\n Schema allocates memory for thread statistics and assigns an internal\n ID to each thread for which instance memory is available. If there\n are threads for which instance memory is not available,\n PS_THREAD_ID() returns NULL; in this case,\n Performance_schema_thread_instances_lost is nonzero.\n\no If performance_schema_max_thread_instances is 0, the Performance\n Schema allocates no thread memory and PS_THREAD_ID() returns NULL.\n\no If the Performance Schema itself is disabled, PS_THREAD_ID() produces\n an error.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/performance-schema-functions.html
+[QUARTER]
+declaration=date
+category=Date and Time Functions
+description=Returns the quarter of the year for date, in the range 1 to 4, or NULL\nif date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[QUOTE]
+declaration=str
+category=String Functions
+description=Quotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotation marks and with each instance of backslash (\),\nsingle quote ('), ASCII NUL, and Control+Z preceded by a backslash. If\nthe argument is NULL, the return value is the word "NULL" without\nenclosing single quotation marks.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[RADIANS]
+declaration=X
+category=Numeric Functions
+description=Returns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.) Returns NULL if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[RAND]
+declaration=[N]
+category=Numeric Functions
+description=Returns a random floating-point value v in the range 0 <= v < 1.0. To\nobtain a random integer R in the range i <= R < j, use the expression\nFLOOR(i + RAND() * (j − i)). For example, to obtain a random integer\nin the range the range 7 <= R < 12, use the following statement:\n\nSELECT FLOOR(7 + (RAND() * 5));\n\nIf an integer argument N is specified, it is used as the seed value:\n\no With a constant initializer argument, the seed is initialized once\n when the statement is prepared, prior to execution.\n\no With a nonconstant initializer argument (such as a column name), the\n seed is initialized with the value for each invocation of RAND().\n\nOne implication of this behavior is that for equal argument values,\nRAND(N) returns the same value each time, and thus produces a\nrepeatable sequence of column values. In the following example, the\nsequence of values produced by RAND(3) is the same both places it\noccurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[RANDOM_BYTES]
+declaration=len
+category=Encryption Functions
+description=This function returns a binary string of len random bytes generated\nusing the random number generator of the SSL library. Permitted values\nof len range from 1 to 1024. For values outside that range, an error\noccurs. Returns NULL if len is NULL.\n\nRANDOM_BYTES() can be used to provide the initialization vector for the\nAES_DECRYPT() and AES_ENCRYPT() functions. For use in that context, len\nmust be at least 16. Larger values are permitted, but bytes in excess\nof 16 are ignored.\n\nRANDOM_BYTES() generates a random value, which makes its result\nnondeterministic. Consequently, statements that use this function are\nunsafe for statement-based replication.\n\nIf RANDOM_BYTES() is invoked from within the mysql client, binary\nstrings display using hexadecimal notation, depending on the value of\nthe --binary-as-hex. For more information about that option, see\nhttps://dev.mysql.com/doc/refman/8.3/en/mysql.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[RANK]
+declaration=
+category=Window Functions
+description=Returns the rank of the current row within its partition, with gaps.\nPeers are considered ties and receive the same rank. This function does\nnot assign consecutive ranks to peer groups if groups of size greater\nthan one exist; the result is noncontiguous rank numbers.\n\nThis function should be used with ORDER BY to sort partition rows into\nthe desired order. Without ORDER BY, all rows are peers.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[REGEXP_INSTR]
+declaration=expr, pat[, pos[, occurrence[, return_option[, match_type]]]]
+category=String Functions
+description=Returns the starting index of the substring of the string expr that\nmatches the regular expression specified by the pattern pat, 0 if there\nis no match. If expr or pat is NULL, the return value is NULL.\nCharacter indexes begin at 1.\n\nREGEXP_INSTR() takes these optional arguments:\n\no pos: The position in expr at which to start the search. If omitted,\n the default is 1.\n\no occurrence: Which occurrence of a match to search for. If omitted,\n the default is 1.\n\no return_option: Which type of position to return. If this value is 0,\n REGEXP_INSTR() returns the position of the matched substring's first\n character. If this value is 1, REGEXP_INSTR() returns the position\n following the matched substring. If omitted, the default is 0.\n\no match_type: A string that specifies how to perform matching. The\n meaning is as described for REGEXP_LIKE().\n\nFor additional information about how matching occurs, see the\ndescription for REGEXP_LIKE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/regexp.html
+[REGEXP_LIKE]
+declaration=expr, pat[, match_type]
+category=String Functions
+description=Returns 1 if the string expr matches the regular expression specified\nby the pattern pat, 0 otherwise. If expr or pat is NULL, the return\nvalue is NULL.\n\nThe pattern can be an extended regular expression, the syntax for which\nis discussed in\nhttps://dev.mysql.com/doc/refman/8.3/en/regexp.html#regexp-syntax. The\npattern need not be a literal string. For example, it can be specified\nas a string expression or table column.\n\nThe optional match_type argument is a string that may contain any or\nall the following characters specifying how to perform matching:\n\no c: Case-sensitive matching.\n\no i: Case-insensitive matching.\n\no m: Multiple-line mode. Recognize line terminators within the string.\n The default behavior is to match line terminators only at the start\n and end of the string expression.\n\no n: The . character matches line terminators. The default is for .\n matching to stop at the end of a line.\n\no u: Unix-only line endings. Only the newline character is recognized\n as a line ending by the ., ^, and $ match operators.\n\nIf characters specifying contradictory options are specified within\nmatch_type, the rightmost one takes precedence.\n\nBy default, regular expression operations use the character set and\ncollation of the expr and pat arguments when deciding the type of a\ncharacter and performing the comparison. If the arguments have\ndifferent character sets or collations, coercibility rules apply as\ndescribed in\nhttps://dev.mysql.com/doc/refman/8.3/en/charset-collation-coercibility.\nhtml. Arguments may be specified with explicit collation indicators to\nchange comparison behavior.\n\nmysql> SELECT REGEXP_LIKE('CamelCase', 'CAMELCASE');\n+---------------------------------------+\n| REGEXP_LIKE('CamelCase', 'CAMELCASE') |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\nmysql> SELECT REGEXP_LIKE('CamelCase', 'CAMELCASE' COLLATE utf8mb4_0900_as_cs);\n+------------------------------------------------------------------+\n| REGEXP_LIKE('CamelCase', 'CAMELCASE' COLLATE utf8mb4_0900_as_cs) |\n+------------------------------------------------------------------+\n| 0 |\n ...
+[REGEXP_REPLACE]
+declaration=expr, pat, repl[, pos[, occurrence[, match_type]]]
+category=String Functions
+description=Replaces occurrences in the string expr that match the regular\nexpression specified by the pattern pat with the replacement string\nrepl, and returns the resulting string. If expr, pat, or repl is NULL,\nthe return value is NULL.\n\nREGEXP_REPLACE() takes these optional arguments:\n\no pos: The position in expr at which to start the search. If omitted,\n the default is 1.\n\no occurrence: Which occurrence of a match to replace. If omitted, the\n default is 0 (which means "replace all occurrences").\n\no match_type: A string that specifies how to perform matching. The\n meaning is as described for REGEXP_LIKE().\n\nThe result returned by this function uses the character set and\ncollation of the expression searched for matches.\n\nFor additional information about how matching occurs, see the\ndescription for REGEXP_LIKE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/regexp.html
+[REGEXP_SUBSTR]
+declaration=expr, pat[, pos[, occurrence[, match_type]]]
+category=String Functions
+description=Returns the substring of the string expr that matches the regular\nexpression specified by the pattern pat, NULL if there is no match. If\nexpr or pat is NULL, the return value is NULL.\n\nREGEXP_SUBSTR() takes these optional arguments:\n\no pos: The position in expr at which to start the search. If omitted,\n the default is 1.\n\no occurrence: Which occurrence of a match to search for. If omitted,\n the default is 1.\n\no match_type: A string that specifies how to perform matching. The\n meaning is as described for REGEXP_LIKE().\n\nThe result returned by this function uses the character set and\ncollation of the expression searched for matches.\n\nFor additional information about how matching occurs, see the\ndescription for REGEXP_LIKE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/regexp.html
+[RELEASE_ALL_LOCKS]
+declaration=
+category=Locking Functions
+description=Releases all named locks held by the current session and returns the\nnumber of locks released (0 if there were none)\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/locking-functions.html
+[RELEASE_LOCK]
+declaration=str
+category=Locking Functions
+description=Releases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/locking-functions.html
+[REVERSE]
+declaration=str
+category=String Functions
+description=Returns the string str with the order of the characters reversed, or\nNULL if str is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[RIGHT]
+declaration=str,len
+category=String Functions
+description=Returns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[ROLES_GRAPHML]
+declaration=
+category=Information Functions
+description=Returns a utf8mb3 string containing a GraphML document representing\nmemory role subgraphs. The ROLE_ADMIN privilege (or the deprecated\nSUPER privilege) is required to see content in the element.\nOtherwise, the result shows only an empty element:\n\nmysql> SELECT ROLES_GRAPHML();\n+---------------------------------------------------+\n| ROLES_GRAPHML() |\n+---------------------------------------------------+\n| |\n+---------------------------------------------------+\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[ROUND]
+declaration=X
+category=Numeric Functions
+description=Rounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero. The maximum absolute value for D is 30; any digits in\nexcess of 30 (or -30) are truncated. If X or D is NULL, the function\nreturns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[ROW_COUNT]
+declaration=
+category=Information Functions
+description=ROW_COUNT() returns a value as follows:\n\no DDL statements: 0. This applies to statements such as CREATE TABLE or\n DROP TABLE.\n\no DML statements other than SELECT: The number of affected rows. This\n applies to statements such as UPDATE, INSERT, or DELETE (as before),\n but now also to statements such as ALTER TABLE and LOAD DATA.\n\no SELECT: -1 if the statement returns a result set, or the number of\n rows "affected" if it does not. For example, for SELECT * FROM t1,\n ROW_COUNT() returns -1. For SELECT * FROM t1 INTO OUTFILE\n 'file_name', ROW_COUNT() returns the number of rows written to the\n file.\n\no SIGNAL statements: 0.\n\nFor UPDATE statements, the affected-rows value by default is the number\nof rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to\nmysql_real_connect()\n(https://dev.mysql.com/doc/c-api/8.2/en/mysql-real-connect.html) when\nconnecting to mysqld, the affected-rows value is the number of rows\n"found"; that is, matched by the WHERE clause.\n\nFor REPLACE statements, the affected-rows value is 2 if the new row\nreplaced an old row, because in this case, one row was inserted after\nthe duplicate was deleted.\n\nFor INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows\nvalue per row is 1 if the row is inserted as a new row, 2 if an\nexisting row is updated, and 0 if an existing row is set to its current\nvalues. If you specify the CLIENT_FOUND_ROWS flag, the affected-rows\nvalue is 1 (not 0) if an existing row is set to its current values.\n\nThe ROW_COUNT() value is similar to the value from the\nmysql_affected_rows()\n(https://dev.mysql.com/doc/c-api/8.2/en/mysql-affected-rows.html) C API\nfunction and the row count that the mysql client displays following\nstatement execution.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[ROW_NUMBER]
+declaration=
+category=Window Functions
+description=Returns the number of the current row within its partition. Rows\nnumbers range from 1 to the number of partition rows.\n\nORDER BY affects the order in which rows are numbered. Without ORDER\nBY, row numbering is nondeterministic.\n\nROW_NUMBER() assigns peers different row numbers. To assign peers the\nsame value, use RANK() or DENSE_RANK(). For an example, see the RANK()\nfunction description.\n\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/window-function-descriptions.html
+[RPAD]
+declaration=str,len,padstr
+category=String Functions
+description=Returns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters. If str, padstr, or len is NULL, the\nfunction returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[RTRIM]
+declaration=str
+category=String Functions
+description=Returns the string str with trailing space characters removed.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SCHEMA]
+declaration=
+category=Information Functions
+description=This function is a synonym for DATABASE().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[SECOND]
+declaration=time
+category=Date and Time Functions
+description=Returns the second for time, in the range 0 to 59, or NULL if time is\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[SEC_TO_TIME]
+declaration=seconds
+category=Date and Time Functions
+description=Returns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nThe function returns NULL if seconds is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[SESSION_USER]
+declaration=
+category=Information Functions
+description=SESSION_USER() is a synonym for USER().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[SHA1]
+declaration=str
+category=Encryption Functions
+description=Calculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of\n40 hexadecimal digits, or NULL if the argument is NULL. One of the\npossible uses for this function is as a hash key. See the notes at the\nbeginning of this section about storing hash values efficiently. SHA()\nis synonymous with SHA1().\n\nThe return value is a string in the connection character set.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[SHA2]
+declaration=str, hash_length
+category=Encryption Functions
+description=Calculates the SHA-2 family of hash functions (SHA-224, SHA-256,\nSHA-384, and SHA-512). The first argument is the plaintext string to be\nhashed. The second argument indicates the desired bit length of the\nresult, which must have a value of 224, 256, 384, 512, or 0 (which is\nequivalent to 256). If either argument is NULL or the hash length is\nnot one of the permitted values, the return value is NULL. Otherwise,\nthe function result is a hash value containing the desired number of\nbits. See the notes at the beginning of this section about storing hash\nvalues efficiently.\n\nThe return value is a string in the connection character set.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[SIGN]
+declaration=X
+category=Numeric Functions
+description=Returns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive. Returns NULL if X is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[SIN]
+declaration=X
+category=Numeric Functions
+description=Returns the sine of X, where X is given in radians. Returns NULL if X\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[SLEEP]
+declaration=duration
+category=Miscellaneous Functions
+description=Sleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. The duration may have a fractional part. If\nthe argument is NULL or negative, SLEEP() produces a warning, or an\nerror in strict SQL mode.\n\nWhen sleep returns normally (without interruption), it returns 0:\n\nmysql> SELECT SLEEP(1000);\n+-------------+\n| SLEEP(1000) |\n+-------------+\n| 0 |\n+-------------+\n\nWhen SLEEP() is the only thing invoked by a query that is interrupted,\nit returns 1 and the query itself returns no error. This is true\nwhether the query is killed or times out:\n\no This statement is interrupted using KILL QUERY from another session:\n\nmysql> SELECT SLEEP(1000);\n+-------------+\n| SLEEP(1000) |\n+-------------+\n| 1 |\n+-------------+\n\no This statement is interrupted by timing out:\n\nmysql> SELECT /*+ MAX_EXECUTION_TIME(1) */ SLEEP(1000);\n+-------------+\n| SLEEP(1000) |\n+-------------+\n| 1 |\n+-------------+\n\nWhen SLEEP() is only part of a query that is interrupted, the query\nreturns an error:\n\no This statement is interrupted using KILL QUERY from another session:\n\nmysql> SELECT 1 FROM t1 WHERE SLEEP(1000);\nERROR 1317 (70100): Query execution was interrupted\n\no This statement is interrupted by timing out:\n\nmysql> SELECT /*+ MAX_EXECUTION_TIME(1000) */ 1 FROM t1 WHERE SLEEP(1000);\nERROR 3024 (HY000): Query execution was interrupted, maximum statement\nexecution time exceeded\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[SMALLINT]
+declaration=M
+category=Data Types
+description=A small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[SOUNDEX]
+declaration=str
+category=String Functions
+description=Returns a soundex string from str, or NULL if str is NULL. Two strings\nthat sound almost the same should have identical soundex strings. A\nstandard soundex string is four characters long, but the SOUNDEX()\nfunction returns an arbitrarily long string. You can use SUBSTRING() on\nthe result to get a standard soundex string. All nonalphabetic\ncharacters in str are ignored. All international alphabetic characters\noutside the A-Z range are treated as vowels.\n\n*Important*:\n\nWhen using SOUNDEX(), you should be aware of the following limitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multibyte character sets, including utf-8. See Bug\n #22638 for more information.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SOURCE_POS_WAIT]
+declaration=log_name,log_pos[,timeout][,channel]
+category=GTID
+description=This function is for control of source-replica synchronization. It\nblocks until the replica has read and applied all updates up to the\nspecified position in the source's binary log.\n\nThe return value is the number of log events the replica had to wait\nfor to advance to the specified position. The function returns NULL if\nthe replication SQL thread is not started, the replica's source\ninformation is not initialized, the arguments are incorrect, or an\nerror occurs. It returns -1 if the timeout has been exceeded. If the\nreplication SQL thread stops while SOURCE_POS_WAIT() is waiting, the\nfunction returns NULL. If the replica is past the specified position,\nthe function returns immediately.\n\nIf the binary log file position has been marked as invalid, the\nfunction waits until a valid file position is known. The binary log\nfile position can be marked as invalid when the CHANGE REPLICATION\nSOURCE TO option GTID_ONLY is set for the replication channel, and the\nserver is restarted or replication is stopped. The file position\nbecomes valid after a transaction is successfully applied past the\ngiven file position. If the applier does not reach the stated position,\nthe function waits until the timeout. Use a SHOW REPLICA STATUS\nstatement to check if the binary log file position has been marked as\ninvalid.\n\nOn a multithreaded replica, the function waits until expiry of the\nlimit set by the replica_checkpoint_group or replica_checkpoint_period\nsystem variable, when the checkpoint operation is called to update the\nstatus of the replica. Depending on the setting for the system\nvariables, the function might therefore return some time after the\nspecified position was reached.\n\nIf binary log transaction compression is in use and the transaction\npayload at the specified position is compressed (as a\nTransaction_payload_event), the function waits until the whole\ntransaction has been read and applied, and the positions have updated.\n\nIf a timeout value is specified, SOURCE_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than or equal to\n0. (When the server is running in strict SQL mode, a negative timeout\nvalue is immediately rejected with ER_WRONG_ARGUMENTS\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_wrong_arguments); otherwise the function returns NULL, and\nraises a warning.)\n\nThe optional channel value enables you to name which replication\nchannel the function applies to. See\nhttps://dev.mysql.com/doc/refman/8.3/en/replication-channels.html for\nmore information.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/replication-functions-synchronization.html
+[SPACE]
+declaration=N
+category=String Functions
+description=Returns a string consisting of N space characters, or NULL if N is\nNULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SQRT]
+declaration=X
+category=Numeric Functions
+description=Returns the square root of a nonnegative number X. If X is NULL, the\nfunction returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[STATEMENT_DIGEST]
+declaration=statement
+category=Encryption Functions
+description=Given an SQL statement as a string, returns the statement digest hash\nvalue as a string in the connection character set, or NULL if the\nargument is NULL. The related STATEMENT_DIGEST_TEXT() function returns\nthe normalized statement digest. For information about statement\ndigesting, see\nhttps://dev.mysql.com/doc/refman/8.3/en/performance-schema-statement-di\ngests.html.\n\nBoth functions use the MySQL parser to parse the statement. If parsing\nfails, an error occurs. The error message includes the parse error only\nif the statement is provided as a literal string.\n\nThe max_digest_length system variable determines the maximum number of\nbytes available to these functions for computing normalized statement\ndigests.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[STATEMENT_DIGEST_TEXT]
+declaration=statement
+category=Encryption Functions
+description=Given an SQL statement as a string, returns the normalized statement\ndigest as a string in the connection character set, or NULL if the\nargument is NULL. For additional discussion and examples, see the\ndescription of the related STATEMENT_DIGEST() function.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[STD]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the population standard deviation of expr. STD() is a synonym\nfor the standard SQL function STDDEV_POP(), provided as a MySQL\nextension.\n\nIf there are no matching rows, or if expr is NULL, STD() returns NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[STDDEV]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the population standard deviation of expr. STDDEV() is a\nsynonym for the standard SQL function STDDEV_POP(), provided for\ncompatibility with Oracle.\n\nIf there are no matching rows, or if expr is NULL, STDDEV() returns\nNULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[STDDEV_POP]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nIf there are no matching rows, or if expr is NULL, STDDEV_POP() returns\nNULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[STDDEV_SAMP]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nIf there are no matching rows, or if expr is NULL, STDDEV_SAMP()\nreturns NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[STRCMP]
+declaration=expr1,expr2
+category=String Functions
+description=STRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and NULL if either argument is NULL. It returns 1 otherwise.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-comparison-functions.html
+[STR_TO_DATE]
+declaration=str,format
+category=Date and Time Functions
+description=This is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If str or\nformat is NULL, the function returns NULL. If the date, time, or\ndatetime value extracted from str cannot be parsed according to the\nrules followed by the server, STR_TO_DATE() returns NULL and produces a\nwarning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nmysql> SELECT STR_TO_DATE('01,5,2013','%d,%m,%Y');\n -> '2013-05-01'\nmysql> SELECT STR_TO_DATE('May 1, 2013','%M %d,%Y');\n -> '2013-05-01'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nmysql> SELECT STR_TO_DATE('a09:30:17','a%h:%i:%s');\n -> '09:30:17'\nmysql> SELECT STR_TO_DATE('a09:30:17','%h:%i:%s');\n -> NULL\nmysql> SELECT STR_TO_DATE('09:30:17a','%h:%i:%s');\n -> '09:30:17'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nmysql> SELECT STR_TO_DATE('abc','abc');\n -> '0000-00-00'\nmysql> SELECT STR_TO_DATE('9','%m');\n -> '0000-09-00'\nmysql> SELECT STR_TO_DATE('9','%s');\n -> '00:00:09'\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[ST_AREA]
+declaration={poly|mpoly}
+category=Polygon Property Functions
+description=Returns a double-precision number indicating the area of the Polygon or\nMultiPolygon argument, as measured in its spatial reference system.\n\nST_Area() handles its arguments as described in the introduction to\nthis section, with these exceptions:\n\no If the geometry is geometrically invalid, either the result is an\n undefined area (that is, it can be any number), or an error occurs.\n\no If the geometry is valid but is not a Polygon or MultiPolygon object,\n an ER_UNEXPECTED_GEOMETRY_TYPE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_unexpected_geometry_type) error occurs.\n\no If the geometry is a valid Polygon in a Cartesian SRS, the result is\n the Cartesian area of the polygon.\n\no If the geometry is a valid MultiPolygon in a Cartesian SRS, the\n result is the sum of the Cartesian area of the polygons.\n\no If the geometry is a valid Polygon in a geographic SRS, the result is\n the geodetic area of the polygon in that SRS, in square meters.\n\no If the geometry is a valid MultiPolygon in a geographic SRS, the\n result is the sum of geodetic area of the polygons in that SRS, in\n square meters.\n\no If an area computation results in +inf, an ER_DATA_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_data_out_of_range) error occurs.\n\no If the geometry has a geographic SRS with a longitude or latitude\n that is out of range, an error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n occurs.\n\n Ranges shown are in degrees. The exact range limits deviate slightly\n due to floating-point arithmetic.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-polygon-property-functions.html
+[ST_ASBINARY]
+declaration=g [, options]
+category=WKB Functions
+description=Converts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nThe function return value has geographic coordinates (latitude,\nlongitude) in the order specified by the spatial reference system that\napplies to the geometry argument. An optional options argument may be\ngiven to override the default axis order.\n\nST_AsBinary() and ST_AsWKB() handle their arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-format-conversion-functions.html
+[ST_ASGEOJSON]
+declaration=g [, max_dec_digits [, options]]
+category=MBR Functions
+description=Generates a GeoJSON object from the geometry g. The object string has\nthe connection character set and collation.\n\nIf any argument is NULL, the return value is NULL. If any non-NULL\nargument is invalid, an error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geojson-functions.html
+[ST_ASTEXT]
+declaration=g [, options]
+category=WKB Functions
+description=Converts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nThe function return value has geographic coordinates (latitude,\nlongitude) in the order specified by the spatial reference system that\napplies to the geometry argument. An optional options argument may be\ngiven to override the default axis order.\n\nST_AsText() and ST_AsWKT() handle their arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-format-conversion-functions.html
+[ST_BUFFER]
+declaration=g, d [, strategy1 [, strategy2 [, strategy3]]]
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents all points whose distance from the\ngeometry value g is less than or equal to a distance of d. The result\nis in the same SRS as the geometry argument.\n\nIf the geometry argument is empty, ST_Buffer() returns an empty\ngeometry.\n\nIf the distance is 0, ST_Buffer() returns the geometry argument\nunchanged:\n\nmysql> SET @pt = ST_GeomFromText('POINT(0 0)');\nmysql> SELECT ST_AsText(ST_Buffer(@pt, 0));\n+------------------------------+\n| ST_AsText(ST_Buffer(@pt, 0)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n\nIf the geometry argument is in a Cartesian SRS:\n\no ST_Buffer() supports negative distances for Polygon and MultiPolygon\n values, and for geometry collections containing Polygon or\n MultiPolygon values.\n\no If the result is reduced so much that it disappears, the result is an\n empty geometry.\n\no An ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs for ST_Buffer() with a\n negative distance for Point, MultiPoint, LineString, and\n MultiLineString values, and for geometry collections not containing\n any Polygon or MultiPolygon values.\n\nPoint geometries in a geographic SRS are permitted, subject to the\nfollowing conditions:\n\no If the distance is not negative and no strategies are specified, the\n function returns the geographic buffer of the Point in its SRS. The\n distance argument must be in the SRS distance unit (currently always\n meters).\n\no If the distance is negative or any strategy (except NULL) is\n specified, an ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs.\n\nFor non-Point geometries, an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_not_implemented_for_geographic_srs) error occurs.\n ...
+[ST_BUFFER_STRATEGY]
+declaration=strategy [, points_per_circle]
+category=GeometryCollection Property Functions
+description=This function returns a strategy byte string for use with ST_Buffer()\nto influence buffer computation.\n\nInformation about strategies is available at Boost.org\n(http://www.boost.org).\n\nThe first argument must be a string indicating a strategy option:\n\no For point strategies, permitted values are 'point_circle' and\n 'point_square'.\n\no For join strategies, permitted values are 'join_round' and\n 'join_miter'.\n\no For end strategies, permitted values are 'end_round' and 'end_flat'.\n\nIf the first argument is 'point_circle', 'join_round', 'join_miter', or\n'end_round', the points_per_circle argument must be given as a positive\nnumeric value. The maximum points_per_circle value is the value of the\nmax_points_in_geometry system variable.\n\nFor examples, see the description of ST_Buffer().\n\nST_Buffer_Strategy() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no If any argument is invalid, an ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs.\n\no If the first argument is 'point_square' or 'end_flat', the\n points_per_circle argument must not be given or an ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_CENTROID]
+declaration={poly|mpoly}
+category=Polygon Property Functions
+description=Returns the mathematical centroid for the Polygon or MultiPolygon\nargument as a Point. The result is not guaranteed to be on the\nMultiPolygon.\n\nThis function processes geometry collections by computing the centroid\npoint for components of highest dimension in the collection. Such\ncomponents are extracted and made into a single MultiPolygon,\nMultiLineString, or MultiPoint for centroid computation.\n\nST_Centroid() handles its arguments as described in the introduction to\nthis section, with these exceptions:\n\no The return value is NULL for the additional condition that the\n argument is an empty geometry collection.\n\no If the geometry has an SRID value for a geographic spatial reference\n system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-polygon-property-functions.html
+[ST_COLLECT]
+declaration=[DISTINCT] g
+category=MBR Functions
+description=Aggregates geometry values and returns a single geometry collection\nvalue. With the DISTINCT option, returns the aggregation of the\ndistinct geometry arguments.\n\nAs with other aggregate functions, GROUP BY may be used to group\narguments into subsets. ST_Collect() returns an aggregate value for\neach subset.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html. In\ncontrast to most aggregate functions that support windowing,\nST_Collect() permits use of over_clause together with DISTINCT.\n\nST_Collect() handles its arguments as follows:\n\no NULL arguments are ignored.\n\no If all arguments are NULL or the aggregate result is empty, the\n return value is NULL.\n\no If any geometry argument is not a syntactically well-formed geometry,\n an ER_GIS_INVALID_DATA\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_gis_invalid_data) error occurs.\n\no If any geometry argument is a syntactically well-formed geometry in\n an undefined spatial reference system (SRS), an ER_SRS_NOT_FOUND\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_srs_not_found) error occurs.\n\no If there are multiple geometry arguments and those arguments are in\n the same SRS, the return value is in that SRS. If those arguments are\n not in the same SRS, an ER_GIS_DIFFERENT_SRIDS_AGGREGATION\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_gis_different_srids_aggregation) error occurs.\n\no The result is the narrowest MultiXxx or GeometryCollection value\n possible, with the result type determined from the non-NULL geometry\n arguments as follows:\n\n o If all arguments are Point values, the result is a MultiPoint\n value.\n\n o If all arguments are LineString values, the result is a\n MultiLineString value.\n\n o If all arguments are Polygon values, the result is a MultiPolygon\n value.\n\n ...
+[ST_CONTAINS]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Returns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as ST_Within().\n\nST_Contains() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_CONVEXHULL]
+declaration=g
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents the convex hull of the geometry\nvalue g.\n\nThis function computes a geometry's convex hull by first checking\nwhether its vertex points are colinear. The function returns a linear\nhull if so, a polygon hull otherwise. This function processes geometry\ncollections by extracting all vertex points of all components of the\ncollection, creating a MultiPoint value from them, and computing its\nconvex hull.\n\nST_ConvexHull() handles its arguments as described in the introduction\nto this section, with this exception:\n\no The return value is NULL for the additional condition that the\n argument is an empty geometry collection.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_CROSSES]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Two geometries spatially cross if their spatial relation has the\nfollowing properties:\n\no Unless g1 and g2 are both of dimension 1: g1 crosses g2 if the\n interior of g2 has points in common with the interior of g1, but g2\n does not cover the entire interior of g1.\n\no If both g1 and g2 are of dimension 1: If the lines cross each other\n in a finite number of points (that is, no common line segments, only\n single points in common).\n\nThis function returns 1 or 0 to indicate whether g1 spatially crosses\ng2.\n\nST_Crosses() handles its arguments as described in the introduction to\nthis section except that the return value is NULL for these additional\nconditions:\n\no g1 is of dimension 2 (Polygon or MultiPolygon).\n\no g2 is of dimension 1 (Point or MultiPoint).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_DIFFERENCE]
+declaration=g1, g2
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents the point set difference of the\ngeometry values g1 and g2. The result is in the same SRS as the\ngeometry arguments.\n\nST_Difference() permits arguments in either a Cartesian or a geographic\nSRS, and handles its arguments as described in the introduction to this\nsection.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_DIMENSION]
+declaration=g
+category=Geometry Property Functions
+description=Returns the inherent dimension of the geometry value g. The dimension\ncan be −1, 0, 1, or 2. The meaning of these values is given in\nhttps://dev.mysql.com/doc/refman/8.3/en/gis-class-geometry.html.\n\nST_Dimension() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_DISJOINT]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nST_Disjoint() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_DISTANCE]
+declaration=g1, g2 [, unit]
+category=Geometry Relation Functions
+description=Returns the distance between g1 and g2, measured in the length unit of\nthe spatial reference system (SRS) of the geometry arguments, or in the\nunit of the optional unit argument if that is specified.\n\nThis function processes geometry collections by returning the shortest\ndistance among all combinations of the components of the two geometry\narguments.\n\nST_Distance() handles its geometry arguments as described in the\nintroduction to this section, with these exceptions:\n\no ST_Distance() detects arguments in a geographic (ellipsoidal) spatial\n reference system and returns the geodetic distance on the ellipsoid.\n ST_Distance() supports distance calculations for geographic SRS\n arguments of all geometry types.\n\no If any argument is geometrically invalid, either the result is an\n undefined distance (that is, it can be any number), or an error\n occurs.\n\no If an intermediate or final result produces NaN or a negative number,\n an ER_GIS_INVALID_DATA\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_gis_invalid_data) error occurs.\n\nST_Distance() permits specifying the linear unit for the returned\ndistance value with an optional unit argument which ST_Distance()\nhandles as described in the introduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_DISTANCE_SPHERE]
+declaration=g1, g2 [, radius]
+category=MBR Functions
+description=Returns the minimum spherical distance between Point or MultiPoint\narguments on a sphere, in meters. (For general-purpose distance\ncalculations, see the ST_Distance() function.) The optional radius\nargument should be given in meters.\n\nIf both geometry parameters are valid Cartesian Point or MultiPoint\nvalues in SRID 0, the return value is shortest distance between the two\ngeometries on a sphere with the provided radius. If omitted, the\ndefault radius is 6,370,986 meters, Point X and Y coordinates are\ninterpreted as longitude and latitude, respectively, in degrees.\n\nIf both geometry parameters are valid Point or MultiPoint values in a\ngeographic spatial reference system (SRS), the return value is the\nshortest distance between the two geometries on a sphere with the\nprovided radius. If omitted, the default radius is equal to the mean\nradius, defined as (2a+b)/3, where a is the semi-major axis and b is\nthe semi-minor axis of the SRS.\n\nST_Distance_Sphere() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no Supported geometry argument combinations are Point and Point, or\n Point and MultiPoint (in any argument order). If at least one of the\n geometries is neither Point nor MultiPoint, and its SRID is 0, an\n ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_cartesian_srs) error occurs. If at\n least one of the geometries is neither Point nor MultiPoint, and its\n SRID refers to a geographic SRS, an\n ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs. If\n any geometry refers to a projected SRS, an\n ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_projected_srs) error occurs.\n\no If any argument has a longitude or latitude that is out of range, an\n error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n ...
+[ST_ENDPOINT]
+declaration=ls
+category=LineString Property Functions
+description=Returns the Point that is the endpoint of the LineString value ls.\n\nST_EndPoint() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-linestring-property-functions.html
+[ST_ENVELOPE]
+declaration=g
+category=Geometry Property Functions
+description=Returns the minimum bounding rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value that is defined by the corner\npoints of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nmysql> SELECT ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,2 2)')));\n+----------------------------------------------------------------+\n| ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,2 2)'))) |\n+----------------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+----------------------------------------------------------------+\n\nIf the argument is a point or a vertical or horizontal line segment,\nST_Envelope() returns the point or the line segment as its MBR rather\nthan returning an invalid polygon:\n\nmysql> SELECT ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,1 2)')));\n+----------------------------------------------------------------+\n| ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,1 2)'))) |\n+----------------------------------------------------------------+\n| LINESTRING(1 1,1 2) |\n+----------------------------------------------------------------+\n\nST_Envelope() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no If the geometry has an SRID value for a geographic spatial reference\n system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_EQUALS]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Returns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nST_Equals() handles its arguments as described in the introduction to\nthis section, except that it does not return NULL for empty geometry\narguments.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_EXTERIORRING]
+declaration=poly
+category=Polygon Property Functions
+description=Returns the exterior ring of the Polygon value poly as a LineString.\n\nST_ExteriorRing() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-polygon-property-functions.html
+[ST_FRECHETDISTANCE]
+declaration=g1, g2 [, unit]
+category=Geometry Relation Functions
+description=Returns the discrete Fréchet distance between two geometries,\nreflecting how similar the geometries are. The result is a\ndouble-precision number measured in the length unit of the spatial\nreference system (SRS) of the geometry arguments, or in the length unit\nof the unit argument if that argument is given.\n\nThis function implements the discrete Fréchet distance, which means it\nis restricted to distances between the points of the geometries. For\nexample, given two LineString arguments, only the points explicitly\nmentioned in the geometries are considered. Points on the line segments\nbetween these points are not considered.\n\nST_FrechetDistance() handles its geometry arguments as described in the\nintroduction to this section, with these exceptions:\n\no The geometries may have a Cartesian or geographic SRS, but only\n LineString values are supported. If the arguments are in the same\n Cartesian or geographic SRS, but either is not a LineString, an\n ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_cartesian_srs) or\n ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs,\n depending on the SRS type.\n\nST_FrechetDistance() handles its optional unit argument as described in\nthe introduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_GEOHASH]
+declaration=longitude, latitude, max_length
+category=MBR Functions
+description=max_length)\n\nReturns a geohash string in the connection character set and collation.\n\nFor the first syntax, the longitude must be a number in the range\n[−180, 180], and the latitude must be a number in the range [−90,\n90]. For the second syntax, a POINT value is required, where the X and\nY coordinates are in the valid ranges for longitude and latitude,\nrespectively.\n\nThe resulting string is no longer than max_length characters, which has\nan upper limit of 100. The string might be shorter than max_length\ncharacters because the algorithm that creates the geohash value\ncontinues until it has created a string that is either an exact\nrepresentation of the location or max_length characters, whichever\ncomes first.\n\nST_GeoHash() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geohash-functions.html
+[ST_GEOMCOLLFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=ST_GeometryCollectionFromText(wkt [, srid [, options]]),\nST_GeomCollFromTxt(wkt [, srid [, options]])\n\nConstructs a GeometryCollection value using its WKT representation and\nSRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_GEOMCOLLFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=ST_GeometryCollectionFromWKB(wkb [, srid [, options]])\n\nConstructs a GeometryCollection value using its WKB representation and\nSRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_GEOMETRYN]
+declaration=gc, N
+category=GeometryCollection Property Functions
+description=Returns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nST_GeometryN() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-geometrycollection-property-functions.html
+[ST_GEOMETRYTYPE]
+declaration=g
+category=Geometry Property Functions
+description=Returns a binary string indicating the name of the geometry type of\nwhich the geometry instance g is a member. The name corresponds to one\nof the instantiable Geometry subclasses.\n\nST_GeometryType() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_GEOMFROMGEOJSON]
+declaration=str [, options [, srid]]
+category=MBR Functions
+description=Parses a string str representing a GeoJSON object and returns a\ngeometry.\n\nIf any argument is NULL, the return value is NULL. If any non-NULL\nargument is invalid, an error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geojson-functions.html
+[ST_GEOMFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=srid [, options]])\n\nConstructs a geometry value of any type using its WKT representation\nand SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_GEOMFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=srid [, options]])\n\nConstructs a geometry value of any type using its WKB representation\nand SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_HAUSDORFFDISTANCE]
+declaration=g1, g2 [, unit]
+category=Geometry Relation Functions
+description=Returns the discrete Hausdorff distance between two geometries,\nreflecting how similar the geometries are. The result is a\ndouble-precision number measured in the length unit of the spatial\nreference system (SRS) of the geometry arguments, or in the length unit\nof the unit argument if that argument is given.\n\nThis function implements the discrete Hausdorff distance, which means\nit is restricted to distances between the points of the geometries. For\nexample, given two LineString arguments, only the points explicitly\nmentioned in the geometries are considered. Points on the line segments\nbetween these points are not considered.\n\nST_HausdorffDistance() handles its geometry arguments as described in\nthe introduction to this section, with these exceptions:\n\no If the geometry arguments are in the same Cartesian or geographic\n SRS, but are not in a supported combination, an\n ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_cartesian_srs) or\n ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs,\n depending on the SRS type. These combinations are supported:\n\n o LineString and LineString\n\n o Point and MultiPoint\n\n o LineString and MultiLineString\n\n o MultiPoint and MultiPoint\n\n o MultiLineString and MultiLineString\n\nST_HausdorffDistance() handles its optional unit argument as described\nin the introduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_INTERIORRINGN]
+declaration=poly, N
+category=Polygon Property Functions
+description=Returns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nST_InteriorRingN() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-polygon-property-functions.html
+[ST_INTERSECTION]
+declaration=g1, g2
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents the point set intersection of the\ngeometry values g1 and g2. The result is in the same SRS as the\ngeometry arguments.\n\nST_Intersection() permits arguments in either a Cartesian or a\ngeographic SRS, and handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_INTERSECTS]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Returns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nST_Intersects() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_ISCLOSED]
+declaration=ls
+category=LineString Property Functions
+description=For a LineString value ls, ST_IsClosed() returns 1 if ls is closed\n(that is, its ST_StartPoint() and ST_EndPoint() values are the same).\n\nFor a MultiLineString value ls, ST_IsClosed() returns 1 if ls is closed\n(that is, the ST_StartPoint() and ST_EndPoint() values are the same for\neach LineString in ls).\n\nST_IsClosed() returns 0 if ls is not closed, and NULL if ls is NULL.\n\nST_IsClosed() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no If the geometry has an SRID value for a geographic spatial reference\n system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-linestring-property-functions.html
+[ST_ISEMPTY]
+declaration=g
+category=Geometry Property Functions
+description=This function is a placeholder that returns 1 for an empty geometry\ncollection value or 0 otherwise.\n\nThe only valid empty geometry is represented in the form of an empty\ngeometry collection value. MySQL does not support GIS EMPTY values such\nas POINT EMPTY.\n\nST_IsEmpty() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_ISSIMPLE]
+declaration=g
+category=Geometry Property Functions
+description=Returns 1 if the geometry value g is simple according to the ISO SQL/MM\nPart 3: Spatial standard. ST_IsSimple() returns 0 if the argument is\nnot simple.\n\nThe descriptions of the instantiable geometric classes given under\nhttps://dev.mysql.com/doc/refman/8.3/en/opengis-geometry-model.html\ninclude the specific conditions that cause class instances to be\nclassified as not simple.\n\nST_IsSimple() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no If the geometry has a geographic SRS with a longitude or latitude\n that is out of range, an error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n occurs.\n\n Ranges shown are in degrees. The exact range limits deviate slightly\n due to floating-point arithmetic.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_ISVALID]
+declaration=g
+category=MBR Functions
+description=Returns 1 if the argument is geometrically valid, 0 if the argument is\nnot geometrically valid. Geometry validity is defined by the OGC\nspecification.\n\nThe only valid empty geometry is represented in the form of an empty\ngeometry collection value. ST_IsValid() returns 1 in this case. MySQL\ndoes not support GIS EMPTY values such as POINT EMPTY.\n\nST_IsValid() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no If the geometry has a geographic SRS with a longitude or latitude\n that is out of range, an error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n occurs.\n\n Ranges shown are in degrees. If an SRS uses another unit, the range\n uses the corresponding values in its unit. The exact range limits\n deviate slightly due to floating-point arithmetic.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-convenience-functions.html
+[ST_LATFROMGEOHASH]
+declaration=geohash_str
+category=MBR Functions
+description=Returns the latitude from a geohash string value, as a double-precision\nnumber in the range [−90, 90].\n\nThe ST_LatFromGeoHash() decoding function reads no more than 433\ncharacters from the geohash_str argument. That represents the upper\nlimit on information in the internal representation of coordinate\nvalues. Characters past the 433rd are ignored, even if they are\notherwise illegal and produce an error.\n\nST_LatFromGeoHash() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geohash-functions.html
+[ST_LATITUDE]
+declaration=p [, new_latitude_val]
+category=Point Property Functions
+description=With a single argument representing a valid Point object p that has a\ngeographic spatial reference system (SRS), ST_Latitude() returns the\nlatitude value of p as a double-precision number.\n\nWith the optional second argument representing a valid latitude value,\nST_Latitude() returns a Point object like the first argument with its\nlatitude equal to the second argument.\n\nST_Latitude() handles its arguments as described in the introduction to\nthis section, with the addition that if the Point object is valid but\ndoes not have a geographic SRS, an ER_SRS_NOT_GEOGRAPHIC\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_srs_not_geographic) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-point-property-functions.html
+[ST_LENGTH]
+declaration=ls [, unit]
+category=LineString Property Functions
+description=Returns a double-precision number indicating the length of the\nLineString or MultiLineString value ls in its associated spatial\nreference system. The length of a MultiLineString value is equal to the\nsum of the lengths of its elements.\n\nST_Length() computes a result as follows:\n\no If the geometry is a valid LineString in a Cartesian SRS, the return\n value is the Cartesian length of the geometry.\n\no If the geometry is a valid MultiLineString in a Cartesian SRS, the\n return value is the sum of the Cartesian lengths of its elements.\n\no If the geometry is a valid LineString in a geographic SRS, the return\n value is the geodetic length of the geometry in that SRS, in meters.\n\no If the geometry is a valid MultiLineString in a geographic SRS, the\n return value is the sum of the geodetic lengths of its elements in\n that SRS, in meters.\n\nST_Length() handles its arguments as described in the introduction to\nthis section, with these exceptions:\n\no If the geometry is not a LineString or MultiLineString, the return\n value is NULL.\n\no If the geometry is geometrically invalid, either the result is an\n undefined length (that is, it can be any number), or an error occurs.\n\no If the length computation result is +inf, an ER_DATA_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_data_out_of_range) error occurs.\n\no If the geometry has a geographic SRS with a longitude or latitude\n that is out of range, an error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n occurs.\n\n Ranges shown are in degrees. The exact range limits deviate slightly\n due to floating-point arithmetic.\n ...
+[ST_LINEFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=srid [, options]])\n\nConstructs a LineString value using its WKT representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_LINEFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=srid [, options]])\n\nConstructs a LineString value using its WKB representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_LINEINTERPOLATEPOINT]
+declaration=ls, fractional_distance
+category=GeometryCollection Property Functions
+description=This function takes a LineString geometry and a fractional distance in\nthe range [0.0, 1.0] and returns the Point along the LineString at the\ngiven fraction of the distance from its start point to its endpoint. It\ncan be used to answer questions such as which Point lies halfway along\nthe road described by the geometry argument.\n\nThe function is implemented for LineString geometries in all spatial\nreference systems, both Cartesian and geographic.\n\nIf the fractional_distance argument is 1.0, the result may not be\nexactly the last point of the LineString argument but a point close to\nit due to numerical inaccuracies in approximate-value computations.\n\nA related function, ST_LineInterpolatePoints(), takes similar arguments\nbut returns a MultiPoint consisting of Point values along the\nLineString at each fraction of the distance from its start point to its\nendpoint. For examples of both functions, see the\nST_LineInterpolatePoints() description.\n\nST_LineInterpolatePoint() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no If the geometry argument is not a LineString, an\n ER_UNEXPECTED_GEOMETRY_TYPE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_unexpected_geometry_type) error occurs.\n\no If the fractional distance argument is outside the range [0.0, 1.0],\n an ER_DATA_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_data_out_of_range) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_LINEINTERPOLATEPOINTS]
+declaration=ls, fractional_distance
+category=GeometryCollection Property Functions
+description=This function takes a LineString geometry and a fractional distance in\nthe range (0.0, 1.0] and returns the MultiPoint consisting of the\nLineString start point, plus Point values along the LineString at each\nfraction of the distance from its start point to its endpoint. It can\nbe used to answer questions such as which Point values lie every 10% of\nthe way along the road described by the geometry argument.\n\nThe function is implemented for LineString geometries in all spatial\nreference systems, both Cartesian and geographic.\n\nIf the fractional_distance argument divides 1.0 with zero remainder the\nresult may not contain the last point of the LineString argument but a\npoint close to it due to numerical inaccuracies in approximate-value\ncomputations.\n\nA related function, ST_LineInterpolatePoint(), takes similar arguments\nbut returns the Point along the LineString at the given fraction of the\ndistance from its start point to its endpoint.\n\nST_LineInterpolatePoints() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no If the geometry argument is not a LineString, an\n ER_UNEXPECTED_GEOMETRY_TYPE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_unexpected_geometry_type) error occurs.\n\no If the fractional distance argument is outside the range [0.0, 1.0],\n an ER_DATA_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_data_out_of_range) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_LONGFROMGEOHASH]
+declaration=geohash_str
+category=MBR Functions
+description=Returns the longitude from a geohash string value, as a\ndouble-precision number in the range [−180, 180].\n\nThe remarks in the description of ST_LatFromGeoHash() regarding the\nmaximum number of characters processed from the geohash_str argument\nalso apply to ST_LongFromGeoHash().\n\nST_LongFromGeoHash() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geohash-functions.html
+[ST_LONGITUDE]
+declaration=p [, new_longitude_val]
+category=Point Property Functions
+description=With a single argument representing a valid Point object p that has a\ngeographic spatial reference system (SRS), ST_Longitude() returns the\nlongitude value of p as a double-precision number.\n\nWith the optional second argument representing a valid longitude value,\nST_Longitude() returns a Point object like the first argument with its\nlongitude equal to the second argument.\n\nST_Longitude() handles its arguments as described in the introduction\nto this section, with the addition that if the Point object is valid\nbut does not have a geographic SRS, an ER_SRS_NOT_GEOGRAPHIC\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_srs_not_geographic) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-point-property-functions.html
+[ST_MAKEENVELOPE]
+declaration=pt1, pt2
+category=MBR Functions
+description=Returns the rectangle that forms the envelope around two points, as a\nPoint, LineString, or Polygon.\n\nCalculations are done using the Cartesian coordinate system rather than\non a sphere, spheroid, or on earth.\n\nGiven two points pt1 and pt2, ST_MakeEnvelope() creates the result\ngeometry on an abstract plane like this:\n\no If pt1 and pt2 are equal, the result is the point pt1.\n\no Otherwise, if (pt1, pt2) is a vertical or horizontal line segment,\n the result is the line segment (pt1, pt2).\n\no Otherwise, the result is a polygon using pt1 and pt2 as diagonal\n points.\n\nThe result geometry has an SRID of 0.\n\nST_MakeEnvelope() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no If the arguments are not Point values, an ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs.\n\no An ER_GIS_INVALID_DATA\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_gis_invalid_data) error occurs for the additional\n condition that any coordinate value of the two points is infinite or\n NaN.\n\no If any geometry has an SRID value for a geographic spatial reference\n system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_not_implemented_for_geographic_srs) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-convenience-functions.html
+[ST_MLINEFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=ST_MultiLineStringFromText(wkt [, srid [, options]])\n\nConstructs a MultiLineString value using its WKT representation and\nSRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_MLINEFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=ST_MultiLineStringFromWKB(wkb [, srid [, options]])\n\nConstructs a MultiLineString value using its WKB representation and\nSRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_MPOINTFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=[, srid [, options]])\n\nConstructs a MultiPoint value using its WKT representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_MPOINTFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=srid [, options]])\n\nConstructs a MultiPoint value using its WKB representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_MPOLYFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=[, srid [, options]])\n\nConstructs a MultiPolygon value using its WKT representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_MPOLYFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=[, srid [, options]])\n\nConstructs a MultiPolygon value using its WKB representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_NUMGEOMETRIES]
+declaration=gc
+category=GeometryCollection Property Functions
+description=Returns the number of geometries in the GeometryCollection value gc.\n\nST_NumGeometries() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-geometrycollection-property-functions.html
+[ST_NUMINTERIORRINGS]
+declaration=poly
+category=Polygon Property Functions
+description=Returns the number of interior rings in the Polygon value poly.\n\nST_NumInteriorRing() and ST_NuminteriorRings() handle their arguments\nas described in the introduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-polygon-property-functions.html
+[ST_NUMPOINTS]
+declaration=ls
+category=LineString Property Functions
+description=Returns the number of Point objects in the LineString value ls.\n\nST_NumPoints() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-linestring-property-functions.html
+[ST_OVERLAPS]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Two geometries spatially overlap if they intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nThis function returns 1 or 0 to indicate whether g1 spatially overlaps\ng2.\n\nST_Overlaps() handles its arguments as described in the introduction to\nthis section except that the return value is NULL for the additional\ncondition that the dimensions of the two geometries are not equal.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_POINTATDISTANCE]
+declaration=ls, distance
+category=GeometryCollection Property Functions
+description=This function takes a LineString geometry and a distance in the range\n[0.0, ST_Length(ls)] measured in the unit of the spatial reference\nsystem (SRS) of the LineString, and returns the Point along the\nLineString at that distance from its start point. It can be used to\nanswer questions such as which Point value is 400 meters from the start\nof the road described by the geometry argument.\n\nThe function is implemented for LineString geometries in all spatial\nreference systems, both Cartesian and geographic.\n\nST_PointAtDistance() handles its arguments as described in the\nintroduction to this section, with these exceptions:\n\no If the geometry argument is not a LineString, an\n ER_UNEXPECTED_GEOMETRY_TYPE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_unexpected_geometry_type) error occurs.\n\no If the fractional distance argument is outside the range [0.0,\n ST_Length(ls)], an ER_DATA_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_data_out_of_range) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_POINTFROMGEOHASH]
+declaration=geohash_str, srid
+category=MBR Functions
+description=Returns a POINT value containing the decoded geohash value, given a\ngeohash string value.\n\nThe X and Y coordinates of the point are the longitude in the range\n[−180, 180] and the latitude in the range [−90, 90], respectively.\n\nThe srid argument is an 32-bit unsigned integer.\n\nThe remarks in the description of ST_LatFromGeoHash() regarding the\nmaximum number of characters processed from the geohash_str argument\nalso apply to ST_PointFromGeoHash().\n\nST_PointFromGeoHash() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-geohash-functions.html
+[ST_POINTFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=Constructs a Point value using its WKT representation and SRID.\n\nST_PointFromText() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_POINTFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=Constructs a Point value using its WKB representation and SRID.\n\nST_PointFromWKB() handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_POINTN]
+declaration=ls, N
+category=LineString Property Functions
+description=Returns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nST_PointN() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-linestring-property-functions.html
+[ST_POLYFROMTEXT]
+declaration=wkt [, srid [, options]]
+category=WKT Functions
+description=srid [, options]])\n\nConstructs a Polygon value using its WKT representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkt-functions.html
+[ST_POLYFROMWKB]
+declaration=wkb [, srid [, options]]
+category=WKB Functions
+description=[, options]])\n\nConstructs a Polygon value using its WKB representation and SRID.\n\nThese functions handle their arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-wkb-functions.html
+[ST_SIMPLIFY]
+declaration=g, max_distance
+category=MBR Functions
+description=Simplifies a geometry using the Douglas-Peucker algorithm and returns a\nsimplified value of the same type.\n\nThe geometry may be any geometry type, although the Douglas-Peucker\nalgorithm may not actually process every type. A geometry collection is\nprocessed by giving its components one by one to the simplification\nalgorithm, and the returned geometries are put into a geometry\ncollection as result.\n\nThe max_distance argument is the distance (in units of the input\ncoordinates) of a vertex to other segments to be removed. Vertices\nwithin this distance of the simplified linestring are removed.\n\nAccording to Boost.Geometry, geometries might become invalid as a\nresult of the simplification process, and the process might create\nself-intersections. To check the validity of the result, pass it to\nST_IsValid().\n\nST_Simplify() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no If the max_distance argument is not positive, or is NaN, an\n ER_WRONG_ARGUMENTS\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_wrong_arguments) error occurs.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-convenience-functions.html
+[ST_SRID]
+declaration=g [, srid]
+category=Geometry Property Functions
+description=With a single argument representing a valid geometry object g,\nST_SRID() returns an integer indicating the ID of the spatial reference\nsystem (SRS) associated with g.\n\nWith the optional second argument representing a valid SRID value,\nST_SRID() returns an object with the same type as its first argument\nwith an SRID value equal to the second argument. This only sets the\nSRID value of the object; it does not perform any transformation of\ncoordinate values.\n\nST_SRID() handles its arguments as described in the introduction to\nthis section, with this exception:\n\no For the single-argument syntax, ST_SRID() returns the geometry SRID\n even if it refers to an undefined SRS. An ER_SRS_NOT_FOUND\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_srs_not_found) error does not occur.\n\nST_SRID(g, target_srid) and ST_Transform(g, target_srid) differ as\nfollows:\n\no ST_SRID() changes the geometry SRID value without transforming its\n coordinates.\n\no ST_Transform() transforms the geometry coordinates in addition to\n changing its SRID value.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-general-property-functions.html
+[ST_STARTPOINT]
+declaration=ls
+category=LineString Property Functions
+description=Returns the Point that is the start point of the LineString value ls.\n\nST_StartPoint() handles its arguments as described in the introduction\nto this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-linestring-property-functions.html
+[ST_SWAPXY]
+declaration=g
+category=WKB Functions
+description=Accepts an argument in internal geometry format, swaps the X and Y\nvalues of each coordinate pair within the geometry, and returns the\nresult.\n\nST_SwapXY() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-format-conversion-functions.html
+[ST_SYMDIFFERENCE]
+declaration=g1, g2
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents the point set symmetric difference\nof the geometry values g1 and g2, which is defined as:\n\ng1 symdifference g2 := (g1 union g2) difference (g1 intersection g2)\n\nOr, in function call notation:\n\nST_SymDifference(g1, g2) = ST_Difference(ST_Union(g1, g2), ST_Intersection(g1, g2))\n\nThe result is in the same SRS as the geometry arguments.\n\nST_SymDifference() permits arguments in either a Cartesian or a\ngeographic SRS, and handles its arguments as described in the\nintroduction to this section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_TOUCHES]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Two geometries spatially touch if their interiors do not intersect, but\nthe boundary of one of the geometries intersects either the boundary or\nthe interior of the other.\n\nThis function returns 1 or 0 to indicate whether g1 spatially touches\ng2.\n\nST_Touches() handles its arguments as described in the introduction to\nthis section except that the return value is NULL for the additional\ncondition that both geometries are of dimension 0 (Point or\nMultiPoint).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_TRANSFORM]
+declaration=g, target_srid
+category=GeometryCollection Property Functions
+description=Transforms a geometry from one spatial reference system (SRS) to\nanother. The return value is a geometry of the same type as the input\ngeometry with all coordinates transformed to the target SRID,\ntarget_srid. MySQL supports all SRSs defined by EPSG except for those\nlisted here:\n\no EPSG 1042 Krovak Modified\n\no EPSG 1043 Krovak Modified (North Orientated)\n\no EPSG 9816 Tunisia Mining Grid\n\no EPSG 9826 Lambert Conic Conformal (West Orientated)\n\nST_Transform() handles its arguments as described in the introduction\nto this section, with these exceptions:\n\no Geometry arguments that have an SRID value for a geographic SRS do\n not produce an error.\n\no If the geometry or target SRID argument has an SRID value that refers\n to an undefined spatial reference system (SRS), an ER_SRS_NOT_FOUND\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_srs_not_found) error occurs.\n\no If the geometry is in an SRS that ST_Transform() cannot transform\n from, an ER_TRANSFORM_SOURCE_SRS_NOT_SUPPORTED\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_transform_source_srs_not_supported) error occurs.\n\no If the target SRID is in an SRS that ST_Transform() cannot transform\n to, an ER_TRANSFORM_TARGET_SRS_NOT_SUPPORTED\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_transform_target_srs_not_supported) error occurs.\n\no If the geometry is in an SRS that is not WGS 84 and has no TOWGS84\n clause, an ER_TRANSFORM_SOURCE_SRS_MISSING_TOWGS84\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_transform_source_srs_missing_towgs84) error occurs.\n\no If the target SRID is in an SRS that is not WGS 84 and has no TOWGS84\n clause, an ER_TRANSFORM_TARGET_SRS_MISSING_TOWGS84\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference\n .html#error_er_transform_target_srs_missing_towgs84) error occurs.\n\nST_SRID(g, target_srid) and ST_Transform(g, target_srid) differ as\nfollows:\n\no ST_SRID() changes the geometry SRID value without transforming its\n coordinates.\n ...
+[ST_UNION]
+declaration=g1, g2
+category=GeometryCollection Property Functions
+description=Returns a geometry that represents the point set union of the geometry\nvalues g1 and g2. The result is in the same SRS as the geometry\narguments.\n\nST_Union() permits arguments in either a Cartesian or a geographic SRS,\nand handles its arguments as described in the introduction to this\nsection.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-operator-functions.html
+[ST_VALIDATE]
+declaration=g
+category=MBR Functions
+description=Validates a geometry according to the OGC specification. A geometry can\nbe syntactically well-formed (WKB value plus SRID) but geometrically\ninvalid. For example, this polygon is geometrically invalid: POLYGON((0\n0, 0 0, 0 0, 0 0, 0 0))\n\nST_Validate() returns the geometry if it is syntactically well-formed\nand is geometrically valid, NULL if the argument is not syntactically\nwell-formed or is not geometrically valid or is NULL.\n\nST_Validate() can be used to filter out invalid geometry data, although\nat a cost. For applications that require more precise results not\ntainted by invalid data, this penalty may be worthwhile.\n\nIf the geometry argument is valid, it is returned as is, except that if\nan input Polygon or MultiPolygon has clockwise rings, those rings are\nreversed before checking for validity. If the geometry is valid, the\nvalue with the reversed rings is returned.\n\nThe only valid empty geometry is represented in the form of an empty\ngeometry collection value. ST_Validate() returns it directly without\nfurther checks in this case.\n\nST_Validate() handles its arguments as described in the introduction to\nthis section, with the exceptions listed here:\n\no If the geometry has a geographic SRS with a longitude or latitude\n that is out of range, an error occurs:\n\n o If a longitude value is not in the range (−180, 180], an\n ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_longitude_out_of_range) error\n occurs.\n\n o If a latitude value is not in the range [−90, 90], an\n ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE\n (https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-referen\n ce.html#error_er_geometry_param_latitude_out_of_range) error\n occurs.\n\n Ranges shown are in degrees. The exact range limits deviate slightly\n due to floating-point arithmetic.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-convenience-functions.html
+[ST_WITHIN]
+declaration=g1, g2
+category=Geometry Relation Functions
+description=Returns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as ST_Contains().\n\nST_Within() handles its arguments as described in the introduction to\nthis section.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/spatial-relation-functions-object-shapes.html
+[ST_X]
+declaration=p [, new_x_val]
+category=Point Property Functions
+description=With a single argument representing a valid Point object p, ST_X()\nreturns the X-coordinate value of p as a double-precision number. The X\ncoordinate is considered to refer to the axis that appears first in the\nPoint spatial reference system (SRS) definition.\n\nWith the optional second argument, ST_X() returns a Point object like\nthe first argument with its X coordinate equal to the second argument.\nIf the Point object has a geographic SRS, the second argument must be\nin the proper range for longitude or latitude values.\n\nST_X() handles its arguments as described in the introduction to this\nsection.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-point-property-functions.html
+[ST_Y]
+declaration=p [, new_y_val]
+category=Point Property Functions
+description=With a single argument representing a valid Point object p, ST_Y()\nreturns the Y-coordinate value of p as a double-precision number.The Y\ncoordinate is considered to refer to the axis that appears second in\nthe Point spatial reference system (SRS) definition.\n\nWith the optional second argument, ST_Y() returns a Point object like\nthe first argument with its Y coordinate equal to the second argument.\nIf the Point object has a geographic SRS, the second argument must be\nin the proper range for longitude or latitude values.\n\nST_Y() handles its arguments as described in the introduction to this\nsection.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gis-point-property-functions.html
+[SUBDATE]
+declaration=date,INTERVAL expr unit
+category=Date and Time Functions
+description=When invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB('2008-01-02', INTERVAL 31 DAY);\n -> '2007-12-02'\nmysql> SELECT SUBDATE('2008-01-02', INTERVAL 31 DAY);\n -> '2007-12-02'\n\nThe second form enables the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE('2008-01-02 12:00:00', 31);\n -> '2007-12-02 12:00:00'\n\nThis function returns NULL if any of its arguments are NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[SUBSTR]
+declaration=str,pos
+category=String Functions
+description=FROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SUBSTRING]
+declaration=str,pos
+category=String Functions
+description=SUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function. A value of 0 for pos returns an empty string.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SUBSTRING_INDEX]
+declaration=str,delim,count
+category=String Functions
+description=Returns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[SUBTIME]
+declaration=expr1,expr2
+category=Date and Time Functions
+description=SUBTIME() returns expr1 − expr2 expressed as a value in the same\nformat as expr1. expr1 is a time or datetime expression, and expr2 is a\ntime expression.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[SUM]
+declaration=[DISTINCT] expr
+category=Aggregate Functions and Modifiers
+description=Returns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used to sum only the distinct values\nof expr.\n\nIf there are no matching rows, or if expr is NULL, SUM() returns NULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html; it\ncannot be used with DISTINCT.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[SYSDATE]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss'\nor YYYYMMDDhhmmss format, depending on whether the function is used in\nstring or numeric context.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nmysql> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nmysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the replication source server and the replica.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[SYSTEM_USER]
+declaration=
+category=Information Functions
+description=SYSTEM_USER() is a synonym for USER().\n\n*Note*:\n\nThe SYSTEM_USER() function is distinct from the SYSTEM_USER privilege.\nThe former returns the current MySQL account name. The latter\ndistinguishes the system user and regular user account categories (see\nhttps://dev.mysql.com/doc/refman/8.3/en/account-categories.html).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[TAN]
+declaration=X
+category=Numeric Functions
+description=Returns the tangent of X, where X is given in radians. Returns NULL if\nX is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[TEXT]
+declaration=M
+category=Data Types
+description=A TEXT column with a maximum length of 65,535 (216 − 1) characters.\nThe effective maximum length is less if the value contains multibyte\ncharacters. Each TEXT value is stored using a 2-byte length prefix that\nindicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[TIME]
+declaration=fsp
+category=Data Types
+description=A time. The range is '-838:59:59.000000' to '838:59:59.000000'. MySQL\ndisplays TIME values in 'hh:mm:ss[.fraction]' format, but permits\nassignment of values to TIME columns using either strings or numbers.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-type-syntax.html
+[TIMEDIFF]
+declaration=expr1,expr2
+category=Date and Time Functions
+description=TIMEDIFF() returns expr1 − expr2 expressed as a time value. expr1 and\nexpr2 are strings which are converted to TIME or DATETIME expressions;\nthese must be of the same type following conversion. Returns NULL if\nexpr1 or expr2 is NULL.\n\nThe result returned by TIMEDIFF() is limited to the range allowed for\nTIME values. Alternatively, you can use either of the functions\nTIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TIMESTAMP]
+declaration=fsp
+category=Data Types
+description=A timestamp. The range is '1970-01-01 00:00:01.000000' UTC to\n'2038-01-19 03:14:07.499999' UTC. TIMESTAMP values are stored as the\nnumber of seconds since the epoch ('1970-01-01 00:00:00' UTC). A\nTIMESTAMP cannot represent the value '1970-01-01 00:00:00' because that\nis equivalent to 0 seconds from the epoch and the value 0 is reserved\nfor representing '0000-00-00 00:00:00', the "zero" TIMESTAMP value.\n\nAn optional fsp value in the range from 0 to 6 may be given to specify\nfractional seconds precision. A value of 0 signifies that there is no\nfractional part. If omitted, the default precision is 0.\n\nThe way the server handles TIMESTAMP definitions depends on the value\nof the explicit_defaults_for_timestamp system variable (see\nhttps://dev.mysql.com/doc/refman/8.3/en/server-system-variables.html).\n\nIf explicit_defaults_for_timestamp is enabled, there is no automatic\nassignment of the DEFAULT CURRENT_TIMESTAMP or ON UPDATE\nCURRENT_TIMESTAMP attributes to any TIMESTAMP column. They must be\nincluded explicitly in the column definition. Also, any TIMESTAMP not\nexplicitly declared as NOT NULL permits NULL values.\n\nIf explicit_defaults_for_timestamp is disabled, the server handles\nTIMESTAMP as follows:\n\nUnless specified otherwise, the first TIMESTAMP column in a table is\ndefined to be automatically set to the date and time of the most recent\nmodification if not explicitly assigned a value. This makes TIMESTAMP\nuseful for recording the timestamp of an INSERT or UPDATE operation.\nYou can also set any TIMESTAMP column to the current date and time by\nassigning it a NULL value, unless it has been defined with the NULL\nattribute to permit NULL values.\n\nAutomatic initialization and updating to the current date and time can\nbe specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE\nCURRENT_TIMESTAMP column definition clauses. By default, the first\nTIMESTAMP column has these properties, as previously noted. However,\nany TIMESTAMP column in a table can be defined to have these\nproperties.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-type-syntax.html
+[TIMESTAMPADD]
+declaration=unit,interval,datetime_expr
+category=Date and Time Functions
+description=Adds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: MICROSECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nThis function returns NULL if interval or datetime_expr is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TIMESTAMPDIFF]
+declaration=unit,datetime_expr1,datetime_expr2
+category=Date and Time Functions
+description=Returns datetime_expr2 − datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part '00:00:00' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nThis function returns NULL if datetime_expr1 or datetime_expr2 is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TIME_FORMAT]
+declaration=time,format
+category=Date and Time Functions
+description=This is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL or 0. TIME_FORMAT()\nreturns NULL if time or format is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TIME_TO_SEC]
+declaration=time
+category=Date and Time Functions
+description=Returns the time argument, converted to seconds. Returns NULL if time\nis NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TINYINT]
+declaration=M
+category=Data Types
+description=A very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/numeric-type-syntax.html
+[TO_BASE64]
+declaration=str
+category=String Functions
+description=Converts the string argument to base-64 encoded form and returns the\nresult as a character string with the connection character set and\ncollation. If the argument is not a string, it is converted to a string\nbefore conversion takes place. The result is NULL if the argument is\nNULL. Base-64 encoded strings can be decoded using the FROM_BASE64()\nfunction.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[TO_DAYS]
+declaration=date
+category=Date and Time Functions
+description=Given a date date, returns a day number (the number of days since year\n0). Returns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TO_SECONDS]
+declaration=expr
+category=Date and Time Functions
+description=Given a date or datetime expr, returns the number of seconds since the\nyear 0. If expr is not a valid date or datetime value (including NULL),\nit returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[TRIM]
+declaration=[{BOTH | LEADING | TRAILING} [remstr] FROM] str
+category=String Functions
+description=FROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[TRUNCATE]
+declaration=X,D
+category=Numeric Functions
+description=Returns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\nIf X or D is NULL, the function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/mathematical-functions.html
+[UCASE]
+declaration=str
+category=String Functions
+description=UCASE() is a synonym for UPPER().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[UNCOMPRESS]
+declaration=string_to_uncompress
+category=Encryption Functions
+description=Uncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL; if\nstring_to_uncompress is NULL, the result is also NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[UNCOMPRESSED_LENGTH]
+declaration=compressed_string
+category=Encryption Functions
+description=Returns the length that the compressed string had before being\ncompressed. Returns NULL if compressed_string is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[UNHEX]
+declaration=str
+category=String Functions
+description=For a string argument str, UNHEX(str) interprets each pair of\ncharacters in the argument as a hexadecimal number and converts it to\nthe byte represented by the number. The return value is a binary\nstring.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[UNIX_TIMESTAMP]
+declaration=[date]
+category=Date and Time Functions
+description=If UNIX_TIMESTAMP() is called with no date argument, it returns a Unix\ntimestamp representing seconds since '1970-01-01 00:00:00' UTC.\n\nIf UNIX_TIMESTAMP() is called with a date argument, it returns the\nvalue of the argument as seconds since '1970-01-01 00:00:00' UTC. The\nserver interprets date as a value in the session time zone and converts\nit to an internal Unix timestamp value in UTC. (Clients can set the\nsession time zone as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/time-zone-support.html.) The\ndate argument may be a DATE, DATETIME, or TIMESTAMP string, or a number\nin YYMMDD, YYMMDDhhmmss, YYYYMMDD, or YYYYMMDDhhmmss format. If the\nargument includes a time part, it may optionally include a fractional\nseconds part.\n\nThe return value is an integer if no argument is given or the argument\ndoes not include a fractional seconds part, or DECIMAL if an argument\nis given that includes a fractional seconds part.\n\nWhen the date argument is a TIMESTAMP column, UNIX_TIMESTAMP() returns\nthe internal timestamp value directly, with no implicit\n"string-to-Unix-timestamp" conversion.\n\nThe valid range of argument values is the same as for the TIMESTAMP\ndata type: '1970-01-01 00:00:01.000000' UTC to '2038-01-19\n03:14:07.999999' UTC for 32-bit platforms; for MySQL running on 64-bit\nplatforms, the valid range of argument values for UNIX_TIMESTAMP() is\n'1970-01-01 00:00:01.000000' UTC to '3001-01-19 03:14:07.999999' UTC\n(corresponding to 32536771199.999999 seconds).\n\nRegardless of MySQL version or platform architecture, if you pass an\nout-of-range date to UNIX_TIMESTAMP(), it returns 0. If date is NULL,\nit returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[UPDATEXML]
+declaration=xml_target, xpath_expr, new_xml
+category=XML
+description=This function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user.\n\nIf no expression matching xpath_expr is found, or if multiple matches\nare found, the function returns the original xml_target XML fragment.\nAll three arguments should be strings. If any of the arguments to\nUpdateXML() are NULL, the function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/xml-functions.html
+[UPPER]
+declaration=str
+category=String Functions
+description=Returns the string str with all characters changed to uppercase\naccording to the current character set mapping, or NULL if str is NULL.\nThe default character set is utf8mb4.\n\nmysql> SELECT UPPER('Hej');\n -> 'HEJ'\n\nSee the description of LOWER() for information that also applies to\nUPPER(). This included information about how to perform lettercase\nconversion of binary strings (BINARY, VARBINARY, BLOB) for which these\nfunctions are ineffective, and information about case folding for\nUnicode character sets.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-functions.html
+[USER]
+declaration=
+category=Information Functions
+description=Returns the current MySQL user name and host name as a string in the\nutf8mb3 character set.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[UTC_DATE]
+declaration=
+category=Date and Time Functions
+description=Returns the current UTC date as a value in 'YYYY-MM-DD' or YYYYMMDD\nformat, depending on whether the function is used in string or numeric\ncontext.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[UTC_TIME]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current UTC time as a value in 'hh:mm:ss' or hhmmss format,\ndepending on whether the function is used in string or numeric context.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[UTC_TIMESTAMP]
+declaration=[fsp]
+category=Date and Time Functions
+description=Returns the current UTC date and time as a value in 'YYYY-MM-DD\nhh:mm:ss' or YYYYMMDDhhmmss format, depending on whether the function\nis used in string or numeric context.\n\nIf the fsp argument is given to specify a fractional seconds precision\nfrom 0 to 6, the return value includes a fractional seconds part of\nthat many digits.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[UUID]
+declaration=
+category=Miscellaneous Functions
+description=Returns a Universal Unique Identifier (UUID) generated according to RFC\n4122, "A Universally Unique IDentifier (UUID) URN Namespace"\n(http://www.ietf.org/rfc/rfc4122.txt).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate devices not\nconnected to each other.\n\n*Warning*:\n\nAlthough UUID() values are intended to be unique, they are not\nnecessarily unguessable or unpredictable. If unpredictability is\nrequired, UUID values should be generated some other way.\n\nUUID() returns a value that conforms to UUID version 1 as described in\nRFC 4122. The value is a 128-bit number represented as a utf8mb3 string\nof five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\n\no The first three numbers are generated from the low, middle, and high\n parts of a timestamp. The high part also includes the UUID version\n number.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host device has no Ethernet card,\n or it is unknown how to find the hardware address of an interface on\n the host operating system). In this case, spatial uniqueness cannot\n be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n The MAC address of an interface is taken into account only on\n FreeBSD, Linux, and Windows. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[UUID_SHORT]
+declaration=
+category=Miscellaneous Functions
+description=Returns a "short" universal identifier as a 64-bit unsigned integer.\nValues returned by UUID_SHORT() differ from the string-format 128-bit\nidentifiers returned by the UUID() function and have different\nuniqueness properties. The value of UUID_SHORT() is guaranteed to be\nunique if the following conditions hold:\n\no The server_id value of the current server is between 0 and 255 and is\n unique among your set of source and replica servers\n\no You do not set back the system time for your server host between\n mysqld restarts\n\no You invoke UUID_SHORT() on average fewer than 16 million times per\n second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[UUID_TO_BIN]
+declaration=string_uuid
+category=Miscellaneous Functions
+description=Converts a string UUID to a binary UUID and returns the result. (The\nIS_UUID() function description lists the permitted string UUID\nformats.) The return binary UUID is a VARBINARY(16) value. If the UUID\nargument is NULL, the return value is NULL. If any argument is invalid,\nan error occurs.\n\nUUID_TO_BIN() takes one or two arguments:\n\no The one-argument form takes a string UUID value. The binary result is\n in the same order as the string argument.\n\no The two-argument form takes a string UUID value and a flag value:\n\n o If swap_flag is 0, the two-argument form is equivalent to the\n one-argument form. The binary result is in the same order as the\n string argument.\n\n o If swap_flag is 1, the format of the return value differs: The\n time-low and time-high parts (the first and third groups of\n hexadecimal digits, respectively) are swapped. This moves the more\n rapidly varying part to the right and can improve indexing\n efficiency if the result is stored in an indexed column.\n\nTime-part swapping assumes the use of UUID version 1 values, such as\nare generated by the UUID() function. For UUID values produced by other\nmeans that do not follow version 1 format, time-part swapping provides\nno benefit. For details about version 1 format, see the UUID() function\ndescription.\n\nSuppose that you have the following string UUID value:\n\nmysql> SET @uuid = '6ccd780c-baba-1026-9564-5b8c656024db';\n\nTo convert the string UUID to binary with or without time-part\nswapping, use UUID_TO_BIN():\n\nmysql> SELECT HEX(UUID_TO_BIN(@uuid));\n+----------------------------------+\n| HEX(UUID_TO_BIN(@uuid)) |\n+----------------------------------+\n| 6CCD780CBABA102695645B8C656024DB |\n+----------------------------------+\nmysql> SELECT HEX(UUID_TO_BIN(@uuid, 0));\n+----------------------------------+\n| HEX(UUID_TO_BIN(@uuid, 0)) |\n+----------------------------------+\n| 6CCD780CBABA102695645B8C656024DB |\n+----------------------------------+\nmysql> SELECT HEX(UUID_TO_BIN(@uuid, 1));\n+----------------------------------+\n ...
+[VALIDATE_PASSWORD_STRENGTH]
+declaration=str
+category=Encryption Functions
+description=Given an argument representing a plaintext password, this function\nreturns an integer to indicate how strong the password is, or NULL if\nthe argument is NULL. The return value ranges from 0 (weak) to 100\n(strong).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/encryption-functions.html
+[VALUES]
+declaration=col_name
+category=Miscellaneous Functions
+description=In an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in the ON DUPLICATE KEY UPDATE clause of\nINSERT statements and returns NULL otherwise. See\nhttps://dev.mysql.com/doc/refman/8.3/en/insert-on-duplicate.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html
+[VARBINARY]
+declaration=M
+category=Data Types
+description=The VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[VARCHAR]
+declaration=M
+category=Data Types
+description=collation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example,\nutf8mb3 characters can require up to three bytes per character, so a\nVARCHAR column that uses the utf8mb3 character set can be declared to\nbe a maximum of 21,844 characters. See\nhttps://dev.mysql.com/doc/refman/8.3/en/column-count-limit.html.\n\nMySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A\nVARCHAR column uses one length byte if values require no more than 255\nbytes, two length bytes if values may require more than 255 bytes.\n\n*Note*:\n\nMySQL follows the standard SQL specification, and does not remove\ntrailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL uses utf8mb3 as this predefined\ncharacter set.\nhttps://dev.mysql.com/doc/refman/8.3/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
+[VARIANCE]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the population standard variance of expr. VARIANCE() is a\nsynonym for the standard SQL function VAR_POP(), provided as a MySQL\nextension.\n\nIf there are no matching rows, or if expr is NULL, VARIANCE() returns\nNULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[VAR_POP]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nIf there are no matching rows, or if expr is NULL, VAR_POP() returns\nNULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[VAR_SAMP]
+declaration=expr
+category=Aggregate Functions and Modifiers
+description=Returns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nIf there are no matching rows, or if expr is NULL, VAR_SAMP() returns\nNULL.\n\nThis function executes as a window function if over_clause is present.\nover_clause is as described in\nhttps://dev.mysql.com/doc/refman/8.3/en/window-functions-usage.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html
+[VERSION]
+declaration=
+category=Information Functions
+description=Returns a string that indicates the MySQL server version. The string\nuses the utf8mb3 character set. The value might have a suffix in\naddition to the version number. See the description of the version\nsystem variable in\nhttps://dev.mysql.com/doc/refman/8.3/en/server-system-variables.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/information-functions.html
+[WAIT_FOR_EXECUTED_GTID_SET]
+declaration=gtid_set[, timeout]
+category=GTID
+description=Wait until the server has applied all of the transactions whose global\ntransaction identifiers are contained in gtid_set; that is, until the\ncondition GTID_SUBSET(gtid_subset, @@GLOBAL.gtid_executed) holds. See\nhttps://dev.mysql.com/doc/refman/8.3/en/replication-gtids-concepts.html\nfor a definition of GTID sets.\n\nIf a timeout is specified, and timeout seconds elapse before all of the\ntransactions in the GTID set have been applied, the function stops\nwaiting. timeout is optional, and the default timeout is 0 seconds, in\nwhich case the function always waits until all of the transactions in\nthe GTID set have been applied. timeout must be greater than or equal\nto 0; when running in strict SQL mode, a negative timeout value is\nimmediately rejected with an error (ER_WRONG_ARGUMENTS\n(https://dev.mysql.com/doc/mysql-errors/8.3/en/server-error-reference.html\n#error_er_wrong_arguments)); otherwise the function returns NULL,\nand raises a warning.\n\nWAIT_FOR_EXECUTED_GTID_SET() monitors all the GTIDs that are applied on\nthe server, including transactions that arrive from all replication\nchannels and user clients. It does not take into account whether\nreplication channels have been started or stopped.\n\nFor more information, see\nhttps://dev.mysql.com/doc/refman/8.3/en/replication-gtids.html.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/gtid-functions.html
+[WEEK]
+declaration=date[,mode]
+category=Date and Time Functions
+description=This function returns the week number for date. The two-argument form\nof WEEK() enables you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttps://dev.mysql.com/doc/refman/8.3/en/server-system-variables.html.\nFor a NULL date value, the function returns NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[WEEKDAY]
+declaration=date
+category=Date and Time Functions
+description=Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday). Returns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[WEEKOFYEAR]
+declaration=date
+category=Date and Time Functions
+description=Returns the calendar week of the date as a number in the range from 1\nto 53. Returns NULL if date is NULL.\n\nWEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[WEIGHT_STRING]
+declaration=str [AS {CHAR|BINARY}(N
+category=String Functions
+description=This function returns the weight string for the input string. The\nreturn value is a binary string that represents the comparison and\nsorting value of the string, or NULL if the argument is NULL. It has\nthese properties:\n\no If WEIGHT_STRING(str1) = WEIGHT_STRING(str2), then str1 = str2 (str1\n and str2 are considered equal)\n\no If WEIGHT_STRING(str1) < WEIGHT_STRING(str2), then str1 < str2 (str1\n sorts before str2)\n\nWEIGHT_STRING() is a debugging function intended for internal use. Its\nbehavior can change without notice between MySQL versions. It can be\nused for testing and debugging of collations, especially if you are\nadding a new collation. See\nhttps://dev.mysql.com/doc/refman/8.3/en/adding-collation.html.\n\nThis list briefly summarizes the arguments. More details are given in\nthe discussion following the list.\n\no str: The input string expression.\n\no AS clause: Optional; cast the input string to a given type and\n length.\n\no flags: Optional; unused.\n\nThe input string, str, is a string expression. If the input is a\nnonbinary (character) string such as a CHAR, VARCHAR, or TEXT value,\nthe return value contains the collation weights for the string. If the\ninput is a binary (byte) string such as a BINARY, VARBINARY, or BLOB\nvalue, the return value is the same as the input (the weight for each\nbyte in a binary string is the byte value). If the input is NULL,\nWEIGHT_STRING() returns NULL.\n\nExamples:\n\nmysql> SET @s = _utf8mb4 'AB' COLLATE utf8mb4_0900_ai_ci;\nmysql> SELECT @s, HEX(@s), HEX(WEIGHT_STRING(@s));\n+------+---------+------------------------+\n| @s | HEX(@s) | HEX(WEIGHT_STRING(@s)) |\n+------+---------+------------------------+\n| AB | 4142 | 1C471C60 |\n+------+---------+------------------------+\n\nmysql> SET @s = _utf8mb4 'ab' COLLATE utf8mb4_0900_ai_ci;\nmysql> SELECT @s, HEX(@s), HEX(WEIGHT_STRING(@s));\n+------+---------+------------------------+\n| @s | HEX(@s) | HEX(WEIGHT_STRING(@s)) |\n+------+---------+------------------------+\n ...
+[YEAR]
+declaration=date
+category=Date and Time Functions
+description=Returns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date. Returns NULL if date is NULL.\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
+[YEARWEEK]
+declaration=date
+category=Date and Time Functions
+description=Returns year and week for a date. The year in the result may be\ndifferent from the year in the date argument for the first and the last\nweek of the year. Returns NULL if date is NULL.\n\nThe mode argument works exactly like the mode argument to WEEK(). For\nthe single-argument syntax, a mode value of 0 is used. Unlike WEEK(),\nthe value of default_week_format does not influence YEARWEEK().\n\nURL: https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html
\ No newline at end of file
diff --git a/out/functions-postgresql.ini b/out/functions-postgresql.ini
index 71a880ab6..bf2a8d0b6 100644
--- a/out/functions-postgresql.ini
+++ b/out/functions-postgresql.ini
@@ -1,204 +1,2244 @@
+[ABBREV]
+declaration=inet
+category=Network Address Functions
+description=Creates an abbreviated display format as text. (The result is the same as\nthe inet output function produces; it is "abbreviated" only in comparison\nto the result of an explicit cast to text, which for historical reasons\nwill never suppress the netmask part.)
[ABS]
-declaration=number
+declaration=numeric_type
category=Numeric/Math Functions
-description=The PostgreSQL abs function returns the absolute value of a number.
-[AGE]
-declaration=date1 and date2
-category=Date/Time Functions
-description=The PostgreSQL age function returns the number of years, months, and days between two dates.
-[AVG]
-declaration=expression1, expression2, ... expression_n,aggregate_expression,tables,WHERE conditions
+description=Absolute value
+[ACLDEFAULT]
+declaration=type "char", ownerId oid
+category=Session Information Functions
+description=Constructs an aclitem array holding the default access privileges for an\nobject of type type belonging to the role with OID ownerId. This represents\nthe access privileges that will be assumed when an object's ACL entry is\nnull. (The default access privileges are described in Section 5.8.) The\ntype parameter must be one of 'c' for COLUMN, 'r' for TABLE and table-like\nobjects, 's' for SEQUENCE, 'd' for DATABASE, 'f' for FUNCTION or PROCEDURE,\n'l' for LANGUAGE, 'L' for LARGE OBJECT, 'n' for SCHEMA, 'p' for PARAMETER,\n't' for TABLESPACE, 'F' for FOREIGN DATA WRAPPER, 'S' for FOREIGN SERVER,\nor 'T' for TYPE or DOMAIN.
+[ACLEXPLODE]
+declaration=aclitem[]
+category=Session Information Functions
+description=Returns the aclitem array as a set of rows. If the grantee is the\npseudo-role PUBLIC, it is represented by zero in the grantee column. Each\ngranted privilege is represented as SELECT, INSERT, etc (see Table 5.1 for\na full list). Note that each privilege is broken out as a separate row, so\nonly one keyword appears in the privilege_type column.
+[ACOS]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse cosine, result in radians
+[ACOSD]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse cosine, result in degrees
+[ACOSH]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL avg function returns the average value of an expression.
-[BTRIM]
-declaration=string,trim_character
+description=Inverse hyperbolic cosine
+[AGE1]
+name=AGE
+declaration=timestamp, timestamp
+category=Date/Time Functions
+description=Subtract arguments, producing a "symbolic" result that uses years and\nmonths, rather than just days
+[AGE2]
+name=AGE
+declaration=xid
+category=Session Information Functions
+description=Returns the number of transactions between the supplied transaction id and\nthe current transaction counter.
+[ANY_VALUE]
+declaration=anyelement
+category=Aggregate Functions
+description=Returns an arbitrary value from the non-null input values.
+[AREA]
+declaration=geometric_type
+category=Geometric Functions
+description=Computes area. Available for box, path, circle. A path input must be\nclosed, else NULL is returned. Also, if the path is self-intersecting, the\nresult may be meaningless.
+[ARRAY_AGG]
+declaration=anynonarray ORDER BY input_sort_columns
+category=Aggregate Functions
+description=Collects all the input values, including nulls, into an array.
+[ARRAY_APPEND]
+declaration=anycompatiblearray, anycompatible
+category=Array Functions
+description=Appends an element to the end of an array (same as the anycompatiblearray\n|| anycompatible operator).
+[ARRAY_CAT]
+declaration=anycompatiblearray, anycompatiblearray
+category=Array Functions
+description=Concatenates two arrays (same as the anycompatiblearray ||\nanycompatiblearray operator).
+[ARRAY_DIMS]
+declaration=anyarray
+category=Array Functions
+description=Returns a text representation of the array's dimensions.
+[ARRAY_FILL]
+declaration=anyelement, integer[] [, integer[] ]
+category=Array Functions
+description=Returns an array filled with copies of the given value, having dimensions\nof the lengths specified by the second argument. The optional third\nargument supplies lower-bound values for each dimension (which default to\nall 1).
+[ARRAY_LENGTH]
+declaration=anyarray, integer
+category=Array Functions
+description=Returns the length of the requested array dimension. (Produces NULL instead\nof 0 for empty or missing array dimensions.)
+[ARRAY_LOWER]
+declaration=anyarray, integer
+category=Array Functions
+description=Returns the lower bound of the requested array dimension.
+[ARRAY_NDIMS]
+declaration=anyarray
+category=Array Functions
+description=Returns the number of dimensions of the array.
+[ARRAY_POSITION]
+declaration=anycompatiblearray, anycompatible [, integer ]
+category=Array Functions
+description=Returns the subscript of the first occurrence of the second argument in the\narray, or NULL if it's not present. If the third argument is given, the\nsearch begins at that subscript. The array must be one-dimensional.\nComparisons are done using IS NOT DISTINCT FROM semantics, so it is\npossible to search for NULL.
+[ARRAY_POSITIONS]
+declaration=anycompatiblearray, anycompatible
+category=Array Functions
+description=Returns an array of the subscripts of all occurrences of the second\nargument in the array given as first argument. The array must be\none-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics,\nso it is possible to search for NULL. NULL is returned only if the array is\nNULL; if the value is not found in the array, an empty array is returned.
+[ARRAY_PREPEND]
+declaration=anycompatible, anycompatiblearray
+category=Array Functions
+description=Prepends an element to the beginning of an array (same as the anycompatible\n|| anycompatiblearray operator).
+[ARRAY_REMOVE]
+declaration=anycompatiblearray, anycompatible
+category=Array Functions
+description=Removes all elements equal to the given value from the array. The array\nmust be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM\nsemantics, so it is possible to remove NULLs.
+[ARRAY_REPLACE]
+declaration=anycompatiblearray, anycompatible, anycompatible
+category=Array Functions
+description=Replaces each array element equal to the second argument with the third\nargument.
+[ARRAY_SAMPLE]
+declaration=array anyarray, n integer
+category=Array Functions
+description=Returns an array of n items randomly selected from array. n may not exceed\nthe length of array's first dimension. If array is multi-dimensional, an\n"item" is a slice having a given first subscript.
+[ARRAY_SHUFFLE]
+declaration=anyarray
+category=Array Functions
+description=Randomly shuffles the first dimension of the array.
+[ARRAY_TO_JSON]
+declaration=anyarray [, boolean ]
+category=JSON Functions
+description=Converts an SQL array to a JSON array. The behavior is the same as to_json\nexcept that line feeds will be added between top-level array elements if\nthe optional boolean parameter is true.
+[ARRAY_TO_STRING]
+declaration=array anyarray, delimiter text [, null_string text ]
+category=Array Functions
+description=Converts each array element to its text representation, and concatenates\nthose separated by the delimiter string. If null_string is given and is not\nNULL, then NULL array entries are represented by that string; otherwise,\nthey are omitted. See also string_to_array.
+[ARRAY_TO_TSVECTOR]
+declaration=text[]
+category=Text Search Functions
+description=Converts an array of text strings to a tsvector. The given strings are used\nas lexemes as-is, without further processing. Array elements must not be\nempty strings or NULL.
+[ARRAY_UPPER]
+declaration=anyarray, integer
+category=Array Functions
+description=Returns the upper bound of the requested array dimension.
+[ASCII]
+declaration=text
category=String Functions
-description=The PostgreSQL btrim function removes all specified characters from both the beginning and the end of a string.
-[CEILING]
-declaration=number
+description=Returns the numeric code of the first character of the argument. In UTF8\nencoding, returns the Unicode code point of the character. In other\nmultibyte encodings, the argument must be an ASCII character.
+[ASIN]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse sine, result in radians
+[ASIND]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse sine, result in degrees
+[ASINH]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse hyperbolic sine
+[ATAN]
+declaration=double precision
+category=Numeric/Math Functions
+description=Inverse tangent, result in radians
+[ATAN2]
+declaration=y double precision, x double precision
+category=Numeric/Math Functions
+description=Inverse tangent of y/x, result in radians
+[ATAN2D]
+declaration=y double precision, x double precision
+category=Numeric/Math Functions
+description=Inverse tangent of y/x, result in degrees
+[ATAND]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL ceiling function returns the smallest integer value that is greater than or equal to a number.
-[CEIL]
-declaration=number
+description=Inverse tangent, result in degrees
+[ATANH]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL ceil function returns the smallest integer value that is greater than or equal to a number.
+description=Inverse hyperbolic tangent
+[BIT_COUNT]
+declaration=bit
+category=Bit String Functions
+description=Returns the number of bits set in the bit string (also known as\n"popcount").
+[BIT_LENGTH1]
+name=BIT_LENGTH
+declaration=text
+category=String Functions
+description=Returns number of bits in the string (8 times the octet_length).
+[BIT_LENGTH2]
+name=BIT_LENGTH
+declaration=bytea
+category=Binary String Functions
+description=Returns number of bits in the binary string (8 times the octet_length).
+[BIT_LENGTH3]
+name=BIT_LENGTH
+declaration=bit
+category=Bit String Functions
+description=Returns number of bits in the bit string.
+[BOOL_AND]
+declaration=boolean
+category=Aggregate Functions
+description=Returns true if all non-null input values are true, otherwise false.
+[BOOL_OR]
+declaration=boolean
+category=Aggregate Functions
+description=Returns true if any non-null input value is true, otherwise false.
+[BOUND_BOX]
+declaration=box, box
+category=Geometric Functions
+description=Computes bounding box of two boxes.
+[BOX]
+declaration=circle
+category=Geometric Functions
+description=Computes box inscribed within the circle.
+[BRIN_DESUMMARIZE_RANGE]
+declaration=index regclass, blockNumber bigint
+category=System Administration Functions
+description=Removes the BRIN index tuple that summarizes the page range covering the\ngiven table block, if there is one.
+[BRIN_SUMMARIZE_NEW_VALUES]
+declaration=index regclass
+category=System Administration Functions
+description=Scans the specified BRIN index to find page ranges in the base table that\nare not currently summarized by the index; for any such range it creates a\nnew summary index tuple by scanning those table pages. Returns the number\nof new page range summaries that were inserted into the index.
+[BRIN_SUMMARIZE_RANGE]
+declaration=index regclass, blockNumber bigint
+category=System Administration Functions
+description=Summarizes the page range covering the given block, if not already\nsummarized. This is like brin_summarize_new_values except that it only\nprocesses the page range that covers the given table block number.
+[BROADCAST]
+declaration=inet
+category=Network Address Functions
+description=Computes the broadcast address for the address's network.
+[BTRIM1]
+name=BTRIM
+declaration=string text [, characters text ]
+category=String Functions
+description=Removes the longest string containing only characters in characters (a\nspace by default) from the start and end of string.
+[BTRIM2]
+name=BTRIM
+declaration=bytes bytea, bytesremoved bytea
+category=Binary String Functions
+description=Removes the longest string containing only bytes appearing in bytesremoved\nfrom the start and end of bytes.
+[CARDINALITY]
+declaration=anyarray
+category=Array Functions
+description=Returns the total number of elements in the array, or 0 if the array is\nempty.
+[CBRT]
+declaration=double precision
+category=Numeric/Math Functions
+description=Cube root
+[CENTER]
+declaration=geometric_type
+category=Geometric Functions
+description=Computes center point. Available for box, circle.
[CHARACTER_LENGTH]
-declaration=string
+declaration=text
category=String Functions
-description=The PostgreSQL character_length function returns the length of the specified string.
-[CHAR_LENGTH]
-declaration=string
+description=Returns number of characters in the string.
+[CHR]
+declaration=integer
category=String Functions
-description=The PostgreSQL char_length function returns the length of the specified string.
-[COUNT]
-declaration=expression1, expression2, ... expression_n,aggregate_expression,tables,WHERE conditions
+description=Returns the character with the given code. In UTF8 encoding the argument is\ntreated as a Unicode code point. In other multibyte encodings the argument\nmust designate an ASCII character. chr(0) is disallowed because text data\ntypes cannot store that character.
+[CIRCLE]
+declaration=box
+category=Geometric Functions
+description=Computes smallest circle enclosing box.
+[CLOCK_TIMESTAMP]
+declaration=
+category=Date/Time Functions
+description=Current date and time (changes during statement execution); see Section\n9.9.5
+[COL_DESCRIPTION]
+declaration=table oid, column integer
+category=Session Information Functions
+description=Returns the comment for a table column, which is specified by the OID of\nits table and its column number. (obj_description cannot be used for table\ncolumns, since columns do not have OIDs of their own.)
+[CONCAT]
+declaration=val1 "any" [, val2 "any" [, ...] ]
+category=String Functions
+description=Concatenates the text representations of all the arguments. NULL arguments\nare ignored.
+[CONCAT_WS]
+declaration=sep text, val1 "any" [, val2 "any" [, ...] ]
+category=String Functions
+description=Concatenates all but the first argument, with separators. The first\nargument is used as the separator string, and should not be NULL. Other\nNULL arguments are ignored.
+[CONVERT]
+declaration=bytes bytea, src_encoding name, dest_encoding name
+category=Binary String Functions
+description=Converts a binary string representing text in encoding src_encoding to a\nbinary string in encoding dest_encoding (see Section 23.3.4 for available\nconversions).
+[CONVERT_FROM]
+declaration=bytes bytea, src_encoding name
+category=Binary String Functions
+description=Converts a binary string representing text in encoding src_encoding to text\nin the database encoding (see Section 23.3.4 for available conversions).
+[CONVERT_TO]
+declaration=string text, dest_encoding name
+category=Binary String Functions
+description=Converts a text string (in the database encoding) to a binary string\nencoded in encoding dest_encoding (see Section 23.3.4 for available\nconversions).
+[COS]
+declaration=double precision
+category=Numeric/Math Functions
+description=Cosine, argument in radians
+[COSD]
+declaration=double precision
+category=Numeric/Math Functions
+description=Cosine, argument in degrees
+[COSH]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL count function returns the count of an expression.
-[CURRENT_DATE]
+description=Hyperbolic cosine
+[COT]
+declaration=double precision
+category=Numeric/Math Functions
+description=Cotangent, argument in radians
+[COTD]
+declaration=double precision
+category=Numeric/Math Functions
+description=Cotangent, argument in degrees
+[COUNT]
+declaration=*
+category=Aggregate Functions
+description=Computes the number of input rows.
+[CUME_DIST1]
+name=CUME_DIST
+declaration=args
+category=Aggregate Functions
+description=Computes the cumulative distribution, that is (number of rows preceding or\npeers with hypothetical row) / (total rows). The value thus ranges from 1/N\nto 1.
+[CUME_DIST2]
+name=CUME_DIST
+declaration=
+category=Window Functions
+description=Returns the cumulative distribution, that is (number of partition rows\npreceding or peers with current row) / (total partition rows). The value\nthus ranges from 1/N to 1.
+[CURRENT_DATABASE]
+declaration=
+category=Session Information Functions
+description=Returns the name of the current database. (Databases are called "catalogs"\nin the SQL standard, so current_catalog is the standard's spelling.)
+[CURRENT_QUERY]
declaration=
+category=Session Information Functions
+description=Returns the text of the currently executing query, as submitted by the\nclient (which might contain more than one statement).
+[CURRENT_SETTING]
+declaration=setting_name text [, missing_ok boolean ]
+category=System Administration Functions
+description=Returns the current value of the setting setting_name. If there is no such\nsetting, current_setting throws an error unless missing_ok is supplied and\nis true (in which case NULL is returned). This function corresponds to the\nSQL command SHOW.
+[CURRVAL]
+declaration=regclass
+category=Sequence Manipulation Functions
+description=Returns the value most recently obtained by nextval for this sequence in\nthe current session. (An error is reported if nextval has never been called\nfor this sequence in this session.) Because this is returning a\nsession-local value, it gives a predictable answer whether or not other\nsessions have executed nextval since the current session did.
+[DATE_ADD]
+declaration=timestamp with time zone, interval [, text ]
category=Date/Time Functions
-description=The PostgreSQL current_date function returns the current date.
-[CURRENT_TIMESTAMP]
-declaration=precision
+description=Add an interval to a timestamp with time zone, computing times of day and\ndaylight-savings adjustments according to the time zone named by the third\nargument, or the current TimeZone setting if that is omitted. The form with\ntwo arguments is equivalent to the timestamp with time zone + interval\noperator.
+[DATE_PART]
+declaration=text, timestamp
category=Date/Time Functions
-description=The PostgreSQL current_timestamp function returns the current date and time with the time zone.
-[CURRENT_TIME]
-declaration=precision
+description=Get timestamp subfield (equivalent to extract); see Section 9.9.1
+[DATE_SUBTRACT]
+declaration=timestamp with time zone, interval [, text ]
category=Date/Time Functions
-description=The PostgreSQL current_time function returns the current time with the time zone.
-[DATE_PART]
-declaration=date,unit
+description=Subtract an interval from a timestamp with time zone, computing times of\nday and daylight-savings adjustments according to the time zone named by\nthe third argument, or the current TimeZone setting if that is omitted. The\nform with two arguments is equivalent to the timestamp with time zone -\ninterval operator.
+[DATE_TRUNC]
+declaration=text, timestamp
category=Date/Time Functions
-description=The PostgreSQL date_part function extracts parts from a date.
+description=Truncate to specified precision; see Section 9.9.2
+[DECODE]
+declaration=string text, format text
+category=Binary String Functions
+description=Decodes binary data from a textual representation; supported format values\nare the same as for encode.
+[DEGREES]
+declaration=double precision
+category=Numeric/Math Functions
+description=Converts radians to degrees
+[DENSE_RANK1]
+name=DENSE_RANK
+declaration=args
+category=Aggregate Functions
+description=Computes the rank of the hypothetical row, without gaps; this function\neffectively counts peer groups.
+[DENSE_RANK2]
+name=DENSE_RANK
+declaration=
+category=Window Functions
+description=Returns the rank of the current row, without gaps; this function\neffectively counts peer groups.
+[DIAGONAL]
+declaration=box
+category=Geometric Functions
+description=Extracts box's diagonal as a line segment (same as lseg(box)).
+[DIAMETER]
+declaration=circle
+category=Geometric Functions
+description=Computes diameter of circle.
[DIV]
-declaration=n,m
+declaration=y numeric, x numeric
+category=Numeric/Math Functions
+description=Integer quotient of y/x (truncates towards zero)
+[ENCODE]
+declaration=bytes bytea, format text
+category=Binary String Functions
+description=Encodes binary data into a textual representation; supported format values\nare: base64, escape, hex.
+[ENUM_FIRST]
+declaration=anyenum
+category=Enum Support Functions
+description=Returns the first value of the input enum type.
+[ENUM_LAST]
+declaration=anyenum
+category=Enum Support Functions
+description=Returns the last value of the input enum type.
+[ENUM_RANGE]
+declaration=anyenum
+category=Enum Support Functions
+description=Returns all values of the input enum type in an ordered array.
+[ERF]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL div function is used for integer division where n is divided by m and an integer value is returned.
-[EXP]
-declaration=number
+description=Error function
+[ERFC]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL exp function returns e raised to the power of number (or enumber).
+description=Complementary error function (1 - erf(x), without loss of precision for\nlarge inputs)
+[EVERY]
+declaration=boolean
+category=Aggregate Functions
+description=This is the SQL standard's equivalent to bool_and.
[EXTRACT]
-declaration=date,unit
+declaration=field from timestamp
category=Date/Time Functions
-description=The PostgreSQL extract function extracts parts from a date.
-[FLOOR]
-declaration=number
+description=Get timestamp subfield; see Section 9.9.1
+[FACTORIAL]
+declaration=bigint
category=Numeric/Math Functions
-description=The PostgreSQL floor function returns the largest integer value that is equal to or less than a number.
-[INITCAP]
-declaration=string
+description=Factorial
+[FAMILY]
+declaration=inet
+category=Network Address Functions
+description=Returns the address's family: 4 for IPv4, 6 for IPv6.
+[FIRST_VALUE]
+declaration=value anyelement
+category=Window Functions
+description=Returns value evaluated at the row that is the first row of the window\nframe.
+[FORMAT]
+declaration=formatstr text [, formatarg "any" [, ...] ]
category=String Functions
-description=The PostgreSQL initcap function converts the first letter of each word to uppercase and all other letters are converted to lowercase.
-[LENGTH]
-declaration=string
+description=Formats arguments according to a format string; see Section 9.4.1. This\nfunction is similar to the C function sprintf.
+[FORMAT_TYPE]
+declaration=type oid, typemod integer
+category=Session Information Functions
+description=Returns the SQL name for a data type that is identified by its type OID and\npossibly a type modifier. Pass NULL for the type modifier if no specific\nmodifier is known.
+[GCD]
+declaration=numeric_type, numeric_type
+category=Numeric/Math Functions
+description=Greatest common divisor (the largest positive number that divides both\ninputs with no remainder); returns 0 if both inputs are zero; available for\ninteger, bigint, and numeric
+[GET_BIT1]
+name=GET_BIT
+declaration=bytes bytea, n bigint
+category=Binary String Functions
+description=Extracts n'th bit from binary string.
+[GET_BIT2]
+name=GET_BIT
+declaration=bits bit, n integer
+category=Bit String Functions
+description=Extracts n'th bit from bit string; the first (leftmost) bit is bit 0.
+[GET_BYTE]
+declaration=bytes bytea, n integer
+category=Binary String Functions
+description=Extracts n'th byte from binary string.
+[GET_CURRENT_TS_CONFIG]
+declaration=
+category=Text Search Functions
+description=Returns the OID of the current default text search configuration (as set by\ndefault_text_search_config).
+[GIN_CLEAN_PENDING_LIST]
+declaration=index regclass
+category=System Administration Functions
+description=Cleans up the "pending" list of the specified GIN index by moving entries\nin it, in bulk, to the main GIN data structure. Returns the number of pages\nremoved from the pending list. If the argument is a GIN index built with\nthe fastupdate option disabled, no cleanup happens and the result is zero,\nbecause the index doesn't have a pending list. See Section 64.4.4.1 and\nSection 64.4.5 for details about the pending list and fastupdate option.
+[GROUPING]
+declaration=group_by_expression(s
+category=Aggregate Functions
+description=Returns a bit mask indicating which GROUP BY expressions are not included\nin the current grouping set. Bits are assigned with the rightmost argument\ncorresponding to the least-significant bit; each bit is 0 if the\ncorresponding expression is included in the grouping criteria of the\ngrouping set generating the current result row, and 1 if it is not\nincluded.
+[HAS_ANY_COLUMN_PRIVILEGE]
+declaration=[ user name or oid, ] table text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for any column of table? This succeeds either if\nthe privilege is held for the whole table, or if there is a column-level\ngrant of the privilege for at least one column. Allowable privilege types\nare SELECT, INSERT, UPDATE, and REFERENCES.
+[HAS_COLUMN_PRIVILEGE]
+declaration=[ user name or oid, ] table text or oid, column text or smallint, privilege text
+category=Session Information Functions
+description=Does user have privilege for the specified table column? This succeeds\neither if the privilege is held for the whole table, or if there is a\ncolumn-level grant of the privilege for the column. The column can be\nspecified by name or by attribute number (pg_attribute.attnum). Allowable\nprivilege types are SELECT, INSERT, UPDATE, and REFERENCES.
+[HAS_DATABASE_PRIVILEGE]
+declaration=[ user name or oid, ] database text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for database? Allowable privilege types are\nCREATE, CONNECT, TEMPORARY, and TEMP (which is equivalent to TEMPORARY).
+[HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE]
+declaration=[ user name or oid, ] fdw text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for foreign-data wrapper? The only allowable\nprivilege type is USAGE.
+[HAS_FUNCTION_PRIVILEGE]
+declaration=[ user name or oid, ] function text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for function? The only allowable privilege type is\nEXECUTE.
+[HAS_LANGUAGE_PRIVILEGE]
+declaration=[ user name or oid, ] language text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for language? The only allowable privilege type is\nUSAGE.
+[HAS_PARAMETER_PRIVILEGE]
+declaration=[ user name or oid, ] parameter text, privilege text
+category=Session Information Functions
+description=Does user have privilege for configuration parameter? The parameter name is\ncase-insensitive. Allowable privilege types are SET and ALTER SYSTEM.
+[HAS_SCHEMA_PRIVILEGE]
+declaration=[ user name or oid, ] schema text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for schema? Allowable privilege types are CREATE\nand USAGE.
+[HAS_SEQUENCE_PRIVILEGE]
+declaration=[ user name or oid, ] sequence text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for sequence? Allowable privilege types are USAGE,\nSELECT, and UPDATE.
+[HAS_SERVER_PRIVILEGE]
+declaration=[ user name or oid, ] server text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for foreign server? The only allowable privilege\ntype is USAGE.
+[HAS_TABLESPACE_PRIVILEGE]
+declaration=[ user name or oid, ] tablespace text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for tablespace? The only allowable privilege type\nis CREATE.
+[HAS_TABLE_PRIVILEGE]
+declaration=[ user name or oid, ] table text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for table? Allowable privilege types are SELECT,\nINSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, and MAINTAIN.
+[HAS_TYPE_PRIVILEGE]
+declaration=[ user name or oid, ] type text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for data type? The only allowable privilege type\nis USAGE. When specifying a type by name rather than by OID, the allowed\ninput is the same as for the regtype data type (see Section 8.19).
+[HEIGHT]
+declaration=box
+category=Geometric Functions
+description=Computes vertical size of box.
+[HOST]
+declaration=inet
+category=Network Address Functions
+description=Returns the IP address as text, ignoring the netmask.
+[HOSTMASK]
+declaration=inet
+category=Network Address Functions
+description=Computes the host mask for the address's network.
+[ICU_UNICODE_VERSION]
+declaration=
+category=Session Information Functions
+description=Returns a string representing the version of Unicode used by ICU, if the\nserver was built with ICU support; otherwise returns NULL
+[INET_CLIENT_ADDR]
+declaration=
+category=Session Information Functions
+description=Returns the IP address of the current client, or NULL if the current\nconnection is via a Unix-domain socket.
+[INET_CLIENT_PORT]
+declaration=
+category=Session Information Functions
+description=Returns the IP port number of the current client, or NULL if the current\nconnection is via a Unix-domain socket.
+[INET_MERGE]
+declaration=inet, inet
+category=Network Address Functions
+description=Computes the smallest network that includes both of the given networks.
+[INET_SAME_FAMILY]
+declaration=inet, inet
+category=Network Address Functions
+description=Tests whether the addresses belong to the same IP family.
+[INET_SERVER_ADDR]
+declaration=
+category=Session Information Functions
+description=Returns the IP address on which the server accepted the current connection,\nor NULL if the current connection is via a Unix-domain socket.
+[INET_SERVER_PORT]
+declaration=
+category=Session Information Functions
+description=Returns the IP port number on which the server accepted the current\nconnection, or NULL if the current connection is via a Unix-domain socket.
+[INITCAP]
+declaration=text
category=String Functions
-description=The PostgreSQL length function returns the length of the specified string, expressed as the number of characters.
-[LOCALTIMESTAMP]
-declaration=precision
+description=Converts the first letter of each word to upper case and the rest to lower\ncase. Words are sequences of alphanumeric characters separated by\nnon-alphanumeric characters.
+[ISCLOSED]
+declaration=path
+category=Geometric Functions
+description=Is path closed?
+[ISEMPTY1]
+name=ISEMPTY
+declaration=anyrange
+category=Range Functions
+description=Is the range empty?
+[ISEMPTY2]
+name=ISEMPTY
+declaration=anymultirange
+category=Range Functions
+description=Is the multirange empty?
+[ISFINITE]
+declaration=date
+category=Date/Time Functions
+description=Test for finite date (not +/-infinity)
+[ISOPEN]
+declaration=path
+category=Geometric Functions
+description=Is path open?
+[JSON]
+declaration=expression [ FORMAT JSON [ ENCODING UTF8 ]] [ { WITH | WITHOUT } UNIQUE [ KEYS ]]
+category=JSON Functions
+description=Converts a given expression specified as text or bytea string (in UTF8\nencoding) into a JSON value. If expression is NULL, an SQL null value is\nreturned. If WITH UNIQUE is specified, the expression must not contain any\nduplicate object keys.
+[JSONB_AGG]
+declaration=anyelement ORDER BY input_sort_columns
+category=Aggregate Functions
+description=Collects all the input values, including nulls, into a JSON array. Values\nare converted to JSON as per to_json or to_jsonb.
+[JSONB_AGG_STRICT]
+declaration=anyelement
+category=Aggregate Functions
+description=Collects all the input values, skipping nulls, into a JSON array. Values\nare converted to JSON as per to_json or to_jsonb.
+[JSONB_ARRAY_ELEMENTS]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON array into a set of JSON values.
+[JSONB_ARRAY_ELEMENTS_TEXT]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON array into a set of text values.
+[JSONB_ARRAY_LENGTH]
+declaration=jsonb
+category=JSON Functions
+description=Returns the number of elements in the top-level JSON array.
+[JSONB_BUILD_ARRAY]
+declaration=VARIADIC "any"
+category=JSON Functions
+description=Builds a possibly-heterogeneously-typed JSON array out of a variadic\nargument list. Each argument is converted as per to_json or to_jsonb.
+[JSONB_BUILD_OBJECT]
+declaration=VARIADIC "any"
+category=JSON Functions
+description=Builds a JSON object out of a variadic argument list. By convention, the\nargument list consists of alternating keys and values. Key arguments are\ncoerced to text; value arguments are converted as per to_json or to_jsonb.
+[JSONB_EACH]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON object into a set of key/value pairs.
+[JSONB_EACH_TEXT]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON object into a set of key/value pairs. The\nreturned values will be of type text.
+[JSONB_EXTRACT_PATH]
+declaration=from_json jsonb, VARIADIC path_elems text[]
+category=JSON Functions
+description=Extracts JSON sub-object at the specified path. (This is functionally\nequivalent to the #> operator, but writing the path out as a variadic\nlist can be more convenient in some cases.)
+[JSONB_EXTRACT_PATH_TEXT]
+declaration=from_json jsonb, VARIADIC path_elems text[]
+category=JSON Functions
+description=Extracts JSON sub-object at the specified path as text. (This is\nfunctionally equivalent to the #>> operator.)
+[JSONB_INSERT]
+declaration=target jsonb, path text[], new_value jsonb [, insert_after boolean ]
+category=JSON Functions
+description=Returns target with new_value inserted. If the item designated by the path\nis an array element, new_value will be inserted before that item if\ninsert_after is false (which is the default), or after it if insert_after\nis true. If the item designated by the path is an object field, new_value\nwill be inserted only if the object does not already contain that key. All\nearlier steps in the path must exist, or the target is returned unchanged.\nAs with the path oriented operators, negative integers that appear in the\npath count from the end of JSON arrays. If the last path step is an array\nindex that is out of range, the new value is added at the beginning of the\narray if the index is negative, or at the end of the array if it is\npositive.
+[JSONB_OBJECT]
+declaration=text[]
+category=JSON Functions
+description=Builds a JSON object out of a text array. The array must have either\nexactly one dimension with an even number of members, in which case they\nare taken as alternating key/value pairs, or two dimensions such that each\ninner array has exactly two elements, which are taken as a key/value pair.\nAll values are converted to JSON strings.
+[JSONB_OBJECT_AGG]
+declaration=key "any", value "any" ORDER BY input_sort_columns
+category=Aggregate Functions
+description=Collects all the key/value pairs into a JSON object. Key arguments are\ncoerced to text; value arguments are converted as per to_json or to_jsonb.\nValues can be null, but keys cannot.
+[JSONB_OBJECT_AGG_STRICT]
+declaration=key "any", value "any"
+category=Aggregate Functions
+description=Collects all the key/value pairs into a JSON object. Key arguments are\ncoerced to text; value arguments are converted as per to_json or to_jsonb.\nThe key can not be null. If the value is null then the entry is skipped,
+[JSONB_OBJECT_AGG_UNIQUE]
+declaration=key "any", value "any"
+category=Aggregate Functions
+description=Collects all the key/value pairs into a JSON object. Key arguments are\ncoerced to text; value arguments are converted as per to_json or to_jsonb.\nValues can be null, but keys cannot. If there is a duplicate key an error\nis thrown.
+[JSONB_OBJECT_AGG_UNIQUE_STRICT]
+declaration=key "any", value "any"
+category=Aggregate Functions
+description=Collects all the key/value pairs into a JSON object. Key arguments are\ncoerced to text; value arguments are converted as per to_json or to_jsonb.\nThe key can not be null. If the value is null then the entry is skipped. If\nthere is a duplicate key an error is thrown.
+[JSONB_OBJECT_KEYS]
+declaration=jsonb
+category=JSON Functions
+description=Returns the set of keys in the top-level JSON object.
+[JSONB_PATH_EXISTS]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=Checks whether the JSON path returns any item for the specified JSON value.\n(This is useful only with SQL-standard JSON path expressions, not predicate\ncheck expressions, since those always return a value.) If the vars argument\nis specified, it must be a JSON object, and its fields provide named values\nto be substituted into the jsonpath expression. If the silent argument is\nspecified and is true, the function suppresses the same errors as the @?\nand @@ operators do.
+[JSONB_PATH_MATCH]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=Returns the result of a JSON path predicate check for the specified JSON\nvalue. (This is useful only with predicate check expressions, not\nSQL-standard JSON path expressions, since it will either fail or return\nNULL if the path result is not a single boolean value.) The optional vars\nand silent arguments act the same as for jsonb_path_exists.
+[JSONB_PATH_QUERY]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=Returns all JSON items returned by the JSON path for the specified JSON\nvalue. For SQL-standard JSON path expressions it returns the JSON values\nselected from target. For predicate check expressions it returns the result\nof the predicate check: true, false, or null. The optional vars and silent\narguments act the same as for jsonb_path_exists.
+[JSONB_PATH_QUERY_ARRAY]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=Returns all JSON items returned by the JSON path for the specified JSON\nvalue, as a JSON array. The parameters are the same as for\njsonb_path_query.
+[JSONB_PATH_QUERY_FIRST]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=Returns the first JSON item returned by the JSON path for the specified\nJSON value, or NULL if there are no results. The parameters are the same as\nfor jsonb_path_query.
+[JSONB_PATH_QUERY_FIRST_TZ]
+declaration=target jsonb, path jsonpath [, vars jsonb [, silent boolean ]]
+category=JSON Functions
+description=These functions act like their counterparts described above without the _tz\nsuffix, except that these functions support comparisons of date/time values\nthat require timezone-aware conversions. The example below requires\ninterpretation of the date-only value 2015-08-02 as a timestamp with time\nzone, so the result depends on the current TimeZone setting. Due to this\ndependency, these functions are marked as stable, which means these\nfunctions cannot be used in indexes. Their counterparts are immutable, and\nso can be used in indexes; but they will throw errors if asked to make such\ncomparisons.
+[JSONB_POPULATE_RECORD]
+declaration=base anyelement, from_json jsonb
+category=JSON Functions
+description=Expands the top-level JSON object to a row having the composite type of the\nbase argument. The JSON object is scanned for fields whose names match\ncolumn names of the output row type, and their values are inserted into\nthose columns of the output. (Fields that do not correspond to any output\ncolumn name are ignored.) In typical use, the value of base is just NULL,\nwhich means that any output columns that do not match any object field will\nbe filled with nulls. However, if base isn't NULL then the values it\ncontains will be used for unmatched columns.
+[JSONB_POPULATE_RECORDSET]
+declaration=base anyelement, from_json jsonb
+category=JSON Functions
+description=Expands the top-level JSON array of objects to a set of rows having the\ncomposite type of the base argument. Each element of the JSON array is\nprocessed as described above for json[b]_populate_record.
+[JSONB_POPULATE_RECORD_VALID]
+declaration=base anyelement, from_json json
+category=JSON Functions
+description=Function for testing jsonb_populate_record. Returns true if the input\njsonb_populate_record would finish without an error for the given input\nJSON object; that is, it's valid input, false otherwise.
+[JSONB_PRETTY]
+declaration=jsonb
+category=JSON Functions
+description=Converts the given JSON value to pretty-printed, indented text.
+[JSONB_SET]
+declaration=target jsonb, path text[], new_value jsonb [, create_if_missing boolean ]
+category=JSON Functions
+description=Returns target with the item designated by path replaced by new_value, or\nwith new_value added if create_if_missing is true (which is the default)\nand the item designated by path does not exist. All earlier steps in the\npath must exist, or the target is returned unchanged. As with the path\noriented operators, negative integers that appear in the path count from\nthe end of JSON arrays. If the last path step is an array index that is out\nof range, and create_if_missing is true, the new value is added at the\nbeginning of the array if the index is negative, or at the end of the array\nif it is positive.
+[JSONB_SET_LAX]
+declaration=target jsonb, path text[], new_value jsonb [, create_if_missing boolean [, null_value_treatment text ]]
+category=JSON Functions
+description=If new_value is not NULL, behaves identically to jsonb_set. Otherwise\nbehaves according to the value of null_value_treatment which must be one of\n'raise_exception', 'use_json_null', 'delete_key', or 'return_target'. The\ndefault is 'use_json_null'.
+[JSONB_STRIP_NULLS]
+declaration=jsonb
+category=JSON Functions
+description=Deletes all object fields that have null values from the given JSON value,\nrecursively. Null values that are not object fields are untouched.
+[JSONB_TO_RECORD]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON object to a row having the composite type\ndefined by an AS clause. (As with all functions returning record, the\ncalling query must explicitly define the structure of the record with an AS\nclause.) The output record is filled from fields of the JSON object, in the\nsame way as described above for json[b]_populate_record. Since there is no\ninput record value, unmatched columns are always filled with nulls.
+[JSONB_TO_RECORDSET]
+declaration=jsonb
+category=JSON Functions
+description=Expands the top-level JSON array of objects to a set of rows having the\ncomposite type defined by an AS clause. (As with all functions returning\nrecord, the calling query must explicitly define the structure of the\nrecord with an AS clause.) Each element of the JSON array is processed as\ndescribed above for json[b]_populate_record.
+[JSONB_TO_TSVECTOR]
+declaration=[ config regconfig, ] document jsonb, filter jsonb
+category=Text Search Functions
+description=Selects each item in the JSON document that is requested by the filter and\nconverts each one to a tsvector, normalizing words according to the\nspecified or default configuration. The results are then concatenated in\ndocument order to produce the output. Position information is generated as\nthough one stopword exists between each pair of selected items. (Beware\nthat "document order" of the fields of a JSON object is\nimplementation-dependent when the input is jsonb.) The filter must be a\njsonb array containing zero or more of these keywords: "string" (to include\nall string values), "numeric" (to include all numeric values), "boolean"\n(to include all boolean values), "key" (to include all keys), or "all" (to\ninclude all the above). As a special case, the filter can also be a simple\nJSON value that is one of these keywords.
+[JSONB_TYPEOF]
+declaration=jsonb
+category=JSON Functions
+description=Returns the type of the top-level JSON value as a text string. Possible\ntypes are object, array, string, number, boolean, and null. (The null\nresult should not be confused with an SQL NULL; see the examples.)
+[JSON_ARRAYAGG]
+declaration=[ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ]
+category=Aggregate Functions
+description=Behaves in the same way as json_array but as an aggregate function so it\nonly takes one value_expression parameter. If ABSENT ON NULL is specified,\nany NULL values are omitted. If ORDER BY is specified, the elements will\nappear in the array in that order rather than in the input order.
+[JSON_OBJECT]
+declaration=[ { key_expression { VALUE | ':' } value_expression [ FORMAT JSON [ ENCODING UTF8 ] ] }[, ...] ] [ { NULL | ABSENT } ON NULL ] [ { WITH | WITHOUT } UNIQUE [ KEYS ] ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ]
+category=JSON Functions
+description=Constructs a JSON object of all the key/value pairs given, or an empty\nobject if none are given. key_expression is a scalar expression defining\nthe JSON key, which is converted to the text type. It cannot be NULL nor\ncan it belong to a type that has a cast to the json type. If WITH UNIQUE\nKEYS is specified, there must not be any duplicate key_expression. Any pair\nfor which the value_expression evaluates to NULL is omitted from the output\nif ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause\nomitted, the key is included with value NULL.
+[JSON_OBJECTAGG]
+declaration=[ { key_expression { VALUE | ':' } value_expression } ] [ { NULL | ABSENT } ON NULL ] [ { WITH | WITHOUT } UNIQUE [ KEYS ] ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ]
+category=Aggregate Functions
+description=Behaves like json_object, but as an aggregate function, so it only takes\none key_expression and one value_expression parameter.
+[JSON_SCALAR]
+declaration=expression
+category=JSON Functions
+description=Converts a given SQL scalar value into a JSON scalar value. If the input is\nNULL, an SQL null is returned. If the input is number or a boolean value, a\ncorresponding JSON number or boolean value is returned. For any other\nvalue, a JSON string is returned.
+[JUSTIFY_DAYS]
+declaration=interval
category=Date/Time Functions
-description=The PostgreSQL localtimestamp function returns the current date and time.
-[LOCALTIME]
-declaration=precision
+description=Adjust interval, converting 30-day time periods to months
+[JUSTIFY_HOURS]
+declaration=interval
category=Date/Time Functions
-description=The PostgreSQL localtime function returns the current time.
-[LOWER]
-declaration=string
+description=Adjust interval, converting 24-hour time periods to days
+[JUSTIFY_INTERVAL]
+declaration=interval
+category=Date/Time Functions
+description=Adjust interval using justify_days and justify_hours, with additional sign\nadjustments
+[LAG]
+declaration=value anycompatible [, offset integer [, default anycompatible ]]
+category=Window Functions
+description=Returns value evaluated at the row that is offset rows before the current\nrow within the partition; if there is no such row, instead returns default\n(which must be of a type compatible with value). Both offset and default\nare evaluated with respect to the current row. If omitted, offset defaults\nto 1 and default to NULL.
+[LASTVAL]
+declaration=
+category=Sequence Manipulation Functions
+description=Returns the value most recently returned by nextval in the current session.\nThis function is identical to currval, except that instead of taking the\nsequence name as an argument it refers to whichever sequence nextval was\nmost recently applied to in the current session. It is an error to call\nlastval if nextval has not yet been called in the current session.
+[LAST_VALUE]
+declaration=value anyelement
+category=Window Functions
+description=Returns value evaluated at the row that is the last row of the window\nframe.
+[LCM]
+declaration=numeric_type, numeric_type
+category=Numeric/Math Functions
+description=Least common multiple (the smallest strictly positive number that is an\nintegral multiple of both inputs); returns 0 if either input is zero;\navailable for integer, bigint, and numeric
+[LEAD]
+declaration=value anycompatible [, offset integer [, default anycompatible ]]
+category=Window Functions
+description=Returns value evaluated at the row that is offset rows after the current\nrow within the partition; if there is no such row, instead returns default\n(which must be of a type compatible with value). Both offset and default\nare evaluated with respect to the current row. If omitted, offset defaults\nto 1 and default to NULL.
+[LEFT]
+declaration=string text, n integer
+category=String Functions
+description=Returns first n characters in the string, or when n is negative, returns\nall but last |n| characters.
+[LENGTH1]
+name=LENGTH
+declaration=text
+category=String Functions
+description=Returns the number of characters in the string.
+[LENGTH2]
+name=LENGTH
+declaration=geometric_type
+category=Geometric Functions
+description=Computes the total length. Available for lseg, path.
+[LENGTH3]
+name=LENGTH
+declaration=tsvector
+category=Text Search Functions
+description=Returns the number of lexemes in the tsvector.
+[LINE]
+declaration=point, point
+category=Geometric Functions
+description=Converts two points to the line through them.
+[LOWER1]
+name=LOWER
+declaration=text
category=String Functions
-description=The PostgreSQL lower function converts all characters in the specified string to lowercase.
+description=Converts the string to all lower case, according to the rules of the\ndatabase's locale.
+[LOWER2]
+name=LOWER
+declaration=anyrange
+category=Range Functions
+description=Extracts the lower bound of the range (NULL if the range is empty or has no\nlower bound).
+[LOWER3]
+name=LOWER
+declaration=anymultirange
+category=Range Functions
+description=Extracts the lower bound of the multirange (NULL if the multirange is empty\nhas no lower bound).
+[LOWER_INC1]
+name=LOWER_INC
+declaration=anyrange
+category=Range Functions
+description=Is the range's lower bound inclusive?
+[LOWER_INC2]
+name=LOWER_INC
+declaration=anymultirange
+category=Range Functions
+description=Is the multirange's lower bound inclusive?
+[LOWER_INF1]
+name=LOWER_INF
+declaration=anyrange
+category=Range Functions
+description=Does the range have no lower bound? (A lower bound of -Infinity returns\nfalse.)
+[LOWER_INF2]
+name=LOWER_INF
+declaration=anymultirange
+category=Range Functions
+description=Does the multirange have no lower bound? (A lower bound of -Infinity\nreturns false.)
[LPAD]
-declaration=string,length,pad_string
+declaration=string text, length integer [, fill text ]
category=String Functions
-description=The PostgreSQL lpad function returns a string that is left-padded with a specified string to a certain length.
-[LTRIM]
-declaration=string,trim_character
+description=Extends the string to length length by prepending the characters fill (a\nspace by default). If the string is already longer than length then it is\ntruncated (on the right).
+[LSEG]
+declaration=box
+category=Geometric Functions
+description=Extracts box's diagonal as a line segment.
+[LTRIM1]
+name=LTRIM
+declaration=string text [, characters text ]
category=String Functions
-description=The PostgreSQL ltrim function removes all specified characters from the left-hand side of a string.
+description=Removes the longest string containing only characters in characters (a\nspace by default) from the start of string.
+[LTRIM2]
+name=LTRIM
+declaration=bytes bytea, bytesremoved bytea
+category=Binary String Functions
+description=Removes the longest string containing only bytes appearing in bytesremoved\nfrom the start of bytes.
+[MACADDR8_SET7BIT]
+declaration=macaddr8
+category=Network Address Functions
+description=Sets the 7th bit of the address to one, creating what is known as modified\nEUI-64, for inclusion in an IPv6 address.
+[MAKEACLITEM]
+declaration=grantee oid, grantor oid, privileges text, is_grantable boolean
+category=Session Information Functions
+description=Constructs an aclitem with the given properties. privileges is a\ncomma-separated list of privilege names such as SELECT, INSERT, etc, all of\nwhich are set in the result. (Case of the privilege string is not\nsignificant, and extra whitespace is allowed between but not within\nprivilege names.)
+[MAKE_DATE]
+declaration=year int, month int, day int
+category=Date/Time Functions
+description=Create date from year, month and day fields (negative years signify BC)
+[MAKE_INTERVAL]
+declaration=[ years int [, months int [, weeks int [, days int [, hours int [, mins int [, secs double precision ]]]]]]]
+category=Date/Time Functions
+description=Create interval from years, months, weeks, days, hours, minutes and seconds\nfields, each of which can default to zero
+[MAKE_TIME]
+declaration=hour int, min int, sec double precision
+category=Date/Time Functions
+description=Create time from hour, minute and seconds fields
+[MAKE_TIMESTAMP]
+declaration=year int, month int, day int, hour int, min int, sec double precision
+category=Date/Time Functions
+description=Create timestamp from year, month, day, hour, minute and seconds fields\n(negative years signify BC)
+[MAKE_TIMESTAMPTZ]
+declaration=year int, month int, day int, hour int, min int, sec double precision [, timezone text ]
+category=Date/Time Functions
+description=Create timestamp with time zone from year, month, day, hour, minute and\nseconds fields (negative years signify BC). If timezone is not specified,\nthe current time zone is used; the examples assume the session time zone is\nEurope/London
+[MASKLEN]
+declaration=inet
+category=Network Address Functions
+description=Returns the netmask length in bits.
[MAX]
-declaration=expression1, expression2, ... expression_n,aggregate_expression,tables,WHERE conditions
-category=Numeric/Math Functions
-description=The PostgreSQL max function returns the maximum value of an expression.
+declaration=see text
+category=Aggregate Functions
+description=Computes the maximum of the non-null input values. Available for any\nnumeric, string, date/time, or enum type, as well as inet, interval, money,\noid, pg_lsn, tid, xid8, and arrays of any of these types.
+[MD51]
+name=MD5
+declaration=text
+category=String Functions
+description=Computes the MD5 hash of the argument, with the result written in\nhexadecimal.
+[MD52]
+name=MD5
+declaration=bytea
+category=Binary String Functions
+description=Computes the MD5 hash of the binary string, with the result written in\nhexadecimal.
+[MERGE_ACTION]
+declaration=
+category=Merge Support Functions
+description=Returns the merge action command executed for the current row. This will be\n'INSERT', 'UPDATE', or 'DELETE'.
[MIN]
-declaration=expression1, expression2, ... expression_n,aggregate_expression,tables,WHERE conditions
+declaration=see text
+category=Aggregate Functions
+description=Computes the minimum of the non-null input values. Available for any\nnumeric, string, date/time, or enum type, as well as inet, interval, money,\noid, pg_lsn, tid, xid8, and arrays of any of these types.
+[MIN_SCALE]
+declaration=numeric
category=Numeric/Math Functions
-description=The PostgreSQL min function returns the minimum value of an expression.
+description=Minimum scale (number of fractional decimal digits) needed to represent the\nsupplied value precisely
[MOD]
-declaration=n,m
+declaration=y numeric_type, x numeric_type
category=Numeric/Math Functions
-description=The PostgreSQL mod function returns the remainder of n divided by m.
+description=Remainder of y/x; available for smallint, integer, bigint, and numeric
+[MODE]
+declaration=
+category=Aggregate Functions
+description=Computes the mode, the most frequent value of the aggregated argument\n(arbitrarily choosing the first one if there are multiple equally-frequent\nvalues). The aggregated argument must be of a sortable type.
+[MULTIRANGE]
+declaration=anyrange
+category=Range Functions
+description=Returns a multirange containing just the given range.
+[MXID_AGE]
+declaration=xid
+category=Session Information Functions
+description=Returns the number of multixacts IDs between the supplied multixact ID and\nthe current multixacts counter.
+[NETMASK]
+declaration=inet
+category=Network Address Functions
+description=Computes the network mask for the address's network.
+[NETWORK]
+declaration=inet
+category=Network Address Functions
+description=Returns the network part of the address, zeroing out whatever is to the\nright of the netmask. (This is equivalent to casting the value to cidr.)
+[NEXTVAL]
+declaration=regclass
+category=Sequence Manipulation Functions
+description=Advances the sequence object to its next value and returns that value. This\nis done atomically: even if multiple sessions execute nextval concurrently,\neach will safely receive a distinct sequence value. If the sequence object\nhas been created with default parameters, successive nextval calls will\nreturn successive values beginning with 1. Other behaviors can be obtained\nby using appropriate parameters in the CREATE SEQUENCE command.
[NOW]
-declaration=precision
+declaration=
category=Date/Time Functions
-description=The PostgreSQL now function returns the current date and time with the time zone.
-[POSITION]
-declaration=substring,string
+description=Current date and time (start of current transaction); see Section 9.9.5
+[NPOINTS]
+declaration=geometric_type
+category=Geometric Functions
+description=Returns the number of points. Available for path, polygon.
+[NTH_VALUE]
+declaration=value anyelement, n integer
+category=Window Functions
+description=Returns value evaluated at the row that is the n'th row of the window frame\n(counting from 1); returns NULL if there is no such row.
+[NTILE]
+declaration=num_buckets integer
+category=Window Functions
+description=Returns an integer ranging from 1 to the argument value, dividing the\npartition as equally as possible.
+[NUMNODE]
+declaration=tsquery
+category=Text Search Functions
+description=Returns the number of lexemes plus operators in the tsquery.
+[OBJ_DESCRIPTION]
+declaration=object oid, catalog name
+category=Session Information Functions
+description=Returns the comment for a database object specified by its OID and the name\nof the containing system catalog. For example, obj_description(123456,\n'pg_class') would retrieve the comment for the table with OID 123456.
+[OCTET_LENGTH1]
+name=OCTET_LENGTH
+declaration=text
+category=String Functions
+description=Returns number of bytes in the string.
+[OCTET_LENGTH2]
+name=OCTET_LENGTH
+declaration=character
+category=String Functions
+description=Returns number of bytes in the string. Since this version of the function\naccepts type character directly, it will not strip trailing spaces.
+[OCTET_LENGTH3]
+name=OCTET_LENGTH
+declaration=bytea
+category=Binary String Functions
+description=Returns number of bytes in the binary string.
+[OCTET_LENGTH4]
+name=OCTET_LENGTH
+declaration=bit
+category=Bit String Functions
+description=Returns number of bytes in the bit string.
+[OVERLAY1]
+name=OVERLAY
+declaration=string text PLACING newsubstring text FROM start integer [ FOR count integer ]
+category=String Functions
+description=Replaces the substring of string that starts at the start'th character and\nextends for count characters with newsubstring. If count is omitted, it\ndefaults to the length of newsubstring.
+[OVERLAY2]
+name=OVERLAY
+declaration=bytes bytea PLACING newsubstring bytea FROM start integer [ FOR count integer ]
+category=Binary String Functions
+description=Replaces the substring of bytes that starts at the start'th byte and\nextends for count bytes with newsubstring. If count is omitted, it defaults\nto the length of newsubstring.
+[OVERLAY3]
+name=OVERLAY
+declaration=bits bit PLACING newsubstring bit FROM start integer [ FOR count integer ]
+category=Bit String Functions
+description=Replaces the substring of bits that starts at the start'th bit and extends\nfor count bits with newsubstring. If count is omitted, it defaults to the\nlength of newsubstring.
+[PARSE_IDENT]
+declaration=qualified_identifier text [, strict_mode boolean DEFAULT true ]
+category=String Functions
+description=Splits qualified_identifier into an array of identifiers, removing any\nquoting of individual identifiers. By default, extra characters after the\nlast identifier are considered an error; but if the second parameter is\nfalse, then such extra characters are ignored. (This behavior is useful for\nparsing names for objects like functions.) Note that this function does not\ntruncate over-length identifiers. If you want truncation you can cast the\nresult to name[].
+[PATH]
+declaration=polygon
+category=Geometric Functions
+description=Converts polygon to a closed path with the same list of points.
+[PCLOSE]
+declaration=path
+category=Geometric Functions
+description=Converts path to closed form.
+[PERCENTILE_DISC]
+declaration=fraction double precision
+category=Aggregate Functions
+description=Computes the discrete percentile, the first value within the ordered set of\naggregated argument values whose position in the ordering equals or exceeds\nthe specified fraction. The aggregated argument must be of a sortable type.
+[PERCENT_RANK1]
+name=PERCENT_RANK
+declaration=args
+category=Aggregate Functions
+description=Computes the relative rank of the hypothetical row, that is (rank - 1) /\n(total rows - 1). The value thus ranges from 0 to 1 inclusive.
+[PERCENT_RANK2]
+name=PERCENT_RANK
+declaration=
+category=Window Functions
+description=Returns the relative rank of the current row, that is (rank - 1) / (total\npartition rows - 1). The value thus ranges from 0 to 1 inclusive.
+[PG_ADVISORY_UNLOCK_ALL]
+declaration=
+category=System Administration Functions
+description=Releases all session-level advisory locks held by the current session.\n(This function is implicitly invoked at session end, even if the client\ndisconnects ungracefully.)
+[PG_AVAILABLE_WAL_SUMMARIES]
+declaration=
+category=Session Information Functions
+description=Returns information about the WAL summary files present in the data\ndirectory, under pg_wal/summaries. One row will be returned per WAL summary\nfile. Each file summarizes WAL on the indicated TLI within the indicated\nLSN range. This function might be useful to determine whether enough WAL\nsummaries are present on the server to take an incremental backup based on\nsome prior backup whose start LSN is known.
+[PG_BACKEND_PID]
+declaration=
+category=Session Information Functions
+description=Returns the process ID of the server process attached to the current\nsession.
+[PG_BACKUP_START]
+declaration=label text [, fast boolean ]
+category=System Administration Functions
+description=Prepares the server to begin an on-line backup. The only required parameter\nis an arbitrary user-defined label for the backup. (Typically this would be\nthe name under which the backup dump file will be stored.) If the optional\nsecond parameter is given as true, it specifies executing pg_backup_start\nas quickly as possible. This forces an immediate checkpoint which will\ncause a spike in I/O operations, slowing any concurrently executing\nqueries.
+[PG_BACKUP_STOP]
+declaration=[wait_for_archive boolean ]
+category=System Administration Functions
+description=Finishes performing an on-line backup. The desired contents of the backup\nlabel file and the tablespace map file are returned as part of the result\nof the function and must be written to files in the backup area. These\nfiles must not be written to the live data directory (doing so will cause\nPostgreSQL to fail to restart in the event of a crash).
+[PG_BASETYPE]
+declaration=regtype
+category=Session Information Functions
+description=Returns the OID of the base type of a domain identified by its type OID. If\nthe argument is the OID of a non-domain type, returns the argument as-is.\nReturns NULL if the argument is not a valid type OID. If there's a chain of\ndomain dependencies, it will recurse until finding the base type.
+[PG_BLOCKING_PIDS]
+declaration=integer
+category=Session Information Functions
+description=Returns an array of the process ID(s) of the sessions that are blocking the\nserver process with the specified process ID from acquiring a lock, or an\nempty array if there is no such server process or it is not blocked.
+[PG_CANCEL_BACKEND]
+declaration=pid integer
+category=System Administration Functions
+description=Cancels the current query of the session whose backend process has the\nspecified process ID. This is also allowed if the calling role is a member\nof the role whose backend is being canceled or the calling role has\nprivileges of pg_signal_backend, however only superusers can cancel\nsuperuser backends.
+[PG_CHAR_TO_ENCODING]
+declaration=encoding name
+category=Session Information Functions
+description=Converts the supplied encoding name into an integer representing the\ninternal identifier used in some system catalog tables. Returns -1 if an\nunknown encoding name is provided.
+[PG_CLIENT_ENCODING]
+declaration=
+category=String Functions
+description=Returns current client encoding name.
+[PG_COLLATION_ACTUAL_VERSION]
+declaration=oid
+category=System Administration Functions
+description=Returns the actual version of the collation object as it is currently\ninstalled in the operating system. If this is different from the value in\npg_collation.collversion, then objects depending on the collation might\nneed to be rebuilt. See also ALTER COLLATION.
+[PG_COLLATION_IS_VISIBLE]
+declaration=collation oid
+category=Session Information Functions
+description=Is collation visible in search path?
+[PG_COLUMN_COMPRESSION]
+declaration="any"
+category=System Administration Functions
+description=Shows the compression algorithm that was used to compress an individual\nvariable-length value. Returns NULL if the value is not compressed.
+[PG_COLUMN_SIZE]
+declaration="any"
+category=System Administration Functions
+description=Shows the number of bytes used to store any individual data value. If\napplied directly to a table column value, this reflects any compression\nthat was done.
+[PG_COLUMN_TOAST_CHUNK_ID]
+declaration="any"
+category=System Administration Functions
+description=Shows the chunk_id of an on-disk TOASTed value. Returns NULL if the value\nis un-TOASTed or not on-disk. See Section 65.2 for more information about\nTOAST.
+[PG_CONF_LOAD_TIME]
+declaration=
+category=Session Information Functions
+description=Returns the time when the server configuration files were last loaded. If\nthe current session was alive at the time, this will be the time when the\nsession itself re-read the configuration files (so the reading will vary a\nlittle in different sessions). Otherwise it is the time when the postmaster\nprocess re-read the configuration files.
+[PG_CONTROL_CHECKPOINT]
+declaration=
+category=Session Information Functions
+description=Returns information about current checkpoint state, as shown in Table 9.87.
+[PG_CONTROL_INIT]
+declaration=
+category=Session Information Functions
+description=Returns information about cluster initialization state, as shown in Table\n9.89.
+[PG_CONTROL_RECOVERY]
+declaration=
+category=Session Information Functions
+description=Returns information about recovery state, as shown in Table 9.90.
+[PG_CONTROL_SYSTEM]
+declaration=
+category=Session Information Functions
+description=Returns information about current control file state, as shown in Table\n9.88.
+[PG_CONVERSION_IS_VISIBLE]
+declaration=conversion oid
+category=Session Information Functions
+description=Is conversion visible in search path?
+[PG_COPY_LOGICAL_REPLICATION_SLOT]
+declaration=src_slot_name name, dst_slot_name name [, temporary boolean [, plugin name ]]
+category=System Administration Functions
+description=Copies an existing logical replication slot named src_slot_name to a\nlogical replication slot named dst_slot_name, optionally changing the\noutput plugin and persistence. The copied logical slot starts from the same\nLSN as the source logical slot. Both temporary and plugin are optional; if\nthey are omitted, the values of the source slot are used.
+[PG_COPY_PHYSICAL_REPLICATION_SLOT]
+declaration=src_slot_name name, dst_slot_name name [, temporary boolean ]
+category=System Administration Functions
+description=Copies an existing physical replication slot named src_slot_name to a\nphysical replication slot named dst_slot_name. The copied physical slot\nstarts to reserve WAL from the same LSN as the source slot. temporary is\noptional. If temporary is omitted, the same value as the source slot is\nused.
+[PG_CREATE_LOGICAL_REPLICATION_SLOT]
+declaration=slot_name name, plugin name [, temporary boolean, twophase boolean, failover boolean ]
+category=System Administration Functions
+description=Creates a new logical (decoding) replication slot named slot_name using the\noutput plugin plugin. The optional third parameter, temporary, when set to\ntrue, specifies that the slot should not be permanently stored to disk and\nis only meant for use by the current session. Temporary slots are also\nreleased upon any error. The optional fourth parameter, twophase, when set\nto true, specifies that the decoding of prepared transactions is enabled\nfor this slot. The optional fifth parameter, failover, when set to true,\nspecifies that this slot is enabled to be synced to the standbys so that\nlogical replication can be resumed after failover. A call to this function\nhas the same effect as the replication protocol command\nCREATE_REPLICATION_SLOT ... LOGICAL.
+[PG_CREATE_PHYSICAL_REPLICATION_SLOT]
+declaration=slot_name name [, immediately_reserve boolean, temporary boolean ]
+category=System Administration Functions
+description=Creates a new physical replication slot named slot_name. The optional\nsecond parameter, when true, specifies that the LSN for this replication\nslot be reserved immediately; otherwise the LSN is reserved on first\nconnection from a streaming replication client. Streaming changes from a\nphysical slot is only possible with the streaming-replication protocol -\nsee Section 53.4. The optional third parameter, temporary, when set to\ntrue, specifies that the slot should not be permanently stored to disk and\nis only meant for use by the current session. Temporary slots are also\nreleased upon any error. This function corresponds to the replication\nprotocol command CREATE_REPLICATION_SLOT ... PHYSICAL.
+[PG_CREATE_RESTORE_POINT]
+declaration=name text
+category=System Administration Functions
+description=Creates a named marker record in the write-ahead log that can later be used\nas a recovery target, and returns the corresponding write-ahead log\nlocation. The given name can then be used with recovery_target_name to\nspecify the point up to which recovery will proceed. Avoid creating\nmultiple restore points with the same name, since recovery will stop at the\nfirst one whose name matches the recovery target.
+[PG_CURRENT_SNAPSHOT]
+declaration=
+category=Session Information Functions
+description=Returns a current snapshot, a data structure showing which transaction IDs\nare now in-progress. Only top-level transaction IDs are included in the\nsnapshot; subtransaction IDs are not shown; see Section 66.3 for details.
+[PG_CURRENT_WAL_FLUSH_LSN]
+declaration=
+category=System Administration Functions
+description=Returns the current write-ahead log flush location (see notes below).
+[PG_CURRENT_WAL_INSERT_LSN]
+declaration=
+category=System Administration Functions
+description=Returns the current write-ahead log insert location (see notes below).
+[PG_CURRENT_WAL_LSN]
+declaration=
+category=System Administration Functions
+description=Returns the current write-ahead log write location (see notes below).
+[PG_CURRENT_XACT_ID]
+declaration=
+category=Session Information Functions
+description=Returns the current transaction's ID. It will assign a new one if the\ncurrent transaction does not have one already (because it has not performed\nany database updates); see Section 66.1 for details. If executed in a\nsubtransaction, this will return the top-level transaction ID; see Section\n66.3 for details.
+[PG_CURRENT_XACT_ID_IF_ASSIGNED]
+declaration=
+category=Session Information Functions
+description=Returns the current transaction's ID, or NULL if no ID is assigned yet.\n(It's best to use this variant if the transaction might otherwise be\nread-only, to avoid unnecessary consumption of an XID.) If executed in a\nsubtransaction, this will return the top-level transaction ID.
+[PG_DATABASE_COLLATION_ACTUAL_VERSION]
+declaration=oid
+category=System Administration Functions
+description=Returns the actual version of the database's collation as it is currently\ninstalled in the operating system. If this is different from the value in\npg_database.datcollversion, then objects depending on the collation might\nneed to be rebuilt. See also ALTER DATABASE.
+[PG_DESCRIBE_OBJECT]
+declaration=classid oid, objid oid, objsubid integer
+category=Session Information Functions
+description=Returns a textual description of a database object identified by catalog\nOID, object OID, and sub-object ID (such as a column number within a table;\nthe sub-object ID is zero when referring to a whole object). This\ndescription is intended to be human-readable, and might be translated,\ndepending on server configuration. This is especially useful to determine\nthe identity of an object referenced in the pg_depend catalog. This\nfunction returns NULL values for undefined objects.
+[PG_DROP_REPLICATION_SLOT]
+declaration=slot_name name
+category=System Administration Functions
+description=Drops the physical or logical replication slot named slot_name. Same as\nreplication protocol command DROP_REPLICATION_SLOT. For logical slots, this\nmust be called while connected to the same database the slot was created\non.
+[PG_ENCODING_TO_CHAR]
+declaration=encoding integer
+category=Session Information Functions
+description=Converts the integer used as the internal identifier of an encoding in some\nsystem catalog tables into a human-readable string. Returns an empty string\nif an invalid encoding number is provided.
+[PG_EXPORT_SNAPSHOT]
+declaration=
+category=System Administration Functions
+description=Saves the transaction's current snapshot and returns a text string\nidentifying the snapshot. This string must be passed (outside the database)\nto clients that want to import the snapshot. The snapshot is available for\nimport only until the end of the transaction that exported it.
+[PG_FILENODE_RELATION]
+declaration=tablespace oid, filenode oid
+category=System Administration Functions
+description=Returns a relation's OID given the tablespace OID and filenode it is stored\nunder. This is essentially the inverse mapping of pg_relation_filepath. For\na relation in the database's default tablespace, the tablespace can be\nspecified as zero. Returns NULL if no relation in the current database is\nassociated with the given values.
+[PG_FUNCTION_IS_VISIBLE]
+declaration=function oid
+category=Session Information Functions
+description=Is function visible in search path? (This also works for procedures and\naggregates.)
+[PG_GET_CATALOG_FOREIGN_KEYS]
+declaration=
+category=Session Information Functions
+description=Returns a set of records describing the foreign key relationships that\nexist within the PostgreSQL system catalogs. The fktable column contains\nthe name of the referencing catalog, and the fkcols column contains the\nname(s) of the referencing column(s). Similarly, the pktable column\ncontains the name of the referenced catalog, and the pkcols column contains\nthe name(s) of the referenced column(s). If is_array is true, the last\nreferencing column is an array, each of whose elements should match some\nentry in the referenced catalog. If is_opt is true, the referencing\ncolumn(s) are allowed to contain zeroes instead of a valid reference.
+[PG_GET_CONSTRAINTDEF]
+declaration=constraint oid [, pretty boolean ]
+category=Session Information Functions
+description=Reconstructs the creating command for a constraint. (This is a decompiled\nreconstruction, not the original text of the command.)
+[PG_GET_EXPR]
+declaration=expr pg_node_tree, relation oid [, pretty boolean ]
+category=Session Information Functions
+description=Decompiles the internal form of an expression stored in the system\ncatalogs, such as the default value for a column. If the expression might\ncontain Vars, specify the OID of the relation they refer to as the second\nparameter; if no Vars are expected, passing zero is sufficient.
+[PG_GET_FUNCTIONDEF]
+declaration=func oid
+category=Session Information Functions
+description=Reconstructs the creating command for a function or procedure. (This is a\ndecompiled reconstruction, not the original text of the command.) The\nresult is a complete CREATE OR REPLACE FUNCTION or CREATE OR REPLACE\nPROCEDURE statement.
+[PG_GET_FUNCTION_ARGUMENTS]
+declaration=func oid
+category=Session Information Functions
+description=Reconstructs the argument list of a function or procedure, in the form it\nwould need to appear in within CREATE FUNCTION (including default values).
+[PG_GET_FUNCTION_IDENTITY_ARGUMENTS]
+declaration=func oid
+category=Session Information Functions
+description=Reconstructs the argument list necessary to identify a function or\nprocedure, in the form it would need to appear in within commands such as\nALTER FUNCTION. This form omits default values.
+[PG_GET_FUNCTION_RESULT]
+declaration=func oid
+category=Session Information Functions
+description=Reconstructs the RETURNS clause of a function, in the form it would need to\nappear in within CREATE FUNCTION. Returns NULL for a procedure.
+[PG_GET_INDEXDEF]
+declaration=index oid [, column integer, pretty boolean ]
+category=Session Information Functions
+description=Reconstructs the creating command for an index. (This is a decompiled\nreconstruction, not the original text of the command.) If column is\nsupplied and is not zero, only the definition of that column is\nreconstructed.
+[PG_GET_KEYWORDS]
+declaration=
+category=Session Information Functions
+description=Returns a set of records describing the SQL keywords recognized by the\nserver. The word column contains the keyword. The catcode column contains a\ncategory code: U for an unreserved keyword, C for a keyword that can be a\ncolumn name, T for a keyword that can be a type or function name, or R for\na fully reserved keyword. The barelabel column contains true if the keyword\ncan be used as a "bare" column label in SELECT lists, or false if it can\nonly be used after AS. The catdesc column contains a possibly-localized\nstring describing the keyword's category. The baredesc column contains a\npossibly-localized string describing the keyword's column label status.
+[PG_GET_OBJECT_ADDRESS]
+declaration=type text, object_names text[], object_args text[]
+category=Session Information Functions
+description=Returns a row containing enough information to uniquely identify the\ndatabase object specified by a type code and object name and argument\narrays. The returned values are the ones that would be used in system\ncatalogs such as pg_depend; they can be passed to other system functions\nsuch as pg_describe_object or pg_identify_object. classid is the OID of the\nsystem catalog containing the object; objid is the OID of the object\nitself, and objsubid is the sub-object ID, or zero if none. This function\nis the inverse of pg_identify_object_as_address. Undefined objects are\nidentified with NULL values.
+[PG_GET_PARTKEYDEF]
+declaration=table oid
+category=Session Information Functions
+description=Reconstructs the definition of a partitioned table's partition key, in the\nform it would have in the PARTITION BY clause of CREATE TABLE. (This is a\ndecompiled reconstruction, not the original text of the command.)
+[PG_GET_RULEDEF]
+declaration=rule oid [, pretty boolean ]
+category=Session Information Functions
+description=Reconstructs the creating command for a rule. (This is a decompiled\nreconstruction, not the original text of the command.)
+[PG_GET_SERIAL_SEQUENCE]
+declaration=table text, column text
+category=Session Information Functions
+description=Returns the name of the sequence associated with a column, or NULL if no\nsequence is associated with the column. If the column is an identity\ncolumn, the associated sequence is the sequence internally created for that\ncolumn. For columns created using one of the serial types (serial,\nsmallserial, bigserial), it is the sequence created for that serial column\ndefinition. In the latter case, the association can be modified or removed\nwith ALTER SEQUENCE OWNED BY. (This function probably should have been\ncalled pg_get_owned_sequence; its current name reflects the fact that it\nhas historically been used with serial-type columns.) The first parameter\nis a table name with optional schema, and the second parameter is a column\nname. Because the first parameter potentially contains both schema and\ntable names, it is parsed per usual SQL rules, meaning it is lower-cased by\ndefault. The second parameter, being just a column name, is treated\nliterally and so has its case preserved. The result is suitably formatted\nfor passing to the sequence functions (see Section 9.17).
+[PG_GET_STATISTICSOBJDEF]
+declaration=statobj oid
+category=Session Information Functions
+description=Reconstructs the creating command for an extended statistics object. (This\nis a decompiled reconstruction, not the original text of the command.)
+[PG_GET_TRIGGERDEF]
+declaration=trigger oid [, pretty boolean ]
+category=Session Information Functions
+description=Reconstructs the creating command for a trigger. (This is a decompiled\nreconstruction, not the original text of the command.)
+[PG_GET_USERBYID]
+declaration=role oid
+category=Session Information Functions
+description=Returns a role's name given its OID.
+[PG_GET_VIEWDEF]
+declaration=view oid [, pretty boolean ]
+category=Session Information Functions
+description=Reconstructs the underlying SELECT command for a view or materialized view.\n(This is a decompiled reconstruction, not the original text of the\ncommand.)
+[PG_GET_WAL_REPLAY_PAUSE_STATE]
+declaration=
+category=System Administration Functions
+description=Returns recovery pause state. The return values are not paused if pause is\nnot requested, pause requested if pause is requested but recovery is not\nyet paused, and paused if the recovery is actually paused.
+[PG_GET_WAL_RESOURCE_MANAGERS]
+declaration=
+category=System Administration Functions
+description=Returns the currently-loaded WAL resource managers in the system. The\ncolumn rm_builtin indicates whether it's a built-in resource manager, or a\ncustom resource manager loaded by an extension.
+[PG_GET_WAL_SUMMARIZER_STATE]
+declaration=
+category=Session Information Functions
+description=Returns information about the progress of the WAL summarizer. If the WAL\nsummarizer has never run since the instance was started, then\nsummarized_tli and summarized_lsn will be 0 and 0/0 respectively;\notherwise, they will be the TLI and ending LSN of the last WAL summary file\nwritten to disk. If the WAL summarizer is currently running, pending_lsn\nwill be the ending LSN of the last record that it has consumed, which must\nalways be greater than or equal to summarized_lsn; if the WAL summarizer is\nnot running, it will be equal to summarized_lsn. summarizer_pid is the PID\nof the WAL summarizer process, if it is running, and otherwise NULL.
+[PG_HAS_ROLE]
+declaration=[ user name or oid, ] role text or oid, privilege text
+category=Session Information Functions
+description=Does user have privilege for role? Allowable privilege types are MEMBER,\nUSAGE, and SET. MEMBER denotes direct or indirect membership in the role\nwithout regard to what specific privileges may be conferred. USAGE denotes\nwhether the privileges of the role are immediately available without doing\nSET ROLE, while SET denotes whether it is possible to change to the role\nusing the SET ROLE command. WITH ADMIN OPTION or WITH GRANT OPTION can be\nadded to any of these privilege types to test whether the ADMIN privilege\nis held (all six spellings test the same thing). This function does not\nallow the special case of setting user to public, because the PUBLIC\npseudo-role can never be a member of real roles.
+[PG_IDENTIFY_OBJECT]
+declaration=classid oid, objid oid, objsubid integer
+category=Session Information Functions
+description=Returns a row containing enough information to uniquely identify the\ndatabase object specified by catalog OID, object OID and sub-object ID.\nThis information is intended to be machine-readable, and is never\ntranslated. type identifies the type of database object; schema is the\nschema name that the object belongs in, or NULL for object types that do\nnot belong to schemas; name is the name of the object, quoted if necessary,\nif the name (along with schema name, if pertinent) is sufficient to\nuniquely identify the object, otherwise NULL; identity is the complete\nobject identity, with the precise format depending on object type, and each\nname within the format being schema-qualified and quoted as necessary.\nUndefined objects are identified with NULL values.
+[PG_IDENTIFY_OBJECT_AS_ADDRESS]
+declaration=classid oid, objid oid, objsubid integer
+category=Session Information Functions
+description=Returns a row containing enough information to uniquely identify the\ndatabase object specified by catalog OID, object OID and sub-object ID. The\nreturned information is independent of the current server, that is, it\ncould be used to identify an identically named object in another server.\ntype identifies the type of database object; object_names and object_args\nare text arrays that together form a reference to the object. These three\nvalues can be passed to pg_get_object_address to obtain the internal\naddress of the object.
+[PG_IMPORT_SYSTEM_COLLATIONS]
+declaration=schema regnamespace
+category=System Administration Functions
+description=Adds collations to the system catalog pg_collation based on all the locales\nit finds in the operating system. This is what initdb uses; see Section\n23.2.2 for more details. If additional locales are installed into the\noperating system later on, this function can be run again to add collations\nfor the new locales. Locales that match existing entries in pg_collation\nwill be skipped. (But collation objects based on locales that are no longer\npresent in the operating system are not removed by this function.) The\nschema parameter would typically be pg_catalog, but that is not a\nrequirement; the collations could be installed into some other schema as\nwell. The function returns the number of new collation objects it created.\nUse of this function is restricted to superusers.
+[PG_INDEXAM_HAS_PROPERTY]
+declaration=am oid, property text
+category=Session Information Functions
+description=Tests whether an index access method has the named property. Access method\nproperties are listed in Table 9.77. NULL is returned if the property name\nis not known or does not apply to the particular object, or if the OID does\nnot identify a valid object.
+[PG_INDEXES_SIZE]
+declaration=regclass
+category=System Administration Functions
+description=Computes the total disk space used by indexes attached to the specified\ntable.
+[PG_INDEX_COLUMN_HAS_PROPERTY]
+declaration=index regclass, column integer, property text
+category=Session Information Functions
+description=Tests whether an index column has the named property. Common index column\nproperties are listed in Table 9.75. (Note that extension access methods\ncan define additional property names for their indexes.) NULL is returned\nif the property name is not known or does not apply to the particular\nobject, or if the OID or column number does not identify a valid object.
+[PG_INDEX_HAS_PROPERTY]
+declaration=index regclass, property text
+category=Session Information Functions
+description=Tests whether an index has the named property. Common index properties are\nlisted in Table 9.76. (Note that extension access methods can define\nadditional property names for their indexes.) NULL is returned if the\nproperty name is not known or does not apply to the particular object, or\nif the OID does not identify a valid object.
+[PG_INPUT_ERROR_INFO]
+declaration=string text, type text
+category=Session Information Functions
+description=Tests whether the given string is valid input for the specified data type;\nif not, return the details of the error that would have been thrown. If the\ninput is valid, the results are NULL. The inputs are the same as for\npg_input_is_valid.
+[PG_INPUT_IS_VALID]
+declaration=string text, type text
+category=Session Information Functions
+description=Tests whether the given string is valid input for the specified data type,\nreturning true or false.
+[PG_IS_IN_RECOVERY]
+declaration=
+category=System Administration Functions
+description=Returns true if recovery is still in progress.
+[PG_IS_OTHER_TEMP_SCHEMA]
+declaration=oid
+category=Session Information Functions
+description=Returns true if the given OID is the OID of another session's temporary\nschema. (This can be useful, for example, to exclude other sessions'\ntemporary tables from a catalog display.)
+[PG_IS_WAL_REPLAY_PAUSED]
+declaration=
+category=System Administration Functions
+description=Returns true if recovery pause is requested.
+[PG_JIT_AVAILABLE]
+declaration=
+category=Session Information Functions
+description=Returns true if a JIT compiler extension is available (see Chapter 30) and\nthe jit configuration parameter is set to on.
+[PG_LAST_COMMITTED_XACT]
+declaration=
+category=Session Information Functions
+description=Returns the transaction ID, commit timestamp and replication origin of the\nlatest committed transaction.
+[PG_LAST_WAL_RECEIVE_LSN]
+declaration=
+category=System Administration Functions
+description=Returns the last write-ahead log location that has been received and synced\nto disk by streaming replication. While streaming replication is in\nprogress this will increase monotonically. If recovery has completed then\nthis will remain static at the location of the last WAL record received and\nsynced to disk during recovery. If streaming replication is disabled, or if\nit has not yet started, the function returns NULL.
+[PG_LAST_WAL_REPLAY_LSN]
+declaration=
+category=System Administration Functions
+description=Returns the last write-ahead log location that has been replayed during\nrecovery. If recovery is still in progress this will increase\nmonotonically. If recovery has completed then this will remain static at\nthe location of the last WAL record applied during recovery. When the\nserver has been started normally without recovery, the function returns\nNULL.
+[PG_LAST_XACT_REPLAY_TIMESTAMP]
+declaration=
+category=System Administration Functions
+description=Returns the time stamp of the last transaction replayed during recovery.\nThis is the time at which the commit or abort WAL record for that\ntransaction was generated on the primary. If no transactions have been\nreplayed during recovery, the function returns NULL. Otherwise, if recovery\nis still in progress this will increase monotonically. If recovery has\ncompleted then this will remain static at the time of the last transaction\napplied during recovery. When the server has been started normally without\nrecovery, the function returns NULL.
+[PG_LISTENING_CHANNELS]
+declaration=
+category=Session Information Functions
+description=Returns the set of names of asynchronous notification channels that the\ncurrent session is listening to.
+[PG_LOGICAL_SLOT_GET_BINARY_CHANGES]
+declaration=slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[]
+category=System Administration Functions
+description=Behaves just like the pg_logical_slot_get_changes() function, except that\nchanges are returned as bytea.
+[PG_LOGICAL_SLOT_GET_CHANGES]
+declaration=slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[]
+category=System Administration Functions
+description=Returns changes in the slot slot_name, starting from the point from which\nchanges have been consumed last. If upto_lsn and upto_nchanges are NULL,\nlogical decoding will continue until end of WAL. If upto_lsn is non-NULL,\ndecoding will include only those transactions which commit prior to the\nspecified LSN. If upto_nchanges is non-NULL, decoding will stop when the\nnumber of rows produced by decoding exceeds the specified value. Note,\nhowever, that the actual number of rows returned may be larger, since this\nlimit is only checked after adding the rows produced when decoding each new\ntransaction commit. If the specified slot is a logical failover slot then\nthe function will not return until all physical slots specified in\nsynchronized_standby_slots have confirmed WAL receipt.
+[PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES]
+declaration=slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[]
+category=System Administration Functions
+description=Behaves just like the pg_logical_slot_peek_changes() function, except that\nchanges are returned as bytea.
+[PG_LOGICAL_SLOT_PEEK_CHANGES]
+declaration=slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[]
+category=System Administration Functions
+description=Behaves just like the pg_logical_slot_get_changes() function, except that\nchanges are not consumed; that is, they will be returned again on future\ncalls.
+[PG_LOG_BACKEND_MEMORY_CONTEXTS]
+declaration=pid integer
+category=System Administration Functions
+description=Requests to log the memory contexts of the backend with the specified\nprocess ID. This function can send the request to backends and auxiliary\nprocesses except logger. These memory contexts will be logged at LOG\nmessage level. They will appear in the server log based on the log\nconfiguration set (see Section 19.8 for more information), but will not be\nsent to the client regardless of client_min_messages.
+[PG_LOG_STANDBY_SNAPSHOT]
+declaration=
+category=System Administration Functions
+description=Take a snapshot of running transactions and write it to WAL, without having\nto wait for bgwriter or checkpointer to log one. This is useful for logical\ndecoding on standby, as logical slot creation has to wait until such a\nrecord is replayed on the standby.
+[PG_LS_ARCHIVE_STATUSDIR]
+declaration=
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's WAL archive status directory (pg_wal/archive_status).\nFilenames beginning with a dot, directories, and other special files are\nexcluded.
+[PG_LS_DIR]
+declaration=dirname text [, missing_ok boolean, include_dot_dirs boolean ]
+category=System Administration Functions
+description=Returns the names of all files (and directories and other special files) in\nthe specified directory. The include_dot_dirs parameter indicates whether\n"." and ".." are to be included in the result set; the default is to\nexclude them. Including them can be useful when missing_ok is true, to\ndistinguish an empty directory from a non-existent directory.
+[PG_LS_LOGDIR]
+declaration=
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's log directory. Filenames beginning with a dot,\ndirectories, and other special files are excluded.
+[PG_LS_LOGICALMAPDIR]
+declaration=
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's pg_logical/mappings directory. Filenames beginning\nwith a dot, directories, and other special files are excluded.
+[PG_LS_LOGICALSNAPDIR]
+declaration=
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's pg_logical/snapshots directory. Filenames beginning\nwith a dot, directories, and other special files are excluded.
+[PG_LS_REPLSLOTDIR]
+declaration=slot_name text
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's pg_replslot/slot_name directory, where slot_name is\nthe name of the replication slot provided as input of the function.\nFilenames beginning with a dot, directories, and other special files are\nexcluded.
+[PG_LS_TMPDIR]
+declaration=[ tablespace oid ]
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the temporary file directory for the specified tablespace. If\ntablespace is not provided, the pg_default tablespace is examined.\nFilenames beginning with a dot, directories, and other special files are\nexcluded.
+[PG_LS_WALDIR]
+declaration=
+category=System Administration Functions
+description=Returns the name, size, and last modification time (mtime) of each ordinary\nfile in the server's write-ahead log (WAL) directory. Filenames beginning\nwith a dot, directories, and other special files are excluded.
+[PG_MY_TEMP_SCHEMA]
+declaration=
+category=Session Information Functions
+description=Returns the OID of the current session's temporary schema, or zero if it\nhas none (because it has not created any temporary tables).
+[PG_NOTIFICATION_QUEUE_USAGE]
+declaration=
+category=Session Information Functions
+description=Returns the fraction (0–1) of the asynchronous notification queue's\nmaximum size that is currently occupied by notifications that are waiting\nto be processed. See LISTEN and NOTIFY for more information.
+[PG_OPCLASS_IS_VISIBLE]
+declaration=opclass oid
+category=Session Information Functions
+description=Is operator class visible in search path?
+[PG_OPERATOR_IS_VISIBLE]
+declaration=operator oid
+category=Session Information Functions
+description=Is operator visible in search path?
+[PG_OPFAMILY_IS_VISIBLE]
+declaration=opclass oid
+category=Session Information Functions
+description=Is operator family visible in search path?
+[PG_OPTIONS_TO_TABLE]
+declaration=options_array text[]
+category=Session Information Functions
+description=Returns the set of storage options represented by a value from\npg_class.reloptions or pg_attribute.attoptions.
+[PG_PARTITION_ANCESTORS]
+declaration=regclass
+category=System Administration Functions
+description=Lists the ancestor relations of the given partition, including the relation\nitself. Returns no rows if the relation does not exist or is not a\npartition or partitioned table.
+[PG_PARTITION_ROOT]
+declaration=regclass
+category=System Administration Functions
+description=Returns the top-most parent of the partition tree to which the given\nrelation belongs. Returns NULL if the relation does not exist or is not a\npartition or partitioned table.
+[PG_PARTITION_TREE]
+declaration=regclass
+category=System Administration Functions
+description=Lists the tables or indexes in the partition tree of the given partitioned\ntable or partitioned index, with one row for each partition. Information\nprovided includes the OID of the partition, the OID of its immediate\nparent, a boolean value telling if the partition is a leaf, and an integer\ntelling its level in the hierarchy. The level value is 0 for the input\ntable or index, 1 for its immediate child partitions, 2 for their\npartitions, and so on. Returns no rows if the relation does not exist or is\nnot a partition or partitioned table.
+[PG_POSTMASTER_START_TIME]
+declaration=
+category=Session Information Functions
+description=Returns the time when the server started.
+[PG_PROMOTE]
+declaration=wait boolean DEFAULT true, wait_seconds integer DEFAULT 60
+category=System Administration Functions
+description=Promotes a standby server to primary status. With wait set to true (the\ndefault), the function waits until promotion is completed or wait_seconds\nseconds have passed, and returns true if promotion is successful and false\notherwise. If wait is set to false, the function returns true immediately\nafter sending a SIGUSR1 signal to the postmaster to trigger promotion.
+[PG_READ_BINARY_FILE]
+declaration=filename text [, offset bigint, length bigint ] [, missing_ok boolean ]
+category=System Administration Functions
+description=Returns all or part of a file. This function is identical to pg_read_file\nexcept that it can read arbitrary binary data, returning the result as\nbytea not text; accordingly, no encoding checks are performed.
+[PG_READ_FILE]
+declaration=filename text [, offset bigint, length bigint ] [, missing_ok boolean ]
+category=System Administration Functions
+description=Returns all or part of a text file, starting at the given byte offset,\nreturning at most length bytes (less if the end of file is reached first).\nIf offset is negative, it is relative to the end of the file. If offset and\nlength are omitted, the entire file is returned. The bytes read from the\nfile are interpreted as a string in the database's encoding; an error is\nthrown if they are not valid in that encoding.
+[PG_RELATION_FILENODE]
+declaration=relation regclass
+category=System Administration Functions
+description=Returns the "filenode" number currently assigned to the specified relation.\nThe filenode is the base component of the file name(s) used for the\nrelation (see Section 65.1 for more information). For most relations the\nresult is the same as pg_class.relfilenode, but for certain system catalogs\nrelfilenode is zero and this function must be used to get the correct\nvalue. The function returns NULL if passed a relation that does not have\nstorage, such as a view.
+[PG_RELATION_FILEPATH]
+declaration=relation regclass
+category=System Administration Functions
+description=Returns the entire file path name (relative to the database cluster's data\ndirectory, PGDATA) of the relation.
+[PG_RELATION_SIZE]
+declaration=relation regclass [, fork text ]
+category=System Administration Functions
+description=Computes the disk space used by one "fork" of the specified relation. (Note\nthat for most purposes it is more convenient to use the higher-level\nfunctions pg_total_relation_size or pg_table_size, which sum the sizes of\nall forks.) With one argument, this returns the size of the main data fork\nof the relation. The second argument can be provided to specify which fork\nto examine:
+[PG_RELOAD_CONF]
+declaration=
+category=System Administration Functions
+description=Causes all processes of the PostgreSQL server to reload their configuration\nfiles. (This is initiated by sending a SIGHUP signal to the postmaster\nprocess, which in turn sends SIGHUP to each of its children.) You can use\nthe pg_file_settings, pg_hba_file_rules and pg_ident_file_mappings views to\ncheck the configuration files for possible errors, before reloading.
+[PG_REPLICATION_ORIGIN_ADVANCE]
+declaration=node_name text, lsn pg_lsn
+category=System Administration Functions
+description=Sets replication progress for the given node to the given location. This is\nprimarily useful for setting up the initial location, or setting a new\nlocation after configuration changes and similar. Be aware that careless\nuse of this function can lead to inconsistently replicated data.
+[PG_REPLICATION_ORIGIN_CREATE]
+declaration=node_name text
+category=System Administration Functions
+description=Creates a replication origin with the given external name, and returns the\ninternal ID assigned to it.
+[PG_REPLICATION_ORIGIN_DROP]
+declaration=node_name text
+category=System Administration Functions
+description=Deletes a previously-created replication origin, including any associated\nreplay progress.
+[PG_REPLICATION_ORIGIN_OID]
+declaration=node_name text
+category=System Administration Functions
+description=Looks up a replication origin by name and returns the internal ID. If no\nsuch replication origin is found, NULL is returned.
+[PG_REPLICATION_ORIGIN_PROGRESS]
+declaration=node_name text, flush boolean
+category=System Administration Functions
+description=Returns the replay location for the given replication origin. The parameter\nflush determines whether the corresponding local transaction will be\nguaranteed to have been flushed to disk or not.
+[PG_REPLICATION_ORIGIN_SESSION_IS_SETUP]
+declaration=
+category=System Administration Functions
+description=Returns true if a replication origin has been selected in the current\nsession.
+[PG_REPLICATION_ORIGIN_SESSION_PROGRESS]
+declaration=flush boolean
+category=System Administration Functions
+description=Returns the replay location for the replication origin selected in the\ncurrent session. The parameter flush determines whether the corresponding\nlocal transaction will be guaranteed to have been flushed to disk or not.
+[PG_REPLICATION_ORIGIN_SESSION_RESET]
+declaration=
+category=System Administration Functions
+description=Cancels the effects of pg_replication_origin_session_setup().
+[PG_REPLICATION_ORIGIN_SESSION_SETUP]
+declaration=node_name text
+category=System Administration Functions
+description=Marks the current session as replaying from the given origin, allowing\nreplay progress to be tracked. Can only be used if no origin is currently\nselected. Use pg_replication_origin_session_reset to undo.
+[PG_REPLICATION_ORIGIN_XACT_RESET]
+declaration=
+category=System Administration Functions
+description=Cancels the effects of pg_replication_origin_xact_setup().
+[PG_REPLICATION_ORIGIN_XACT_SETUP]
+declaration=origin_lsn pg_lsn, origin_timestamp timestamp with time zone
+category=System Administration Functions
+description=Marks the current transaction as replaying a transaction that has committed\nat the given LSN and timestamp. Can only be called when a replication\norigin has been selected using pg_replication_origin_session_setup.
+[PG_REPLICATION_SLOT_ADVANCE]
+declaration=slot_name name, upto_lsn pg_lsn
+category=System Administration Functions
+description=Advances the current confirmed position of a replication slot named\nslot_name. The slot will not be moved backwards, and it will not be moved\nbeyond the current insert location. Returns the name of the slot and the\nactual position that it was advanced to. The updated slot position\ninformation is written out at the next checkpoint if any advancing is done.\nSo in the event of a crash, the slot may return to an earlier position. If\nthe specified slot is a logical failover slot then the function will not\nreturn until all physical slots specified in synchronized_standby_slots\nhave confirmed WAL receipt.
+[PG_ROTATE_LOGFILE]
+declaration=
+category=System Administration Functions
+description=Signals the log-file manager to switch to a new output file immediately.\nThis works only when the built-in log collector is running, since otherwise\nthere is no log-file manager subprocess.
+[PG_SAFE_SNAPSHOT_BLOCKING_PIDS]
+declaration=integer
+category=Session Information Functions
+description=Returns an array of the process ID(s) of the sessions that are blocking the\nserver process with the specified process ID from acquiring a safe\nsnapshot, or an empty array if there is no such server process or it is not\nblocked.
+[PG_SETTINGS_GET_FLAGS]
+declaration=guc text
+category=Session Information Functions
+description=Returns an array of the flags associated with the given GUC, or NULL if it\ndoes not exist. The result is an empty array if the GUC exists but there\nare no flags to show. Only the most useful flags listed in Table 9.78 are\nexposed.
+[PG_SIZE_BYTES]
+declaration=text
+category=System Administration Functions
+description=Converts a size in human-readable format (as returned by pg_size_pretty)\ninto bytes. Valid units are bytes, B, kB, MB, GB, TB, and PB.
+[PG_SNAPSHOT_XIP]
+declaration=pg_snapshot
+category=Session Information Functions
+description=Returns the set of in-progress transaction IDs contained in a snapshot.
+[PG_SNAPSHOT_XMAX]
+declaration=pg_snapshot
+category=Session Information Functions
+description=Returns the xmax of a snapshot.
+[PG_SNAPSHOT_XMIN]
+declaration=pg_snapshot
+category=Session Information Functions
+description=Returns the xmin of a snapshot.
+[PG_SPLIT_WALFILE_NAME]
+declaration=file_name text
+category=System Administration Functions
+description=Extracts the sequence number and timeline ID from a WAL file name.
+[PG_STATISTICS_OBJ_IS_VISIBLE]
+declaration=stat oid
+category=Session Information Functions
+description=Is statistics object visible in search path?
+[PG_STAT_FILE]
+declaration=filename text [, missing_ok boolean ]
+category=System Administration Functions
+description=Returns a record containing the file's size, last access time stamp, last\nmodification time stamp, last file status change time stamp (Unix platforms\nonly), file creation time stamp (Windows only), and a flag indicating if it\nis a directory.
+[PG_SWITCH_WAL]
+declaration=
+category=System Administration Functions
+description=Forces the server to switch to a new write-ahead log file, which allows the\ncurrent file to be archived (assuming you are using continuous archiving).\nThe result is the ending write-ahead log location plus 1 within the\njust-completed write-ahead log file. If there has been no write-ahead log\nactivity since the last write-ahead log switch, pg_switch_wal does nothing\nand returns the start location of the write-ahead log file currently in\nuse.
+[PG_SYNC_REPLICATION_SLOTS]
+declaration=
+category=System Administration Functions
+description=Synchronize the logical failover replication slots from the primary server\nto the standby server. This function can only be executed on the standby\nserver. Temporary synced slots, if any, cannot be used for logical decoding\nand must be dropped after promotion. See Section 47.2.3 for details. Note\nthat this function cannot be executed if sync_replication_slots is enabled\nand the slotsync worker is already running to perform the synchronization\nof slots.
+[PG_TABLESPACE_DATABASES]
+declaration=tablespace oid
+category=Session Information Functions
+description=Returns the set of OIDs of databases that have objects stored in the\nspecified tablespace. If this function returns any rows, the tablespace is\nnot empty and cannot be dropped. To identify the specific objects\npopulating the tablespace, you will need to connect to the database(s)\nidentified by pg_tablespace_databases and query their pg_class catalogs.
+[PG_TABLESPACE_LOCATION]
+declaration=tablespace oid
+category=Session Information Functions
+description=Returns the file system path that this tablespace is located in.
+[PG_TABLE_IS_VISIBLE]
+declaration=table oid
+category=Session Information Functions
+description=Is table visible in search path? (This works for all types of relations,\nincluding views, materialized views, indexes, sequences and foreign\ntables.)
+[PG_TABLE_SIZE]
+declaration=regclass
+category=System Administration Functions
+description=Computes the disk space used by the specified table, excluding indexes (but\nincluding its TOAST table if any, free space map, and visibility map).
+[PG_TERMINATE_BACKEND]
+declaration=pid integer, timeout bigint DEFAULT 0
+category=System Administration Functions
+description=Terminates the session whose backend process has the specified process ID.\nThis is also allowed if the calling role is a member of the role whose\nbackend is being terminated or the calling role has privileges of\npg_signal_backend, however only superusers can terminate superuser\nbackends.
+[PG_TOTAL_RELATION_SIZE]
+declaration=regclass
+category=System Administration Functions
+description=Computes the total disk space used by the specified table, including all\nindexes and TOAST data. The result is equivalent to pg_table_size +\npg_indexes_size.
+[PG_TRIGGER_DEPTH]
+declaration=
+category=Session Information Functions
+description=Returns the current nesting level of PostgreSQL triggers (0 if not called,\ndirectly or indirectly, from inside a trigger).
+[PG_TS_CONFIG_IS_VISIBLE]
+declaration=config oid
+category=Session Information Functions
+description=Is text search configuration visible in search path?
+[PG_TS_DICT_IS_VISIBLE]
+declaration=dict oid
+category=Session Information Functions
+description=Is text search dictionary visible in search path?
+[PG_TS_PARSER_IS_VISIBLE]
+declaration=parser oid
+category=Session Information Functions
+description=Is text search parser visible in search path?
+[PG_TS_TEMPLATE_IS_VISIBLE]
+declaration=template oid
+category=Session Information Functions
+description=Is text search template visible in search path?
+[PG_TYPEOF]
+declaration="any"
+category=Session Information Functions
+description=Returns the OID of the data type of the value that is passed to it. This\ncan be helpful for troubleshooting or dynamically constructing SQL queries.\nThe function is declared as returning regtype, which is an OID alias type\n(see Section 8.19); this means that it is the same as an OID for comparison\npurposes but displays as a type name.
+[PG_TYPE_IS_VISIBLE]
+declaration=type oid
+category=Session Information Functions
+description=Is type (or domain) visible in search path?
+[PG_VISIBLE_IN_SNAPSHOT]
+declaration=xid8, pg_snapshot
+category=Session Information Functions
+description=Is the given transaction ID visible according to this snapshot (that is,\nwas it completed before the snapshot was taken)? Note that this function\nwill not give the correct answer for a subtransaction ID (subxid); see\nSection 66.3 for details.
+[PG_WALFILE_NAME]
+declaration=lsn pg_lsn
+category=System Administration Functions
+description=Converts a write-ahead log location to the name of the WAL file holding\nthat location.
+[PG_WALFILE_NAME_OFFSET]
+declaration=lsn pg_lsn
+category=System Administration Functions
+description=Converts a write-ahead log location to a WAL file name and byte offset\nwithin that file.
+[PG_WAL_LSN_DIFF]
+declaration=lsn1 pg_lsn, lsn2 pg_lsn
+category=System Administration Functions
+description=Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead\nlog locations. This can be used with pg_stat_replication or some of the\nfunctions shown in Table 9.95 to get the replication lag.
+[PG_WAL_REPLAY_PAUSE]
+declaration=
+category=System Administration Functions
+description=Request to pause recovery. A request doesn't mean that recovery stops right\naway. If you want a guarantee that recovery is actually paused, you need to\ncheck for the recovery pause state returned by\npg_get_wal_replay_pause_state(). Note that pg_is_wal_replay_paused()\nreturns whether a request is made. While recovery is paused, no further\ndatabase changes are applied. If hot standby is active, all new queries\nwill see the same consistent snapshot of the database, and no further query\nconflicts will be generated until recovery is resumed.
+[PG_WAL_REPLAY_RESUME]
+declaration=
+category=System Administration Functions
+description=Restarts recovery if it was paused.
+[PG_WAL_SUMMARY_CONTENTS]
+declaration=tli bigint, start_lsn pg_lsn, end_lsn pg_lsn
+category=Session Information Functions
+description=Returns one information about the contents of a single WAL summary file\nidentified by TLI and starting and ending LSNs. Each row with\nis_limit_block false indicates that the block identified by the remaining\noutput columns was modified by at least one WAL record within the range of\nrecords summarized by this file. Each row with is_limit_block true\nindicates either that (a) the relation fork was truncated to the length\ngiven by relblocknumber within the relevant range of WAL records or (b)\nthat the relation fork was created or dropped within the relevant range of\nWAL records; in such cases, relblocknumber will be zero.
+[PG_XACT_COMMIT_TIMESTAMP]
+declaration=xid
+category=Session Information Functions
+description=Returns the commit timestamp of a transaction.
+[PG_XACT_COMMIT_TIMESTAMP_ORIGIN]
+declaration=xid
+category=Session Information Functions
+description=Returns the commit timestamp and replication origin of a transaction.
+[PG_XACT_STATUS]
+declaration=xid8
+category=Session Information Functions
+description=Reports the commit status of a recent transaction. The result is one of in\nprogress, committed, or aborted, provided that the transaction is recent\nenough that the system retains the commit status of that transaction. If it\nis old enough that no references to the transaction survive in the system\nand the commit status information has been discarded, the result is NULL.\nApplications might use this function, for example, to determine whether\ntheir transaction committed or aborted after the application and database\nserver become disconnected while a COMMIT is in progress. Note that\nprepared transactions are reported as in progress; applications must check\npg_prepared_xacts if they need to determine whether a transaction ID\nbelongs to a prepared transaction.
+[PHRASETO_TSQUERY]
+declaration=[ config regconfig, ] query text
+category=Text Search Functions
+description=Converts text to a tsquery, normalizing words according to the specified or\ndefault configuration. Any punctuation in the string is ignored (it does\nnot determine query operators). The resulting query matches phrases\ncontaining all non-stopwords in the text.
+[PI]
+declaration=
+category=Numeric/Math Functions
+description=Approximate value of π
+[PLAINTO_TSQUERY]
+declaration=[ config regconfig, ] query text
+category=Text Search Functions
+description=Converts text to a tsquery, normalizing words according to the specified or\ndefault configuration. Any punctuation in the string is ignored (it does\nnot determine query operators). The resulting query matches documents\ncontaining all non-stopwords in the text.
+[POINT]
+declaration=double precision, double precision
+category=Geometric Functions
+description=Constructs point from its coordinates.
+[POLYGON]
+declaration=box
+category=Geometric Functions
+description=Converts box to a 4-point polygon.
+[POPEN]
+declaration=path
+category=Geometric Functions
+description=Converts path to open form.
+[POSITION1]
+name=POSITION
+declaration=substring text IN string text
+category=String Functions
+description=Returns first starting index of the specified substring within string, or\nzero if it's not present.
+[POSITION2]
+name=POSITION
+declaration=substring bytea IN bytes bytea
+category=Binary String Functions
+description=Returns first starting index of the specified substring within bytes, or\nzero if it's not present.
+[POSITION3]
+name=POSITION
+declaration=substring bit IN bits bit
+category=Bit String Functions
+description=Returns first starting index of the specified substring within bits, or\nzero if it's not present.
+[QUERYTREE]
+declaration=tsquery
+category=Text Search Functions
+description=Produces a representation of the indexable portion of a tsquery. A result\nthat is empty or just T indicates a non-indexable query.
+[QUOTE_IDENT]
+declaration=text
+category=String Functions
+description=Returns the given string suitably quoted to be used as an identifier in an\nSQL statement string. Quotes are added only if necessary (i.e., if the\nstring contains non-identifier characters or would be case-folded).\nEmbedded quotes are properly doubled. See also Example 41.1.
+[QUOTE_LITERAL]
+declaration=text
category=String Functions
-description=The PostgreSQL position function returns the location of a substring in a string.
-[POWER]
-declaration=m,n
+description=Returns the given string suitably quoted to be used as a string literal in\nan SQL statement string. Embedded single-quotes and backslashes are\nproperly doubled. Note that quote_literal returns null on null input; if\nthe argument might be null, quote_nullable is often more suitable. See also\nExample 41.1.
+[QUOTE_NULLABLE]
+declaration=text
+category=String Functions
+description=Returns the given string suitably quoted to be used as a string literal in\nan SQL statement string; or, if the argument is null, returns NULL.\nEmbedded single-quotes and backslashes are properly doubled. See also\nExample 41.1.
+[RADIANS]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL power function returns m raised to the nth power.
+description=Converts degrees to radians
+[RADIUS]
+declaration=circle
+category=Geometric Functions
+description=Computes radius of circle.
[RANDOM]
declaration=
category=Numeric/Math Functions
-description=The PostgreSQL random function can be used to return a random number or a random number within a range.
+description=Returns a random value in the range 0.0 <= x < 1.0
+[RANDOM_NORMAL]
+declaration=[ mean double precision [, stddev double precision ]]
+category=Numeric/Math Functions
+description=Returns a random value from the normal distribution with the given\nparameters; mean defaults to 0.0 and stddev defaults to 1.0
+[RANGE_MERGE1]
+name=RANGE_MERGE
+declaration=anyrange, anyrange
+category=Range Functions
+description=Computes the smallest range that includes both of the given ranges.
+[RANGE_MERGE2]
+name=RANGE_MERGE
+declaration=anymultirange
+category=Range Functions
+description=Computes the smallest range that includes the entire multirange.
+[RANK1]
+name=RANK
+declaration=args
+category=Aggregate Functions
+description=Computes the rank of the hypothetical row, with gaps; that is, the row\nnumber of the first row in its peer group.
+[RANK2]
+name=RANK
+declaration=
+category=Window Functions
+description=Returns the rank of the current row, with gaps; that is, the row_number of\nthe first row in its peer group.
+[REGEXP_COUNT]
+declaration=string text, pattern text [, start integer [, flags text ] ]
+category=String Functions
+description=Returns the number of times the POSIX regular expression pattern matches in\nthe string; see Section 9.7.3.
+[REGEXP_INSTR]
+declaration=string text, pattern text [, start integer [, N integer [, endoption integer [, flags text [, subexpr integer ] ] ] ] ]
+category=String Functions
+description=Returns the position within string where the N'th match of the POSIX\nregular expression pattern occurs, or zero if there is no such match; see\nSection 9.7.3.
+[REGEXP_LIKE]
+declaration=string text, pattern text [, flags text ]
+category=String Functions
+description=Checks whether a match of the POSIX regular expression pattern occurs\nwithin string; see Section 9.7.3.
+[REGEXP_MATCH]
+declaration=string text, pattern text [, flags text ]
+category=String Functions
+description=Returns substrings within the first match of the POSIX regular expression\npattern to the string; see Section 9.7.3.
+[REGEXP_MATCHES]
+declaration=string text, pattern text [, flags text ]
+category=String Functions
+description=Returns substrings within the first match of the POSIX regular expression\npattern to the string, or substrings within all such matches if the g flag\nis used; see Section 9.7.3.
+[REGEXP_REPLACE]
+declaration=string text, pattern text, replacement text [, start integer ] [, flags text ]
+category=String Functions
+description=Replaces the substring that is the first match to the POSIX regular\nexpression pattern, or all such matches if the g flag is used; see Section\n9.7.3.
+[REGEXP_SPLIT_TO_ARRAY]
+declaration=string text, pattern text [, flags text ]
+category=String Functions
+description=Splits string using a POSIX regular expression as the delimiter, producing\nan array of results; see Section 9.7.3.
+[REGEXP_SPLIT_TO_TABLE]
+declaration=string text, pattern text [, flags text ]
+category=String Functions
+description=Splits string using a POSIX regular expression as the delimiter, producing\na set of results; see Section 9.7.3.
+[REGEXP_SUBSTR]
+declaration=string text, pattern text [, start integer [, N integer [, flags text [, subexpr integer ] ] ] ]
+category=String Functions
+description=Returns the substring within string that matches the N'th occurrence of the\nPOSIX regular expression pattern, or NULL if there is no such match; see\nSection 9.7.3.
+[REGR_AVGX]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the average of the independent variable, sum(X)/N.
+[REGR_AVGY]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the average of the dependent variable, sum(Y)/N.
+[REGR_COUNT]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the number of rows in which both inputs are non-null.
+[REGR_R2]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the square of the correlation coefficient.
+[REGR_SXX]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the "sum of squares" of the independent variable, sum(X^2) -\nsum(X)^2/N.
+[REGR_SXY]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the "sum of products" of independent times dependent variables,\nsum(X*Y) - sum(X) * sum(Y)/N.
+[REGR_SYY]
+declaration=Y double precision, X double precision
+category=Aggregate Functions
+description=Computes the "sum of squares" of the dependent variable, sum(Y^2) -\nsum(Y)^2/N.
[REPEAT]
-declaration=string,number
+declaration=string text, number integer
category=String Functions
-description=The PostgreSQL repeat function repeats a string a specified number of times.
+description=Repeats string the specified number of times.
[REPLACE]
-declaration=string,from_substring,to_substring
+declaration=string text, from text, to text
category=String Functions
-description=The PostgreSQL replace function replaces all occurrences of a specified string.
-[ROUND]
-declaration=number,decimal_places
-category=Numeric/Math Functions
-description=The PostgreSQL round function returns a number rounded to a certain number of decimal places.
+description=Replaces all occurrences in string of substring from with substring to.
+[REVERSE]
+declaration=text
+category=String Functions
+description=Reverses the order of the characters in the string.
+[RIGHT]
+declaration=string text, n integer
+category=String Functions
+description=Returns last n characters in the string, or when n is negative, returns all\nbut first |n| characters.
+[ROW_NUMBER]
+declaration=
+category=Window Functions
+description=Returns the number of the current row within its partition, counting from\n1.
+[ROW_SECURITY_ACTIVE]
+declaration=table text or oid
+category=Session Information Functions
+description=Is row-level security active for the specified table in the context of the\ncurrent user and current environment?
+[ROW_TO_JSON]
+declaration=record [, boolean ]
+category=JSON Functions
+description=Converts an SQL composite value to a JSON object. The behavior is the same\nas to_json except that line feeds will be added between top-level elements\nif the optional boolean parameter is true.
[RPAD]
-declaration=string,length,pad_string
+declaration=string text, length integer [, fill text ]
category=String Functions
-description=The PostgreSQL rpad function returns a string that is right-padded with a specified string to a certain length.
-[RTRIM]
-declaration=string,trim_character
+description=Extends the string to length length by appending the characters fill (a\nspace by default). If the string is already longer than length then it is\ntruncated.
+[RTRIM1]
+name=RTRIM
+declaration=string text [, characters text ]
category=String Functions
-description=The PostgreSQL rtrim function removes all specified characters from the right-hand side of a string.
+description=Removes the longest string containing only characters in characters (a\nspace by default) from the end of string.
+[RTRIM2]
+name=RTRIM
+declaration=bytes bytea, bytesremoved bytea
+category=Binary String Functions
+description=Removes the longest string containing only bytes appearing in bytesremoved\nfrom the end of bytes.
+[SCALE]
+declaration=numeric
+category=Numeric/Math Functions
+description=Scale of the argument (the number of decimal digits in the fractional part)
[SETSEED]
-declaration=seed
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL setseed function can be used to set a seed for the next time that you call the random function. If you do not call setseed, PostgreSQL will use its own seed value. This may or may not be truly random. If you set the seed by calling the setseed function, then the random function will return a repeatable sequence of random numbers that is derived from the seed.
-[SIGN]
-declaration=number
+description=Sets the seed for subsequent random() and random_normal() calls; argument\nmust be between -1.0 and 1.0, inclusive
+[SETVAL]
+declaration=regclass, bigint [, boolean ]
+category=Sequence Manipulation Functions
+description=Sets the sequence object's current value, and optionally its is_called\nflag. The two-parameter form sets the sequence's last_value field to the\nspecified value and sets its is_called field to true, meaning that the next\nnextval will advance the sequence before returning a value. The value that\nwill be reported by currval is also set to the specified value. In the\nthree-parameter form, is_called can be set to either true or false. true\nhas the same effect as the two-parameter form. If it is set to false, the\nnext nextval will return exactly the specified value, and sequence\nadvancement commences with the following nextval. Furthermore, the value\nreported by currval is not changed in this case. For example,
+[SETWEIGHT1]
+name=SETWEIGHT
+declaration=vector tsvector, weight "char"
+category=Text Search Functions
+description=Assigns the specified weight to each element of the vector.
+[SETWEIGHT2]
+name=SETWEIGHT
+declaration=vector tsvector, weight "char", lexemes text[]
+category=Text Search Functions
+description=Assigns the specified weight to elements of the vector that are listed in\nlexemes. The strings in lexemes are taken as lexemes as-is, without further\nprocessing. Strings that do not match any lexeme in vector are ignored.
+[SET_BIT1]
+name=SET_BIT
+declaration=bytes bytea, n bigint, newvalue integer
+category=Binary String Functions
+description=Sets n'th bit in binary string to newvalue.
+[SET_BIT2]
+name=SET_BIT
+declaration=bits bit, n integer, newvalue integer
+category=Bit String Functions
+description=Sets n'th bit in bit string to newvalue; the first (leftmost) bit is bit 0.
+[SET_BYTE]
+declaration=bytes bytea, n integer, newvalue integer
+category=Binary String Functions
+description=Sets n'th byte in binary string to newvalue.
+[SET_CONFIG]
+declaration=setting_name text, new_value text, is_local boolean
+category=System Administration Functions
+description=Sets the parameter setting_name to new_value, and returns that value. If\nis_local is true, the new value will only apply during the current\ntransaction. If you want the new value to apply for the rest of the current\nsession, use false instead. This function corresponds to the SQL command\nSET.
+[SET_MASKLEN]
+declaration=inet, integer
+category=Network Address Functions
+description=Sets the netmask length for an inet value. The address part does not\nchange.
+[SHA224]
+declaration=bytea
+category=Binary String Functions
+description=Computes the SHA-224 hash of the binary string.
+[SHA256]
+declaration=bytea
+category=Binary String Functions
+description=Computes the SHA-256 hash of the binary string.
+[SHA384]
+declaration=bytea
+category=Binary String Functions
+description=Computes the SHA-384 hash of the binary string.
+[SHA512]
+declaration=bytea
+category=Binary String Functions
+description=Computes the SHA-512 hash of the binary string.
+[SHOBJ_DESCRIPTION]
+declaration=object oid, catalog name
+category=Session Information Functions
+description=Returns the comment for a shared database object specified by its OID and\nthe name of the containing system catalog. This is just like\nobj_description except that it is used for retrieving comments on shared\nobjects (that is, databases, roles, and tablespaces). Some system catalogs\nare global to all databases within each cluster, and the descriptions for\nobjects in them are stored globally as well.
+[SIN]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL sign function returns a value indicating the sign of a number.
-[SQRT]
-declaration=number
+description=Sine, argument in radians
+[SIND]
+declaration=double precision
category=Numeric/Math Functions
-description=The PostgreSQL sqrt function returns the square root of a number.
+description=Sine, argument in degrees
+[SINH]
+declaration=double precision
+category=Numeric/Math Functions
+description=Hyperbolic sine
+[SLOPE]
+declaration=point, point
+category=Geometric Functions
+description=Computes slope of a line drawn through the two points.
+[SPLIT_PART]
+declaration=string text, delimiter text, n integer
+category=String Functions
+description=Splits string at occurrences of delimiter and returns the n'th field\n(counting from one), or when n is negative, returns the |n|'th-from-last\nfield.
+[STARTS_WITH]
+declaration=string text, prefix text
+category=String Functions
+description=Returns true if string starts with prefix.
+[STATEMENT_TIMESTAMP]
+declaration=
+category=Date/Time Functions
+description=Current date and time (start of current statement); see Section 9.9.5
+[STRING_TO_ARRAY]
+declaration=string text, delimiter text [, null_string text ]
+category=String Functions
+description=Splits the string at occurrences of delimiter and forms the resulting\nfields into a text array. If delimiter is NULL, each character in the\nstring will become a separate element in the array. If delimiter is an\nempty string, then the string is treated as a single field. If null_string\nis supplied and is not NULL, fields matching that string are replaced by\nNULL. See also array_to_string.
+[STRING_TO_TABLE]
+declaration=string text, delimiter text [, null_string text ]
+category=String Functions
+description=Splits the string at occurrences of delimiter and returns the resulting\nfields as a set of text rows. If delimiter is NULL, each character in the\nstring will become a separate row of the result. If delimiter is an empty\nstring, then the string is treated as a single field. If null_string is\nsupplied and is not NULL, fields matching that string are replaced by NULL.
+[STRIP]
+declaration=tsvector
+category=Text Search Functions
+description=Removes positions and weights from the tsvector.
[STRPOS]
-declaration=string,substring
-category=String Functions
-description=The PostgreSQL strpos function returns the location of a substring in a string.
-[SUBSTRING]
-declaration=string,start_position,length
-category=String Functions
-description=The PostgreSQL substring function allows you to extract a substring from a string.
-[SUM]
-declaration=expression1, expression2, ... expression_n,aggregate_expression,tables,WHERE conditions
-category=Numeric/Math Functions
-description=The PostgreSQL sum function returns the summed value of an expression.
-[TO_CHAR]
-declaration=value,format_mask
-category=Conversion Functions
-description=The PostgreSQL to_char function converts a number or date to a string.
-[TO_DATE]
-declaration=string1,format_mask
-category=Conversion Functions
-description=The PostgreSQL to_date function converts a string to a date.
-[TO_NUMBER]
-declaration=string1,format_mask
-category=Conversion Functions
-description=The PostgreSQL to_number function converts a string to a number.
+declaration=string text, substring text
+category=String Functions
+description=Returns first starting index of the specified substring within string, or\nzero if it's not present. (Same as position(substring in string), but note\nthe reversed argument order.)
+[SUBSTR1]
+name=SUBSTR
+declaration=string text, start integer [, count integer ]
+category=String Functions
+description=Extracts the substring of string starting at the start'th character, and\nextending for count characters if that is specified. (Same as\nsubstring(string from start for count).)
+[SUBSTR2]
+name=SUBSTR
+declaration=bytes bytea, start integer [, count integer ]
+category=Binary String Functions
+description=Extracts the substring of bytes starting at the start'th byte, and\nextending for count bytes if that is specified. (Same as substring(bytes\nfrom start for count).)
+[SUBSTRING1]
+name=SUBSTRING
+declaration=string text [ FROM start integer ] [ FOR count integer ]
+category=String Functions
+description=Extracts the substring of string starting at the start'th character if that\nis specified, and stopping after count characters if that is specified.\nProvide at least one of start and count.
+[SUBSTRING2]
+name=SUBSTRING
+declaration=bytes bytea [ FROM start integer ] [ FOR count integer ]
+category=Binary String Functions
+description=Extracts the substring of bytes starting at the start'th byte if that is\nspecified, and stopping after count bytes if that is specified. Provide at\nleast one of start and count.
+[SUBSTRING3]
+name=SUBSTRING
+declaration=bits bit [ FROM start integer ] [ FOR count integer ]
+category=Bit String Functions
+description=Extracts the substring of bits starting at the start'th bit if that is\nspecified, and stopping after count bits if that is specified. Provide at\nleast one of start and count.
+[SUPPRESS_REDUNDANT_UPDATES_TRIGGER]
+declaration=
+category=Trigger Functions
+description=Suppresses do-nothing update operations. See below for details.
+[TAN]
+declaration=double precision
+category=Numeric/Math Functions
+description=Tangent, argument in radians
+[TAND]
+declaration=double precision
+category=Numeric/Math Functions
+description=Tangent, argument in degrees
+[TANH]
+declaration=double precision
+category=Numeric/Math Functions
+description=Hyperbolic tangent
+[TEXT]
+declaration=inet
+category=Network Address Functions
+description=Returns the unabbreviated IP address and netmask length as text. (This has\nthe same result as an explicit cast to text.)
+[TIMEOFDAY]
+declaration=
+category=Date/Time Functions
+description=Current date and time (like clock_timestamp, but as a text string); see\nSection 9.9.5
+[TO_JSONB]
+declaration=anyelement
+category=JSON Functions
+description=Converts any SQL value to json or jsonb. Arrays and composites are\nconverted recursively to arrays and objects (multidimensional arrays become\narrays of arrays in JSON). Otherwise, if there is a cast from the SQL data\ntype to json, the cast function will be used to perform the conversion;[a]\notherwise, a scalar JSON value is produced. For any scalar other than a\nnumber, a Boolean, or a null value, the text representation will be used,\nwith escaping as necessary to make it a valid JSON string value.
+[TO_REGCLASS]
+declaration=text
+category=Session Information Functions
+description=Translates a textual relation name to its OID. A similar result is obtained\nby casting the string to type regclass (see Section 8.19); however, this\nfunction will return NULL rather than throwing an error if the name is not\nfound.
+[TO_REGCOLLATION]
+declaration=text
+category=Session Information Functions
+description=Translates a textual collation name to its OID. A similar result is\nobtained by casting the string to type regcollation (see Section 8.19);\nhowever, this function will return NULL rather than throwing an error if\nthe name is not found.
+[TO_REGNAMESPACE]
+declaration=text
+category=Session Information Functions
+description=Translates a textual schema name to its OID. A similar result is obtained\nby casting the string to type regnamespace (see Section 8.19); however,\nthis function will return NULL rather than throwing an error if the name is\nnot found.
+[TO_REGOPER]
+declaration=text
+category=Session Information Functions
+description=Translates a textual operator name to its OID. A similar result is obtained\nby casting the string to type regoper (see Section 8.19); however, this\nfunction will return NULL rather than throwing an error if the name is not\nfound or is ambiguous.
+[TO_REGOPERATOR]
+declaration=text
+category=Session Information Functions
+description=Translates a textual operator name (with parameter types) to its OID. A\nsimilar result is obtained by casting the string to type regoperator (see\nSection 8.19); however, this function will return NULL rather than throwing\nan error if the name is not found.
+[TO_REGPROC]
+declaration=text
+category=Session Information Functions
+description=Translates a textual function or procedure name to its OID. A similar\nresult is obtained by casting the string to type regproc (see Section\n8.19); however, this function will return NULL rather than throwing an\nerror if the name is not found or is ambiguous.
+[TO_REGPROCEDURE]
+declaration=text
+category=Session Information Functions
+description=Translates a textual function or procedure name (with argument types) to\nits OID. A similar result is obtained by casting the string to type\nregprocedure (see Section 8.19); however, this function will return NULL\nrather than throwing an error if the name is not found.
+[TO_REGROLE]
+declaration=text
+category=Session Information Functions
+description=Translates a textual role name to its OID. A similar result is obtained by\ncasting the string to type regrole (see Section 8.19); however, this\nfunction will return NULL rather than throwing an error if the name is not\nfound.
+[TO_REGTYPE]
+declaration=text
+category=Session Information Functions
+description=Parses a string of text, extracts a potential type name from it, and\ntranslates that name into a type OID. A syntax error in the string will\nresult in an error; but if the string is a syntactically valid type name\nthat happens not to be found in the catalogs, the result is NULL. A similar\nresult is obtained by casting the string to type regtype (see Section\n8.19), except that that will throw error for name not found.
+[TO_REGTYPEMOD]
+declaration=text
+category=Session Information Functions
+description=Parses a string of text, extracts a potential type name from it, and\ntranslates its type modifier, if any. A syntax error in the string will\nresult in an error; but if the string is a syntactically valid type name\nthat happens not to be found in the catalogs, the result is NULL. The\nresult is -1 if no type modifier is present.
[TO_TIMESTAMP]
-declaration=string1,format_mask
-category=Conversion Functions
-description=The PostgreSQL to_timestamp function converts a string to a timestamp.
+declaration=double precision
+category=Date/Time Functions
+description=Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to timestamp with\ntime zone
+[TO_TSQUERY]
+declaration=[ config regconfig, ] query text
+category=Text Search Functions
+description=Converts text to a tsquery, normalizing words according to the specified or\ndefault configuration. The words must be combined by valid tsquery\noperators.
+[TO_TSVECTOR]
+declaration=[ config regconfig, ] document text
+category=Text Search Functions
+description=Converts text to a tsvector, normalizing words according to the specified\nor default configuration. Position information is included in the result.
+[TRANSACTION_TIMESTAMP]
+declaration=
+category=Date/Time Functions
+description=Current date and time (start of current transaction); see Section 9.9.5
[TRANSLATE]
-declaration=string1,string_to_replace,replacement_string
+declaration=string text, from text, to text
category=String Functions
-description=The PostgreSQL translate function replaces a sequence of characters in a string with another set of characters. However, it replaces a single character at a time. For example, it will replace the 1st character in the string_to_replace with the 1st character in the replacement_string. Then it will replace the 2nd character in the string_to_replace with the 2nd character in the replacement_string, and so on.
-[TRIM]
-declaration=leading,trailing,both,trim_character,string
+description=Replaces each character in string that matches a character in the from set\nwith the corresponding character in the to set. If from is longer than to,\noccurrences of the extra characters in from are deleted.
+[TRIM1]
+name=TRIM
+declaration=[ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text
category=String Functions
-description=The PostgreSQL trim function removes all specified characters either from the beginning or the end of a string.
-[TRUNC]
-declaration=number,decimal_places
+description=Removes the longest string containing only characters in characters (a\nspace by default) from the start, end, or both ends (BOTH is the default)\nof string.
+[TRIM2]
+name=TRIM
+declaration=[ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea
+category=Binary String Functions
+description=Removes the longest string containing only bytes appearing in bytesremoved\nfrom the start, end, or both ends (BOTH is the default) of bytes.
+[TRIM_ARRAY]
+declaration=array anyarray, n integer
+category=Array Functions
+description=Trims an array by removing the last n elements. If the array is\nmultidimensional, only the first dimension is trimmed.
+[TRIM_SCALE]
+declaration=numeric
category=Numeric/Math Functions
-description=The PostgreSQL trunc function returns a number truncated to a certain number of decimal places.
-[UPPER]
-declaration=string
+description=Reduces the value's scale (number of fractional decimal digits) by removing\ntrailing zeroes
+[TRUNC]
+declaration=macaddr
+category=Network Address Functions
+description=Sets the last 3 bytes of the address to zero. The remaining prefix can be\nassociated with a particular manufacturer (using data not included in\nPostgreSQL).
+[TSQUERY_PHRASE]
+declaration=query1 tsquery, query2 tsquery
+category=Text Search Functions
+description=Constructs a phrase query that searches for matches of query1 and query2 at\nsuccessive lexemes (same as <-> operator).
+[TSVECTOR_TO_ARRAY]
+declaration=tsvector
+category=Text Search Functions
+description=Converts a tsvector to an array of lexemes.
+[TSVECTOR_UPDATE_TRIGGER]
+declaration=
+category=Trigger Functions
+description=Automatically updates a tsvector column from associated plain-text document\ncolumn(s). The text search configuration to use is specified by name as a\ntrigger argument. See Section 12.4.3 for details.
+[TSVECTOR_UPDATE_TRIGGER_COLUMN]
+declaration=
+category=Trigger Functions
+description=Automatically updates a tsvector column from associated plain-text document\ncolumn(s). The text search configuration to use is taken from a regconfig\ncolumn of the table. See Section 12.4.3 for details.
+[TS_DEBUG]
+declaration=[ config regconfig, ] document text
+category=Text Search Functions
+description=Extracts and normalizes tokens from the document according to the specified\nor default text search configuration, and returns information about how\neach token was processed. See Section 12.8.1 for details.
+[TS_DELETE]
+declaration=vector tsvector, lexeme text
+category=Text Search Functions
+description=Removes any occurrence of the given lexeme from the vector. The lexeme\nstring is treated as a lexeme as-is, without further processing.
+[TS_FILTER]
+declaration=vector tsvector, weights "char"[]
+category=Text Search Functions
+description=Selects only elements with the given weights from the vector.
+[TS_HEADLINE]
+declaration=[ config regconfig, ] document text, query tsquery [, options text ]
+category=Text Search Functions
+description=Displays, in an abbreviated form, the match(es) for the query in the\ndocument, which must be raw text not a tsvector. Words in the document are\nnormalized according to the specified or default configuration before\nmatching to the query. Use of this function is discussed in Section 12.3.4,\nwhich also describes the available options.
+[TS_LEXIZE]
+declaration=dict regdictionary, token text
+category=Text Search Functions
+description=Returns an array of replacement lexemes if the input token is known to the\ndictionary, or an empty array if the token is known to the dictionary but\nit is a stop word, or NULL if it is not a known word. See Section 12.8.3\nfor details.
+[TS_PARSE]
+declaration=parser_name text, document text
+category=Text Search Functions
+description=Extracts tokens from the document using the named parser. See Section\n12.8.2 for details.
+[TS_RANK]
+declaration=[ weights real[], ] vector tsvector, query tsquery [, normalization integer ]
+category=Text Search Functions
+description=Computes a score showing how well the vector matches the query. See Section\n12.3.3 for details.
+[TS_RANK_CD]
+declaration=[ weights real[], ] vector tsvector, query tsquery [, normalization integer ]
+category=Text Search Functions
+description=Computes a score showing how well the vector matches the query, using a\ncover density algorithm. See Section 12.3.3 for details.
+[TS_REWRITE]
+declaration=query tsquery, target tsquery, substitute tsquery
+category=Text Search Functions
+description=Replaces occurrences of target with substitute within the query. See\nSection 12.4.2.1 for details.
+[TS_STAT]
+declaration=sqlquery text [, weights text ]
+category=Text Search Functions
+description=Executes the sqlquery, which must return a single tsvector column, and\nreturns statistics about each distinct lexeme contained in the data. See\nSection 12.4.4 for details.
+[TS_TOKEN_TYPE]
+declaration=parser_name text
+category=Text Search Functions
+description=Returns a table that describes each type of token the named parser can\nrecognize. See Section 12.8.2 for details.
+[TXID_CURRENT]
+declaration=
+category=Session Information Functions
+description=See pg_current_xact_id().
+[TXID_CURRENT_IF_ASSIGNED]
+declaration=
+category=Session Information Functions
+description=See pg_current_xact_id_if_assigned().
+[TXID_CURRENT_SNAPSHOT]
+declaration=
+category=Session Information Functions
+description=See pg_current_snapshot().
+[TXID_SNAPSHOT_XIP]
+declaration=txid_snapshot
+category=Session Information Functions
+description=See pg_snapshot_xip().
+[TXID_SNAPSHOT_XMAX]
+declaration=txid_snapshot
+category=Session Information Functions
+description=See pg_snapshot_xmax().
+[TXID_SNAPSHOT_XMIN]
+declaration=txid_snapshot
+category=Session Information Functions
+description=See pg_snapshot_xmin().
+[TXID_STATUS]
+declaration=bigint
+category=Session Information Functions
+description=See pg_xact_status().
+[TXID_VISIBLE_IN_SNAPSHOT]
+declaration=bigint, txid_snapshot
+category=Session Information Functions
+description=See pg_visible_in_snapshot().
+[UNICODE_ASSIGNED]
+declaration=text
+category=String Functions
+description=Returns true if all characters in the string are assigned Unicode\ncodepoints; false otherwise. This function can only be used when the server\nencoding is UTF8.
+[UNICODE_VERSION]
+declaration=
+category=Session Information Functions
+description=Returns a string representing the version of Unicode used by PostgreSQL.
+[UNISTR]
+declaration=text
category=String Functions
-description=The PostgreSQL upper function converts all characters in the specified string to uppercase.
-[XMLCONCAT]
-declaration=xml
-category=XML
-description=concatenates a list of individual XML values to create a single value containing an XML content fragment
\ No newline at end of file
+description=Evaluate escaped Unicode characters in the argument. Unicode characters can\nbe specified as \XXXX (4 hexadecimal digits), \+XXXXXX (6 hexadecimal\ndigits), \uXXXX (4 hexadecimal digits), or \UXXXXXXXX (8 hexadecimal\ndigits). To specify a backslash, write two backslashes. All other\ncharacters are taken literally.
+[UNNEST1]
+name=UNNEST
+declaration=tsvector
+category=Text Search Functions
+description=Expands a tsvector into a set of rows, one per lexeme.
+[UNNEST2]
+name=UNNEST
+declaration=anyarray
+category=Array Functions
+description=Expands an array into a set of rows. The array's elements are read out in\nstorage order.
+[UNNEST3]
+name=UNNEST
+declaration=anymultirange
+category=Range Functions
+description=Expands a multirange into a set of ranges in ascending order.
+[UPPER1]
+name=UPPER
+declaration=text
+category=String Functions
+description=Converts the string to all upper case, according to the rules of the\ndatabase's locale.
+[UPPER2]
+name=UPPER
+declaration=anyrange
+category=Range Functions
+description=Extracts the upper bound of the range (NULL if the range is empty or has no\nupper bound).
+[UPPER3]
+name=UPPER
+declaration=anymultirange
+category=Range Functions
+description=Extracts the upper bound of the multirange (NULL if the multirange is empty\nor has no upper bound).
+[UPPER_INC1]
+name=UPPER_INC
+declaration=anyrange
+category=Range Functions
+description=Is the range's upper bound inclusive?
+[UPPER_INC2]
+name=UPPER_INC
+declaration=anymultirange
+category=Range Functions
+description=Is the multirange's upper bound inclusive?
+[UPPER_INF1]
+name=UPPER_INF
+declaration=anyrange
+category=Range Functions
+description=Does the range have no upper bound? (An upper bound of Infinity returns\nfalse.)
+[UPPER_INF2]
+name=UPPER_INF
+declaration=anymultirange
+category=Range Functions
+description=Does the multirange have no upper bound? (An upper bound of Infinity\nreturns false.)
+[VARIANCE]
+declaration=numeric_type
+category=Aggregate Functions
+description=This is a historical alias for var_samp.
+[VERSION]
+declaration=
+category=Session Information Functions
+description=Returns a string describing the PostgreSQL server's version. You can also\nget this information from server_version, or for a machine-readable version\nuse server_version_num. Software developers should use server_version_num\n(available since 8.2) or PQserverVersion instead of parsing the text\nversion.
+[WEBSEARCH_TO_TSQUERY]
+declaration=[ config regconfig, ] query text
+category=Text Search Functions
+description=Converts text to a tsquery, normalizing words according to the specified or\ndefault configuration. Quoted word sequences are converted to phrase tests.\nThe word "or" is understood as producing an OR operator, and a dash\nproduces a NOT operator; other punctuation is ignored. This approximates\nthe behavior of some common web search tools.
+[WIDTH]
+declaration=box
+category=Geometric Functions
+description=Computes horizontal size of box.
+[XMLAGG]
+declaration=xml ORDER BY input_sort_columns
+category=Aggregate Functions
+description=Concatenates the non-null XML input values (see Section 9.15.1.8).
\ No newline at end of file
diff --git a/out/gds32-14.1.dll b/out/gds32-14.1.dll
deleted file mode 100644
index 0fa2ab47d..000000000
Binary files a/out/gds32-14.1.dll and /dev/null differ
diff --git a/out/heidisql.iss b/out/heidisql.iss
index 4fe22f8dc..bf9fbe812 100644
--- a/out/heidisql.iss
+++ b/out/heidisql.iss
@@ -13,8 +13,8 @@
#define ProgVerMinor
#define ProgVerRevision
#define ProgVerBuild
-#define ProgVersion GetVersionComponents(AddBackslash(SourcePath) + ProgNameLower + "32.exe", ProgVerMajor, ProgVerMinor, ProgVerRevision, ProgVerBuild)
-#define ProgShortVersion Str(ProgVerMajor) + "." + Str(ProgVerMinor)
+#define ProgVersion GetVersionComponents(AddBackslash(SourcePath) + ProgNameLower + "64.exe", ProgVerMajor, ProgVerMinor, ProgVerRevision, ProgVerBuild)
+#define ProgVersionStr Str(ProgVerMajor) + "." + Str(ProgVerMinor) + "." + Str(ProgVerRevision) + "." + Str(ProgVerBuild)
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
@@ -33,6 +33,7 @@ Name: "hu"; MessagesFile: "compiler:Languages\Hungarian.isl"
Name: "is"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl"
+Name: "kr"; MessagesFile: "compiler:Languages\Korean.isl"
Name: "no"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "pl"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl"
@@ -41,6 +42,8 @@ Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "sk"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "sl"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"
+Name: "se"; MessagesFile: "compiler:Languages\Swedish.isl"
+Name: "ta"; MessagesFile: "compiler:Languages\Tamil.isl"
Name: "tr"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "uk"; MessagesFile: "compiler:Languages\Ukrainian.isl"
@@ -50,7 +53,7 @@ AppName={#ProgName}
AppVerName={#ProgName} {#ProgVersion}
VersionInfoVersion={#ProgVersion}
; Displayed on the "Support" dialog of the Add/Remove Programs Control Panel applet:
-AppVersion={#ProgShortVersion}
+AppVersion={#ProgVersionStr}
AppPublisher=Ansgar Becker
AppPublisherURL={#WebSite}
AppSupportURL={#WebSite}forum.php
@@ -70,79 +73,57 @@ WizardStyle=modern
WizardImageFile={#ResourceDir}installer-logo.bmp
WizardSmallImageFile={#ResourceDir}installer-small-logo.bmp
OutputDir={#OutDir}
-OutputBaseFilename={#ProgName}_{#ProgShortVersion}_Setup
+OutputBaseFilename={#ProgName}_{#ProgVersionStr}_Setup
UninstallDisplayIcon={app}\{#ProgExeName}
SetupIconFile={#ResourceDir}mainicon.ico
-ArchitecturesInstallIn64BitMode=x64
+ArchitecturesAllowed=x64compatible
+ArchitecturesInstallIn64BitMode=x64compatible
UsePreviousAppDir=yes
DirExistsWarning=auto
PrivilegesRequired=admin
PrivilegesRequiredOverridesAllowed=commandline dialog
-SignedUninstaller=yes
-SignTool=signtool $f
+;SignedUninstaller=yes
+;SignTool=signtool $f
[Tasks]
Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Local options:"; MinVersion: 4,4
-Name: "install_snippets"; Description: "Create example SQL snippet files in {#SnippetsDir}"; GroupDescription: "Local options:";
+Name: "install_snippets"; Description: "Create example SQL snippet files in {#SnippetsDir}"; GroupDescription: "Local options:"; Flags: unchecked
Name: "associatesqlfiles"; Description: "Associate .&SQL files with {#ProgName}"; GroupDescription: "Local options:";
Name: "activate_updatechecks"; Description: "Automatically check {#WebSite} for updates"; GroupDescription: "Telemetry:";
Name: "activate_statistics"; Description: "Automatically report client and server versions on {#WebSite}"; GroupDescription: "Telemetry:";
-[InstallDelete]
-Type: files; Name: "{app}\heidisql32.exe"
-Type: files; Name: "{app}\libpq.dll"
-
[Files]
-Source: "{#ProgNameLower}64.exe"; DestDir: "{app}"; DestName: "{#ProgExeName}"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "{#ProgNameLower}32.exe"; DestDir: "{app}"; DestName: "{#ProgExeName}"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "{#ProgNameLower}64.exe"; DestDir: "{app}"; DestName: "{#ProgExeName}"; Flags: ignoreversion
Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "gpl.txt"; DestDir: "{app}"; Flags: ignoreversion
-Source: "plugins64\*.dll"; DestDir: "{app}\plugins"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "plugins32\*.dll"; DestDir: "{app}\plugins"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "plugins64\*.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion
Source: "Snippets\*.sql"; DestDir: "{#SnippetsDir}"; Tasks: install_snippets
-Source: "plink-64.exe"; DestDir: "{app}"; DestName: "plink.exe"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "plink-32.exe"; DestDir: "{app}"; DestName: "plink.exe"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "plink-64.exe"; DestDir: "{app}"; DestName: "plink.exe"; Flags: ignoreversion
+Source: "plink-0.81-64.exe"; DestDir: "{app}"; DestName: "plink-0.81.exe"; Flags: ignoreversion
; OpenSSL libraries, used by Indy HTTP:
-Source: "libeay32-64.dll"; DestDir: "{app}"; DestName: "libeay32.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libeay32-32.dll"; DestDir: "{app}"; DestName: "libeay32.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "ssleay32-64.dll"; DestDir: "{app}"; DestName: "ssleay32.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "ssleay32-32.dll"; DestDir: "{app}"; DestName: "ssleay32.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "libeay32-64.dll"; DestDir: "{app}"; DestName: "libeay32.dll"; Flags: ignoreversion
+Source: "ssleay32-64.dll"; DestDir: "{app}"; DestName: "ssleay32.dll"; Flags: ignoreversion
; MySQL + MariaDB:
-Source: "libmariadb64.dll"; DestDir: "{app}"; DestName: "libmariadb.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libmariadb32.dll"; DestDir: "{app}"; DestName: "libmariadb.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libmysql64.dll"; DestDir: "{app}"; DestName: "libmysql.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libmysql32.dll"; DestDir: "{app}"; DestName: "libmysql.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libmysql-6.1-64.dll"; DestDir: "{app}"; DestName: "libmysql-6.1.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libmysql-6.1-32.dll"; DestDir: "{app}"; DestName: "libmysql-6.1.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "libmariadb-64.dll"; DestDir: "{app}"; DestName: "libmariadb.dll"; Flags: ignoreversion
+Source: "libmysql-64.dll"; DestDir: "{app}"; DestName: "libmysql.dll"; Flags: ignoreversion
+Source: "libmysql-6.1-64.dll"; DestDir: "{app}"; DestName: "libmysql-6.1.dll"; Flags: ignoreversion
+Source: "libmysql-8.4.0-64.dll"; DestDir: "{app}"; DestName: "libmysql-8.4.0.dll"; Flags: ignoreversion
+Source: "libmysql-9.4.0-64.dll"; DestDir: "{app}"; DestName: "libmysql-9.4.0.dll"; Flags: ignoreversion
; PostgreSQL:
-Source: "libpq-10-64.dll"; DestDir: "{app}"; DestName: "libpq-10.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libpq-10-32.dll"; DestDir: "{app}"; DestName: "libpq-10.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libpq-12-64.dll"; DestDir: "{app}"; DestName: "libpq-12.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libpq-15-64.dll"; DestDir: "{app}"; DestName: "libpq-15.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libintl-8-64.dll"; DestDir: "{app}"; DestName: "libintl-8.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libintl-8-32.dll"; DestDir: "{app}"; DestName: "libintl-8.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libintl-9-64.dll"; DestDir: "{app}"; DestName: "libintl-9.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libssl-1_1-x64.dll"; DestDir: "{app}"; DestName: "libssl-1_1-x64.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libssl-1_1-32.dll"; DestDir: "{app}"; DestName: "libssl-1_1.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libssl-3-x64.dll"; DestDir: "{app}"; DestName: "libssl-3-x64.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libcrypto-1_1-x64.dll"; DestDir: "{app}"; DestName: "libcrypto-1_1-x64.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libcrypto-1_1-32.dll"; DestDir: "{app}"; DestName: "libcrypto-1_1.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libcrypto-3-x64.dll"; DestDir: "{app}"; DestName: "libcrypto-3-x64.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
+Source: "libpq-15-64.dll"; DestDir: "{app}"; DestName: "libpq-15.dll"; Flags: ignoreversion
+Source: "libpq-17-64.dll"; DestDir: "{app}"; DestName: "libpq-17.dll"; Flags: ignoreversion
+Source: "libintl-9-64.dll"; DestDir: "{app}"; DestName: "libintl-9.dll"; Flags: ignoreversion
+Source: "libssl-3-x64.dll"; DestDir: "{app}"; DestName: "libssl-3-x64.dll"; Flags: ignoreversion
+Source: "libcrypto-3-x64.dll"; DestDir: "{app}"; DestName: "libcrypto-3-x64.dll"; Flags: ignoreversion
Source: "LICENSE-openssl"; DestDir: "{app}"; Flags: ignoreversion
-Source: "libiconv-2-64.dll"; DestDir: "{app}"; DestName: "libiconv-2.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "libiconv-2-32.dll"; DestDir: "{app}"; DestName: "libiconv-2.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "libwinpthread-1-64.dll"; DestDir: "{app}"; DestName: "libwinpthread-1.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
+Source: "libiconv-2-64.dll"; DestDir: "{app}"; DestName: "libiconv-2.dll"; Flags: ignoreversion
+Source: "libwinpthread-1-64.dll"; DestDir: "{app}"; DestName: "libwinpthread-1.dll"; Flags: ignoreversion
; SQLite:
-Source: "sqlite3-64.dll"; DestDir: "{app}"; DestName: "sqlite3.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "sqlite3-32.dll"; DestDir: "{app}"; DestName: "sqlite3.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "sqlite3-64.dll"; DestDir: "{app}"; DestName: "sqlite3.dll"; Flags: ignoreversion
+Source: "sqlite3mc-64.dll"; DestDir: "{app}"; DestName: "sqlite3mc.dll"; Flags: ignoreversion
; Interbase/Firebird:
-Source: "ibclient64-14.1.dll"; DestDir: "{app}"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "gds32-14.1.dll"; DestDir: "{app}"; Check: not Is64BitInstallMode; Flags: ignoreversion
-Source: "fbclient-4.0-64.dll"; DestDir: "{app}"; DestName: "fbclient-4.0.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: "fbclient-4.0-32.dll"; DestDir: "{app}"; DestName: "fbclient-4.0.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion
-; VC redistributable
-Source: VC_redist.x64.exe; DestDir: "{app}"; Check: Is64BitInstallMode; Flags: ignoreversion
-Source: VC_redist.x86.exe; DestDir: "{app}"; Check: not Is64BitInstallMode; Flags: ignoreversion
+Source: "ibclient64-14.1.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "fbclient-4.0-64.dll"; DestDir: "{app}"; DestName: "fbclient-4.0.dll"; Flags: ignoreversion
; SQL function definitions
Source: "functions-*.ini"; DestDir: "{app}"; Flags: ignoreversion
@@ -164,8 +145,6 @@ Root: HKCU; Subkey: "Software\{#ProgName}"; ValueType: dword; ValueName: "DoUsag
[Run]
Filename: "{app}\{#ProgExeName}"; Description: "Launch {#ProgName}"; Flags: nowait postinstall skipifsilent
-Filename: "{app}\VC_redist.x64.exe"; Parameters: "/q /norestart /q:a /c:""VC_RED~2.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; Check: Is64BitInstallMode; StatusMsg: Installing VC++ 2019 x64 Redistributables...
-Filename: "{app}\VC_redist.x86.exe"; Parameters: "/q /norestart /q:a /c:""VC_RED~1.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; Check: not Is64BitInstallMode; StatusMsg: Installing VC++ 2019 x86 Redistributables...
[Code]
var
diff --git a/out/libcrypto-1_1-32.dll b/out/libcrypto-1_1-32.dll
deleted file mode 100644
index d407b5123..000000000
Binary files a/out/libcrypto-1_1-32.dll and /dev/null differ
diff --git a/out/libcrypto-1_1-x64.dll b/out/libcrypto-1_1-x64.dll
deleted file mode 100644
index 80f1ab3eb..000000000
Binary files a/out/libcrypto-1_1-x64.dll and /dev/null differ
diff --git a/out/libcrypto-3-x64.dll b/out/libcrypto-3-x64.dll
index 5b75f1161..a818e68d5 100644
Binary files a/out/libcrypto-3-x64.dll and b/out/libcrypto-3-x64.dll differ
diff --git a/out/libeay32-32.dll b/out/libeay32-32.dll
deleted file mode 100644
index 03eb35d46..000000000
Binary files a/out/libeay32-32.dll and /dev/null differ
diff --git a/out/libeay32-64.dll b/out/libeay32-64.dll
index cd605f4b0..8d34547af 100644
Binary files a/out/libeay32-64.dll and b/out/libeay32-64.dll differ
diff --git a/out/libiconv-2-32.dll b/out/libiconv-2-32.dll
deleted file mode 100644
index 11beb1fc5..000000000
Binary files a/out/libiconv-2-32.dll and /dev/null differ
diff --git a/out/libiconv-2-64.dll b/out/libiconv-2-64.dll
index 53e907700..1e990c66f 100644
Binary files a/out/libiconv-2-64.dll and b/out/libiconv-2-64.dll differ
diff --git a/out/libintl-8-32.dll b/out/libintl-8-32.dll
deleted file mode 100644
index 4e8daae1e..000000000
Binary files a/out/libintl-8-32.dll and /dev/null differ
diff --git a/out/libintl-8-64.dll b/out/libintl-8-64.dll
deleted file mode 100644
index 5d68c23e7..000000000
Binary files a/out/libintl-8-64.dll and /dev/null differ
diff --git a/out/libmariadb-64.dll b/out/libmariadb-64.dll
new file mode 100644
index 000000000..6efb2852a
Binary files /dev/null and b/out/libmariadb-64.dll differ
diff --git a/out/libmariadb32.dll b/out/libmariadb32.dll
deleted file mode 100644
index b08dee210..000000000
Binary files a/out/libmariadb32.dll and /dev/null differ
diff --git a/out/libmariadb64.dll b/out/libmariadb64.dll
deleted file mode 100644
index c3ba5f174..000000000
Binary files a/out/libmariadb64.dll and /dev/null differ
diff --git a/out/libmysql64.dll b/out/libmysql-64.dll
similarity index 100%
rename from out/libmysql64.dll
rename to out/libmysql-64.dll
diff --git a/out/libmysql-6.1-32.dll b/out/libmysql-8.4.0-64.dll
similarity index 54%
rename from out/libmysql-6.1-32.dll
rename to out/libmysql-8.4.0-64.dll
index aed0d8771..d9a2c2971 100644
Binary files a/out/libmysql-6.1-32.dll and b/out/libmysql-8.4.0-64.dll differ
diff --git a/out/libmysql-9.4.0-64.dll b/out/libmysql-9.4.0-64.dll
new file mode 100644
index 000000000..e65f866be
Binary files /dev/null and b/out/libmysql-9.4.0-64.dll differ
diff --git a/out/libmysql32.dll b/out/libmysql32.dll
deleted file mode 100644
index ca36aad03..000000000
Binary files a/out/libmysql32.dll and /dev/null differ
diff --git a/out/libpq-10-32.dll b/out/libpq-10-32.dll
deleted file mode 100644
index b97c33d5f..000000000
Binary files a/out/libpq-10-32.dll and /dev/null differ
diff --git a/out/libpq-10-64.dll b/out/libpq-10-64.dll
deleted file mode 100644
index cc0bed2b9..000000000
Binary files a/out/libpq-10-64.dll and /dev/null differ
diff --git a/out/libpq-12-64.dll b/out/libpq-12-64.dll
deleted file mode 100644
index 14703e5f4..000000000
Binary files a/out/libpq-12-64.dll and /dev/null differ
diff --git a/out/libpq-15-64.dll b/out/libpq-15-64.dll
index 51ef36c57..416d68e78 100644
Binary files a/out/libpq-15-64.dll and b/out/libpq-15-64.dll differ
diff --git a/out/libpq-17-64.dll b/out/libpq-17-64.dll
new file mode 100644
index 000000000..c7e450172
Binary files /dev/null and b/out/libpq-17-64.dll differ
diff --git a/out/libssl-1_1-32.dll b/out/libssl-1_1-32.dll
deleted file mode 100644
index b47ee968e..000000000
Binary files a/out/libssl-1_1-32.dll and /dev/null differ
diff --git a/out/libssl-1_1-x64.dll b/out/libssl-1_1-x64.dll
deleted file mode 100644
index dd872282c..000000000
Binary files a/out/libssl-1_1-x64.dll and /dev/null differ
diff --git a/out/libssl-3-x64.dll b/out/libssl-3-x64.dll
index f294d31c3..e25fed2e1 100644
Binary files a/out/libssl-3-x64.dll and b/out/libssl-3-x64.dll differ
diff --git a/out/libwinpthread-1-64.dll b/out/libwinpthread-1-64.dll
index 1ae10ed8d..2d5ecc2eb 100644
Binary files a/out/libwinpthread-1-64.dll and b/out/libwinpthread-1-64.dll differ
diff --git a/out/license.txt b/out/license.txt
index 47adda3d4..66d8d2ba1 100644
--- a/out/license.txt
+++ b/out/license.txt
@@ -1,4 +1,4 @@
-Copyright (C)2000 - 2023 - Ansgar Becker
+Copyright (C)2000 - 2025 - Ansgar Becker
HeidiSQL is free. You don't have to pay for it, and you can use it any
way you want. It is developed as an Open Source project under the GNU
diff --git a/out/locale/en/LC_MESSAGES/default.po b/out/locale/en/LC_MESSAGES/default.po
index f1b17c225..4d11cf009 100644
--- a/out/locale/en/LC_MESSAGES/default.po
+++ b/out/locale/en/LC_MESSAGES/default.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
-"PO-Revision-Date: 2023-12-02 14:00+0100\n"
+"PO-Revision-Date: 2025-11-06 19:16+0100\n"
"Last-Translator: Ansgar Becker \n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"Language: en\n"
@@ -15,7 +15,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Poedit 3.4.1\n"
+"X-Generator: Poedit 3.8\n"
#. AboutBox..Caption
#: about.dfm:5
@@ -315,6 +315,9 @@ msgstr "Flush tables"
msgid "Databases:"
msgstr "Databases:"
+msgid "Encryption parameters:"
+msgstr "Encryption parameters:"
+
#. connform..PageControlDetails..tabSettings..chkCompressed..Caption
#: connections.dfm:298
msgid "Compressed client/server protocol"
@@ -436,6 +439,21 @@ msgstr "SSL certificate:"
msgid "SSL cipher:"
msgstr "SSL cipher:"
+msgid "Certificate verification"
+msgstr "Certificate verification"
+
+msgid "No verification (insecure)"
+msgstr "No verification (insecure)"
+
+msgid "Verify CA (insecure)"
+msgstr "Verify CA (insecure)"
+
+msgid "Verify CA and host name identity (may fail with self-signed certs and wildcard cn)"
+msgstr "Verify CA and host name identity (may fail with self-signed certs and wildcard cn)"
+
+msgid "You might need to lower the certificate verification in the SSL settings."
+msgstr "You might need to lower the certificate verification in the SSL settings."
+
msgid "Path to key file"
msgstr "Path to key file"
@@ -1081,6 +1099,9 @@ msgstr "Input file contains local formatted numbers, e.g. 1.234,56 in Germany"
msgid "Truncate destination table before import"
msgstr "Truncate destination table before import"
+msgid "Keep dialog open after import"
+msgstr "Keep dialog open after import"
+
#. loaddataform..grpDuplicates..Caption
#: loaddata.dfm:272
msgid "Handling of duplicate rows"
@@ -2776,6 +2797,18 @@ msgstr "Close tab on doubleclick"
msgid "Close tab on middleclick"
msgstr "Close tab on middleclick"
+msgid "Grayscale inactive tab icons"
+msgstr "Grayscale inactive tab icons"
+
+msgid "Color icons on all tabs"
+msgstr "Color icons on all tabs"
+
+msgid "Grayscale icons on inactive query tabs only"
+msgstr "Grayscale icons on inactive query tabs only"
+
+msgid "Grayscale icons on every inactive tab"
+msgstr "Grayscale icons on every inactive tab"
+
msgid "Tabs in multiple lines"
msgstr "Tabs in multiple lines"
@@ -3259,6 +3292,15 @@ msgstr "Expression"
msgid "Virtuality"
msgstr "Virtuality"
+msgid "Spatial reference system"
+msgstr "Spatial reference system"
+
+msgid "Invisible"
+msgstr "Invisible"
+
+msgid "Hide in certain contexts"
+msgstr "Hide in certain contexts"
+
#. frmTableEditor..PageControlMain..tabBasic..Caption
#: table_editor.dfm:183
msgid "Basic"
@@ -3989,6 +4031,9 @@ msgstr "Your %s is incompatible to %s, or your system is missing a dependent lib
msgid "SSL parameters successfully set."
msgstr "SSL parameters successfully set."
+msgid "SSL parameters not fully set. Result: %d"
+msgstr "SSL parameters not fully set. Result: %d"
+
#: dbconnection.pas:1151
msgid "Attempt to create SSH process, waiting %ds for response ..."
msgstr "Attempt to create SSH process, waiting %ds for response ..."
@@ -4072,6 +4117,9 @@ msgstr "Login to %s:"
msgid "Connecting to %s via %s, username %s, using password: %s ..."
msgstr "Connecting to %s via %s, username %s, using password: %s ..."
+msgid "Connecting to %s via %s, cipher %s, using encryption key: %s ..."
+msgstr "Connecting to %s via %s, cipher %s, using encryption key: %s ..."
+
#: dbconnection.pas:1582
msgid "Closing SSH process #%d ..."
msgstr "Closing SSH process #%d ..."
@@ -4283,13 +4331,6 @@ msgstr "Save new %s?"
msgid "Could not open %s (%s)"
msgstr "Could not open %s (%s)"
-msgid "Could not open %s (%s) - trying again without SSL..."
-msgstr "Could not open %s (%s) - trying again without SSL..."
-
-#: helpers.pas:2829
-msgid "Server did not send required \"Content-Length\" header: %s"
-msgstr "Server did not send required \"Content-Length\" header: %s"
-
#: helpers.pas:2837
msgid "Got HTTP status %d from %s"
msgstr "Got HTTP status %d from %s"
@@ -4483,10 +4524,6 @@ msgstr "First %s warnings:"
msgid "Show all warnings in a new query tab?"
msgstr "Show all warnings in a new query tab?"
-#: main.pas:2364
-msgid "The server variable %s is currently set to %d, so you won't see all warnings."
-msgstr "The server variable %s is currently set to %d, so you won't see all warnings."
-
#: main.pas:2379
msgid "Updating query history ..."
msgstr "Updating query history ..."
@@ -4651,10 +4688,16 @@ msgstr "Empty %d table(s) and/or view(s)?"
msgid "No stored procedure selected."
msgstr "No stored procedure selected."
+msgid "No table selected."
+msgstr "No table selected."
+
#: main.pas:3285
msgid "Please select one or more stored function(s) or routine(s)."
msgstr "Please select one or more stored function(s) or routine(s)."
+msgid "Please select one or more table(s) or view(s)."
+msgstr "Please select one or more table(s) or view(s)."
+
#: main.pas:3304
msgid "Parameter"
msgstr "Parameter"
@@ -4799,6 +4842,9 @@ msgstr "unknown"
msgid "You could try the default library %s in your session settings. (Current: %s)"
msgstr "You could try the default library %s in your session settings. (Current: %s)"
+msgid "This is a known issue with older libraries. Try a newer %s in the session settings."
+msgstr "This is a known issue with older libraries. Try a newer %s in the session settings."
+
#: main.pas:5261
msgid "Specify filter-value..."
msgstr "Specify filter-value..."
@@ -4913,6 +4959,15 @@ msgstr "Please select a non-readonly SQL editor first."
msgid "No SQL editor focused. ActiveControl is %s"
msgstr "No SQL editor focused. ActiveControl is %s"
+msgid "No listing or tree focused. ActiveControl is %s"
+msgstr "No listing or tree focused. ActiveControl is %s"
+
+msgid "Copy all lines from listing or tree in CSV format"
+msgstr "Copy all lines from listing or tree in CSV format"
+
+msgid "%s: %s lines copied to clipboard"
+msgstr "%s: %s lines copied to clipboard"
+
#: main.pas:9768
msgid "The current editor is empty."
msgstr "The current editor is empty."
@@ -5329,8 +5384,8 @@ msgid "Update in progress"
msgstr "Update in progress"
#: updatecheck.pas:264
-msgid "Downloading: %s / %s"
-msgstr "Downloading: %s / %s"
+msgid "Downloading: %s"
+msgstr "Downloading: %s"
#: usermanager.pas:435
msgid "Save modified user?"
@@ -5756,13 +5811,17 @@ msgstr "The selected foreign column do not match the source columns data type an
msgid "Foreign key mismatch"
msgstr "Foreign key mismatch"
-#. Clear data tab filter
+#. Clear data tab filter and sort order
msgid "Data filter for %s deleted"
msgstr "Data filter for %s deleted"
-#. Clear data tab filter
-msgid "Clear data tab filter"
-msgstr "Clear data tab filter"
+#. Clear data tab filter and sort order
+msgid "Sort order for %s deleted"
+msgstr "Sort order for %s deleted"
+
+#. Clear data tab filter and sort order
+msgid "Clear data tab filter and sort order"
+msgstr "Clear data tab filter and sort order"
msgid "Error when updating query history: %s"
msgstr "Error when updating query history: %s"
@@ -6648,3 +6707,63 @@ msgstr "Reset panel dimensions"
msgid "Reset and fix overlapping panels in main window"
msgstr "Reset and fix overlapping panels in main window"
+
+msgid "Warning: Given cipher scheme name \"%s\" could not be found"
+msgstr "Warning: Given cipher scheme name \"%s\" could not be found"
+
+msgid "Warning: Configuring with cipher index %d failed"
+msgstr "Warning: Configuring with cipher index %d failed"
+
+msgid "Warning: Failed to set cipher encryption parameter \"%s\""
+msgstr "Warning: Failed to set cipher encryption parameter \"%s\""
+
+msgid "Info: Cipher encryption parameter \"%s\" set"
+msgstr "Info: Cipher encryption parameter \"%s\" set"
+
+msgid "You have activated encryption on a probably non-encrypted database."
+msgstr "You have activated encryption on a probably non-encrypted database."
+
+msgid "Number of rows:"
+msgstr "Number of rows:"
+
+msgid "Amount of NULLs [percent]:"
+msgstr "Amount of NULLs [percent]:"
+
+msgid "Generate"
+msgstr "Generate"
+
+msgid "Generate data"
+msgstr "Generate data"
+
+msgid "Reformatter:"
+msgstr "Reformatter:"
+
+msgid "Always ask"
+msgstr "Always ask"
+
+msgid ""
+"File already exists: %s\n"
+"\n"
+"Overwrite it?"
+msgstr ""
+"File already exists: %s\n"
+"\n"
+"Overwrite it?"
+
+msgid "Export cancelled, file not overwritten: %s"
+msgstr "Export cancelled, file not overwritten: %s"
+
+msgid "Discard changes?"
+msgstr "Discard changes?"
+
+msgid "Select top %s rows"
+msgstr "Select top %s rows"
+
+msgid "Selects the first %s rows in a new query tab"
+msgstr "Selects the first %s rows in a new query tab"
+
+msgid "Open file after creation"
+msgstr "Open file after creation"
+
+msgid "Source table"
+msgstr "Source table"
diff --git a/out/plink-0.81-64.exe b/out/plink-0.81-64.exe
new file mode 100644
index 000000000..c1dbbd092
Binary files /dev/null and b/out/plink-0.81-64.exe differ
diff --git a/out/plink-32.exe b/out/plink-32.exe
deleted file mode 100644
index 95f91a4da..000000000
Binary files a/out/plink-32.exe and /dev/null differ
diff --git a/out/plink-64.exe b/out/plink-64.exe
index 3b73b55bd..11aa60d03 100644
Binary files a/out/plink-64.exe and b/out/plink-64.exe differ
diff --git a/out/plugins32/auth_gssapi_client.dll b/out/plugins32/auth_gssapi_client.dll
deleted file mode 100644
index 83a2acb99..000000000
Binary files a/out/plugins32/auth_gssapi_client.dll and /dev/null differ
diff --git a/out/plugins32/auth_named_pipe.dll b/out/plugins32/auth_named_pipe.dll
deleted file mode 100644
index 91d079d3d..000000000
Binary files a/out/plugins32/auth_named_pipe.dll and /dev/null differ
diff --git a/out/plugins32/caching_sha2_password.dll b/out/plugins32/caching_sha2_password.dll
deleted file mode 100644
index 262ee1d4b..000000000
Binary files a/out/plugins32/caching_sha2_password.dll and /dev/null differ
diff --git a/out/plugins32/client_ed25519.dll b/out/plugins32/client_ed25519.dll
deleted file mode 100644
index 6550c0af3..000000000
Binary files a/out/plugins32/client_ed25519.dll and /dev/null differ
diff --git a/out/plugins32/dialog.dll b/out/plugins32/dialog.dll
deleted file mode 100644
index 0037b0a2e..000000000
Binary files a/out/plugins32/dialog.dll and /dev/null differ
diff --git a/out/plugins32/mysql_clear_password.dll b/out/plugins32/mysql_clear_password.dll
deleted file mode 100644
index 7d29143f2..000000000
Binary files a/out/plugins32/mysql_clear_password.dll and /dev/null differ
diff --git a/out/plugins32/pvio_npipe.dll b/out/plugins32/pvio_npipe.dll
deleted file mode 100644
index b12f9f927..000000000
Binary files a/out/plugins32/pvio_npipe.dll and /dev/null differ
diff --git a/out/plugins32/pvio_shmem.dll b/out/plugins32/pvio_shmem.dll
deleted file mode 100644
index e7f51e1ed..000000000
Binary files a/out/plugins32/pvio_shmem.dll and /dev/null differ
diff --git a/out/plugins32/sha256_password.dll b/out/plugins32/sha256_password.dll
deleted file mode 100644
index b229ea264..000000000
Binary files a/out/plugins32/sha256_password.dll and /dev/null differ
diff --git a/out/plugins64/auth_gssapi_client.dll b/out/plugins64/auth_gssapi_client.dll
index 80350ea97..e09ff0aa6 100644
Binary files a/out/plugins64/auth_gssapi_client.dll and b/out/plugins64/auth_gssapi_client.dll differ
diff --git a/out/plugins64/caching_sha2_password.dll b/out/plugins64/caching_sha2_password.dll
index 895263288..2d8accce6 100644
Binary files a/out/plugins64/caching_sha2_password.dll and b/out/plugins64/caching_sha2_password.dll differ
diff --git a/out/plugins64/client_ed25519.dll b/out/plugins64/client_ed25519.dll
index dd445d431..f224a30d9 100644
Binary files a/out/plugins64/client_ed25519.dll and b/out/plugins64/client_ed25519.dll differ
diff --git a/out/plugins64/dialog.dll b/out/plugins64/dialog.dll
index 27dbc0a19..467d4eb65 100644
Binary files a/out/plugins64/dialog.dll and b/out/plugins64/dialog.dll differ
diff --git a/out/plugins64/mysql_clear_password.dll b/out/plugins64/mysql_clear_password.dll
index c614769f0..9f7fe5d25 100644
Binary files a/out/plugins64/mysql_clear_password.dll and b/out/plugins64/mysql_clear_password.dll differ
diff --git a/out/plugins64/parsec.dll b/out/plugins64/parsec.dll
new file mode 100644
index 000000000..14b086980
Binary files /dev/null and b/out/plugins64/parsec.dll differ
diff --git a/out/plugins64/pvio_shmem.dll b/out/plugins64/pvio_shmem.dll
index 8e8231968..ec3c0a81a 100644
Binary files a/out/plugins64/pvio_shmem.dll and b/out/plugins64/pvio_shmem.dll differ
diff --git a/out/plugins64/sha256_password.dll b/out/plugins64/sha256_password.dll
index 4959bf03c..afc5548f7 100644
Binary files a/out/plugins64/sha256_password.dll and b/out/plugins64/sha256_password.dll differ
diff --git a/out/sqlite3-32.dll b/out/sqlite3-32.dll
deleted file mode 100644
index c8ad18817..000000000
Binary files a/out/sqlite3-32.dll and /dev/null differ
diff --git a/out/sqlite3-64.dll b/out/sqlite3-64.dll
index 1239c3520..ae8492c56 100644
Binary files a/out/sqlite3-64.dll and b/out/sqlite3-64.dll differ
diff --git a/out/sqlite3mc-64.dll b/out/sqlite3mc-64.dll
new file mode 100644
index 000000000..9affcfb99
Binary files /dev/null and b/out/sqlite3mc-64.dll differ
diff --git a/out/ssleay32-32.dll b/out/ssleay32-32.dll
deleted file mode 100644
index a8e34648f..000000000
Binary files a/out/ssleay32-32.dll and /dev/null differ
diff --git a/out/ssleay32-64.dll b/out/ssleay32-64.dll
index f4b5c75be..44f79428e 100644
Binary files a/out/ssleay32-64.dll and b/out/ssleay32-64.dll differ
diff --git a/packages/Delphi11.2/heidisql.dpr b/packages/Delphi12.1/heidisql.dpr
similarity index 96%
rename from packages/Delphi11.2/heidisql.dpr
rename to packages/Delphi12.1/heidisql.dpr
index 418f51321..b9d721e61 100644
--- a/packages/Delphi11.2/heidisql.dpr
+++ b/packages/Delphi12.1/heidisql.dpr
@@ -97,6 +97,9 @@ begin
// Issue #3064: Ignore TFont, so "Default" on mainform for WinXP users does not get broken.
gnugettext.TP_GlobalIgnoreClass(TFont);
+ // Enable padding in customized tooltips
+ HintWindowClass := TExtHintWindow;
+
Application.Initialize;
Application.Title := APPNAME;
Application.UpdateFormatSettings := False;
diff --git a/packages/Delphi11.2/heidisql.dproj b/packages/Delphi12.1/heidisql.dproj
similarity index 88%
rename from packages/Delphi11.2/heidisql.dproj
rename to packages/Delphi12.1/heidisql.dproj
index 3843d8e1a..49289f45c 100644
--- a/packages/Delphi11.2/heidisql.dproj
+++ b/packages/Delphi12.1/heidisql.dproj
@@ -7,8 +7,9 @@
3ApplicationVCL
- 19.5
+ 20.1Win64
+ heidisqltrue
@@ -77,6 +78,7 @@
Vcl;System;Winapi;System.Win;Data;$(DCC_Namespace)falsefalse
+ falsetrue
@@ -440,6 +442,16 @@
1
+
+
+ res\drawable-anydpi-v21
+ 1
+
+
+ res\drawable-anydpi-v21
+ 1
+
+ res\values
@@ -460,6 +472,66 @@
1
+
+
+ res\values-v31
+ 1
+
+
+ res\values-v31
+ 1
+
+
+
+
+ res\drawable-anydpi-v26
+ 1
+
+
+ res\drawable-anydpi-v26
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-anydpi-v33
+ 1
+
+
+ res\drawable-anydpi-v33
+ 1
+
+ res\values
@@ -470,6 +542,16 @@
1
+
+
+ res\values-night-v21
+ 1
+
+
+ res\values-night-v21
+ 1
+
+ res\drawable
@@ -640,6 +722,56 @@
1
+
+
+ res\drawable-anydpi-v24
+ 1
+
+
+ res\drawable-anydpi-v24
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-night-anydpi-v21
+ 1
+
+
+ res\drawable-night-anydpi-v21
+ 1
+
+
+
+
+ res\drawable-anydpi-v31
+ 1
+
+
+ res\drawable-anydpi-v31
+ 1
+
+
+
+
+ res\drawable-night-anydpi-v31
+ 1
+
+
+ res\drawable-night-anydpi-v31
+ 1
+
+ 1
@@ -770,177 +902,201 @@
0
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ 1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ ..\1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ ..\
+ 1
+
+
+ ..\1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+ Contents1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ Contents
+ 1
+
+
+ Contents1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+ Contents\Resources1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ library\lib\armeabi-v7a1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ library\lib\arm64-v8a
+ 1
+
+ 1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents\MacOS1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents\MacOS1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents\MacOS1
+
+ 0
+
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ library\lib\armeabi-v7a1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+
+ 1
+
+
+ 1
+
+ 1
-
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
+
+
+ ..\
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\1
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\1
-
+
+
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
- 1
+ ..\$(PROJECTNAME).launchscreen
+ 64
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
- 1
+ ..\$(PROJECTNAME).launchscreen
+ 64
-
+
+
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ Assets1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Assets1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ Assets1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Assets1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
@@ -950,7 +1106,7 @@
1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
@@ -960,7 +1116,7 @@
1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
@@ -970,194 +1126,173 @@
1
-
-
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
- 1
-
+
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- ..\
- 1
-
+
- ..\
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
- ..\
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- 1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
- ..\$(PROJECTNAME).launchscreen
- 64
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
- ..\$(PROJECTNAME).launchscreen
- 64
-
-
-
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\
- 1
-
-
- ..\
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
- ..\
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- Contents
- 1
-
-
- Contents
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
- Contents
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- Contents\Resources
- 1
-
-
- Contents\Resources
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
- Contents\Resources
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- library\lib\armeabi-v7a
- 1
-
-
- library\lib\arm64-v8a
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- 1
-
-
- Contents\MacOS
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Contents\MacOS
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Contents\MacOS
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- 0
-
-
-
-
- library\lib\armeabi-v7a
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- Assets
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Assets
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- Assets
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Assets
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
@@ -1173,6 +1308,7 @@
+ 12
diff --git a/packages/Delphi11.2/heidisql.groupproj b/packages/Delphi12.1/heidisql.groupproj
similarity index 88%
rename from packages/Delphi11.2/heidisql.groupproj
rename to packages/Delphi12.1/heidisql.groupproj
index 8541c5f98..c86a77c88 100644
--- a/packages/Delphi11.2/heidisql.groupproj
+++ b/packages/Delphi12.1/heidisql.groupproj
@@ -3,10 +3,10 @@
{C4296A31-CCFB-4D2F-8BEC-26CD630E9987}
-
+
-
+
@@ -30,22 +30,22 @@
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/packages/Delphi11.2/heidisql.mes b/packages/Delphi12.1/heidisql.mes
similarity index 100%
rename from packages/Delphi11.2/heidisql.mes
rename to packages/Delphi12.1/heidisql.mes
diff --git a/packages/Delphi11.1/heidisql.dpr b/packages/Delphi12.3/heidisql.dpr
similarity index 89%
rename from packages/Delphi11.1/heidisql.dpr
rename to packages/Delphi12.3/heidisql.dpr
index a37910c4d..f25ac703e 100644
--- a/packages/Delphi11.1/heidisql.dpr
+++ b/packages/Delphi12.3/heidisql.dpr
@@ -2,10 +2,12 @@ program heidisql;
uses
madExcept,
- Forms,
- SysUtils,
- Dialogs,
- Windows,
+ Vcl.Forms,
+ System.SysUtils,
+ Vcl.Dialogs,
+ Vcl.Controls,
+ Vcl.ComCtrls,
+ Winapi.Windows,
main in '..\..\source\main.pas' {MainForm},
about in '..\..\source\about.pas' {AboutBox},
connections in '..\..\source\connections.pas' {connform},
@@ -55,14 +57,16 @@ uses
csv_detector in '..\..\source\csv_detector.pas' {frmCsvDetector},
generic_types in '..\..\source\generic_types.pas',
customize_highlighter in '..\..\source\customize_highlighter.pas' {frmCustomizeHighlighter},
- Xml.VerySimple in '..\..\source\Xml.VerySimple.pas';
+ Xml.VerySimple in '..\..\source\Xml.VerySimple.pas',
+ Sequal.Suggest in '..\..\source\Sequal.Suggest.pas' {SequalSuggestForm},
+ reformatter in '..\..\source\reformatter.pas' {frmReformatter};
{.$R *.RES}
{$R ..\..\res\icon.RES}
{$R ..\..\res\icon-question.RES}
{$R ..\..\res\version.RES}
{$R ..\..\res\manifest.RES}
-{$R ..\..\res\updater.RES}
+{$IFDEF CPUX64}{$R ..\..\res\updater.RES}{$ENDIF}
{$R ..\..\res\styles.RES}
var
@@ -93,6 +97,10 @@ begin
// First time translation via dxgettext.
// Issue #3064: Ignore TFont, so "Default" on mainform for WinXP users does not get broken.
gnugettext.TP_GlobalIgnoreClass(TFont);
+ gnugettext.TP_GlobalIgnoreClass(TComboBoxEx);
+
+ // Enable padding in customized tooltips
+ HintWindowClass := TExtHintWindow;
Application.Initialize;
Application.Title := APPNAME;
@@ -104,7 +112,6 @@ begin
if TStyleManager.ActiveStyle.Name <> WantedStyle then begin
AppSettings.WriteString(asTheme, TStyleManager.ActiveStyle.Name);
end;
-
Application.CreateForm(TMainForm, MainForm);
MainForm.AfterFormCreate;
Application.OnDeactivate := MainForm.ApplicationDeActivate;
diff --git a/packages/Delphi11.1/heidisql.dproj b/packages/Delphi12.3/heidisql.dproj
similarity index 83%
rename from packages/Delphi11.1/heidisql.dproj
rename to packages/Delphi12.3/heidisql.dproj
index 4e7677836..a725978f6 100644
--- a/packages/Delphi11.1/heidisql.dproj
+++ b/packages/Delphi12.3/heidisql.dproj
@@ -3,12 +3,13 @@
{32493ED6-4F48-45D7-9D50-E4FA13F59063}heidisql.dprTrue
- Release
+ Debug3ApplicationVCL
- 19.4
+ 20.3Win64
+ heidisqltrue
@@ -45,12 +46,6 @@
Basetrue
-
- true
- Cfg_2
- true
- true
- trueCfg_2
@@ -72,7 +67,6 @@
$(BDS)\bin\default_app.manifestfalsefalse
- Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;FMX.Canvas.GPU;System.Win;Data.Win;$(DCC_Namespace)false00400000CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;UIDeviceFamily=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;UISupportedInterfaceOrientations=;CFBundleExecutable=;CFBundleResourceSpecification=;LSRequiresIPhoneOS=;CFBundleInfoDictionaryVersion=;CFBundleDevelopmentRegion=;package=;label=;versionCode=;versionName=;persistent=;restoreAnyVersion=;installLocation=;largeHeap=;theme=
@@ -81,17 +75,18 @@
false1033heidisql
- Windows10|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10.vsf
+ Vcl;System;Winapi;System.Win;Data;$(DCC_Namespace)
+ false
+ false
+ false
- Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)trueCompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
- Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)true$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
@@ -107,23 +102,27 @@
trueCompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)false
+ Debug
+ madExcept;$(DCC_Define)
+ 3
+ 2
+ truetrueCompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
+ DebugmadExcept;$(DCC_Define)
+ 2
+ 3
+ none
+ truetrueDEBUG;$(DCC_Define)false
-
-
- true
- Cfg_2
- true
- true
- Debug
+ trueNone
@@ -139,7 +138,6 @@
trueCompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)3
- trueDebugPerMonitorV2madExcept;$(DCC_Define)
@@ -259,9 +257,16 @@
- dfm
+
+
+ dfm
+
+
+
+ dfm
+ Base
@@ -334,34 +339,21 @@
- Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver
- Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server
+ Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver
+ Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server
- FalseTrueTrueFalse
-
-
-
- true
-
-
-
-
- heidisql.exe
- true
-
-
-
-
- .\
- true
-
-
+
+
+
+
+
+ 1
@@ -374,26 +366,6 @@
0
-
-
- classes
- 64
-
-
- classes
- 64
-
-
-
-
- classes
- 1
-
-
- classes
- 1
-
- res\xml
@@ -404,12 +376,6 @@
1
-
-
- library\lib\armeabi-v7a
- 1
-
- library\lib\armeabi
@@ -462,6 +428,16 @@
1
+
+
+ res\drawable-anydpi-v21
+ 1
+
+
+ res\drawable-anydpi-v21
+ 1
+
+ res\values
@@ -482,6 +458,76 @@
1
+
+
+ res\values-v31
+ 1
+
+
+ res\values-v31
+ 1
+
+
+
+
+ res\values-v35
+ 1
+
+
+ res\values-v35
+ 1
+
+
+
+
+ res\drawable-anydpi-v26
+ 1
+
+
+ res\drawable-anydpi-v26
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-anydpi-v33
+ 1
+
+
+ res\drawable-anydpi-v33
+ 1
+
+ res\values
@@ -492,6 +538,16 @@
1
+
+
+ res\values-night-v21
+ 1
+
+
+ res\values-night-v21
+ 1
+
+ res\drawable
@@ -662,6 +718,56 @@
1
+
+
+ res\drawable-anydpi-v24
+ 1
+
+
+ res\drawable-anydpi-v24
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-night-anydpi-v21
+ 1
+
+
+ res\drawable-night-anydpi-v21
+ 1
+
+
+
+
+ res\drawable-anydpi-v31
+ 1
+
+
+ res\drawable-anydpi-v31
+ 1
+
+
+
+
+ res\drawable-night-anydpi-v31
+ 1
+
+
+ res\drawable-night-anydpi-v31
+ 1
+
+ 1
@@ -703,7 +809,7 @@
1.dylib
-
+ 1.dylib
@@ -736,7 +842,7 @@
1.dylib
-
+ 1.dylib
@@ -773,7 +879,7 @@
0
-
+ 0
@@ -792,382 +898,397 @@
0
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
- 1
-
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ 1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+ ..\1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ ..\1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ ..\1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+
+ Contents1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ Contents\Resources1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents\Resources1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Contents\Resources1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+
+ library\lib\armeabi-v7a1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ library\lib\arm64-v8a1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ Contents\MacOS1
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+ library\lib\armeabi-v7a1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+
+
+ 1
+
+
+ 1
+
+ 1
-
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF1
-
+
+
+ ..\
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ ..\1
-
- ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+
+ ..\1
-
+
+
+ 1
+
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
+
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+
+ 1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ 1
+
+ 1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ Assets1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Assets1
-
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+
+ Assets1
-
- ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+
+ Assets1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
- 1
-
+
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
-
- ..\
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
+
+
- ..\
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
- ..\$(PROJECTNAME).launchscreen
- 64
-
-
- ..\$(PROJECTNAME).launchscreen
- 64
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
-
-
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- ..\
- 1
-
-
- ..\
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- ..\
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- Contents
- 1
-
-
- Contents
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
- Contents
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- Contents\Resources
- 1
-
-
- Contents\Resources
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
- Contents\Resources
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
-
- library\lib\armeabi-v7a
- 1
-
-
- library\lib\arm64-v8a
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset1
-
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Contents\MacOS
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Contents\MacOS
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Contents\MacOS
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- 0
-
-
-
- library\lib\armeabi-v7a
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- Assets
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Assets
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
-
- Assets
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
-
- Assets
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset1
@@ -1175,6 +1296,7 @@
+
@@ -1182,6 +1304,7 @@
+ 12
diff --git a/packages/Delphi11.1/heidisql.groupproj b/packages/Delphi12.3/heidisql.groupproj
similarity index 82%
rename from packages/Delphi11.1/heidisql.groupproj
rename to packages/Delphi12.3/heidisql.groupproj
index a51586394..ef3f2fbb5 100644
--- a/packages/Delphi11.1/heidisql.groupproj
+++ b/packages/Delphi12.3/heidisql.groupproj
@@ -3,16 +3,16 @@
{C4296A31-CCFB-4D2F-8BEC-26CD630E9987}
-
+
-
+
-
+
-
+
@@ -30,40 +30,40 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/packages/Delphi11.1/heidisql.mes b/packages/Delphi12.3/heidisql.mes
similarity index 97%
rename from packages/Delphi11.1/heidisql.mes
rename to packages/Delphi12.3/heidisql.mes
index 52176f0dc..cf4d3b4fd 100644
--- a/packages/Delphi11.1/heidisql.mes
+++ b/packages/Delphi12.3/heidisql.mes
@@ -29,7 +29,7 @@ SmtpPort=0
SmtpAccount=
SmtpPassword=
HttpServer=www.heidisql.com/bugreport.php
-HttpPort=443
+HttpPort=0
HttpAccount=
HttpPassword=
BugReportFile=bugreport.txt
diff --git a/readme.md b/readme.md
index 2a7db80c1..e996fd965 100644
--- a/readme.md
+++ b/readme.md
@@ -6,27 +6,47 @@
# HeidiSQL
HeidiSQL is a graphical interface for managing [MariaDB](http://www.mariadb.org/) or [MySQL](http://www.mysql.com/) servers, [Microsoft SQL databases](http://www.microsoft.com/sql/), [PostgreSQL](http://www.postgresql.org/), [SQLite](https://www.sqlite.org/), [Interbase](https://www.embarcadero.com/de/products/interbase) or [Firebird](https://firebirdsql.org/). "Heidi" lets you browse and edit data, create and edit tables, views, procedures, triggers and scheduled events. Also, you can export structure and data, either to SQL file, clipboard or to other servers. Read about [features](https://www.heidisql.com/#featurelist) or see some [screenshots](https://www.heidisql.com/screenshots.php).
-# Need help?
+### Need help?
Look at [the online help page](https://www.heidisql.com/help.php) to learn how to use HeidiSQL. The [forum](https://www.heidisql.com/forum.php) is meant to ask questions. The [issue tracker](https://github.com/HeidiSQL/HeidiSQL/issues) is the place to report bugs or request new features.
-# Building
-Delphi 11.1 is required for building HeidiSQL. Older Delphi versions will most likely fail; newer Delphi versions may work or fail. Unfortunately, Lazarus or one
+### Building
+For compiling on platforms other than Windows, look at the [`lazarus`](https://github.com/HeidiSQL/HeidiSQL/tree/lazarus) branch.
+
+Delphi 12.1 is required for building HeidiSQL for Windows. Older Delphi versions will most likely fail; newer Delphi versions may work or fail. Unfortunately, Lazarus or one
of the other free compilers cannot currently compile HeidiSQL.
Once Delphi is installed, you need to load the SynEdit project from the components folder. Build both run-time and design-time packages. Install the
-design-time package. Do the same for the VirtualTree component project, and install madExcept.
+design-time package. Do the same for the VirtualTree component project.
+
+Second you need install [madExcept](http://madshi.net/madCollection.exe).
+
+Third compile *.rc files:
+
+| folder | file | command |
+| ------ | ------ | ------ |
+|HeidiSQL/source/vcl-styles-utils |AwesomeFont.RC| brcc32 AwesomeFont.RC|
+|HeidiSQL/res| icon.rc | cgrc icon.rc |
+|HeidiSQL/res| icon-question.rc | brcc32 icon-question.rc |
+|HeidiSQL/res| version.rc | brcc32 version.rc |
+|HeidiSQL/res| manifest.rc | manifest.rc |
+|HeidiSQL/res| styles.rc | brcc32 styles.rc |
+|HeidiSQL/res| updater.rc | brcc32 updater.rc |
+> if updater.rc and updater.exe are not exists. you can copy them from updater64.rc and updater64.exe.
Afterwards, load the HeidiSQL project from the packages folder.
-# Translation
+### Translation
If you'd like to contribute by translating HeidiSQL into your mother tongue, you need to register at
-[Transifex](https://www.transifex.com/heidisql/heidisql/), and join an existing language or request a
+[Transifex](https://explore.transifex.com/heidisql/heidisql/), and join an existing language or request a
new one.
-# Contributing to HeidiSQL
+### Contributing to HeidiSQL
* Pull requests will only be accepted for bugfixes. No new features please.
* Please mention a ticket id in your pull request. If there is no ticket for that particular bug yet, go and create an issue request first, and fill out all fields of the issue template.
* To become a developer member, ask Ansgar via email (see https://www.heidisql.com/imprint.php for email address)
-# Icons8 copyright
+### Icons8 copyright
Icons added in January 2019 into a `TImageCollection` component are copyright by [Icons8](https://icons8.com). Used with a special permission from Icons8 given to Ansgar for this project only. Do not copy them for anything else other than building HeidiSQL.
+
+[](https://www.embarcadero.com/de/case-study/heidisql-case-study)
+
diff --git a/res/icons/key_vector.png b/res/icons/key_vector.png
new file mode 100644
index 000000000..83ae5ab03
Binary files /dev/null and b/res/icons/key_vector.png differ
diff --git a/res/manifest.xml b/res/manifest.xml
index 36996eaa2..b315924c5 100644
--- a/res/manifest.xml
+++ b/res/manifest.xml
@@ -49,4 +49,7 @@
+
+
+
\ No newline at end of file
diff --git a/res/styles/Glow.vsf b/res/styles/Glow.vsf
index 9d35e00d3..6acafc775 100644
Binary files a/res/styles/Glow.vsf and b/res/styles/Glow.vsf differ
diff --git a/res/version.rc b/res/version.rc
index e61d40374..a60b9a1dc 100644
--- a/res/version.rc
+++ b/res/version.rc
@@ -1,5 +1,5 @@
1 VERSIONINFO
- FILEVERSION 12,6,0,0
+ FILEVERSION 12,17,0,0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
diff --git a/source/about.dfm b/source/about.dfm
index 6eac6df96..79659877c 100644
--- a/source/about.dfm
+++ b/source/about.dfm
@@ -3,7 +3,7 @@ object AboutBox: TAboutBox
Top = 105
BorderStyle = bsDialog
Caption = 'About'
- ClientHeight = 327
+ ClientHeight = 371
ClientWidth = 471
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -16,7 +16,7 @@ object AboutBox: TAboutBox
OnShow = FormShow
DesignSize = (
471
- 327)
+ 371)
TextHeight = 14
object lblAppName: TLabel
Left = 117
@@ -40,7 +40,7 @@ object AboutBox: TAboutBox
end
object lblAppCompiled: TLabel
Left = 117
- Top = 62
+ Top = 63
Width = 82
Height = 14
Caption = 'lblAppCompiled'
@@ -264,14 +264,14 @@ object AboutBox: TAboutBox
end
object lblDonated: TLabel
Left = 117
- Top = 153
+ Top = 171
Width = 238
Height = 14
Caption = 'I have donated per following email address:'
end
object lblEnvironment: TLabel
Left = 117
- Top = 81
+ Top = 83
Width = 80
Height = 14
Caption = 'lblEnvironment'
@@ -279,9 +279,9 @@ object AboutBox: TAboutBox
end
object lnklblWebpage: TLinkLabel
Left = 117
- Top = 100
- Width = 83
- Height = 19
+ Top = 103
+ Width = 104
+ Height = 24
Caption = 'lnklblWebpage'
TabOrder = 0
UseVisualStyle = True
@@ -289,9 +289,9 @@ object AboutBox: TAboutBox
end
object lnklblCredits: TLinkLabel
Left = 117
- Top = 119
- Width = 41
- Height = 19
+ Top = 123
+ Width = 50
+ Height = 24
Caption = 'Credits'
TabOrder = 1
UseVisualStyle = True
@@ -299,7 +299,7 @@ object AboutBox: TAboutBox
end
object btnClose: TButton
Left = 353
- Top = 294
+ Top = 338
Width = 100
Height = 25
Anchors = [akRight, akBottom]
@@ -311,7 +311,7 @@ object AboutBox: TAboutBox
end
object btnUpdateCheck: TButton
Left = 117
- Top = 294
+ Top = 338
Width = 230
Height = 25
Action = MainForm.actUpdateCheck
@@ -321,7 +321,7 @@ object AboutBox: TAboutBox
end
object editDonated: TEdit
Left = 117
- Top = 172
+ Top = 190
Width = 180
Height = 22
TabOrder = 2
@@ -331,7 +331,7 @@ object AboutBox: TAboutBox
end
object btnDonatedOK: TButton
Left = 303
- Top = 171
+ Top = 189
Width = 64
Height = 25
Caption = 'OK'
@@ -340,7 +340,7 @@ object AboutBox: TAboutBox
end
object btnDonate: TButton
Left = 117
- Top = 200
+ Top = 218
Width = 336
Height = 74
Hint =
@@ -354,6 +354,16 @@ object AboutBox: TAboutBox
Style = bsCommandLink
TabOrder = 4
end
+ object lnklblCompiler: TLinkLabel
+ Left = 246
+ Top = 63
+ Width = 101
+ Height = 24
+ Caption = 'lnklblCompiler'
+ TabOrder = 7
+ UseVisualStyle = True
+ OnLinkClick = lnklblWebpageLinkClick
+ end
object popupLabels: TPopupMenu
Images = MainForm.VirtualImageListMain
Left = 32
diff --git a/source/about.pas b/source/about.pas
index b15dc0489..f72b4bc0c 100644
--- a/source/about.pas
+++ b/source/about.pas
@@ -27,6 +27,7 @@ TAboutBox = class(TExtForm)
menuCopyLabel: TMenuItem;
lblEnvironment: TLabel;
btnDonate: TButton;
+ lnklblCompiler: TLinkLabel;
procedure OpenURL(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure editDonatedEnter(Sender: TObject);
@@ -39,6 +40,7 @@ TAboutBox = class(TExtForm)
procedure menuCopyLabelClick(Sender: TObject);
private
{ Private declarations }
+ function GetDelphiVersion: String;
public
{ Public declarations }
end;
@@ -120,7 +122,10 @@ procedure TAboutBox.FormShow(Sender: TObject);
Caption := f_('About %s', [APPNAME]);
lblAppName.Caption := APPNAME;
lblAppVersion.Caption := _('Version') + ' ' + Mainform.AppVersion + ' (' + IntToStr(GetExecutableBits) + ' Bit)';
- lblAppCompiled.Caption := _('Compiled on:') + ' ' + DateTimeToStr(GetImageLinkTimeStamp(Application.ExeName));
+ lblAppCompiled.Caption := _('Compiled on:') + ' ' + DateTimeToStr(GetImageLinkTimeStamp(Application.ExeName)) + ' with';
+ lnklblCompiler.Top := lblAppCompiled.Top;
+ lnklblCompiler.Left := lblAppCompiled.Left + lblAppCompiled.Width + Canvas.TextWidth(' ');
+ lnklblCompiler.Caption := ''+GetDelphiVersion+'';
lnklblWebpage.Caption := ''+APPDOMAIN+'';
lnklblCredits.Caption := ''+lnklblCredits.Caption+'';
ImageHeidisql.Hint := APPDOMAIN+'?place='+EncodeURLParam(ImageHeidisql.Name);
@@ -158,5 +163,21 @@ procedure TAboutBox.lnklblWebpageLinkClick(Sender: TObject; const Link: string;
ShellExec(Link);
end;
+function TAboutBox.GetDelphiVersion: string;
+begin
+ {$IF Defined(VER360)}
+ // Oldest/first official version where this gets used
+ Result := '12';
+ {$ELSEIF Defined(VER350)}
+ Result := '11';
+ {$ELSEIF Defined(VER340)}
+ Result := '10.4';
+ {$ELSE}
+ Result := '10.3 or older';
+ {$ENDIF}
+
+ Result := 'Delphi ' + Result;
+end;
+
end.
diff --git a/source/apphelpers.pas b/source/apphelpers.pas
index 7c9d6686a..35e19ab56 100644
--- a/source/apphelpers.pas
+++ b/source/apphelpers.pas
@@ -10,11 +10,11 @@ interface
uses
System.Classes, System.SysUtils, Vcl.Graphics, Vcl.GraphUtil, Vcl.ClipBrd, Vcl.Dialogs, Vcl.Forms, Vcl.Controls, Winapi.ShellApi,
- Winapi.Windows, Winapi.ShlObj, Winapi.ActiveX, VirtualTrees, VirtualTrees.Types, SynRegExpr, Winapi.Messages, System.Math,
+ Winapi.Windows, Winapi.ShlObj, Winapi.ActiveX, VirtualTrees, VirtualTrees.BaseTree, VirtualTrees.Types, SynRegExpr, Winapi.Messages, System.Math,
System.Win.Registry, System.DateUtils, System.Generics.Collections, System.Contnrs, System.StrUtils, System.AnsiStrings, Winapi.TlHelp32, System.Types,
dbconnection, dbstructures, dbstructures.mysql, SynMemo, Vcl.Menus, Winapi.WinInet, gnugettext, Vcl.Themes,
System.Character, Vcl.ImgList, System.UITypes, Vcl.ActnList, Winapi.WinSock, System.IOUtils, Vcl.StdCtrls, Vcl.ComCtrls,
- Winapi.CommCtrl, Winapi.KnownFolders, SynUnicode, SynEdit;
+ Winapi.CommCtrl, Winapi.KnownFolders, SynUnicode, SynEdit, System.IniFiles;
type
@@ -76,10 +76,14 @@ TSQLSentence = class(TObject)
TSQLBatch = class(TObjectList)
private
FSQL: String;
+ FQuotes: THashedStringList;
+ FEscape: Char;
procedure SetSQL(Value: String);
function GetSize: Integer;
function GetSQLWithoutComments: String; overload;
public
+ constructor Create(NetTypeGroup: TNetTypeGroup);
+ destructor Destroy; override;
class function GetSQLWithoutComments(FullSQL: String): String; overload;
property Size: Integer read GetSize;
property SQL: String read FSQL write SetSQL;
@@ -93,7 +97,6 @@ THttpDownload = class(TObject)
FURL: String;
FLastContent: String;
FBytesRead: Integer;
- FContentLength: Integer;
FTimeOut: Cardinal;
FOnProgress: TNotifyEvent;
public
@@ -103,7 +106,6 @@ THttpDownload = class(TObject)
property URL: String read FURL write FURL;
property TimeOut: Cardinal read FTimeOut write FTimeOut;
property BytesRead: Integer read FBytesRead;
- property ContentLength: Integer read FContentLength;
property LastContent: String read FLastContent;
end;
@@ -170,6 +172,8 @@ TWinControlHelper = class helper for TWinControl
procedure TrySetFocus;
end;
+ //TSimpleKeyValuePairs = TDictionary;
+
TAppSettingDataType = (adInt, adBool, adString);
TAppSettingIndex = (asHiddenColumns, asFilter, asSort, asDisplayedColumnsSorted, asLastSessions,
asLastActiveSession, asAutoReconnect, asRestoreLastUsedDB, asLastUsedDB, asTreeBackground, asIgnoreDatabasePattern, asLogFileDdl, asLogFileDml, asLogFilePath,
@@ -184,16 +188,16 @@ TWinControlHelper = class helper for TWinControl
asWrapLongLines, asCodeFolding, asDisplayBLOBsAsText, asSingleQueries, asMemoEditorWidth, asMemoEditorHeight, asMemoEditorMaximized,
asMemoEditorWrap, asMemoEditorHighlighter, asMemoEditorAlwaysFormatCode, asDelimiter, asSQLHelpWindowLeft, asSQLHelpWindowTop, asSQLHelpWindowWidth,
asSQLHelpWindowHeight, asSQLHelpPnlLeftWidth, asSQLHelpPnlRightTopHeight, asHost,
- asUser, asPassword, asCleartextPluginEnabled, asWindowsAuth, asLoginPrompt, asPort, asLibrary, asAllProviders,
+ asUser, asPassword, asCleartextPluginEnabled, asForceUnicode, asWindowsAuth, asLoginPrompt, asPort, asLibrary, asAllProviders,
asSSHtunnelActive, asPlinkExecutable, asSshExecutable, asSSHtunnelHost, asSSHtunnelHostPort, asSSHtunnelPort, asSSHtunnelUser,
asSSHtunnelPassword, asSSHtunnelTimeout, asSSHtunnelPrivateKey, asSSLActive, asSSLKey,
- asSSLCert, asSSLCA, asSSLCipher, asSSLWarnUnused, asNetType, asCompressed, asLocalTimeZone, asQueryTimeout, asKeepAlive,
+ asSSLCert, asSSLCA, asSSLCipher, asSSLVerification, asSSLWarnUnused, asNetType, asCompressed, asLocalTimeZone, asQueryTimeout, asKeepAlive,
asStartupScriptFilename, asDatabases, asComment, asDatabaseFilter, asTableFilter, asFilterVT, asExportSQLCreateDatabases,
asExportSQLCreateTables, asExportSQLDataHow, asExportSQLDataInsertSize, asExportSQLFilenames, asExportZIPFilenames, asExportSQLDirectories,
- asExportSQLDatabase, asExportSQLServerDatabase, asExportSQLOutput, asExportSQLAddComments, asExportSQLRemoveAutoIncrement, asExportSQLRemoveDefiner,
+ asExportSQLDatabase, asExportSQLServerDatabase, asExportSQLOutput, asExportSQLAddComments, asExportSQLTransactions, asExportSQLRemoveAutoIncrement, asExportSQLRemoveDefiner,
asGridExportWindowWidth, asGridExportWindowHeight, asGridExportOutputCopy, asGridExportOutputFile,
asGridExportFilename, asGridExportRecentFiles, asGridExportEncoding, asGridExportFormat, asGridExportSelection,
- asGridExportColumnNames, asGridExportIncludeAutoInc, asGridExportIncludeQuery, asGridExportRemoveLinebreaks,
+ asGridExportColumnNames, asGridExportIncludeAutoInc, asGridExportFocusedColumnOnly, asGridExportIncludeQuery, asGridExportRemoveLinebreaks, asGridExportOpenFile,
asGridExportSeparator, asGridExportEncloser, asGridExportTerminator, asGridExportNull,
asGridExportClpColumnNames, asGridExportClpIncludeAutoInc, asGridExportClpRemoveLinebreaks,
@@ -201,18 +205,19 @@ TWinControlHelper = class helper for TWinControl
asCSVImportSeparator, asCSVImportEncloser, asCSVImportTerminator, asCSVImportFieldEscaper, asCSVImportWindowWidth, asCSVImportWindowHeight,
asCSVImportFilename, asCSVImportFieldsEnclosedOptionally, asCSVImportIgnoreLines, asCSVImportLowPriority, asCSVImportLocalNumbers,
- asCSVImportDuplicateHandling, asCSVImportParseMethod,
+ asCSVImportDuplicateHandling, asCSVImportParseMethod, asCSVKeepDialogOpen,
asUpdatecheck, asUpdatecheckBuilds, asUpdatecheckInterval, asUpdatecheckLastrun, asUpdateCheckWindowWidth, asUpdateCheckWindowHeight,
asTableToolsWindowWidth, asTableToolsWindowHeight, asTableToolsTreeWidth,
asTableToolsFindTextTab, asTableToolsFindText, asTableToolsFindSQL, asTableToolsDatatype, asTableToolsFindCaseSensitive, asTableToolsFindMatchType, asFileImportWindowWidth, asFileImportWindowHeight,
asEditVarWindowWidth, asEditVarWindowHeight, asUsermanagerWindowWidth, asUsermanagerWindowHeight, asUsermanagerListWidth,
asSelectDBOWindowWidth, asSelectDBOWindowHeight,
- asSessionManagerListWidth, asSessionManagerWindowWidth, asSessionManagerWindowHeight, asSessionManagerWindowLeft, asSessionManagerWindowTop,
+ asSessionManagerListWidth, asSessionManagerListFoldersAtTop, asSessionManagerWindowWidth, asSessionManagerWindowHeight, asSessionManagerWindowLeft, asSessionManagerWindowTop,
asCopyTableWindowHeight, asCopyTableWindowWidth, asCopyTableColumns, asCopyTableKeys, asCopyTableForeignKeys,
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory,
- asPromptSaveFileOnTabClose, asRestoreTabs, asTabCloseOnDoubleClick, asTabCloseOnMiddleClick, asTabsInMultipleLines, asWarnUnsafeUpdates, asQueryWarningsMessage, asQueryGridLongSortRowNum,
+ asPromptSaveFileOnTabClose, asRestoreTabs, asTabCloseOnDoubleClick, asTabCloseOnMiddleClick, asTabsInMultipleLines, asTabIconsGrayscaleMode,
+ asWarnUnsafeUpdates, asQueryGridLongSortRowNum,
asCompletionProposal, asCompletionProposalInterval, asCompletionProposalSearchOnMid, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack, asWebSearchBaseUrl,
@@ -231,7 +236,8 @@ TWinControlHelper = class helper for TWinControl
asThemePreviewWidth, asThemePreviewHeight, asThemePreviewTop, asThemePreviewLeft,
asCreateDbCollation, asRealTrailingZeros,
asSequalSuggestWindowWidth, asSequalSuggestWindowHeight, asSequalSuggestPrompt, asSequalSuggestRecentPrompts,
- asReformatter, asAlwaysGenerateFilter,
+ asReformatter, asReformatterNoDialog, asAlwaysGenerateFilter, asDisplayReverseForeignKeys,
+ asGenerateDataNumRows, asGenerateDataNullAmount, asWebOnceAction, asDisplayLogPanel, asDisplayTreeFilters,
asUnused);
TAppSetting = record
Name: String;
@@ -318,6 +324,9 @@ TAppSettings = class(TObject)
function Explode(Separator, Text: String) :TStringList;
procedure ExplodeQuotedList(Text: String; var List: TStringList);
function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True): String;
+ function isUnicode(str: String): Boolean;
+ function encryptUnicode(str: String): String;
+ function decryptUnicode(str: String): String;
function encrypt(str: String): String;
function decrypt(str: String): String;
function HTMLSpecialChars(str: String): String;
@@ -333,6 +342,7 @@ TAppSettings = class(TObject)
function IsFloat(Str: String): Boolean;
function ScanLineBreaks(Text: String): TLineBreaks;
function fixNewlines(txt: String): String;
+ procedure StripNewLines(var txt: String; Replacement: String=' ');
function GetLineBreak(LineBreakIndex: TLineBreaks): String;
procedure RemoveNullChars(var Text: String; var HasNulls: Boolean);
function GetShellFolder(FolderId: TGUID): String;
@@ -350,7 +360,8 @@ TAppSettings = class(TObject)
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
function FormatTimeNumber(Seconds: Double; DisplaySeconds: Boolean; MilliSecondsPrecision: Integer=1): String;
function GetTempDir: String;
- procedure SaveUnicodeFile(Filename: String; Text: String);
+ function GetAppDir: String;
+ procedure SaveUnicodeFile(Filename: String; Text: String; Encoding: TEncoding);
procedure OpenTextFile(const Filename: String; out Stream: TFileStream; var Encoding: TEncoding);
function DetectEncoding(Stream: TStream): TEncoding;
function ReadTextfileChunk(Stream: TFileStream; Encoding: TEncoding; ChunkSize: Int64 = 0): String;
@@ -390,6 +401,7 @@ TAppSettings = class(TObject)
function GetImageLinkTimeStamp(const FileName: string): TDateTime;
function IsEmpty(Str: String): Boolean;
function IsNotEmpty(Str: String): Boolean;
+ function IfEmpty(Str: String; WhenEmpty: String): String;
function MessageDialog(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons): Integer; overload;
function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; KeepAskingSetting: TAppSettingIndex=asUnused; FooterText: String=''): Integer; overload;
function ErrorDialog(Msg: string): Integer; overload;
@@ -403,6 +415,7 @@ TAppSettings = class(TObject)
function GetSystemImageList: TImageList;
function GetSystemImageIndex(Filename: String): Integer;
function GetExecutableBits: Byte;
+ procedure GetExecutableVersion(FileName: String; var MajorVer, MinorVer, ReleaseVer, RevisionVer: Word);
procedure Help(Sender: TObject; Anchor: String);
function PortOpen(Port: Word): Boolean;
function IsValidFilePath(FilePath: String): Boolean;
@@ -410,7 +423,7 @@ TAppSettings = class(TObject)
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion, dwSpMinorVersion: DWORD; out pdwReturnedProductType: DWORD): BOOL stdcall; external kernel32 delayed;
function GetCurrentPackageFullName(out Len: Cardinal; Name: PWideChar): Integer; stdcall; external kernel32 delayed;
function GetThemeColor(Color: TColor): TColor;
- function ThemeIsDark(ThemeName: String): Boolean;
+ function ThemeIsDark(ThemeName: String=''): Boolean;
function ProcessExists(pid: Cardinal; ExeNamePattern: String): Boolean;
procedure ToggleCheckBoxWithoutClick(chk: TCheckBox; State: Boolean);
function SynCompletionProposalPrettyText(ImageIndex: Integer; LeftText, CenterText, RightText: String; LeftColor: TColor=-1; CenterColor: TColor=-1; RightColor: TColor=-1): String;
@@ -420,6 +433,8 @@ TAppSettings = class(TObject)
procedure FindComponentInstances(BaseForm: TComponent; ClassType: TClass; var List: TObjectList);
function WebColorStrToColorDef(WebColor: string; Default: TColor): TColor;
function UserAgent(OwnerComponent: TComponent): String;
+ function CodeIndent(Steps: Integer=1): String;
+ function EscapeHotkeyPrefix(Text: String): String;
var
AppSettings: TAppSettings;
@@ -526,6 +541,77 @@ function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True):
+{***
+ Check if string is Unicode
+
+ @param string String to check
+ @return boolean
+}
+function isUnicode(str: String): Boolean;
+var i: integer;
+begin
+ result := false;
+ for i := 1 to length(str) do begin
+ result := ord(str[i]) > 255;
+ if result then exit;
+ end;
+end;
+
+
+{***
+ Password-encryption, used to store session-passwords in registry
+ Unicode (UTF-16) version, support up to 0xFFFF
+
+ @param string Text to encrypt
+ @return string Encrypted Text
+}
+function encryptUnicode(str: String): String;
+var
+ i, salt, nr: integer;
+ h: String;
+begin
+ randomize();
+ result := '';
+ salt := random(9) + 1;
+ for i := 1 to length(str) do begin
+ nr := (ord(str[i]) + salt) mod 65536;
+ h := IntToHex(nr, 4); // 4 hex-symbols
+ result := result + h;
+ end;
+ // Adding Unicode flag
+ result := result + IntToStr(salt) + '0';
+end;
+
+
+{***
+ Password-decryption, used to restore session-passwords from registry
+ Unicode (UTF-16) version, support up to 0xFFFF
+
+ @param string Text to decrypt
+ @return string Decrypted Text
+}
+function decryptUnicode(str: String): String;
+var
+ j, salt, nr: integer;
+begin
+ result := '';
+ if str = '' then exit;
+ salt := StrToIntDef(str[length(str)], -1);
+
+ // Salt is NAN
+ if salt < 0 then exit;
+
+ j := 1;
+ while j < length(str) do begin
+ nr := StrToInt('$' + copy(str, j, 4)) - salt;
+ if nr < 0 then
+ nr := nr + 65536;
+ result := result + chr(nr);
+ inc(j, 4);
+ end;
+end;
+
+
{***
Password-encryption, used to store session-passwords in registry
@@ -537,6 +623,11 @@ function encrypt(str: String) : String;
i, salt, nr : integer;
h : String;
begin
+ if isUnicode(str) then begin
+ result := encryptUnicode(str);
+ exit;
+ end;
+
randomize();
result := '';
salt := random(9) + 1;
@@ -553,7 +644,6 @@ function encrypt(str: String) : String;
end;
-
{***
Password-decryption, used to restore session-passwords from registry
@@ -566,9 +656,20 @@ function decrypt(str: String) : String;
begin
result := '';
if str = '' then exit;
+ salt := StrToIntDef(str[length(str)], -1);
+
+ // Salt is NAN - error
+ if salt < 0 then exit;
+
+ // Salt is Unicode flag - Unicode logic
+ if salt = 0 then begin
+ // Removing Unicode flag
+ result := decryptUnicode(copy(str, 1, length(str) - 1));
+ exit;
+ end;
+
+ // Salt is... salt - ANSI logic
j := 1;
- salt := StrToIntDef(str[length(str)],0);
- result := '';
while j < length(str)-1 do begin
nr := StrToInt('$' + str[j] + str[j+1]) - salt;
if nr < 0 then
@@ -610,10 +711,13 @@ function EncodeURLParam(const Value: String): String;
}
procedure StreamWrite(S: TStream; Text: String = '');
var
- utf8: AnsiString;
+ utf8: UTF8String;
+ L: Integer;
begin
utf8 := Utf8Encode(Text);
- S.Write(utf8[1], Length(utf8));
+ L := Length(utf8);
+ if L > 0 then
+ S.WriteBuffer(utf8[1], L);
end;
@@ -827,6 +931,12 @@ function fixNewlines(txt: String): String;
result := txt;
end;
+procedure StripNewLines(var txt: String; Replacement: String=' ');
+begin
+ txt := StringReplace(txt, #13#10, Replacement, [rfReplaceAll]);
+ txt := StringReplace(txt, #13, Replacement, [rfReplaceAll]);
+ txt := StringReplace(txt, #10, Replacement, [rfReplaceAll]);
+end;
function GetLineBreak(LineBreakIndex: TLineBreaks): String;
begin
@@ -1195,14 +1305,22 @@ function GetTempDir: String;
end;
+function GetAppDir: String;
+begin
+ Result := ExtractFilePath(Application.ExeName);
+end;
+
{**
Save a textfile with unicode
}
-procedure SaveUnicodeFile(Filename: String; Text: String);
+procedure SaveUnicodeFile(Filename: String; Text: String; Encoding: TEncoding);
var
Writer: TStreamWriter;
begin
- Writer := TStreamWriter.Create(Filename, False, UTF8NoBOMEncoding);
+ // Encoding may be nil when previously loaded via auto-detection
+ if not Assigned(Encoding) then
+ Encoding := UTF8NoBOMEncoding;
+ Writer := TStreamWriter.Create(Filename, False, Encoding);
Writer.Write(Text);
Writer.Free;
end;
@@ -1217,6 +1335,9 @@ procedure OpenTextFile(const Filename: String; out Stream: TFileStream; var Enco
Stream := TFileStream.Create(Filename, fmOpenRead or fmShareDenyNone);
if Encoding = nil then
Encoding := DetectEncoding(Stream);
+ // For a 0-bytes file, override the encoding to one without BOM
+ if _GetFileSize(Filename) < Length(Encoding.GetPreamble) then
+ Encoding := UTF8NoBOMEncoding;
// If the file contains a BOM, advance the stream's position
BomLen := 0;
if Length(Encoding.GetPreamble) > 0 then begin
@@ -1403,15 +1524,19 @@ procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
SingleLineHeight := GetTextHeight(VT.Font) + 7;
// Multiline nodes?
VT.DefaultNodeHeight := SingleLineHeight * MultiLineCount;
+ VT.Header.MinHeight := SingleLineHeight;
VT.Header.Height := SingleLineHeight;
// Apply new height to multi line grid nodes
Node := VT.GetFirstInitialized;
while Assigned(Node) do begin
- VT.NodeHeight[Node] := VT.DefaultNodeHeight;
+ // Nodes have vsMultiLine through InitNode event
VT.MultiLine[Node] := MultiLineCount > 1;
Node := VT.GetNextInitialized(Node);
end;
VT.EndUpdate;
+ VT.TextMargin := 6;
+ VT.Margin := 2;
+ VT.DefaultText := '-'; // "Node" by default
// Disable hottracking in non-Vista mode, looks ugly in XP, but nice in Vista
if (toUseExplorerTheme in VT.TreeOptions.PaintOptions) and (Win32MajorVersion >= 6) then
VT.TreeOptions.PaintOptions := VT.TreeOptions.PaintOptions + [toHotTrack]
@@ -1427,7 +1552,7 @@ procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
else
VT.HintMode := hmTooltip; // Just a quick tooltip for clipped nodes
// Apply case insensitive incremental search event
- if VT.IncrementalSearch <> VirtualTrees.isNone then
+ if VT.IncrementalSearch <> VirtualTrees.Types.isNone then
VT.OnIncrementalSearch := Mainform.AnyGridIncrementalSearch;
VT.OnStartOperation := Mainform.AnyGridStartOperation;
VT.OnEndOperation := Mainform.AnyGridEndOperation;
@@ -1523,6 +1648,7 @@ function SelectNode(VT: TVirtualStringTree; idx: Int64; ParentNode: PVirtualNode
function SelectNode(VT: TVirtualStringTree; Node: PVirtualNode; ClearSelection: Boolean=True): Boolean; overload;
var
OldFocus: PVirtualNode;
+ MinimumColumnIndex: TColumnIndex;
begin
if Node = VT.RootNode then
Node := nil;
@@ -1535,7 +1661,9 @@ function SelectNode(VT: TVirtualStringTree; Node: PVirtualNode; ClearSelection:
if ClearSelection then
VT.ClearSelection;
VT.FocusedNode := Node;
- VT.FocusedColumn := VT.Header.Columns.GetFirstVisibleColumn(True);
+ MinimumColumnIndex := VT.Header.Columns.GetFirstVisibleColumn(True);
+ if VT.FocusedColumn < MinimumColumnIndex then
+ VT.FocusedColumn := MinimumColumnIndex;
VT.Selected[Node] := True;
VT.ScrollIntoView(Node, False);
if (OldFocus = Node) and Assigned(VT.OnFocusChanged) then
@@ -1766,9 +1894,9 @@ function TSortItems.ComposeOrderClause(Connection: TDBConnection): String;
if Result <> '' then
Result := Result + ', ';
if SortItem.Order = sioAscending then
- SortOrder := Connection.GetSQLSpecifity(spOrderAsc)
+ SortOrder := Connection.SqlProvider.GetSql(qOrderAsc)
else
- SortOrder := Connection.GetSQLSpecifity(spOrderDesc);
+ SortOrder := Connection.SqlProvider.GetSql(qOrderDesc);
Result := Result + Connection.QuoteIdent(SortItem.Column) + ' ' + SortOrder;
end;
end;
@@ -2151,7 +2279,7 @@ function CompareAnyNode(Text1, Text2: String): Integer;
end;
if (not NumberMode) or (Result=0) then begin
// Compare Strings
- Result := CompareText(Text1, Text2);
+ Result := CompareText(Text1, Text2, loUserLocale);
end;
end;
@@ -2310,6 +2438,13 @@ function IsNotEmpty(Str: String): Boolean;
Result := Str <> '';
end;
+function IfEmpty(Str: String; WhenEmpty: String): String;
+begin
+ if Str.IsEmpty then
+ Result := WhenEmpty
+ else
+ Result := Str;
+end;
function MessageDialog(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons): Integer;
begin
@@ -2344,7 +2479,7 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
cap := _(BtnCaption);
for i:=1 to Length(cap) do begin
// Auto apply hotkey
- if (Pos(LowerCase(cap[i]), Hotkeys) = 0) and TCharacter.IsLetter(cap[i]) then begin
+ if (Pos(LowerCase(cap[i]), Hotkeys) = 0) and cap[i].IsLetter then begin
Hotkeys := Hotkeys + LowerCase(cap[i]);
Insert('&', cap, i);
break;
@@ -2377,11 +2512,14 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
end;
if Title <> Dialog.Caption then
Dialog.Title := Title;
- if Assigned(MainForm) and (MainForm.ActiveConnection <> nil) then
+ if Assigned(MainForm) and (MainForm.ActiveConnection <> nil) and (MainForm.ActiveConnection.Parameters <> nil) then
Dialog.Caption := MainForm.ActiveConnection.Parameters.SessionName + ': ' + Dialog.Caption;
rx := TRegExpr.Create;
- rx.Expression := 'https?://\S+';
- Dialog.Text := rx.Replace(Msg, '$0', True);
+ rx.Expression := 'https?://[^\s"]+';
+ if ThemeIsDark then
+ Dialog.Text := Msg
+ else // See issue #2036
+ Dialog.Text := rx.Replace(Msg, '$0', True);
rx.Free;
// Main icon, and footer link
@@ -2525,8 +2663,9 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
var
rx: TRegExpr;
ExeName, SessName, Host, Lib, Port, User, Pass, Socket, AllDatabases,
- SSLPrivateKey, SSLCACertificate, SSLCertificate, SSLCipher: String;
- NetType, WindowsAuth, WantSSL, CleartextPluginEnabled: Integer;
+ SSLPrivateKey, SSLCACertificate, SSLCertificate, SSLCipher,
+ SshExe, SshHost, SshPort, SshLocalPort, SshUser, SshPassword, SshKey, SshTimeout: String;
+ NetType, WindowsAuth, WantSSL, CleartextPluginEnabled, SSLVerification: Integer;
AbsentFiles: TStringList;
function GetParamValue(ShortName, LongName: String): String;
@@ -2605,7 +2744,16 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
SSLCACertificate := GetParamValue('sslca', 'sslcacertificate');
SSLCertificate := GetParamValue('sslcert', 'sslcertificate');
SSLCipher := GetParamValue('sslcip', 'sslcipher');
+ SSLVerification := StrToIntDef(GetParamValue('sslvrf', 'sslverification'), -1);
// Leave out support for startup script, seems reasonable for command line connecting
+ SshExe := GetParamValue('se', 'ssh-executable');
+ SshHost := GetParamValue('sh', 'ssh-host');
+ SshPort := GetParamValue('sP', 'ssh-port');
+ SshLocalPort := GetParamValue('sLP', 'ssh-local-port');
+ SshUser := GetParamValue('su', 'ssh-user');
+ SshPassword := GetParamValue('sp', 'ssh-password');
+ SshKey := GetParamValue('sk', 'ssh-key');
+ SshTimeout := GetParamValue('st', 'ssh-timeout');
if (Host <> '') or (User <> '') or (Pass <> '') or (Port <> '') or (Socket <> '') or (AllDatabases <> '') then begin
if not Assigned(ConnectionParams) then begin
@@ -2641,13 +2789,39 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
ConnectionParams.SSLCertificate := SSLCertificate;
if SSLCipher <> '' then
ConnectionParams.SSLCipher := SSLCipher;
+ if SSLVerification >= 0 then
+ ConnectionParams.SSLVerification := SSLVerification;
if WindowsAuth in [0,1] then
ConnectionParams.WindowsAuth := Boolean(WindowsAuth);
- // Ensure we have a session name to pass to InitConnection
- if (ConnectionParams.SessionPath = '') and (ConnectionParams.Hostname <> '') then
- ConnectionParams.SessionPath := ConnectionParams.Hostname;
+ if not SshHost.IsEmpty then begin
+ ConnectionParams.SSHActive := True;
+ if not SshExe.IsEmpty then
+ ConnectionParams.SSHExe := SshExe;
+ if not SshHost.IsEmpty then
+ ConnectionParams.SSHHost := SshHost;
+ if not SshPort.IsEmpty then
+ ConnectionParams.SSHPort := StrToIntDef(SshPort, ConnectionParams.SSHPort);
+ if not SshLocalPort.IsEmpty then
+ ConnectionParams.SSHLocalPort := StrToIntDef(SshLocalPort, ConnectionParams.SSHLocalPort);
+ if not SshUser.IsEmpty then
+ ConnectionParams.SSHUser := SshUser;
+ if not SshPassword.IsEmpty then
+ ConnectionParams.SSHPassword := SshPassword;
+ if not SshKey.IsEmpty then
+ ConnectionParams.SSHPrivateKey := SshKey;
+ if not SshTimeout.IsEmpty then
+ ConnectionParams.SSHTimeout := StrToIntDef(SshTimeout, ConnectionParams.SSHTimeout);
+ end;
+
+ if ConnectionParams.SessionPath.IsEmpty then begin
+ // Ensure we have a (random) session name to pass to InitConnection
+ ConnectionParams.SessionPath := IfEmpty(ConnectionParams.Hostname, 'temp')+'-'+GeneratePassword(4);
+ end;
+
+ // Delete stored session in Destroy:
+ ConnectionParams.DeleteAfterUse := True;
end;
// Check for valid filename(s) in parameters.
@@ -2767,6 +2941,34 @@ function GetExecutableBits: Byte;
{$ENDIF}
end;
+procedure GetExecutableVersion(FileName: String; var MajorVer, MinorVer, ReleaseVer, RevisionVer: Word);
+var
+ dwInfoSize, // Size of VERSIONINFO structure
+ dwVerSize, // Size of Version Info Data
+ dwWnd: DWORD; // Handle for the size call.
+ FI: PVSFixedFileInfo; // Delphi structure; see WINDOWS.PAS
+ ptrVerBuf: Pointer;
+begin
+ // Detect version of given executable or library
+ MajorVer := 0;
+ MinorVer := 0;
+ ReleaseVer := 0;
+ RevisionVer := 0;
+ try
+ dwInfoSize := GetFileVersionInfoSize(PChar(FileName), dwWnd);
+ GetMem(ptrVerBuf, dwInfoSize);
+ GetFileVersionInfo(PChar(FileName), dwWnd, dwInfoSize, ptrVerBuf);
+ VerQueryValue(ptrVerBuf, '\', Pointer(FI), dwVerSize );
+ MajorVer := HiWord(FI.dwFileVersionMS);
+ MinorVer := LoWord(FI.dwFileVersionMS);
+ ReleaseVer := HiWord(FI.dwFileVersionLS);
+ RevisionVer := LoWord(FI.dwFileVersionLS);
+ FreeMem(ptrVerBuf);
+ except
+ // Silence any error
+ end;
+end;
+
procedure Help(Sender: TObject; Anchor: String);
var
@@ -2848,13 +3050,15 @@ function GetThemeColor(Color: TColor): TColor;
end;
-function ThemeIsDark(ThemeName: String): Boolean;
+function ThemeIsDark(ThemeName: String=''): Boolean;
const
DarkThemes: String = 'Amakrits,Aqua Graphite,Auric,Carbon,Charcoal Dark Slate,Cobalt XEMedia,Glossy,Glow,Golden Graphite,Material,Onyx Blue,Ruby Graphite,TabletDark,Windows10 Dark,Windows10 SlateGray';
var
DarkThemesList: TStringList;
begin
DarkThemesList := Explode(',', DarkThemes);
+ if ThemeName.IsEmpty then
+ ThemeName := TStyleManager.ActiveStyle.Name;
Result := DarkThemesList.IndexOf(ThemeName) > -1;
DarkThemesList.Free;
end;
@@ -2895,7 +3099,7 @@ procedure ToggleCheckBoxWithoutClick(chk: TCheckBox; State: Boolean);
function SynCompletionProposalPrettyText(ImageIndex: Integer; LeftText, CenterText, RightText: String;
LeftColor: TColor=-1; CenterColor: TColor=-1; RightColor: TColor=-1): String;
const
- LineFormat = '\image{%d}\hspace{5}\color{%s}%s\column{}\color{%s}%s\hspace{5}\color{%s}%s';
+ LineFormat = '\image{%d}\hspace{5}\color{%s}%s\column{}\color{%s}%s\hspace{10}\color{%s}\style{+i}%s';
begin
// Return formatted item string for a TSynCompletionProposal
if LeftColor = -1 then LeftColor := clGrayText;
@@ -2987,6 +3191,23 @@ function UserAgent(OwnerComponent: TComponent): String;
end;
+function CodeIndent(Steps: Integer=1): String;
+begin
+ // Provide tab or spaces for indentation, uniquely used for all SQL statements
+ if AppSettings.ReadBool(asTabsToSpaces) then
+ Result := StringOfChar(' ', AppSettings.ReadInt(asTabWidth) * Steps)
+ else
+ Result := StringOfChar(#9, Steps);
+end;
+
+
+function EscapeHotkeyPrefix(Text: String): String;
+begin
+ // Issue #1992: Escape ampersand in caption of menus and tabs, preventing underlined hotkey generation
+ Result := StringReplace(Text, Vcl.Menus.cHotkeyPrefix, Vcl.Menus.cHotkeyPrefix + Vcl.Menus.cHotkeyPrefix, [rfReplaceAll]);
+end;
+
+
{ Get SID of current Windows user, probably useful in the future
function GetCurrentUserSID: string;
type
@@ -3084,9 +3305,9 @@ procedure TQueryThread.Execute;
end else begin
// Concat queries up to a size of max_allowed_packet
if MaxAllowedPacket = 0 then begin
- FConnection.LockedByThread := Self;
+ FConnection.SetLockedByThread(Self);
MaxAllowedPacket := FConnection.MaxAllowedPacket;
- FConnection.LockedByThread := nil;
+ FConnection.SetLockedByThread(nil);
// TODO: Log('Detected maximum allowed packet size: '+FormatByteNumber(MaxAllowedPacket), lcDebug);
end;
BatchStartOffset := FBatch[i].LeftOffset;
@@ -3109,7 +3330,7 @@ procedure TQueryThread.Execute;
end;
Synchronize(procedure begin MainForm.BeforeQueryExecution(Self); end);
try
- FConnection.LockedByThread := Self;
+ FConnection.SetLockedByThread(Self);
DoStoreResult := ResultCount < AppSettings.ReadInt(asMaxQueryResults);
if (not DoStoreResult) and (not LogMaxResultsDone) then begin
// Inform user about preference setting for limiting result tabs
@@ -3128,13 +3349,13 @@ procedure TQueryThread.Execute;
Inc(FWarningCount, FConnection.WarningCount);
except
on E:EDbError do begin
- if FStopOnErrors or (i = FBatch.Count - 1) then begin
+ if FStopOnErrors or (i = FBatch.Count) then begin
FErrorMessage := E.Message;
ErrorAborted := True;
end;
end;
end;
- FConnection.LockedByThread := nil;
+ FConnection.SetLockedByThread(nil);
Synchronize(procedure begin MainForm.AfterQueryExecution(Self); end);
// Check if FAborted is set by the main thread, to avoid proceeding the loop in case
// FStopOnErrors is set to false
@@ -3183,6 +3404,28 @@ function TSQLSentence.GetSQLWithoutComments: String;
{ TSQLBatch }
+constructor TSQLBatch.Create(NetTypeGroup: TNetTypeGroup);
+begin
+ inherited Create;
+ FQuotes := THashedStringList.Create;
+ FQuotes.CaseSensitive := True;
+ FQuotes.Sorted := True;
+ FQuotes.Add('"');
+ FQuotes.Add('''');
+ FEscape := '\';
+ case NetTypeGroup of
+ ngMySQL: FQuotes.Add('`'); // MySQL/MariaDB only
+ ngPgSQL: FQuotes.Add('$$'); // PostgreSQL only ($abc$ unsupported)
+ ngSQLite: FEscape := '''';
+ end;
+end;
+
+destructor TSQLBatch.Destroy;
+begin
+ FQuotes.Free;
+ inherited;
+end;
+
function TSQLBatch.GetSize: Integer;
var
Query: TSQLSentence;
@@ -3197,13 +3440,12 @@ function TSQLBatch.GetSize: Integer;
procedure TSQLBatch.SetSQL(Value: String);
var
i, AllLen, DelimLen, DelimStart, LastLeftOffset, RightOffset: Integer;
- c, n, LastStringEncloser: Char;
- Delim, DelimTest, QueryTest: String;
+ c, n: Char;
+ Delim, DelimTest, QueryTest, LastQuote, cn: String;
InString, InComment, InBigComment, InEscape: Boolean;
Marker: TSQLSentence;
rx: TRegExpr;
const
- StringEnclosers = ['"', '''', '`'];
NewLines = [#13, #10];
WhiteSpaces = NewLines + [#9, ' '];
begin
@@ -3214,11 +3456,12 @@ procedure TSQLBatch.SetSQL(Value: String);
i := 0;
LastLeftOffset := 1;
Delim := Mainform.Delimiter;
- InString := False; // Loop in "enclosed string" or `identifier`
- InComment := False; // Loop in one-line comment (# or --)
- InBigComment := False; // Loop in /* multi-line */ or /*! condictional comment */
- InEscape := False; // Previous char was backslash
- LastStringEncloser := #0;
+
+ InString := False; // c is in "enclosed string" or `identifier`
+ InComment := False; // c is in one-line comment (# or --)
+ InBigComment := False; // c is in /* multi-line */ or /*! condictional comment */
+ InEscape := False; // Previous char was backslash
+ LastQuote := #0;
DelimLen := Length(Delim);
rx := TRegExpr.Create;
rx.Expression := '^\s*DELIMITER\s+(\S+)';
@@ -3229,20 +3472,27 @@ procedure TSQLBatch.SetSQL(Value: String);
Inc(i);
// Current and next char
c := FSQL[i];
- if i < AllLen then n := FSQL[i+1]
- else n := #0;
+ if i < AllLen then
+ n := FSQL[i+1]
+ else
+ n := #0;
+ cn := c + n;
- // Check for comment syntax and for enclosed literals, so a query delimiter can be ignored
+ // Check for comment syntax, so a query delimiter can be ignored
if (not InComment) and (not InBigComment) and (not InString) and ((c + n = '--') or (c = '#')) then
InComment := True;
if (not InComment) and (not InBigComment) and (not InString) and (c + n = '/*') then
InBigComment := True;
if InBigComment and (not InComment) and (not InString) and (c + n = '*/') then
InBigComment := False;
- if (not InEscape) and (not InComment) and (not InBigComment) and CharInSet(c, StringEnclosers) then begin
- if (not InString) or (InString and (c = LastStringEncloser)) then begin
- InString := not InString;
- LastStringEncloser := c;
+ // Check for enclosed literals, so a query delimiter can be ignored
+ if (not InEscape) and (not InComment) and (not InBigComment) and (FQuotes.Contains(c) or FQuotes.Contains(cn)) then begin
+ if not InString then begin
+ InString := True;
+ LastQuote := IfThen(FQuotes.Contains(c), c, cn);
+ end
+ else if (c = LastQuote) or (cn = LastQuote) then begin
+ InString := False;
end;
end;
if (CharInSet(c, NewLines) and (not CharInSet(n, NewLines))) or (i = 1) then begin
@@ -3257,7 +3507,7 @@ procedure TSQLBatch.SetSQL(Value: String);
end;
end;
if not InEscape then
- InEscape := c = '\'
+ InEscape := c = FEscape
else
InEscape := False;
@@ -3285,6 +3535,7 @@ procedure TSQLBatch.SetSQL(Value: String);
end;
end;
end;
+
end;
function TSQLBatch.GetSQLWithoutComments: String;
@@ -3304,13 +3555,11 @@ class function TSQLBatch.GetSQLWithoutComments(FullSQL: String): String;
Result := '';
InLineComment := False;
InMultiLineComment := False;
- Prev1 := #0;
- Prev2 := #0;
for i:=1 to Length(FullSQL) do begin
Cur := FullSQL[i];
AddCur := True;
- if i > 1 then Prev1 := FullSQL[i-1];
- if i > 2 then Prev2 := FullSQL[i-2];
+ if i > 1 then Prev1 := FullSQL[i-1] else Prev1 := #0;
+ if i > 2 then Prev2 := FullSQL[i-2] else Prev2 := #0;
if (Cur = '*') and (Prev1 = '/') then begin
InMultiLineComment := True;
@@ -3329,7 +3578,7 @@ class function TSQLBatch.GetSQLWithoutComments(FullSQL: String): String;
else if Cur = '#' then begin
InLineComment := True;
end
- else if (Cur = ' ') and (Prev1 = '-') and (Prev2 = '-') then begin
+ else if (not InLineComment) and (Cur = ' ') and (Prev1 = '-') and (Prev2 = '-') then begin
InLineComment := True;
System.Delete(Result, Length(Result)-1, 2); // Delete comment chars
end;
@@ -3346,7 +3595,6 @@ class function TSQLBatch.GetSQLWithoutComments(FullSQL: String): String;
constructor THttpDownload.Create(Owner: TComponent);
begin
FBytesRead := -1;
- FContentLength := -1;
FOwner := Owner;
FTimeOut := 10;
end;
@@ -3375,24 +3623,10 @@ procedure THttpDownload.SendRequest(Filename: String);
FLastContent := '';
try
UrlHandle := InternetOpenURL(NetHandle, PChar(FURL), nil, 0, INTERNET_FLAG_RELOAD, 0);
- if (not Assigned(UrlHandle)) and FURL.StartsWith('https:', true) then begin
- // Try again without SSL. See issue #65 and #1209
- MainForm.LogSQL(f_('Could not open %s (%s) - trying again without SSL...', [FURL, SysErrorMessage(GetLastError)]), lcError);
- FURL := ReplaceRegExpr('^https:', FURL, 'http:');
- UrlHandle := InternetOpenURL(NetHandle, PChar(FURL), nil, 0, INTERNET_FLAG_RELOAD, 0);
- end;
if not Assigned(UrlHandle) then begin
raise Exception.CreateFmt(_('Could not open %s (%s)'), [FURL, SysErrorMessage(GetLastError)]);
end;
- // Detect content length
- HeadSize := SizeOf(Head);
- Reserved := 0;
- if HttpQueryInfo(UrlHandle, HTTP_QUERY_CONTENT_LENGTH, @Head, HeadSize, Reserved) then
- FContentLength := StrToIntDef(Head, -1)
- else
- raise Exception.CreateFmt(_('Server did not send required "Content-Length" header: %s'), [FURL]);
-
// Check if we got HTTP status 200
HeadSize := SizeOf(Head);
Reserved := 0;
@@ -3531,11 +3765,11 @@ procedure TClipboardHelper.SetTryAsText(AValue: String);
procedure TWinControlHelper.TrySetFocus;
begin
try
- if Enabled and CanFocus then
+ if Enabled
+ and CanFocus then
SetFocus;
except
- on E:EInvalidOperation do
- MessageBeep(MB_ICONWARNING);
+ MessageBeep(MB_ICONWARNING);
end;
end;
@@ -3546,7 +3780,6 @@ constructor TAppSettings.Create;
var
rx: TRegExpr;
i: Integer;
- DefaultSnippetsDirectory: String;
PortableLockFile: String;
NewFileHandle: THandle;
begin
@@ -3555,7 +3788,7 @@ constructor TAppSettings.Create;
FReads := 0;
FWrites := 0;
- PortableLockFile := ExtractFilePath(ParamStr(0)) + FPortableLockFileBase;
+ PortableLockFile := GetAppDir + FPortableLockFileBase;
// Use filename from command line. If not given, use file in directory of executable.
rx := TRegExpr.Create;
@@ -3568,7 +3801,7 @@ constructor TAppSettings.Create;
end;
// Default settings file, if not given per command line
if FSettingsFile = '' then
- FSettingsFile := ExtractFilePath(ParamStr(0)) + 'portable_settings.txt';
+ FSettingsFile := GetAppDir + 'portable_settings.txt';
// Backwards compatibility: only settings file exists, create lock file in that case
if FileExists(FSettingsFile) and (not FileExists(PortableLockFile)) then begin
NewFileHandle := FileCreate(PortableLockFile);
@@ -3678,6 +3911,7 @@ constructor TAppSettings.Create;
InitSetting(asUser, 'User', 0, False, '', True);
InitSetting(asPassword, 'Password', 0, False, '', True);
InitSetting(asCleartextPluginEnabled, 'CleartextPluginEnabled', 0, False, '', True);
+ InitSetting(asForceUnicode, 'ForceUnicode', 0, True, '', True);
InitSetting(asWindowsAuth, 'WindowsAuth', 0, False, '', True);
InitSetting(asLoginPrompt, 'LoginPrompt', 0, False, '', True);
InitSetting(asPort, 'Port', 0, False, '', True);
@@ -3698,6 +3932,7 @@ constructor TAppSettings.Create;
InitSetting(asSSLCert, 'SSL_Cert', 0, False, '', True);
InitSetting(asSSLCA, 'SSL_CA', 0, False, '', True);
InitSetting(asSSLCipher, 'SSL_Cipher', 0, False, '', True);
+ InitSetting(asSSLVerification, 'SSL_Verification', 2, False, '', True);
InitSetting(asSSLWarnUnused, 'SSL_WarnUnused', 0, True);
InitSetting(asNetType, 'NetType', Integer(ntMySQL_TCPIP), False, '', True);
InitSetting(asCompressed, 'Compressed', 0, False, '', True);
@@ -3721,6 +3956,7 @@ constructor TAppSettings.Create;
InitSetting(asExportSQLServerDatabase, 'ExportSQL_ServerDatabase', 0, False, '');
InitSetting(asExportSQLOutput, 'ExportSQL_Output', 0);
InitSetting(asExportSQLAddComments, 'ExportSQLAddComments', 0, True);
+ InitSetting(asExportSQLTransactions, 'ExportSQLTransactions', 0, False);
InitSetting(asExportSQLRemoveAutoIncrement, 'ExportSQLRemoveAutoIncrement', 0, False);
InitSetting(asExportSQLRemoveDefiner, 'ExportSQLRemoveDefiner', 0, True);
InitSetting(asGridExportWindowWidth, 'GridExportWindowWidth', 400);
@@ -3734,8 +3970,10 @@ constructor TAppSettings.Create;
InitSetting(asGridExportSelection, 'GridExportSelection', 1);
InitSetting(asGridExportColumnNames, 'GridExportColumnNames', 0, True);
InitSetting(asGridExportIncludeAutoInc, 'GridExportAutoInc', 0, True);
+ InitSetting(asGridExportFocusedColumnOnly, 'GridExportFocusedColumnOnly', 0, False);
InitSetting(asGridExportIncludeQuery, 'GridExportIncludeQuery', 0, False);
InitSetting(asGridExportRemoveLinebreaks, 'GridExportRemoveLinebreaks', 0, False);
+ InitSetting(asGridExportOpenFile, 'GridExportOpenFile', 0, False);
InitSetting(asGridExportSeparator, 'GridExportSeparator', 0, False, ';');
InitSetting(asGridExportEncloser, 'GridExportEncloser', 0, False, '');
InitSetting(asGridExportTerminator, 'GridExportTerminator', 0, False, '\r\n');
@@ -3754,7 +3992,7 @@ constructor TAppSettings.Create;
InitSetting(asCSVImportTerminator, 'CSVTerminator', 0, False, '\r\n');
InitSetting(asCSVImportFieldEscaper, 'CSVImportFieldEscaperV2', 0, False, '"');
InitSetting(asCSVImportWindowWidth, 'CSVImportWindowWidth', 530);
- InitSetting(asCSVImportWindowHeight, 'CSVImportWindowHeight', 530);
+ InitSetting(asCSVImportWindowHeight, 'CSVImportWindowHeight', 550);
InitSetting(asCSVImportFilename, 'loadfilename', 0, False, '');
InitSetting(asCSVImportFieldsEnclosedOptionally, 'CSVImportFieldsEnclosedOptionallyV2', 0, True);
InitSetting(asCSVImportIgnoreLines, 'CSVImportIgnoreLines', 1);
@@ -3762,6 +4000,7 @@ constructor TAppSettings.Create;
InitSetting(asCSVImportLocalNumbers, 'CSVImportLocalNumbers', 0, False);
InitSetting(asCSVImportDuplicateHandling, 'CSVImportDuplicateHandling', 2);
InitSetting(asCSVImportParseMethod, 'CSVImportParseMethod', 0);
+ InitSetting(asCSVKeepDialogOpen, 'CSVKeepDialogOpen', 0, False);
InitSetting(asUpdatecheck, 'Updatecheck', 0, False);
InitSetting(asUpdatecheckBuilds, 'UpdatecheckBuilds', 0, False);
InitSetting(asUpdatecheckInterval, 'UpdatecheckInterval', 3);
@@ -3787,6 +4026,7 @@ constructor TAppSettings.Create;
InitSetting(asSelectDBOWindowWidth, 'SelectDBO_WindowWidth', 250);
InitSetting(asSelectDBOWindowHeight, 'SelectDBO_WindowHeight', 350);
InitSetting(asSessionManagerListWidth, 'SessionManager_ListWidth', 220);
+ InitSetting(asSessionManagerListFoldersAtTop, 'SessionManager_ListFoldersAtTop', 0, True);
InitSetting(asSessionManagerWindowWidth, 'SessionManager_WindowWidth', 700);
InitSetting(asSessionManagerWindowHeight, 'SessionManager_WindowHeight', 490);
InitSetting(asSessionManagerWindowLeft, 'SessionManager_WindowLeft', 50);
@@ -3814,23 +4054,20 @@ constructor TAppSettings.Create;
InitSetting(asSequalSuggestPrompt, 'SequalSuggestPrompt', 0, False, '');
InitSetting(asSequalSuggestRecentPrompts, 'SequalSuggestRecentPrompts', 0, False, '');
InitSetting(asReformatter, 'Reformatter', 0);
+ InitSetting(asReformatterNoDialog, 'ReformatterNoDialog', 0);
InitSetting(asAlwaysGenerateFilter, 'AlwaysGenerateFilter', 0, False);
-
- // Default folder for snippets
- if FPortableMode then
- DefaultSnippetsDirectory := ExtractFilePath(ParamStr(0))
- else
- DefaultSnippetsDirectory := DirnameUserDocuments;
- DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\';
- InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
+ InitSetting(asDisplayReverseForeignKeys, 'DisplayReverseForeignKeys', 0, False);
+ InitSetting(asGenerateDataNumRows, 'GenerateDataNumRows', 1000);
+ InitSetting(asGenerateDataNullAmount, 'GenerateDataNullAmount', 10);
+ InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DirnameUserDocuments + 'Snippets\');
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
// Restore tabs feature crashes often on old XP systems, see https://www.heidisql.com/forum.php?t=34044
InitSetting(asRestoreTabs, 'RestoreTabs', 0, Win32MajorVersion >= 6);
InitSetting(asTabCloseOnDoubleClick, 'TabCloseOnDoubleClick', 0, True);
InitSetting(asTabCloseOnMiddleClick, 'TabCloseOnMiddleClick', 0, True);
InitSetting(asTabsInMultipleLines, 'TabsInMultipleLines', 0, True);
+ InitSetting(asTabIconsGrayscaleMode, 'TabIconsGrayscaleMode', 1);
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
- InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asQueryGridLongSortRowNum, 'QueryGridLongSortRowNum', 10000);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
InitSetting(asCompletionProposalInterval, 'CompletionProposalInterval', 500);
@@ -3873,6 +4110,8 @@ constructor TAppSettings.Create;
InitSetting(asRowBackgroundOdd, 'RowBackgroundOdd', clNone);
InitSetting(asGroupTreeObjects, 'GroupTreeObjects', 0, False);
InitSetting(asDisplayObjectSizeColumn, 'DisplayObjectSizeColumn', 0, True);
+ InitSetting(asDisplayLogPanel, 'DisplayLogPanel', 0, True);
+ InitSetting(asDisplayTreeFilters, 'DisplayTreeFilters', 0, True);
InitSetting(asActionShortcut1, 'Shortcut1_%s', 0);
InitSetting(asActionShortcut2, 'Shortcut2_%s', 0);
InitSetting(asHighlighterForeground, 'SQL Attr %s Foreground', 0);
@@ -3898,7 +4137,7 @@ constructor TAppSettings.Create;
InitSetting(asColumnSelectorHeight, 'ColumnSelectorHeight', 270, False, '');
InitSetting(asDonatedEmail, 'DonatedEmail', 0, False, '');
InitSetting(asFavoriteObjects, 'FavoriteObjects', 0, False, '', True);
- InitSetting(asFavoriteObjectsOnly, 'FavoriteObjectsOnly', 0, False);
+ InitSetting(asFavoriteObjectsOnly, 'FavoriteObjectsOnly', 0, False); // No longer used
InitSetting(asFullTableStatus, 'FullTableStatus', 0, True, '', True);
InitSetting(asLineBreakStyle, 'LineBreakStyle', Integer(lbsWindows));
InitSetting(asPreferencesWindowWidth, 'PreferencesWindowWidth', 740);
@@ -3910,6 +4149,7 @@ constructor TAppSettings.Create;
InitSetting(asThemePreviewLeft, 'ThemePreviewLeft', 300);
InitSetting(asCreateDbCollation, 'CreateDbCollation', 0, False, '');
InitSetting(asRealTrailingZeros, 'RealTrailingZeros', 1);
+ InitSetting(asWebOnceAction, 'WebOnceAction', 0, False, DateToStr(DateTimeNever));
// Initialization values
FRestoreTabsInitValue := ReadBool(asRestoreTabs);
@@ -4451,7 +4691,7 @@ function TAppSettings.ExportSettings(Filename: String): Boolean;
// Save registry settings to file
Content := '';
ReadKeyToContent(FBasePath);
- SaveUnicodeFile(FileName, Content);
+ SaveUnicodeFile(FileName, Content, UTF8NoBOMEncoding);
Result := True;
end;
@@ -4466,7 +4706,7 @@ function TAppSettings.ExportSettings: Boolean;
except
on E:Exception do begin
FPortableModeReadOnly := True;
- Raise Exception.Create(E.Message + CRLF + CRLF
+ Raise Exception.Create(E.ClassName + ': ' + E.Message + CRLF + CRLF
+ f_('Switching to read-only mode. Settings won''t be saved. Use the command line parameter %s to use a custom file path.', ['--psettings'])
);
end;
@@ -4477,19 +4717,29 @@ function TAppSettings.ExportSettings: Boolean;
function TAppSettings.DirnameUserAppData: String;
begin
- // User folder for HeidiSQL's data (\Application Data)
- Result := GetShellFolder(FOLDERID_RoamingAppData) + '\' + APPNAME + '\';
- if not DirectoryExists(Result) then begin
- ForceDirectories(Result);
+ // C:\Users\mike\AppData\Roaming\HeidiSQL\
+ if PortableMode then begin
+ Result := GetAppDir;
+ end
+ else begin
+ Result := GetShellFolder(FOLDERID_RoamingAppData) + '\' + APPNAME + '\';
+ if not DirectoryExists(Result) then begin
+ ForceDirectories(Result);
+ end;
end;
end;
function TAppSettings.DirnameUserDocuments: String;
begin
- // "HeidiSQL" folder under user's documents folder, e.g. c:\Users\Mike\Documents\HeidiSQL\
- Result := GetShellFolder(FOLDERID_Documents) + '\' + APPNAME + '\';
- // Do not auto-create it, as we only use it for snippets which can also have a custom path.
+ // C:\Users\mike\Documents\HeidiSQL\
+ if PortableMode then begin
+ Result := GetAppDir;
+ end
+ else begin
+ Result := GetShellFolder(FOLDERID_Documents) + '\' + APPNAME + '\';
+ // Do not auto-create it, as we only use it for snippets which can also have a custom path.
+ end;
end;
@@ -4509,11 +4759,7 @@ function TAppSettings.DirnameSnippets: String;
function TAppSettings.DirnameBackups: String;
begin
// Create backup folder if it does not exist and return it
- if PortableMode then begin
- Result := ExtractFilePath(Application.ExeName) + 'Backups\'
- end else begin
- Result := DirnameUserAppData + 'Backups\';
- end;
+ Result := DirnameUserAppData + 'Backups\';
if not DirectoryExists(Result) then begin
ForceDirectories(Result);
end;
@@ -4522,11 +4768,7 @@ function TAppSettings.DirnameBackups: String;
function TAppSettings.DirnameHighlighters: string;
begin
- if PortableMode then begin
- Result := ExtractFilePath(Application.ExeName) + 'Highlighters\'
- end else begin
- Result := DirnameUserAppData + 'Highlighters\';
- end;
+ Result := DirnameUserAppData + 'Highlighters\';
if not DirectoryExists(Result) then begin
ForceDirectories(Result);
end;
diff --git a/source/column_selection.pas b/source/column_selection.pas
index 087e7bb4e..4dfaddbe4 100644
--- a/source/column_selection.pas
+++ b/source/column_selection.pas
@@ -89,6 +89,7 @@ procedure TfrmColumnSelection.btnOKClick(Sender: TObject);
i: Integer;
Col: String;
begin
+ AppSettings.WriteBool(asDisplayedColumnsSorted, chkSort.Checked);
AppSettings.WriteBool(asShowRowId, chkShowRowId.Checked);
// Prepare string for storing in registry.
// Use quote-character as separator to ensure columnnames can
diff --git a/source/connections.dfm b/source/connections.dfm
index a8daaad50..4199c289d 100644
--- a/source/connections.dfm
+++ b/source/connections.dfm
@@ -51,7 +51,7 @@ object connform: Tconnform
OnClick = btnSaveClick
end
object btnOpen: TButton
- Left = 489
+ Left = 485
Top = 473
Width = 80
Height = 25
@@ -63,7 +63,7 @@ object connform: Tconnform
OnClick = btnOpenClick
end
object btnCancel: TButton
- Left = 575
+ Left = 571
Top = 473
Width = 80
Height = 25
@@ -138,7 +138,7 @@ object connform: Tconnform
object btnImportSettings: TButton
Left = 10
Top = 184
- Width = 497
+ Width = 493
Height = 25
Anchors = [akLeft, akTop, akRight]
Caption = 'Import settings ...'
@@ -157,67 +157,67 @@ object connform: Tconnform
object lblPort: TLabel
Left = 3
Top = 199
- Width = 24
- Height = 13
+ Width = 27
+ Height = 14
Caption = 'Port:'
FocusControl = editPort
end
object lblPassword: TLabel
Left = 3
Top = 174
- Width = 50
- Height = 13
+ Width = 55
+ Height = 14
Caption = 'Password:'
FocusControl = editPassword
end
object lblHost: TLabel
Left = 3
Top = 76
- Width = 72
- Height = 13
+ Width = 83
+ Height = 14
Caption = 'Hostname / IP:'
FocusControl = editHost
end
object lblUsername: TLabel
Left = 3
Top = 149
- Width = 26
- Height = 13
+ Width = 28
+ Height = 14
Caption = 'User:'
FocusControl = editUsername
end
object lblNetworkType: TLabel
Left = 3
Top = 12
- Width = 69
- Height = 13
+ Width = 80
+ Height = 14
Caption = 'Network type:'
end
object lblDatabase: TLabel
Left = 3
Top = 247
- Width = 55
- Height = 13
+ Width = 59
+ Height = 14
Caption = 'Databases:'
end
object lblComment: TLabel
Left = 3
Top = 274
- Width = 49
- Height = 13
+ Width = 57
+ Height = 14
Caption = 'Comment:'
end
object lblLibrary: TLabel
Left = 3
Top = 39
- Width = 37
- Height = 13
+ Width = 39
+ Height = 14
Caption = 'Library:'
end
object chkCompressed: TCheckBox
Left = 190
Top = 221
- Width = 320
+ Width = 316
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Compressed client/server protocol'
@@ -228,7 +228,7 @@ object connform: Tconnform
Left = 190
Top = 196
Width = 57
- Height = 21
+ Height = 22
TabOrder = 7
Text = '0'
OnChange = Modification
@@ -237,7 +237,7 @@ object connform: Tconnform
Left = 247
Top = 196
Width = 16
- Height = 21
+ Height = 22
Associate = editPort
Max = 2147483647
TabOrder = 8
@@ -247,28 +247,31 @@ object connform: Tconnform
object editPassword: TEdit
Left = 190
Top = 171
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
PasswordChar = '*'
TabOrder = 6
OnChange = Modification
end
- object editUsername: TEdit
+ object editUsername: TButtonedEdit
Left = 190
Top = 146
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
+ Images = MainForm.VirtualImageListMain
+ RightButton.ImageIndex = 75
TabOrder = 5
OnChange = Modification
OnExit = editTrim
+ OnRightButtonClick = editUsernameRightButtonClick
end
object editHost: TButtonedEdit
Left = 190
Top = 73
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.DropDownMenu = popupHost
@@ -282,8 +285,8 @@ object connform: Tconnform
object comboNetType: TComboBoxEx
Left = 190
Top = 8
- Width = 320
- Height = 22
+ Width = 316
+ Height = 23
ItemsEx = <>
Style = csExDropDownList
Anchors = [akLeft, akTop, akRight]
@@ -295,7 +298,7 @@ object connform: Tconnform
object chkLoginPrompt: TCheckBox
Left = 190
Top = 100
- Width = 320
+ Width = 316
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt for credentials'
@@ -305,7 +308,7 @@ object connform: Tconnform
object chkWindowsAuth: TCheckBox
Left = 190
Top = 123
- Width = 320
+ Width = 316
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Use Windows authentication'
@@ -316,7 +319,7 @@ object connform: Tconnform
object memoComment: TMemo
Left = 190
Top = 271
- Width = 320
+ Width = 316
Height = 153
Anchors = [akLeft, akTop, akRight, akBottom]
ScrollBars = ssVertical
@@ -326,8 +329,8 @@ object connform: Tconnform
object editDatabases: TButtonedEdit
Left = 190
Top = 244
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 75
@@ -340,8 +343,8 @@ object connform: Tconnform
object comboLibrary: TComboBox
Left = 190
Top = 36
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
@@ -358,62 +361,62 @@ object connform: Tconnform
object lblSSHLocalPort: TLabel
Left = 3
Top = 202
- Width = 51
- Height = 13
+ Width = 58
+ Height = 14
Caption = 'Local port:'
FocusControl = editSSHlocalport
end
object lblSSHUser: TLabel
Left = 3
Top = 94
- Width = 52
- Height = 13
+ Width = 58
+ Height = 14
Caption = 'Username:'
FocusControl = editSSHUser
end
object lblSSHPassword: TLabel
Left = 3
Top = 121
- Width = 50
- Height = 13
+ Width = 55
+ Height = 14
Caption = 'Password:'
FocusControl = editSSHPassword
end
object lblSSHExe: TLabel
Left = 3
Top = 40
- Width = 87
- Height = 13
+ Width = 90
+ Height = 14
Caption = 'SSH executable:'
end
object lblSSHhost: TLabel
Left = 3
Top = 67
- Width = 81
- Height = 13
+ Width = 93
+ Height = 14
Caption = 'SSH host + port:'
FocusControl = editSSHhost
end
object lblSSHkeyfile: TLabel
Left = 3
Top = 175
- Width = 75
- Height = 13
+ Width = 83
+ Height = 14
Caption = 'Private key file:'
FocusControl = editSSHPrivateKey
end
object lblSSHTimeout: TLabel
Left = 3
Top = 148
- Width = 86
- Height = 13
+ Width = 73
+ Height = 14
Caption = 'SSH timeout:'
end
object editSSHlocalport: TEdit
Left = 190
Top = 199
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
NumbersOnly = True
TabOrder = 9
@@ -423,8 +426,8 @@ object connform: Tconnform
object editSSHUser: TEdit
Left = 190
Top = 91
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
TabOrder = 4
Text = 'editSSHUser'
@@ -435,8 +438,8 @@ object connform: Tconnform
object editSSHPassword: TEdit
Left = 190
Top = 118
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
PasswordChar = '*'
TabOrder = 5
@@ -447,8 +450,8 @@ object connform: Tconnform
object editSSHhost: TEdit
Left = 190
Top = 64
- Width = 260
- Height = 21
+ Width = 256
+ Height = 22
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
Text = 'editSSHhost'
@@ -456,10 +459,10 @@ object connform: Tconnform
OnExit = editTrim
end
object editSSHport: TEdit
- Left = 456
+ Left = 452
Top = 64
Width = 54
- Height = 21
+ Height = 22
Anchors = [akTop, akRight]
NumbersOnly = True
TabOrder = 3
@@ -469,8 +472,8 @@ object connform: Tconnform
object editSSHPrivateKey: TButtonedEdit
Left = 190
Top = 172
- Width = 320
- Height = 21
+ Width = 316
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
@@ -487,7 +490,7 @@ object connform: Tconnform
Left = 190
Top = 145
Width = 60
- Height = 21
+ Height = 22
TabOrder = 6
Text = '1'
OnChange = Modification
@@ -496,7 +499,7 @@ object connform: Tconnform
Left = 250
Top = 145
Width = 17
- Height = 21
+ Height = 22
Associate = editSSHTimeout
Min = 1
Position = 1
@@ -506,7 +509,7 @@ object connform: Tconnform
object comboSSHExe: TComboBox
Left = 190
Top = 36
- Width = 320
+ Width = 316
Height = 22
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
@@ -516,7 +519,7 @@ object connform: Tconnform
object chkSSHActive: TCheckBox
Left = 190
Top = 13
- Width = 324
+ Width = 320
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Use SSH tunnel'
@@ -534,50 +537,50 @@ object connform: Tconnform
object lblStartupScript: TLabel
Left = 3
Top = 12
- Width = 69
- Height = 13
+ Width = 78
+ Height = 14
Caption = 'Startup script:'
FocusControl = editStartupScript
end
object lblQueryTimeout: TLabel
Left = 3
Top = 39
- Width = 73
- Height = 13
+ Width = 84
+ Height = 14
Caption = 'Query timeout:'
end
object lblKeepAlive: TLabel
Left = 3
Top = 66
- Width = 106
- Height = 13
+ Width = 120
+ Height = 14
Caption = 'Ping every X seconds:'
end
object lblBackgroundColor: TLabel
Left = 3
- Top = 162
- Width = 86
- Height = 13
+ Top = 185
+ Width = 98
+ Height = 14
Caption = 'Background color:'
end
object lblIgnoreDatabasePattern: TLabel
Left = 3
- Top = 190
- Width = 112
- Height = 13
+ Top = 213
+ Width = 126
+ Height = 14
Caption = 'Hide database pattern:'
end
object lblLogFile: TLabel
Left = 3
- Top = 229
- Width = 89
- Height = 13
+ Top = 252
+ Width = 102
+ Height = 14
Caption = 'Log queries to file:'
end
object chkLocalTimeZone: TCheckBox
Left = 190
Top = 90
- Width = 324
+ Width = 320
Height = 17
Hint =
'Use your client time zone in date/time SQL functions, e.g. NOW()' +
@@ -590,7 +593,7 @@ object connform: Tconnform
object chkCleartextPluginEnabled: TCheckBox
Left = 190
Top = 136
- Width = 324
+ Width = 320
Height = 17
Hint = 'Send your password to the server in cleartext, for MySQL 5.5.47+'
Anchors = [akLeft, akTop, akRight]
@@ -601,8 +604,8 @@ object connform: Tconnform
object editStartupScript: TButtonedEdit
Left = 190
Top = 9
- Width = 324
- Height = 21
+ Width = 320
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
@@ -616,7 +619,7 @@ object connform: Tconnform
object chkFullTableStatus: TCheckBox
Left = 190
Top = 113
- Width = 324
+ Width = 320
Height = 17
Hint =
'Disable to speed up internal queries on databases with many tabl' +
@@ -630,7 +633,7 @@ object connform: Tconnform
Left = 190
Top = 36
Width = 90
- Height = 21
+ Height = 22
NumbersOnly = True
TabOrder = 1
Text = '0'
@@ -640,7 +643,7 @@ object connform: Tconnform
Left = 280
Top = 36
Width = 16
- Height = 21
+ Height = 22
Associate = editQueryTimeout
Max = 2147483646
TabOrder = 2
@@ -650,7 +653,7 @@ object connform: Tconnform
Left = 190
Top = 63
Width = 90
- Height = 21
+ Height = 22
TabOrder = 3
Text = '0'
OnChange = Modification
@@ -659,15 +662,15 @@ object connform: Tconnform
Left = 280
Top = 63
Width = 16
- Height = 21
+ Height = 22
Associate = editKeepAlive
Max = 86400
TabOrder = 4
end
object ColorBoxBackgroundColor: TColorBox
Left = 190
- Top = 159
- Width = 324
+ Top = 182
+ Width = 320
Height = 22
NoneColorColor = clNone
Selected = clNone
@@ -680,9 +683,9 @@ object connform: Tconnform
end
object editIgnoreDatabasePattern: TEdit
Left = 190
- Top = 187
- Width = 324
- Height = 21
+ Top = 210
+ Width = 320
+ Height = 22
Anchors = [akLeft, akTop, akRight]
TabOrder = 9
TextHint = 'Regular expression'
@@ -690,8 +693,8 @@ object connform: Tconnform
end
object chkLogFileDdl: TCheckBox
Left = 190
- Top = 253
- Width = 324
+ Top = 276
+ Width = 320
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'DDL queries (CREATE, ALTER, ...)'
@@ -700,9 +703,9 @@ object connform: Tconnform
end
object editLogFilePath: TButtonedEdit
Left = 190
- Top = 226
- Width = 324
- Height = 21
+ Top = 249
+ Width = 320
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Enabled = False
Images = MainForm.VirtualImageListMain
@@ -714,14 +717,24 @@ object connform: Tconnform
end
object chkLogFileDml: TCheckBox
Left = 190
- Top = 276
- Width = 324
+ Top = 299
+ Width = 320
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'DML queries (INSERT, UPDATE, ...)'
TabOrder = 12
OnClick = Modification
end
+ object chkForceUnicode: TCheckBox
+ Left = 190
+ Top = 159
+ Width = 320
+ Height = 17
+ Anchors = [akLeft, akTop, akRight]
+ Caption = 'Force Unicode (disable on old servers only)'
+ TabOrder = 13
+ OnClick = Modification
+ end
end
object tabSSL: TTabSheet
Caption = 'SSL'
@@ -732,38 +745,45 @@ object connform: Tconnform
object lblSSLPrivateKey: TLabel
Left = 3
Top = 39
- Width = 78
- Height = 13
+ Width = 88
+ Height = 14
Caption = 'SSL private key:'
FocusControl = editSSLPrivateKey
end
object lblSSLCACertificate: TLabel
Left = 3
Top = 66
- Width = 89
- Height = 13
+ Width = 101
+ Height = 14
Caption = 'SSL CA certificate:'
FocusControl = editSSLCACertificate
end
object lblSSLCertificate: TLabel
Left = 3
Top = 93
- Width = 72
- Height = 13
+ Width = 82
+ Height = 14
Caption = 'SSL certificate:'
FocusControl = editSSLCertificate
end
object lblSSLcipher: TLabel
Left = 3
Top = 120
- Width = 53
- Height = 13
+ Width = 61
+ Height = 14
Caption = 'SSL cipher:'
end
+ object lblSSLVerification: TLabel
+ Left = 3
+ Top = 148
+ Width = 121
+ Height = 14
+ Caption = 'Certificate verification:'
+ end
object chkWantSSL: TCheckBox
Left = 190
Top = 13
- Width = 324
+ Width = 320
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Use SSL'
@@ -774,9 +794,9 @@ object connform: Tconnform
Left = 190
Top = 117
Width = 324
- Height = 21
+ Height = 22
Anchors = [akLeft, akTop, akRight]
- TabOrder = 1
+ TabOrder = 4
TextHint = 'List of permissible ciphers to use for SSL encryption'
OnChange = Modification
OnExit = editTrim
@@ -785,12 +805,12 @@ object connform: Tconnform
Left = 190
Top = 90
Width = 324
- Height = 21
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
RightButton.Visible = True
- TabOrder = 2
+ TabOrder = 3
TextHint = 'Path to certificate file'
OnChange = Modification
OnDblClick = PickFile
@@ -801,12 +821,12 @@ object connform: Tconnform
Left = 190
Top = 63
Width = 324
- Height = 21
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
RightButton.Visible = True
- TabOrder = 3
+ TabOrder = 2
TextHint = 'Path to certificate authority file'
OnChange = Modification
OnDblClick = PickFile
@@ -817,18 +837,34 @@ object connform: Tconnform
Left = 190
Top = 36
Width = 324
- Height = 21
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
RightButton.Visible = True
- TabOrder = 4
+ TabOrder = 1
TextHint = 'Path to key file'
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
+ object comboSSLVerification: TComboBox
+ Left = 190
+ Top = 145
+ Width = 324
+ Height = 22
+ Style = csDropDownList
+ Anchors = [akLeft, akTop, akRight]
+ TabOrder = 5
+ OnChange = Modification
+ Items.Strings = (
+ 'No verification (insecure)'
+ 'Verify CA (insecure)'
+
+ 'Verify CA and host name identity (may fail with self-signed cert' +
+ 's and wildcard cn)')
+ end
end
object tabStatistics: TTabSheet
Caption = 'Statistics'
@@ -837,63 +873,63 @@ object connform: Tconnform
object lblLastConnectLeft: TLabel
Left = 3
Top = 31
- Width = 65
- Height = 13
+ Width = 75
+ Height = 14
Caption = 'Last connect:'
end
object lblCounterLeft: TLabel
Left = 3
Top = 50
- Width = 100
- Height = 13
+ Width = 114
+ Height = 14
Caption = 'Successful connects:'
end
object lblCreatedLeft: TLabel
Left = 3
Top = 12
- Width = 43
- Height = 13
+ Width = 47
+ Height = 14
Caption = 'Created:'
end
object lblCreatedRight: TLabel
Left = 190
Top = 12
- Width = 5
- Height = 13
+ Width = 6
+ Height = 14
Caption = '?'
end
object lblCounterRight1: TLabel
Left = 190
Top = 50
- Width = 5
- Height = 13
+ Width = 6
+ Height = 14
Caption = '?'
end
object lblLastConnectRight: TLabel
Left = 190
Top = 31
- Width = 5
- Height = 13
+ Width = 6
+ Height = 14
Caption = '?'
end
object lblCounterRight2: TLabel
Left = 190
Top = 69
- Width = 5
- Height = 13
+ Width = 6
+ Height = 14
Caption = '?'
end
object lblCounterLeft2: TLabel
Left = 3
Top = 69
- Width = 112
- Height = 13
+ Width = 127
+ Height = 14
Caption = 'Unsuccessful connects:'
end
end
end
object btnMore: TButton
- Left = 661
+ Left = 657
Top = 473
Width = 80
Height = 25
@@ -920,12 +956,13 @@ object connform: Tconnform
TabOrder = 7
object ListSessions: TVirtualStringTree
Left = 0
- Top = 26
+ Top = 27
Width = 200
- Height = 432
+ Height = 431
Align = alClient
DragMode = dmAutomatic
Header.AutoSizeIndex = -1
+ Header.Height = 18
Header.Options = [hoAutoResize, hoColumnResize, hoDblClickResize, hoDrag, hoHotTrack, hoShowSortGlyphs, hoVisible, hoDisableAnimatedResize, hoAutoResizeInclCaption]
Header.PopupMenu = MainForm.popupListHeader
Header.SortColumn = 0
@@ -939,6 +976,7 @@ object connform: Tconnform
TreeOptions.PaintOptions = [toHotTrack, toShowButtons, toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
TreeOptions.SelectionOptions = [toFullRowSelect, toRightClickSelect]
OnBeforeCellPaint = ListSessionsBeforeCellPaint
+ OnCompareNodes = ListSessionsCompareNodes
OnCreateEditor = ListSessionsCreateEditor
OnDragOver = ListSessionsDragOver
OnDragDrop = ListSessionsDragDrop
@@ -964,29 +1002,35 @@ object connform: Tconnform
Text = 'Host'
end
item
- Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
+ Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 2
- Text = 'User'
+ Text = 'Port'
+ Width = 10
end
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
Position = 3
+ Text = 'User'
+ end
+ item
+ Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
+ Position = 4
Text = 'Version'
end
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
- Position = 4
+ Position = 5
Text = 'Last connect'
end
item
Alignment = taRightJustify
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
- Position = 5
+ Position = 6
Text = 'Counter'
end
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
- Position = 6
+ Position = 7
Text = 'Comment'
Width = 10
end>
@@ -996,7 +1040,7 @@ object connform: Tconnform
Left = 0
Top = 0
Width = 200
- Height = 21
+ Height = 22
Margins.Left = 0
Margins.Top = 0
Margins.Right = 0
@@ -1060,6 +1104,11 @@ object connform: Tconnform
object Filter1: TMenuItem
Action = actFilter
end
+ object menuFoldersAtTop: TMenuItem
+ AutoCheck = True
+ Caption = 'Folders at top'
+ OnClick = menuFoldersAtTopClick
+ end
end
object TimerStatistics: TTimer
Interval = 60000
diff --git a/source/connections.pas b/source/connections.pas
index bddb68ff5..7ddee4b15 100644
--- a/source/connections.pas
+++ b/source/connections.pas
@@ -12,7 +12,8 @@ interface
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls,
VirtualTrees, Vcl.Menus, Vcl.Graphics, System.Generics.Collections, Winapi.ActiveX, extra_controls, Winapi.Messages,
dbconnection, gnugettext, SynRegExpr, System.Types, Vcl.GraphUtil, Data.Win.ADODB, System.StrUtils,
- System.Math, System.Actions, System.IOUtils, Vcl.ActnList, Vcl.StdActns;
+ System.Math, System.Actions, System.IOUtils, Vcl.ActnList, Vcl.StdActns, VirtualTrees.BaseTree, VirtualTrees.Types, VirtualTrees.EditLink,
+ VirtualTrees.BaseAncestorVCL, VirtualTrees.AncestorVCL, dbstructures;
type
Tconnform = class(TExtForm)
@@ -21,6 +22,7 @@ Tconnform = class(TExtForm)
btnSave: TButton;
btnNew: TButton;
btnDelete: TButton;
+ chkForceUnicode: TCheckBox;
popupSessions: TPopupMenu;
menuSave: TMenuItem;
menuDelete: TMenuItem;
@@ -37,7 +39,7 @@ Tconnform = class(TExtForm)
editPort: TEdit;
updownPort: TUpDown;
editPassword: TEdit;
- editUsername: TEdit;
+ editUsername: TButtonedEdit;
editHost: TButtonedEdit;
tabAdvanced: TTabSheet;
tabStatistics: TTabSheet;
@@ -137,6 +139,9 @@ Tconnform = class(TExtForm)
timerEditFilterDelay: TTimer;
comboSSHExe: TComboBox;
chkSSHActive: TCheckBox;
+ comboSSLVerification: TComboBox;
+ lblSSLVerification: TLabel;
+ menuFoldersAtTop: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure btnOpenClick(Sender: TObject);
procedure FormShow(Sender: TObject);
@@ -178,7 +183,7 @@ Tconnform = class(TExtForm)
Shift: TShiftState; State: TDragState; Pt: TPoint; Mode: TDropMode;
var Effect: Integer; var Accept: Boolean);
procedure ListSessionsDragDrop(Sender: TBaseVirtualTree; Source: TObject;
- DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState;
+ DataObject: TVTDragDataObject; Formats: TFormatArray; Shift: TShiftState;
Pt: TPoint; var Effect: Integer; Mode: TDropMode);
procedure btnMoreClick(Sender: TObject);
procedure menuRenameClick(Sender: TObject);
@@ -200,6 +205,10 @@ Tconnform = class(TExtForm)
procedure timerEditFilterDelayTimer(Sender: TObject);
procedure chkSSHActiveClick(Sender: TObject);
procedure PageControlDetailsChange(Sender: TObject);
+ procedure editUsernameRightButtonClick(Sender: TObject);
+ procedure ListSessionsCompareNodes(Sender: TBaseVirtualTree; Node1,
+ Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
+ procedure menuFoldersAtTopClick(Sender: TObject);
private
{ Private declarations }
FLoaded: Boolean;
@@ -207,6 +216,7 @@ Tconnform = class(TExtForm)
FServerVersion: String;
FSettingsImportWaitTime: Cardinal;
FPopupDatabases: TPopupMenu;
+ FPopupCiphers: TPopupMenu;
FButtonAnimationStep: Integer;
FLastSelectedNetTypeGroup: TNetTypeGroup;
function GetSelectedNetType: TNetType;
@@ -219,6 +229,7 @@ Tconnform = class(TExtForm)
function NodeSessionNames(Node: PVirtualNode; var RegKey: String): TStringList;
function GetWindowCaption: String;
procedure MenuDatabasesClick(Sender: TObject);
+ procedure MenuCiphersClick(Sender: TObject);
procedure WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ; message WM_NCLBUTTONDOWN;
procedure WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ; message WM_NCLBUTTONUP;
procedure RefreshBackgroundColors;
@@ -230,7 +241,7 @@ Tconnform = class(TExtForm)
implementation
-uses Main, apphelpers, grideditlinks;
+uses Main, apphelpers, grideditlinks, dbstructures.sqlite;
{$I const.inc}
@@ -279,11 +290,12 @@ procedure Tconnform.FormCreate(Sender: TObject);
HasSizeGrip := True;
Caption := GetWindowCaption;
- ListSessions.OnCompareNodes := MainForm.AnyGridCompareNodes;
+ FixVT(ListSessions);
ListSessions.OnHeaderClick := MainForm.AnyGridHeaderClick;
ListSessions.OnHeaderDraggedOut := MainForm.AnyGridHeaderDraggedOut;
btnImportSettings.Caption := MainForm.actImportSettings.Caption;
FLoaded := False;
+ menuFoldersAtTop.Checked := AppSettings.ReadBool(asSessionManagerListFoldersAtTop);
comboNetType.Clear;
Params := TConnectionParameters.Create;
@@ -311,7 +323,7 @@ procedure Tconnform.FormCreate(Sender: TObject);
editLogFilePath.Hint := FilenameHint;
// Populate dropdown with supported SSH executables
- ExeFiles := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), '*.exe');
+ ExeFiles := TDirectory.GetFiles(GetAppDir, '*.exe');
for ExePath in ExeFiles do begin
ExeFile := ExtractFileName(ExePath);
if ExecRegExprI('([pk]link|putty)', ExeFile) then begin
@@ -343,11 +355,17 @@ procedure Tconnform.RefreshSessions(ParentNode: PVirtualNode);
Params := TConnectionParameters.Create(RegKey+SessionNames[i]);
SessNode := ListSessions.AddChild(ParentNode, PConnectionParameters(Params));
if Params.IsFolder then begin
+ SessNode.Dummy := 1; // We use this Byte value later in CompareNodes
RefreshSessions(SessNode);
+ end
+ else begin
+ SessNode.Dummy := 0;
end;
end;
- if not Assigned(ParentNode) then
+ if not Assigned(ParentNode) then begin
RefreshBackgroundColors;
+ ListSessions.SortTree(ListSessions.Header.SortColumn, ListSessions.Header.SortDirection);
+ end;
end;
@@ -392,7 +410,6 @@ procedure Tconnform.FormShow(Sender: TObject);
MakeFullyVisible;
pnlLeft.Width := AppSettings.ReadIntDpiAware(asSessionManagerListWidth, Self);
splitterMain.OnMoved(Sender);
- FixVT(ListSessions);
RestoreListSetup(ListSessions);
// Init sessions tree
@@ -480,6 +497,7 @@ procedure Tconnform.btnSaveClick(Sender: TObject);
Sess.LoginPrompt := chkLoginPrompt.Checked;
Sess.WindowsAuth := chkWindowsAuth.Checked;
Sess.CleartextPluginEnabled := chkCleartextPluginEnabled.Checked;
+ Sess.ForceUnicode := chkForceUnicode.Checked;
Sess.Port := updownPort.Position;
Sess.NetType := SelectedNetType;
Sess.Compressed := chkCompressed.Checked;
@@ -506,6 +524,7 @@ procedure Tconnform.btnSaveClick(Sender: TObject);
Sess.SSLCertificate := editSSLCertificate.Text;
Sess.SSLCACertificate := editSSLCACertificate.Text;
Sess.SSLCipher := editSSLCipher.Text;
+ Sess.SSLVerification := comboSSLVerification.ItemIndex;
Sess.IgnoreDatabasePattern := editIgnoreDatabasePattern.Text;
Sess.LogFileDdl := chkLogFileDdl.Checked;
Sess.LogFileDml := chkLogFileDml.Checked;
@@ -708,6 +727,7 @@ function Tconnform.CurrentParams: TConnectionParameters;
Result.LoginPrompt := chkLoginPrompt.Checked;
Result.WindowsAuth := chkWindowsAuth.Checked;
Result.CleartextPluginEnabled := chkCleartextPluginEnabled.Checked;
+ Result.ForceUnicode := chkForceUnicode.Checked;
if updownPort.Enabled then
Result.Port := updownPort.Position
else
@@ -729,6 +749,7 @@ function Tconnform.CurrentParams: TConnectionParameters;
Result.SSLCertificate := editSSLCertificate.Text;
Result.SSLCACertificate := editSSLCACertificate.Text;
Result.SSLCipher := editSSLCipher.Text;
+ Result.SSLVerification := comboSSLVerification.ItemIndex;
Result.StartupScriptFilename := editStartupScript.Text;
Result.Compressed := chkCompressed.Checked;
Result.QueryTimeout := updownQueryTimeout.Position;
@@ -795,14 +816,15 @@ procedure Tconnform.ListSessionsGetText(Sender: TBaseVirtualTree;
CellText := CellText + ' *';
end;
1: CellText := Sess.Hostname;
- 2: CellText := Sess.Username;
- 3: CellText := Sess.ServerVersion;
- 4: if Sess.LastConnect>0 then
+ 2: CellText := Sess.Port.ToString;
+ 3: CellText := Sess.Username;
+ 4: CellText := Sess.ServerVersion;
+ 5: if Sess.LastConnect>0 then
CellText := DateTimeToStr(Sess.LastConnect)
else
CellText := '';
- 5: CellText := FormatNumber(Sess.Counter);
- 6: CellText := Sess.Comment;
+ 6: CellText := FormatNumber(Sess.Counter);
+ 7: CellText := Sess.Comment;
end;
end;
end;
@@ -849,6 +871,25 @@ procedure Tconnform.ListSessionsBeforeCellPaint(Sender: TBaseVirtualTree;
end;
end;
+procedure Tconnform.ListSessionsCompareNodes(Sender: TBaseVirtualTree; Node1,
+ Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
+var
+ VT: TVirtualStringTree;
+ DirectionMarker: Integer;
+begin
+ VT := Sender as TVirtualStringTree;
+ if Assigned(Node1) and Assigned(Node2) then begin
+ // This marker when set to -1 ensures folders are at the top
+ DirectionMarker := IfThen(VT.Header.SortDirection = sdAscending, 1, -1);
+ if menuFoldersAtTop.Checked and (Node1.Dummy=1) and (Node2.Dummy<>1) then
+ Result := -1 * DirectionMarker
+ else if menuFoldersAtTop.Checked and (Node1.Dummy<>1) and (Node2.Dummy=1) then
+ Result := 1 * DirectionMarker
+ else
+ Result := CompareAnyNode(VT.Text[Node1, Column], VT.Text[Node2, Column]);
+ end;
+end;
+
procedure Tconnform.ListSessionsCreateEditor(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; out EditLink: IVTEditLink);
begin
@@ -858,7 +899,7 @@ procedure Tconnform.ListSessionsCreateEditor(Sender: TBaseVirtualTree; Node: PVi
procedure Tconnform.ListSessionsDragDrop(Sender: TBaseVirtualTree;
- Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
+ Source: TObject; DataObject: TVTDragDataObject; Formats: TFormatArray;
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
var
TargetNode, ParentNode: PVirtualNode;
@@ -923,9 +964,11 @@ procedure Tconnform.ListSessionsDragOver(Sender: TBaseVirtualTree;
TargetSess := Sender.GetNodeData(TargetNode);
Accept := (Source = Sender)
and Assigned(TargetSess)
- and (Mode <> dmNowhere)
- and (TargetNode <> ListSessions.FocusedNode.Parent);
-
+ and (Mode <> dmNowhere);
+ if Accept and (Mode = dmOnNode) and (TargetNode = ListSessions.FocusedNode.Parent) then
+ Accept := False;
+ if Accept and (Mode in [dmAbove, dmBelow]) and (TargetNode.Parent = ListSessions.FocusedNode.Parent) then
+ Accept := False;
// Moving a folder into itself would create an infinite folder structure
if Accept and TargetSess.IsFolder then
Accept := Accept and (TargetNode <> ListSessions.FocusedNode);
@@ -975,6 +1018,7 @@ procedure Tconnform.ListSessionsFocusChanged(Sender: TBaseVirtualTree;
menuNewSessionInFolder.Enabled := InFolder;
menuNewFolderInFolder.Enabled := InFolder;
FreeAndNil(FPopupDatabases);
+ FreeAndNil(FPopupCiphers);
if not SessionFocused then begin
PageControlDetails.ActivePage := tabStart;
@@ -995,6 +1039,7 @@ procedure Tconnform.ListSessionsFocusChanged(Sender: TBaseVirtualTree;
chkLoginPrompt.Checked := Sess.LoginPrompt;
chkWindowsAuth.Checked := Sess.WindowsAuth;
chkCleartextPluginEnabled.Checked := Sess.CleartextPluginEnabled;
+ chkForceUnicode.Checked := Sess.ForceUnicode;
updownPort.Position := Sess.Port;
chkCompressed.Checked := Sess.Compressed;
updownQueryTimeout.Position := Sess.QueryTimeout;
@@ -1028,6 +1073,7 @@ procedure Tconnform.ListSessionsFocusChanged(Sender: TBaseVirtualTree;
editSSLCertificate.Text := Sess.SSLCertificate;
editSSLCACertificate.Text := Sess.SSLCACertificate;
editSSLCipher.Text := Sess.SSLCipher;
+ comboSSLVerification.ItemIndex := Sess.SSLVerification;
editIgnoreDatabasePattern.Text := Sess.IgnoreDatabasePattern;
chkLogFileDdl.Checked := Sess.LogFileDdl;
chkLogFileDml.Checked := Sess.LogFileDml;
@@ -1118,6 +1164,9 @@ procedure Tconnform.ListSessionsNewText(Sender: TBaseVirtualTree;
SiblingSessions := NodeSessionNames(Node.Parent, ParentKey);
+ // Safety replacement for folder separator, see issue #682
+ NewText := StringReplace(NewText, '\', '-', [rfReplaceAll]);
+
if SiblingSessions.IndexOf(NewText) > -1 then begin
ErrorDialog(
f_('Session "%s" already exists!', [ParentKey+NewText])
@@ -1269,7 +1318,7 @@ procedure Tconnform.editDatabasesRightButtonClick(Sender: TObject);
Item.Caption := DB;
Item.OnClick := MenuDatabasesClick;
Item.AutoCheck := True;
- Item.RadioItem := Params.NetTypeGroup = ngPgSQL;
+ Item.RadioItem := Params.IsAnyPostgreSQL;
FPopupDatabases.Items.Add(Item);
end;
Databases.Free;
@@ -1309,6 +1358,52 @@ procedure Tconnform.MenuDatabasesClick(Sender: TObject);
end;
+procedure Tconnform.MenuCiphersClick(Sender: TObject);
+begin
+ editUsername.Text := TMenuItem(Sender).Caption;
+end;
+
+
+procedure Tconnform.editUsernameRightButtonClick(Sender: TObject);
+var
+ Params: TConnectionParameters;
+ Item: TMenuItem;
+ LibraryPath: String;
+ Lib: TSQLiteLib;
+ p: TPoint;
+ i: Integer;
+begin
+ // Provide supported cipher names
+ if FPopupCiphers = nil then begin
+ FPopupCiphers := TPopupMenu.Create(Self);
+ FPopupCiphers.AutoHotkeys := maManual;
+ Params := CurrentParams;
+ LibraryPath := GetAppDir + Params.LibraryOrProvider;
+ // Throws EDbError on any failure:
+ Lib := TSQLiteLib.CreateWithMultipleCipherFunctions(LibraryPath, Params.DefaultLibrary);
+ for i:=1 to Lib.sqlite3mc_cipher_count() do begin
+ Item := TMenuItem.Create(FPopupCiphers);
+ Item.Caption := Utf8ToString(Lib.sqlite3mc_cipher_name(i));
+ Item.OnClick := MenuCiphersClick;
+ FPopupCiphers.Items.Add(Item);
+ end;
+ Lib.Free;
+
+ end;
+
+ p := editUsername.ClientToScreen(editUsername.ClientRect.BottomRight);
+ FPopupCiphers.Popup(p.X-editUsername.Images.Width, p.Y);
+end;
+
+
+procedure Tconnform.menuFoldersAtTopClick(Sender: TObject);
+begin
+ AppSettings.WriteBool(asSessionManagerListFoldersAtTop, menuFoldersAtTop.Checked);
+ ListSessions.SortTree(ListSessions.Header.SortColumn, ListSessions.Header.SortDirection);
+ if ListSessions.SelectedCount > 0 then
+ ListSessions.ScrollIntoView(ListSessions.GetFirstSelected, False);
+end;
+
procedure Tconnform.menuRenameClick(Sender: TObject);
begin
// Start node editor to rename a session
@@ -1319,6 +1414,7 @@ procedure Tconnform.menuRenameClick(Sender: TObject);
procedure Tconnform.comboNetTypeChange(Sender: TObject);
var
Params: TConnectionParameters;
+ Libs: TStringList;
begin
// Autoset default connection data as long as that was not modified by user
// and only if net type group has now changed
@@ -1337,8 +1433,14 @@ procedure Tconnform.comboNetTypeChange(Sender: TObject);
if not editHost.Modified then
editHost.Text := Params.DefaultHost;
chkSSHActive.Checked := Params.DefaultSshActive;
+ end;
- comboLibrary.Items := Params.GetLibraries;
+ // Populate libraries combobox. Required on each net group change, and also between
+ // SQLite and SQLite-encrypted.
+ Libs := Params.GetLibraries;
+ mainform.LogSQL(Libs.CommaText);
+ if Libs.Text <> comboLibrary.Items.Text then begin
+ comboLibrary.Items := Libs;
comboLibrary.ItemIndex := comboLibrary.Items.IndexOf(Params.DefaultLibrary);
end;
@@ -1364,6 +1466,7 @@ procedure Tconnform.Modification(Sender: TObject);
or (Sess.LoginPrompt <> chkLoginPrompt.Checked)
or (Sess.WindowsAuth <> chkWindowsAuth.Checked)
or (Sess.CleartextPluginEnabled <> chkCleartextPluginEnabled.Checked)
+ or (Sess.ForceUnicode <> chkForceUnicode.Checked)
or (Sess.Port <> updownPort.Position)
or (Sess.Compressed <> chkCompressed.Checked)
or (Sess.QueryTimeout <> updownQueryTimeout.Position)
@@ -1390,6 +1493,7 @@ procedure Tconnform.Modification(Sender: TObject);
or (Sess.SSLCertificate <> editSSLCertificate.Text)
or (Sess.SSLCACertificate <> editSSLCACertificate.Text)
or (Sess.SSLCipher <> editSSLCipher.Text)
+ or (Sess.SSLVerification <> comboSSLVerification.ItemIndex)
or (Sess.IgnoreDatabasePattern <> editIgnoreDatabasePattern.Text)
or (Sess.LogFileDdl <> chkLogFileDdl.Checked)
or (Sess.LogFileDml <> chkLogFileDml.Checked)
@@ -1400,7 +1504,8 @@ procedure Tconnform.Modification(Sender: TObject);
FSessionModified := FSessionModified or PasswordModified;
if (Sender=editHost) or (Sender=editUsername) or (Sender=editPassword) or
(Sender=comboNetType) or (Sender=chkWindowsAuth) or (Sender=editPort) or
- (Sender=chkCleartextPluginEnabled) then begin
+ (Sender=chkCleartextPluginEnabled) or (Sender=chkForceUnicode)
+ then begin
// Be sure to use the modified connection params next time the user clicks the "Databases" pulldown
FreeAndNil(FPopupDatabases);
end;
@@ -1458,16 +1563,26 @@ procedure Tconnform.ValidateControls;
if SessionFocused then begin
// Validate session GUI stuff on "Settings" tab:
+ lblHost.Caption := _('Hostname / IP:');
+ lblUsername.Caption := _('User')+':';
+ lblPassword.Caption := _('Password:');
+ lblDatabase.Caption := _('Databases')+':';
+ editDatabases.TextHint := _('Separated by semicolon');
case Params.NetType of
ntMySQL_NamedPipe: begin
lblHost.Caption := _('Socket name:');
end;
- ntSQLite: begin
+ ntPgSQL_TCPIP, ntPgSQL_SSHtunnel: begin
+ lblDatabase.Caption := _('Database')+':';
+ editDatabases.TextHint := _('Single database name');
+ end;
+ ntSQLite, ntSQLiteEncrypted: begin
lblHost.Caption := _('Database filename(s)')+':';
+ lblUsername.Caption := _('Cipher')+':';
+ lblPassword.Caption := _('Key:');
+ lblDatabase.Caption := _('Encryption parameters')+':';
+ editDatabases.TextHint := _('Example:') + ' kdf_iter=4000;legacy=1;...';
end
- else begin
- lblHost.Caption := _('Hostname / IP:');
- end;
end;
editHost.RightButton.Visible := Params.IsAnySQLite;
chkLoginPrompt.Enabled := Params.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL];
@@ -1475,17 +1590,19 @@ procedure Tconnform.ValidateControls;
lblUsername.Enabled := (Params.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL, ngInterbase])
and ((not chkLoginPrompt.Checked) or (not chkLoginPrompt.Enabled))
and ((not chkWindowsAuth.Checked) or (not chkWindowsAuth.Enabled));
+ lblUsername.Enabled := lblUsername.Enabled or (Params.NetType = ntSQLiteEncrypted);
editUsername.Enabled := lblUsername.Enabled;
+ editUsername.RightButton.Visible := Params.NetType = ntSQLiteEncrypted;
lblPassword.Enabled := lblUsername.Enabled;
editPassword.Enabled := lblUsername.Enabled;
lblPort.Enabled := Params.NetType in [ntMySQL_TCPIP, ntMySQL_SSHtunnel, ntMySQL_ProxySQLAdmin, ntMySQL_RDS, ntMSSQL_TCPIP, ntPgSQL_TCPIP, ntPgSQL_SSHtunnel, ntInterbase_TCPIP, ntFirebird_TCPIP];
editPort.Enabled := lblPort.Enabled;
updownPort.Enabled := lblPort.Enabled;
chkCompressed.Enabled := Params.IsAnyMySQL;
- lblDatabase.Caption := IfThen(Params.IsAnyPostgreSQL, _('Database')+':', _('Databases')+':');
- editDatabases.TextHint := IfThen(Params.IsAnyPostgreSQL, _('Single database name'), _('Separated by semicolon'));
lblDatabase.Enabled := Params.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL, ngInterbase];
+ lblDatabase.Enabled := lblDatabase.Enabled or (Params.NetType = ntSQLiteEncrypted);
editDatabases.Enabled := lblDatabase.Enabled;
+ editDatabases.RightButton.Visible := Params.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL, ngInterbase];
// SSH tunnel tab:
chkSSHActive.Enabled := Params.SshSupport;
lblSSHExe.Enabled := Params.SSHActive;
@@ -1505,6 +1622,15 @@ procedure Tconnform.ValidateControls;
lblSSHLocalPort.Enabled := Params.SSHActive;
editSSHlocalport.Enabled := Params.SSHActive;
// Advanced tab:
+ lblQueryTimeout.Enabled := True;
+ editQueryTimeout.Enabled := lblQueryTimeout.Enabled;
+ updownQueryTimeout.Enabled := lblQueryTimeout.Enabled;
+ chkLocalTimeZone.Enabled := Params.NetTypeGroup = ngMySQL;
+ chkFullTableStatus.Enabled := (Params.NetTypeGroup in [ngMySQL, ngPgSQL, ngSQLite]) and (Params.NetType <> ntMySQL_ProxySQLAdmin);
+ chkCleartextPluginEnabled.Enabled := Params.NetTypeGroup = ngMySQL;
+ chkForceUnicode.Enabled := Params.NetTypeGroup = ngMySQL;
+ editLogFilePath.Enabled := Params.LogFileDdl or Params.LogFileDml;
+ // SSL tab:
chkWantSSL.Enabled := Params.NetType in [ntMySQL_TCPIP, ntMySQL_SSHtunnel, ntMySQL_ProxySQLAdmin, ntMySQL_RDS, ntPgSQL_TCPIP, ntPgSQL_SSHtunnel];
lblSSLPrivateKey.Enabled := Params.WantSSL;
editSSLPrivateKey.Enabled := Params.WantSSL;
@@ -1514,13 +1640,8 @@ procedure Tconnform.ValidateControls;
editSSLCertificate.Enabled := Params.WantSSL;
lblSSLcipher.Enabled := Params.WantSSL;
editSSLcipher.Enabled := Params.WantSSL;
- lblQueryTimeout.Enabled := True;
- editQueryTimeout.Enabled := lblQueryTimeout.Enabled;
- updownQueryTimeout.Enabled := lblQueryTimeout.Enabled;
- chkLocalTimeZone.Enabled := Params.NetTypeGroup = ngMySQL;
- chkFullTableStatus.Enabled := (Params.NetTypeGroup in [ngMySQL, ngPgSQL]) and (Params.NetType <> ntMySQL_ProxySQLAdmin);
- chkCleartextPluginEnabled.Enabled := Params.NetTypeGroup = ngMySQL;
- editLogFilePath.Enabled := Params.LogFileDdl or Params.LogFileDml;
+ lblSSLVerification.Enabled := Params.WantSSL;
+ comboSSLVerification.Enabled := Params.WantSSL;
Params.Free;
end;
@@ -1624,7 +1745,7 @@ procedure Tconnform.PickFile(Sender: TObject);
FileNames.Assign(Selector.Files);
for i:=0 to FileNames.Count-1 do begin
// Remove path if it's the application directory
- if ExtractFilePath(FileNames[i]) = ExtractFilePath(Application.ExeName) then
+ if ExtractFilePath(FileNames[i]) = GetAppDir then
FileNames[i] := ExtractFileName(FileNames[i]);
end;
Edit.Text := Implode(DELIM, FileNames);
diff --git a/source/const.inc b/source/const.inc
index 3747a8403..e89efdbf3 100644
--- a/source/const.inc
+++ b/source/const.inc
@@ -33,6 +33,7 @@ const
ICONINDEX_UNIQUEKEY = 24;
ICONINDEX_FULLTEXTKEY = 22;
ICONINDEX_SPATIALKEY = 126;
+ ICONINDEX_VECTORKEY = 207;
ICONINDEX_FOREIGNKEY = 136;
ICONINDEX_SERVER = 36;
ICONINDEX_DB = 5;
@@ -45,6 +46,8 @@ const
ICONINDEX_FUNCTION = 13;
ICONINDEX_EVENT = 80;
ICONINDEX_KEYWORD = 25;
+ ICONINDEX_USER = 43;
+ ICONINDEX_ROLE = 95;
// Size of byte units
{Kibibyte} SIZE_KB = Int64(1024);
@@ -95,8 +98,14 @@ const
MsgUnhandledNetType: String = 'Unhandled connection type (%d)';
MsgUnhandledControl: String = 'Unhandled control in %s';
MsgDisconnect: String = 'Connection to %s closed at %s';
- MsgInvalidColumn: String = 'Column #%d not available. Query returned %d columns and %d rows.';
+ // This must be an empty string, otherwise TTableColumn's get GenerationExpression=XYZ on old servers
+ TextInvalidColumn: String = '';
FILEFILTER_SQLITEDB = '*.sqlite3;*.sqlite;*.db;*.s3db';
FILEEXT_SQLITEDB = 'sqlite3';
+ FILEEXT_SNIPPET = '.sql';
PROPOSAL_ITEM_HEIGHT = 18;
+ // Note the following should be in sync to what MySQL returns from SHOW WARNINGS
+ SLogPrefixWarning = 'Warning';
+ SLogPrefixNote = 'Note';
+ SLogPrefixInfo = 'Info';
diff --git a/source/copytable.pas b/source/copytable.pas
index 9be282743..af3e8aee8 100644
--- a/source/copytable.pas
+++ b/source/copytable.pas
@@ -5,7 +5,8 @@ interface
uses
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, extra_controls,
- dbconnection, dbstructures, dbstructures.mysql, VirtualTrees, SynEdit, SynMemo, Vcl.Menus, gnugettext;
+ dbconnection, dbstructures, dbstructures.mysql, VirtualTrees, SynEdit, SynMemo, Vcl.Menus, gnugettext, VirtualTrees.BaseTree, VirtualTrees.Types,
+ VirtualTrees.BaseAncestorVCL, VirtualTrees.AncestorVCL;
type
TCopyTableForm = class(TExtForm)
@@ -356,12 +357,13 @@ procedure TCopyTableForm.btnOKClick(Sender: TObject);
Column: TTableColumn;
Key: TTableKey;
ForeignKey: TForeignKey;
-const
- ClausePattern: String = #9 + '%s,' + CRLF;
+ ClausePattern: String;
+ NewObj: TDBObject;
begin
// Compose and run CREATE query
TargetTable := FConnection.QuotedDbAndTableName(comboDatabase.Text, editNewTablename.Text);
+ ClausePattern := CodeIndent + '%s,' + sLineBreak;
// Watch out if target table exists
try
@@ -376,6 +378,7 @@ procedure TCopyTableForm.btnOKClick(Sender: TObject);
Exit;
end;
FConnection.Query('DROP TABLE '+TargetTable);
+ FConnection.ShowWarnings;
end;
Screen.Cursor := crHourglass;
@@ -413,7 +416,7 @@ procedure TCopyTableForm.btnOKClick(Sender: TObject);
for Column in SelectedColumns do begin
AutoIncGetsKey := False;
AutoIncRemoved := False;
- AutoIncName := Column.AutoIncName;
+ AutoIncName := FConnection.SqlProvider.GetSql(qAutoInc);
if Column.DefaultType = cdtAutoInc then begin
for Key in SelectedKeys do begin
// Don't check index type, MySQL allows auto-increment columns on nearly all indexes
@@ -478,11 +481,20 @@ procedure TCopyTableForm.btnOKClick(Sender: TObject);
try
MainForm.ShowStatusMsg(_('Creating table ...'));
FConnection.Query(CreateCode);
- if InsertCode <> '' then
+ FConnection.ShowWarnings;
+ if InsertCode <> '' then begin
FConnection.Query(InsertCode);
+ FConnection.ShowWarnings;
+ end;
// actRefresh takes care of whether the table editor is open
// See also issue #1597
- MainForm.actRefresh.Execute
+ MainForm.actRefresh.Execute;
+ // Select it in tree
+ NewObj := TDBObject.Create(FDBObj.Connection);
+ NewObj.NodeType := lntTable;
+ NewObj.Database := comboDatabase.Text;
+ NewObj.Name := editNewTablename.Text;
+ MainForm.ActiveDbObj := NewObj;
except
on E:EDbError do begin
Screen.Cursor := crDefault;
diff --git a/source/createdatabase.pas b/source/createdatabase.pas
index 14107bd0a..2f71279b1 100644
--- a/source/createdatabase.pas
+++ b/source/createdatabase.pas
@@ -52,12 +52,15 @@ procedure TCreateDatabaseForm.FormCreate(Sender: TObject);
}
procedure TCreateDatabaseForm.FormShow(Sender: TObject);
var
- ServerCollation, Collation, Charset, CreateCode: String;
+ ServerCollation, PreviousCollation, CurrentCollation: String;
+ Charset, CreateCode: String;
CollationTable: TDBQuery;
rx: TRegExpr;
begin
FConnection := MainForm.ActiveConnection;
CollationTable := FConnection.CollationTable;
+ CurrentCollation := '';
+ PreviousCollation := AppSettings.ReadString(asCreateDbCollation);
// Detect servers default collation
case FConnection.Parameters.NetTypeGroup of
@@ -68,13 +71,9 @@ procedure TCreateDatabaseForm.FormShow(Sender: TObject);
end;
lblServerDefaultCollation.Caption := f_('Servers default: %s', [ServerCollation]);
- if modifyDB = '' then begin
+ if modifyDB.IsEmpty then begin
Caption := _('Create database ...');
editDBName.Text := '';
- Charset := '';
- Collation := AppSettings.ReadString(asCreateDbCollation);
- if Collation.IsEmpty then
- Collation := ServerCollation;
end
else begin
Caption := _('Alter database ...');
@@ -88,19 +87,19 @@ procedure TCreateDatabaseForm.FormShow(Sender: TObject);
Charset := rx.Match[1];
rx.Expression := '\sCOLLATE\s+(\w+)\b';
if rx.Exec(CreateCode) then
- Collation := rx.Match[1];
+ CurrentCollation := rx.Match[1];
rx.Free;
// Find default collation of given charset
- if (Collation = '') and (Charset <> '') and Assigned(CollationTable) then begin
+ if (CurrentCollation = '') and (Charset <> '') and Assigned(CollationTable) then begin
while not CollationTable.Eof do begin
if (CollationTable.Col('Charset') = Charset) and (LowerCase(CollationTable.Col('Default')) = 'yes') then
- Collation := CollationTable.Col('Collation');
+ CurrentCollation := CollationTable.Col('Collation');
CollationTable.Next;
end;
end;
end;
- // Select collation in pulldown
+ // Populate collation combo box
comboCollation.Enabled := Assigned(CollationTable);
lblCollation.Enabled := comboCollation.Enabled;
comboCollation.Clear;
@@ -110,9 +109,16 @@ procedure TCreateDatabaseForm.FormShow(Sender: TObject);
comboCollation.Items.Add(CollationTable.Col('Collation'));
CollationTable.Next;
end;
- comboCollation.ItemIndex := comboCollation.Items.IndexOf(Collation);
+ // Pre-select best fitting collation
+ comboCollation.ItemIndex := comboCollation.Items.IndexOf(CurrentCollation);
if comboCollation.ItemIndex = -1 then
- comboCollation.ItemIndex := 0;
+ comboCollation.ItemIndex := comboCollation.Items.IndexOf(PreviousCollation);
+ if comboCollation.ItemIndex = -1 then
+ comboCollation.ItemIndex := comboCollation.Items.IndexOf(ServerCollation);
+ if comboCollation.ItemIndex = -1 then
+ comboCollation.ItemIndex := comboCollation.Items.IndexOf('utf8mb4_unicode_ci');
+ if comboCollation.ItemIndex = -1 then
+ comboCollation.ItemIndex := 0; // give up, use the first one
end;
editDBName.SetFocus;
@@ -135,9 +141,10 @@ procedure TCreateDatabaseForm.btnOKClick(Sender: TObject);
ObjectsInNewDb, ObjectsInOldDb: TDBObjectList;
i, j: Integer;
begin
- if modifyDB = '' then try
+ if modifyDB.IsEmpty then try
sql := GetCreateStatement;
FConnection.Query(sql);
+ FConnection.ShowWarnings;
AppSettings.WriteString(asCreateDbCollation, comboCollation.Text);
MainForm.RefreshTree;
// Close form
@@ -154,6 +161,7 @@ procedure TCreateDatabaseForm.btnOKClick(Sender: TObject);
if modifyDB = editDBName.Text then begin
// Alter database
FConnection.Query(sql);
+ FConnection.ShowWarnings;
end else begin
// Rename database
ObjectsInOldDb := FConnection.GetDBObjects(modifyDB, True);
@@ -180,6 +188,7 @@ procedure TCreateDatabaseForm.btnOKClick(Sender: TObject);
if AllDatabases.IndexOf(editDBName.Text) = -1 then begin
// Target db does not exist - create it
FConnection.Query(GetCreateStatement);
+ FConnection.ShowWarnings;
end else begin
if MessageDialog(f_('Database "%s" exists. But it does not contain objects with same names as in "%s", so it''s uncritical to move everything. Move all objects to "%s"?', [editDBName.Text, modifyDB, editDBName.Text]),
mtConfirmation, [mbYes, mbCancel]) <> mrYes then
@@ -195,6 +204,7 @@ procedure TCreateDatabaseForm.btnOKClick(Sender: TObject);
Delete(sql, Length(sql)-1, 2);
sql := 'RENAME TABLE '+sql;
FConnection.Query(sql);
+ FConnection.ShowWarnings;
FConnection.ClearDbObjects(modifyDB);
FConnection.ClearDbObjects(editDBName.Text);
end;
@@ -202,6 +212,7 @@ procedure TCreateDatabaseForm.btnOKClick(Sender: TObject);
ObjectsLeft := FConnection.GetDBObjects(modifyDB);
if ObjectsLeft.Count = 0 then begin
FConnection.Query('DROP DATABASE '+FConnection.QuoteIdent(modifyDB));
+ FConnection.ShowWarnings;
MainForm.RefreshTree;
end;
end;
diff --git a/source/csv_detector.pas b/source/csv_detector.pas
index 9eb424c76..ade43965d 100644
--- a/source/csv_detector.pas
+++ b/source/csv_detector.pas
@@ -359,7 +359,7 @@ function TfrmCsvDetector.ComposeCreateStatement(Columns: TTableColumnList): Stri
TableName := FConnection.CleanIdent(TableName);
Result := 'CREATE TABLE '+FConnection.QuoteIdent(FLoadDataFrm.comboDatabase.Text)+'.'+FConnection.QuoteIdent(TableName)+' (' + sLineBreak;
for Col in Columns do begin
- Result := Result + #9 + Col.SQLCode;
+ Result := Result + CodeIndent + Col.SQLCode;
if Col <> Columns.Last then
Result := Result + ',';
Result := Result + sLineBreak;
@@ -377,6 +377,7 @@ procedure TfrmCsvDetector.btnSaveClick(Sender: TObject);
try
Screen.Cursor := crHourGlass;
FConnection.Query(SynMemoCreateTable.Text);
+ FConnection.ShowWarnings;
ModalResult := mrOk;
rx := TRegExpr.Create;
rx.ModifierI := True;
diff --git a/source/data_sorting.pas b/source/data_sorting.pas
index 6baaea390..935566134 100644
--- a/source/data_sorting.pas
+++ b/source/data_sorting.pas
@@ -4,7 +4,7 @@ interface
uses
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.Buttons,
- Vcl.Graphics, apphelpers, gnugettext, extra_controls;
+ Vcl.Graphics, apphelpers, gnugettext, extra_controls, dbconnection;
type
@@ -26,6 +26,9 @@ TfrmDataSorting = class(TExtForm)
FColumnNames: TStringList;
FSortItems: TSortItems;
FOldOrderClause: String;
+ FDeleteTimer: TTimer;
+ FDeleteButtonPressed: TButton;
+ procedure DeleteTimerTimer(Sender: TObject);
procedure comboColumnsChange(Sender: TObject);
procedure btnOrderClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject);
@@ -57,6 +60,11 @@ procedure TfrmDataSorting.FormCreate(Sender: TObject);
FSortItems.Assign(MainForm.DataGridSortItems);
FOldOrderClause := FSortItems.ComposeOrderClause(MainForm.ActiveConnection);
+ FDeleteTimer := TTimer.Create(Self);
+ FDeleteTimer.Interval := 100;
+ FDeleteTimer.Enabled := False;
+ FDeleteTimer.OnTimer := DeleteTimerTimer;
+
// First creation of controls
DisplaySortingControls(Sender);
end;
@@ -236,11 +244,16 @@ procedure TfrmDataSorting.btnOrderClick( Sender: TObject );
Delete order column
}
procedure TfrmDataSorting.btnDeleteClick(Sender: TObject);
-var
- btn: TButton;
begin
- btn := Sender as TButton;
- FSortItems.Delete(btn.Tag-1);
+ FDeleteButtonPressed := Sender as TButton;
+ FDeleteTimer.Enabled := True;
+end;
+
+
+procedure TfrmDataSorting.DeleteTimerTimer(Sender: TObject);
+begin
+ FDeleteTimer.Enabled := False;
+ FSortItems.Delete(FDeleteButtonPressed.Tag-1);
// Refresh controls
DisplaySortingControls(Self);
// Enables OK button
@@ -269,6 +282,7 @@ procedure TfrmDataSorting.btnAddColClick(Sender: TObject);
NewSortItem.Column := UnusedColumns[0]
else
NewSortItem.Column := FColumnNames[0];
+ MainForm.LogSQL('Created sorting for column '+NewSortItem.Column+'/'+Integer(NewSortItem.Order).ToString+' in TfrmDataSorting.btnAddColClick', lcDebug);
// Refresh controls
DisplaySortingControls(Sender);
diff --git a/source/dbconnection.pas b/source/dbconnection.pas
index 49c50a00b..e39289314 100644
--- a/source/dbconnection.pas
+++ b/source/dbconnection.pas
@@ -5,7 +5,7 @@ interface
uses
System.Classes, System.SysUtils, Winapi.Windows, System.Generics.Collections, System.Generics.Defaults,
System.DateUtils, System.Types, System.Math, Vcl.Dialogs, Data.Win.ADODB, Data.DB, Data.DBCommon, System.Win.ComObj, Vcl.Graphics, Vcl.ExtCtrls, System.StrUtils,
- System.AnsiStrings, Vcl.Controls, Vcl.Forms, System.IOUtils, System.IniFiles, System.Variants,
+ System.AnsiStrings, Vcl.Controls, Vcl.Forms, System.IOUtils, System.IniFiles, System.Variants, Rtti,
SynRegExpr, gnugettext, generic_types,
dbstructures, dbstructures.mysql, dbstructures.mssql, dbstructures.postgresql, dbstructures.sqlite, dbstructures.interbase,
FireDAC.Stan.Intf, FireDAC.Stan.Option,
@@ -29,7 +29,7 @@ TDBQuery = class;
TDBQueryList = TObjectList;
TDBObject = class;
- TColumnPart = (cpAll, cpName, cpType, cpAllowNull, cpDefault, cpVirtuality, cpComment, cpCollation);
+ TColumnPart = (cpAll, cpName, cpType, cpAllowNull, cpSRID, cpDefault, cpVirtuality, cpComment, cpCollation, cpInvisible);
TColumnParts = Set of TColumnPart;
TColumnDefaultType = (cdtNothing, cdtText, cdtNull, cdtAutoInc, cdtExpression);
// General purpose editing status flag
@@ -45,12 +45,13 @@ TTableColumn = class(TPersistent)
Name, OldName: String;
DataType, OldDataType: TDBDatatype;
LengthSet: String;
- Unsigned, AllowNull, ZeroFill, LengthCustomized, Invisible: Boolean;
+ Unsigned, AllowNull, ZeroFill, LengthCustomized, Invisible, Compressed: Boolean;
DefaultType: TColumnDefaultType;
DefaultText: String;
OnUpdateType: TColumnDefaultType;
OnUpdateText: String;
Comment, Charset, Collation, GenerationExpression, Virtuality: String;
+ SRID: Cardinal;
constructor Create(AOwner: TDBConnection; Serialized: String='');
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
@@ -61,12 +62,15 @@ TTableColumn = class(TPersistent)
function CastAsText: String;
property Status: TEditingStatus read FStatus write SetStatus;
property Connection: TDBConnection read FConnection;
- function AutoIncName: String;
+ function FullDataType: String;
end;
PTableColumn = ^TTableColumn;
TTableColumnList = class(TObjectList)
public
procedure Assign(Source: TTableColumnList);
+ function FindByName(const Value: String): TTableColumn;
+ function HasInvisibleColumns: Boolean;
+ function QuoteIdents: String;
end;
TColumnCache = TDictionary;
@@ -77,19 +81,29 @@ TTableKey = class(TPersistent)
UNIQUE = 'UNIQUE';
FULLTEXT = 'FULLTEXT';
SPATIAL = 'SPATIAL';
+ VECTOR = 'VECTOR';
private
FConnection: TDBConnection;
+ function GetInsideCreateCode: Boolean;
function GetImageIndex: Integer;
public
Name, OldName: String;
IndexType, OldIndexType, Algorithm, Comment: String;
- Columns, SubParts: TStringList;
- Modified, Added: Boolean;
+ Columns, SubParts, Collations: TStringList;
+ Modified, Added, Visible: Boolean;
constructor Create(AOwner: TDBConnection);
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
+ function IsPrimary: Boolean;
+ function IsIndex: Boolean;
+ function IsUnique: Boolean;
+ function IsFulltext: Boolean;
+ function IsSpatial: Boolean;
+ function IsVector: Boolean;
+ function IsExpression(KeyPart: Integer): Boolean;
procedure Modification(Sender: TObject);
- function SQLCode: String;
+ function SQLCode(TableName: String=''): String;
+ property InsideCreateCode: Boolean read GetInsideCreateCode;
property ImageIndex: Integer read GetImageIndex;
property Connection: TDBConnection read FConnection;
end;
@@ -153,6 +167,7 @@ TDBObject = class(TPersistent)
FCreateCodeLoaded: Boolean;
FWasSelected: Boolean;
FConnection: TDBConnection;
+ FMap: TStringMap;
function GetObjType: String;
function GetImageIndex: Integer;
function GetOverlayImageIndex: Integer;
@@ -168,10 +183,11 @@ TDBObject = class(TPersistent)
Rows, Size, Version, AvgRowLen, MaxDataLen, IndexLen, DataLen, DataFree, AutoInc, CheckSum: Int64;
// Routine options:
Body, Definer, Returns, DataAccess, Security, ArgTypes: String;
- Deterministic, RowsAreExact: Boolean;
+ Deterministic, RowsAreExact, IsMaterialized: Boolean;
NodeType, GroupType: TListNodeType;
constructor Create(OwnerConnection: TDBConnection);
+ destructor Destroy;
procedure Assign(Source: TPersistent); override;
procedure UnloadDetails;
procedure Drop;
@@ -181,9 +197,10 @@ TDBObject = class(TPersistent)
function QuotedDbAndTableName(AlwaysQuote: Boolean=True): String;
function QuotedColumn(AlwaysQuote: Boolean=True): String;
function SchemaClauseIS(Prefix: String): String;
- function RowCount(Reload: Boolean; ForceExact: Bool=False): Int64;
+ function RowCount(Reload: Boolean; ForceExact: Boolean=False): Int64;
function GetCreateCode: String; overload;
function GetCreateCode(RemoveAutoInc, RemoveDefiner: Boolean): String; overload;
+ function AsStringMap: TStringMap;
property ObjType: String read GetObjType;
property ImageIndex: Integer read GetImageIndex;
property OverlayImageIndex: Integer read GetOverlayImageIndex;
@@ -282,50 +299,33 @@ TSQLFunctionList = class(TObjectList)
{ TConnectionParameters and friends }
- TNetType = (
- ntMySQL_TCPIP,
- ntMySQL_NamedPipe,
- ntMySQL_SSHtunnel,
- ntMSSQL_NamedPipe,
- ntMSSQL_TCPIP,
- ntMSSQL_SPX,
- ntMSSQL_VINES,
- ntMSSQL_RPC,
- ntPgSQL_TCPIP,
- ntPgSQL_SSHtunnel,
- ntSQLite,
- ntMySQL_ProxySQLAdmin,
- ntInterbase_TCPIP,
- ntInterbase_Local,
- ntFirebird_TCPIP,
- ntFirebird_Local,
- ntMySQL_RDS
- );
- TNetTypeGroup = (ngMySQL, ngMSSQL, ngPgSQL, ngSQLite, ngInterbase);
- TNetGroupLibs = TDictionary;
-
TConnectionParameters = class(TObject)
strict private
+ FDeleteAfterUse: Boolean;
+ FLoadedFromSettings: Boolean;
FNetType: TNetType;
FHostname, FUsername, FPassword, FAllDatabases, FLibraryOrProvider, FComment, FStartupScriptFilename,
FSessionPath, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FSSLCipher, FServerVersion,
FSSHHost, FSSHUser, FSSHPassword, FSSHExe, FSSHPrivateKey,
FIgnoreDatabasePattern: String;
- FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter, FQueryTimeout, FKeepAlive: Integer;
+ FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter, FQueryTimeout, FKeepAlive, FSSLVerification: Integer;
FSSHActive, FLoginPrompt, FCompressed, FLocalTimeZone, FFullTableStatus,
- FWindowsAuth, FWantSSL, FIsFolder, FCleartextPluginEnabled: Boolean;
+ FWindowsAuth, FWantSSL, FIsFolder, FCleartextPluginEnabled, FForceUnicode: Boolean;
FSessionColor: TColor;
FLastConnect: TDateTime;
FLogFileDdl: Boolean;
FLogFileDml: Boolean;
FLogFilePath: String;
- class var FLibraries: TNetGroupLibs;
+ class var FLibraries: TNetTypeLibs;
function GetImageIndex: Integer;
function GetSessionName: String;
+ function GetAllDatabasesList: TStringList;
public
constructor Create; overload;
constructor Create(SessionRegPath: String); overload;
+ destructor Destroy; override;
procedure SaveToRegistry;
+ property DeleteAfterUse: Boolean read FDeleteAfterUse write FDeleteAfterUse;
function CreateConnection(AOwner: TComponent): TDBConnection;
function CreateQuery(Connection: TDbConnection): TDBQuery;
function NetTypeName(LongFormat: Boolean): String;
@@ -375,7 +375,9 @@ TConnectionParameters = class(TObject)
property LoginPrompt: Boolean read FLoginPrompt write FLoginPrompt;
property WindowsAuth: Boolean read FWindowsAuth write FWindowsAuth;
property CleartextPluginEnabled: Boolean read FCleartextPluginEnabled write FCleartextPluginEnabled;
+ property ForceUnicode: Boolean read FForceUnicode write FForceUnicode;
property AllDatabasesStr: String read FAllDatabases write FAllDatabases;
+ property AllDatabasesList: TStringList read GetAllDatabasesList;
property LibraryOrProvider: String read FLibraryOrProvider write FLibraryOrProvider;
property Comment: String read FComment write FComment;
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
@@ -398,6 +400,7 @@ TConnectionParameters = class(TObject)
property SSLCertificate: String read FSSLCertificate write FSSLCertificate;
property SSLCACertificate: String read FSSLCACertificate write FSSLCACertificate;
property SSLCipher: String read FSSLCipher write FSSLCipher;
+ property SSLVerification: Integer read FSSLVerification write FSSLVerification;
property IgnoreDatabasePattern: String read FIgnoreDatabasePattern write FIgnoreDatabasePattern;
property LogFileDdl: Boolean read FLogFileDdl write FLogFileDdl;
property LogFileDml: Boolean read FLogFileDml write FLogFileDml;
@@ -419,16 +422,20 @@ TDBLogItem = class(TObject)
TDBLogEvent = procedure(Msg: String; Category: TDBLogCategory=lcInfo; Connection: TDBConnection=nil) of object;
TDBEvent = procedure(Connection: TDBConnection; Database: String) of object;
TDBDataTypeArray = Array of TDBDataType;
- TSQLSpecifityId = (spDatabaseTable, spDatabaseTableId, spDatabaseDrop,
- spDbObjectsTable, spDbObjectsCreateCol, spDbObjectsUpdateCol, spDbObjectsTypeCol,
- spEmptyTable, spRenameTable, spRenameView, spCurrentUserHost, spLikeCompare,
- spAddColumn, spChangeColumn, spRenameColumn, spForeignKeyEventAction,
- spGlobalStatus, spCommandsCounters, spSessionVariables, spGlobalVariables,
- spISSchemaCol,
- spUSEQuery, spKillQuery, spKillProcess,
- spFuncLength, spFuncCeil, spFuncLeft, spFuncNow, spFuncLastAutoIncNumber,
- spLockedTables, spDisableForeignKeyChecks, spEnableForeignKeyChecks,
- spOrderAsc, spOrderDesc);
+ TFeatureOrRequirement = (
+ frSrid,
+ frTemporalTypesFraction,
+ frIntegerDisplayWidth,
+ frColumnDefaultParentheses,
+ frEditVariables,
+ frCreateView,
+ frCreateProcedure,
+ frCreateFunction,
+ frCreateTrigger,
+ frCreateEvent,
+ frInvisibleColumns,
+ frCompressedColumns
+ );
TDBConnection = class(TComponent)
private
@@ -437,8 +444,8 @@ TDBConnection = class(TComponent)
FServerUptime: Integer;
FServerDateTimeOnStartup: String;
FParameters: TConnectionParameters;
+ FOwnsParameters: Boolean;
FSecureShellCmd: TSecureShellCmd;
- FLoginPromptDone: Boolean;
FDatabase: String;
FAllDatabases: TStringList;
FLogPrefix: String;
@@ -475,7 +482,7 @@ TDBConnection = class(TComponent)
FQuoteChars: String;
FDatatypes: TDBDataTypeArray;
FThreadID: Int64;
- FSQLSpecifities: Array[TSQLSpecifityId] of String;
+ FSqlProvider: TSqlProvider;
FKeepAliveTimer: TTimer;
FFavorites: TStringList;
FPrefetchResults: TDBQueryList;
@@ -485,6 +492,7 @@ TDBConnection = class(TComponent)
FMaxRowsPerInsert: Int64;
FCaseSensitivity: Integer;
FSQLFunctions: TSQLFunctionList;
+ FNamedEnums: TStringList;
procedure SetActive(Value: Boolean); virtual; abstract;
procedure DoBeforeConnect; virtual;
procedure StartSSHTunnel(var FinalHost: String; var FinalPort: Integer);
@@ -510,10 +518,9 @@ TDBConnection = class(TComponent)
function GetCurrentUserHostCombination: String;
function GetAllUserHostCombinations: TStringList;
function DecodeAPIString(a: AnsiString): String;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; virtual; abstract;
+ function GetRowCount(Obj: TDBObject; ForceExact: Boolean=False): Int64; virtual;
procedure ClearCache(IncludeDBObjects: Boolean);
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); virtual; abstract;
- procedure SetLockedByThread(Value: TThread); virtual;
procedure KeepAliveTimerEvent(Sender: TObject);
procedure Drop(Obj: TDBObject); virtual;
procedure PrefetchResults(SQL: String);
@@ -522,10 +529,14 @@ TDBConnection = class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
- procedure Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL); virtual;
+ procedure Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL); overload; virtual;
+ procedure Query(QueryId: TQueryId); overload;
+ procedure Query(QueryId: TQueryId; const Args: array of const); overload;
procedure Log(Category: TDBLogCategory; Msg: String);
function EscapeString(Text: String; ProcessJokerChars: Boolean=False; DoQuote: Boolean=True): String; overload;
function EscapeString(Text: String; Datatype: TDBDatatype): String; overload;
+ function EscapeBin(BinValue: String): String; overload;
+ function EscapeBin(var ByteData: TBytes): String; overload;
function QuoteIdent(Identifier: String; AlwaysQuote: Boolean=True; Glue: Char=#0): String;
function DeQuoteIdent(Identifier: String; Glue: Char=#0): String;
function CleanIdent(Identifier: String): String;
@@ -543,7 +554,7 @@ TDBConnection = class(TComponent)
function GetDBObjects(db: String; Refresh: Boolean=False; OnlyNodeType: TListNodeType=lntNone): TDBObjectList;
function DbObjectsCached(db: String): Boolean;
function ParseDateTime(Str: String): TDateTime;
- function GetKeyColumns(Columns: TTableColumnList; Keys: TTableKeyList): TStringList;
+ function GetKeyColumns(Columns: TTableColumnList; Keys: TTableKeyList): TTableColumnList;
function ConnectionInfo: TStringList; virtual;
function GetLastResults: TDBQueryList; virtual;
function GetCreateCode(Obj: TDBObject): String; virtual;
@@ -551,8 +562,6 @@ TDBConnection = class(TComponent)
function GetSessionVariables(Refresh: Boolean): TDBQuery;
function GetSessionVariable(VarName: String; DefaultValue: String=''; Refresh: Boolean=False): String;
function MaxAllowedPacket: Int64; virtual;
- function GetSQLSpecifity(Specifity: TSQLSpecifityId): String; overload;
- function GetSQLSpecifity(Specifity: TSQLSpecifityId; const Args: array of const): String; overload;
function GetDateTimeValue(Input: String; Datatype: TDBDatatypeIndex): String;
procedure ClearDbObjects(db: String);
procedure ClearAllDbObjects;
@@ -565,6 +574,7 @@ TDBConnection = class(TComponent)
function ApplyLimitClause(QueryType, QueryBody: String; Limit, Offset: Int64): String;
function LikeClauseTail: String;
property Parameters: TConnectionParameters read FParameters write FParameters;
+ property OwnsParameters: Boolean read FOwnsParameters write FOwnsParameters;
property ThreadId: Int64 read GetThreadId;
property ConnectionUptime: Integer read GetConnectionUptime;
property ServerUptime: Integer read GetServerUptime;
@@ -578,6 +588,7 @@ TDBConnection = class(TComponent)
property KeyCache: TKeyCache read FKeyCache;
property ForeignKeyCache: TForeignKeyCache read FForeignKeyCache;
property CheckConstraintCache: TCheckConstraintCache read FCheckConstraintCache;
+ property StringQuoteChar: Char read FStringQuoteChar;
property QuoteChar: Char read FQuoteChar;
property QuoteChars: String read FQuoteChars;
function ServerVersionStr: String;
@@ -586,6 +597,7 @@ TDBConnection = class(TComponent)
property RowsFound: Int64 read FRowsFound;
property RowsAffected: Int64 read FRowsAffected;
property WarningCount: Cardinal read FWarningCount;
+ procedure ShowWarnings; virtual;
property LastQueryDuration: Cardinal read FLastQueryDuration;
property LastQueryNetworkDuration: Cardinal read FLastQueryNetworkDuration;
property IsUnicode: Boolean read FIsUnicode;
@@ -601,7 +613,8 @@ TDBConnection = class(TComponent)
function ResultCount: Integer;
property CurrentUserHostCombination: String read GetCurrentUserHostCombination;
property AllUserHostCombinations: TStringList read GetAllUserHostCombinations;
- property LockedByThread: TThread read FLockedByThread write SetLockedByThread;
+ function IsLockedByThread: Boolean;
+ procedure SetLockedByThread(Value: TThread); virtual;
property Datatypes: TDBDataTypeArray read FDatatypes;
property Favorites: TStringList read FFavorites;
property InfSch: String read FInfSch;
@@ -615,6 +628,9 @@ TDBConnection = class(TComponent)
property SQLFunctions: TSQLFunctionList read FSQLFunctions;
function IsNumeric(Text: String): Boolean;
function IsHex(Text: String): Boolean;
+ function Has(Item: TFeatureOrRequirement): Boolean;
+ property SqlProvider: TSqlProvider read FSqlProvider;
+ property NamedEnums: TStringList read FNamedEnums;
published
property Active: Boolean read FActive write SetActive default False;
property Database: String read FDatabase write SetDatabase;
@@ -637,6 +653,7 @@ TMySQLConnection = class(TDBConnection)
FLastRawResults: TMySQLRawResults;
FStatementNum: Cardinal;
procedure SetActive(Value: Boolean); override;
+ procedure SetOption(Option: Integer; Arg: Pointer);
procedure DoBeforeConnect; override;
procedure DoAfterConnect; override;
function GetThreadId: Int64; override;
@@ -646,12 +663,8 @@ TMySQLConnection = class(TDBConnection)
function GetLastErrorMsg: String; override;
function GetAllDatabases: TStringList; override;
function GetTableEngines: TStringList; override;
- function GetCollationTable: TDBQuery; override;
- function GetCharsetTable: TDBQuery; override;
function GetCreateViewCode(Database, Name: String): String;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; override;
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); override;
- procedure SetLockedByThread(Value: TThread); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -664,6 +677,8 @@ TMySQLConnection = class(TDBConnection)
function MaxAllowedPacket: Int64; override;
function GetTableColumns(Table: TDBObject): TTableColumnList; override;
function GetTableKeys(Table: TDBObject): TTableKeyList; override;
+ procedure ShowWarnings; override;
+ procedure SetLockedByThread(Value: TThread); override;
end;
TAdoRawResults = Array of _RecordSet;
@@ -678,9 +693,6 @@ TAdoDBConnection = class(TDBConnection)
function GetLastErrorCode: Cardinal; override;
function GetLastErrorMsg: String; override;
function GetAllDatabases: TStringList; override;
- function GetCollationTable: TDBQuery; override;
- function GetCharsetTable: TDBQuery; override;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; override;
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); override;
public
constructor Create(AOwner: TComponent); override;
@@ -710,7 +722,6 @@ TPgConnection = class(TDBConnection)
function GetLastErrorCode: Cardinal; override;
function GetLastErrorMsg: String; override;
function GetAllDatabases: TStringList; override;
- function GetCharsetTable: TDBQuery; override;
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); override;
procedure Drop(Obj: TDBObject); override;
public
@@ -719,11 +730,10 @@ TPgConnection = class(TDBConnection)
property Lib: TPostgreSQLLib read FLib;
procedure Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL); override;
function Ping(Reconnect: Boolean): Boolean; override;
+ function GetCreateCode(Obj: TDBObject): String; override;
function ConnectionInfo: TStringList; override;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; override;
property LastRawResults: TPGRawResults read FLastRawResults;
property RegClasses: TOidStringPairs read FRegClasses;
- function GetTableColumns(Table: TDBObject): TTableColumnList; override;
function GetTableKeys(Table: TDBObject): TTableKeyList; override;
function GetTableForeignKeys(Table: TDBObject): TForeignKeyList; override;
end;
@@ -750,8 +760,6 @@ TSQLiteConnection = class(TDBConnection)
function GetLastErrorCode: Cardinal; override;
function GetLastErrorMsg: String; override;
function GetAllDatabases: TStringList; override;
- function GetCollationList: TStringList; override;
- function GetCharsetTable: TDBQuery; override;
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); override;
public
constructor Create(AOwner: TComponent); override;
@@ -760,7 +768,6 @@ TSQLiteConnection = class(TDBConnection)
procedure Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL); override;
function Ping(Reconnect: Boolean): Boolean; override;
function GetCreateCode(Obj: TDBObject): String; override;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; override;
property LastRawResults: TSQLiteRawResults read FLastRawResults;
function GetTableColumns(Table: TDBObject): TTableColumnList; override;
function GetTableKeys(Table: TDBObject): TTableKeyList; override;
@@ -785,8 +792,6 @@ TInterbaseConnection = class(TDBConnection)
function GetLastErrorCode: Cardinal; override;
function GetLastErrorMsg: String; override;
function GetAllDatabases: TStringList; override;
- function GetCollationTable: TDBQuery; override;
- function GetCharsetTable: TDBQuery; override;
procedure FetchDbObjects(db: String; var Cache: TDBObjectList); override;
public
constructor Create(AOwner: TComponent); override;
@@ -794,7 +799,6 @@ TInterbaseConnection = class(TDBConnection)
procedure Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL); override;
function Ping(Reconnect: Boolean): Boolean; override;
function GetCreateCode(Obj: TDBObject): String; override;
- function GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64; override;
property LastRawResults: TInterbaseRawResults read FLastRawResults;
function GetTableColumns(Table: TDBObject): TTableColumnList; override;
function GetTableKeys(Table: TDBObject): TTableKeyList; override;
@@ -827,16 +831,18 @@ TDBQuery = class(TComponent)
FDBObject: TDBObject;
FFormatSettings: TFormatSettings;
procedure SetRecNo(Value: Int64); virtual; abstract;
- function ColumnExists(Column: Integer): Boolean;
+ function ColumnExists(Column: Integer): Boolean; overload;
+ function ColumnExists(ColumnName: String): Boolean; overload;
procedure SetColumnOrgNames(Value: TStringList);
procedure SetDBObject(Value: TDBObject);
procedure CreateUpdateRow;
- function GetKeyColumns: TStringList;
+ function GetKeyColumns: TTableColumnList;
function GridQuery(QueryType, QueryBody: String): String;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Execute(AddResult: Boolean=False; UseRawResult: Integer=-1); virtual; abstract;
+ procedure LogMetaInfo(NumResult: Integer);
procedure First;
procedure Next;
function ColumnCount: Integer;
@@ -844,9 +850,7 @@ TDBQuery = class(TComponent)
function Col(Column: Integer; IgnoreErrors: Boolean=False): String; overload; virtual; abstract;
function Col(ColumnName: String; IgnoreErrors: Boolean=False): String; overload;
function ColumnLengths(Column: Integer): Int64; virtual;
- function HexValue(Column: Integer; IgnoreErrors: Boolean=False): String; overload;
- function HexValue(BinValue: String): String; overload;
- function HexValue(var ByteData: TBytes): String; overload;
+ function HexValue(Column: Integer; IgnoreErrors: Boolean=False): String;
function DataType(Column: Integer): TDBDataType;
function MaxLength(Column: Integer): Int64;
function ValueList(Column: Integer): TStringList;
@@ -876,6 +880,7 @@ TDBQuery = class(TComponent)
function DatabaseName: String; virtual; abstract;
function TableName: String; overload;
function TableName(Column: Integer): String; overload; virtual; abstract;
+ function ResultName: String;
function QuotedDbAndTableName: String;
procedure DiscardModifications;
procedure PrepareColumnAttributes;
@@ -1012,6 +1017,8 @@ function mysql_authentication_dialog_ask(
exports
mysql_authentication_dialog_ask;
+var
+ WarningShownOldOleProvider: Boolean = False;
{$I const.inc}
@@ -1085,7 +1092,7 @@ destructor TSecureShellCmd.Destroy;
procedure TSecureShellCmd.Connect;
var
SshCmd, SshCmdDisplay, DialogTitle: String;
- OutText, ErrorText, UserInput: String;
+ OutText, ErrorText, AllPipesText, UserInput: String;
rx: TRegExpr;
StartupInfo: TStartupInfo;
ExitCode: LongWord;
@@ -1093,6 +1100,7 @@ procedure TSecureShellCmd.Connect;
CheckIntervalMs: Integer;
IsPlink: Boolean;
TimeStartedMs, WaitedMs, WaitedLeftMs, TimeOutMs: Int64;
+ PlinkVerMajor, PlinkVerMinor, PlinkVerRelease, PlinkVerRevision: Word;
begin
// Check if local port is open
PortChecks := 0;
@@ -1108,8 +1116,12 @@ procedure TSecureShellCmd.Connect;
// plink bob@domain.com -pw myPassw0rd1 -P 22 -i "keyfile.pem" -L 55555:localhost:3306
IsPlink := ExecRegExprI('([pk]link|putty)', FConnection.Parameters.SSHExe);
SshCmd := FConnection.Parameters.SSHExe;
- if IsPlink then
+ if IsPlink then begin
SshCmd := SshCmd + ' -ssh';
+ GetExecutableVersion(FConnection.Parameters.SSHExe, PlinkVerMajor, PlinkVerMinor, PlinkVerRelease, PlinkVerRevision);
+ if (PlinkVerMajor = 0) and (PlinkVerMinor >= 82) then
+ SshCmd := SshCmd + ' -legacy-stdio-prompts';
+ end;
SshCmd := SshCmd + ' ';
if FConnection.Parameters.SSHUser.Trim <> '' then
SshCmd := SshCmd + FConnection.Parameters.SSHUser.Trim + '@';
@@ -1125,6 +1137,8 @@ procedure TSecureShellCmd.Connect;
SshCmd := SshCmd + IfThen(IsPlink, ' -P ', ' -p ') + IntToStr(FConnection.Parameters.SSHPort);
if FConnection.Parameters.SSHPrivateKey <> '' then
SshCmd := SshCmd + ' -i "' + FConnection.Parameters.SSHPrivateKey + '"';
+ if not IsPlink then
+ SshCmd := SshCmd + ' -o StrictHostKeyChecking=no';
SshCmd := SshCmd + ' -N -L ' + IntToStr(FConnection.Parameters.SSHLocalPort) + ':' + FConnection.Parameters.Hostname + ':' + IntToStr(FConnection.Parameters.Port);
rx := TRegExpr.Create;
rx.Expression := '(-pw\s+")[^"]*(")';
@@ -1189,21 +1203,27 @@ procedure TSecureShellCmd.Connect;
end;
if OutText <> '' then begin
+ // Prepend error text in the dialog, e.g. "Unable to use keyfile"
+ AllPipesText := OutText;
+ if not ErrorText.IsEmpty then begin
+ FConnection.Log(lcError, 'SSH: '+ErrorText);
+ AllPipesText := Trim('Error: ' + ErrorText + sLineBreak + AllPipesText);
+ end;
if ExecRegExpr('login as\s*\:', OutText) then begin
// Prompt for username
- UserInput := InputBox(DialogTitle, OutText, '');
+ UserInput := InputBox(DialogTitle, AllPipesText, '');
SendText(UserInput + CRLF);
end else if ExecRegExpr('(password|Passphrase for key "[^"]+")\s*\:', OutText) then begin
// Prompt for sensitive input. Send * as first char of prompt param so InputBox hides input characters
- UserInput := InputBox(DialogTitle, #31+OutText, '');
+ UserInput := InputBox(DialogTitle, #31+AllPipesText, '');
SendText(UserInput + CRLF);
end else begin
// Informational message box
rx.Expression := '^[^\.]+\.';
if rx.Exec(OutText) then begin // First words end with a dot - use it as caption
- MessageDialog(DialogTitle + ': ' + rx.Match[0], OutText, mtInformation, [mbOK])
+ MessageDialog(DialogTitle + ': ' + rx.Match[0], AllPipesText, mtInformation, [mbOK])
end else begin
- MessageDialog(DialogTitle, OutText, mtInformation, [mbOK]);
+ MessageDialog(DialogTitle, AllPipesText, mtInformation, [mbOK]);
end;
end;
end
@@ -1214,9 +1234,9 @@ procedure TSecureShellCmd.Connect;
// Prompt user with question
case MessageDialog(Trim(rx.Match[1]), Copy(ErrorText, 1, Length(ErrorText)-rx.MatchLen[2]), mtConfirmation, [mbYes, mbNo, mbCancel]) of
mrYes:
- SendText('y');
+ SendText('y'+CRLF);
mrNo:
- SendText('n');
+ SendText('n'+CRLF);
mrCancel: begin
Destroy;
raise EDbError.Create(_('SSH command cancelled'));
@@ -1378,12 +1398,15 @@ constructor TConnectionParameters.Create;
begin
inherited Create;
FIsFolder := False;
+ FDeleteAfterUse := False;
+ FLoadedFromSettings := False;
FNetType := TNetType(AppSettings.GetDefaultInt(asNetType));
FHostname := DefaultHost;
FLoginPrompt := AppSettings.GetDefaultBool(asLoginPrompt);
FWindowsAuth := AppSettings.GetDefaultBool(asWindowsAuth);
FCleartextPluginEnabled := AppSettings.GetDefaultBool(asCleartextPluginEnabled);
+ FForceUnicode := AppSettings.GetDefaultBool(asForceUnicode);
FUsername := DefaultUsername;
FPassword := AppSettings.GetDefaultString(asPassword);
FPort := DefaultPort;
@@ -1407,6 +1430,7 @@ constructor TConnectionParameters.Create;
FSSLCertificate := AppSettings.GetDefaultString(asSSLCert);
FSSLCACertificate := AppSettings.GetDefaultString(asSSLCA);
FSSLCipher := AppSettings.GetDefaultString(asSSLCipher);
+ FSSLVerification := AppSettings.GetDefaultInt(asSSLVerification);
FStartupScriptFilename := AppSettings.GetDefaultString(asStartupScriptFilename);
FQueryTimeout := AppSettings.GetDefaultInt(asQueryTimeout);
FKeepAlive := AppSettings.GetDefaultInt(asKeepAlive);
@@ -1450,12 +1474,14 @@ constructor TConnectionParameters.Create(SessionRegPath: String);
);
FNetType := ntMySQL_TCPIP;
end;
+ FLoadedFromSettings := True;
FHostname := AppSettings.ReadString(asHost);
FUsername := AppSettings.ReadString(asUser);
FPassword := decrypt(AppSettings.ReadString(asPassword));
FLoginPrompt := AppSettings.ReadBool(asLoginPrompt);
FWindowsAuth := AppSettings.ReadBool(asWindowsAuth);
FCleartextPluginEnabled := AppSettings.ReadBool(asCleartextPluginEnabled);
+ FForceUnicode := AppSettings.ReadBool(asForceUnicode);
FPort := MakeInt(AppSettings.ReadString(asPort));
FCompressed := AppSettings.ReadBool(asCompressed);
FAllDatabases := AppSettings.ReadString(asDatabases);
@@ -1481,6 +1507,7 @@ constructor TConnectionParameters.Create(SessionRegPath: String);
FSSLCertificate := AppSettings.ReadString(asSSLCert);
FSSLCACertificate := AppSettings.ReadString(asSSLCA);
FSSLCipher := AppSettings.ReadString(asSSLCipher);
+ FSSLVerification := AppSettings.ReadInt(asSSLVerification);
FStartupScriptFilename := AppSettings.ReadString(asStartupScriptFilename);
FQueryTimeout := AppSettings.ReadInt(asQueryTimeout);
FKeepAlive := AppSettings.ReadInt(asKeepAlive);
@@ -1505,6 +1532,16 @@ constructor TConnectionParameters.Create(SessionRegPath: String);
end;
end;
+destructor TConnectionParameters.Destroy;
+begin
+ if FDeleteAfterUse and (not FLoadedFromSettings) and (not FSessionPath.IsEmpty) then begin
+ if AppSettings.SessionPathExists(FSessionPath) then begin
+ AppSettings.SessionPath := FSessionPath;
+ AppSettings.DeleteCurrentKey;
+ end;
+ end;
+end;
+
procedure TConnectionParameters.SaveToRegistry;
var
@@ -1521,6 +1558,7 @@ procedure TConnectionParameters.SaveToRegistry;
AppSettings.WriteString(asHost, FHostname);
AppSettings.WriteBool(asWindowsAuth, FWindowsAuth);
AppSettings.WriteBool(asCleartextPluginEnabled, FCleartextPluginEnabled);
+ AppSettings.WriteBool(asForceUnicode, FForceUnicode);
AppSettings.WriteString(asUser, FUsername);
AppSettings.WriteString(asPassword, encrypt(FPassword));
AppSettings.WriteBool(asLoginPrompt, FLoginPrompt);
@@ -1550,6 +1588,7 @@ procedure TConnectionParameters.SaveToRegistry;
AppSettings.WriteString(asSSLCert, FSSLCertificate);
AppSettings.WriteString(asSSLCA, FSSLCACertificate);
AppSettings.WriteString(asSSLCipher, FSSLCipher);
+ AppSettings.WriteInt(asSSLVerification, FSSLVerification);
AppSettings.WriteString(asIgnoreDatabasePattern, FIgnoreDatabasePattern);
AppSettings.WriteBool(asLogFileDdl, FLogFileDdl);
AppSettings.WriteBool(asLogFileDml, FLogFileDml);
@@ -1627,6 +1666,7 @@ function TConnectionParameters.NetTypeName(LongFormat: Boolean): String;
ntPgSQL_TCPIP: Result := PrefixPostgres+' (TCP/IP)';
ntPgSQL_SSHtunnel: Result := PrefixPostgres+' (SSH tunnel)';
ntSQLite: Result := PrefixSqlite;
+ ntSQLiteEncrypted: Result := PrefixSqlite+' (Encrypted)';
ntInterbase_TCPIP: Result := PrefixInterbase+' (TCP/IP, experimental)';
ntInterbase_Local: Result := PrefixInterbase+' (Local, experimental)';
ntFirebird_TCPIP: Result := PrefixFirebird+' (TCP/IP, experimental)';
@@ -1667,7 +1707,7 @@ function TConnectionParameters.GetNetTypeGroup: TNetTypeGroup;
Result := ngMSSQL;
ntPgSQL_TCPIP, ntPgSQL_SSHtunnel:
Result := ngPgSQL;
- ntSQLite:
+ ntSQLite, ntSQLiteEncrypted:
Result := ngSQLite;
ntInterbase_TCPIP, ntInterbase_Local, ntFirebird_TCPIP, ntFirebird_Local:
Result := ngInterbase;
@@ -1724,9 +1764,15 @@ function TConnectionParameters.IsMariaDB: Boolean;
function TConnectionParameters.IsMySQL(StrictDetect: Boolean): Boolean;
+var
+ MajorVersionNum: String;
begin
if StrictDetect then begin
- Result := IsAnyMySQL and (ContainsText(ServerVersion, 'mysql') or IsMySQLonRDS);
+ MajorVersionNum := RegExprGetMatch('\b(\d+)\.\d+\.\d+', ServerVersion, 1);
+ Result := IsAnyMySQL and (not IsMariaDB) and (
+ (ContainsText(ServerVersion, 'mysql') or IsMySQLonRDS) // RDS is always MySQL, but does not contain "mysql"
+ or (StrToIntDef(MajorVersionNum, -1) in [3,4,5,8]) // MySQL 8.0 does not contain "mysql", but major version only exists in MySQL
+ );
end else begin
Result := IsAnyMySQL
and (not IsMariaDB)
@@ -1876,7 +1922,12 @@ function TConnectionParameters.DefaultLibrary: String;
ngMySQL: Result := 'libmariadb.dll';
ngMSSQL: Result := 'MSOLEDBSQL'; // Prefer MSOLEDBSQL provider on newer systems
ngPgSQL: Result := 'libpq.dll';
- ngSQLite: Result := 'sqlite3.dll';
+ ngSQLite: begin
+ if NetType = ntSQLite then
+ Result := 'sqlite3.dll'
+ else
+ Result := 'sqlite3mc.dll';
+ end;
ngInterbase: begin
if IsInterbase then
Result := IfThen(GetExecutableBits=64, 'ibclient64.dll', 'gds32.dll')
@@ -1971,10 +2022,10 @@ function TConnectionParameters.GetLibraries: TStringList;
Provider: String;
begin
if not Assigned(FLibraries) then begin
- FLibraries := TNetGroupLibs.Create;
+ FLibraries := TNetTypeLibs.Create;
end;
- if not FLibraries.ContainsKey(NetTypeGroup) then begin
+ if not FLibraries.ContainsKey(NetType) then begin
FoundLibs := TStringList.Create;
rx := TRegExpr.Create;
rx.ModifierI := True;
@@ -1982,17 +2033,21 @@ function TConnectionParameters.GetLibraries: TStringList;
ngMySQL:
rx.Expression := '^lib(mysql|mariadb).*\.dll$';
ngMSSQL: // Allow unsupported ADODB providers per registry hack
- rx.Expression := IfThen(AppSettings.ReadBool(asAllProviders), '^', '^(MSOLEDBSQL|SQLOLEDB)$');
+ rx.Expression := IfThen(AppSettings.ReadBool(asAllProviders), '^', '^(MSOLEDBSQL|SQLOLEDB)');
ngPgSQL:
rx.Expression := '^libpq.*\.dll$';
- ngSQLite:
- rx.Expression := '^sqlite.*\.dll$';
+ ngSQLite: begin
+ if NetType = ntSQLite then
+ rx.Expression := '^sqlite.*\.dll$'
+ else
+ rx.Expression := '^sqlite3mc.*\.dll$';
+ end;
ngInterbase:
rx.Expression := '^(gds32|ibclient|fbclient).*\.dll$';
end;
case NetTypeGroup of
ngMySQL, ngPgSQL, ngSQLite, ngInterbase: begin
- Dlls := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), '*.dll');
+ Dlls := TDirectory.GetFiles(GetAppDir, '*.dll');
for DllPath in Dlls do begin
DllFile := ExtractFileName(DllPath);
if rx.Exec(DllFile) then begin
@@ -2018,9 +2073,9 @@ function TConnectionParameters.GetLibraries: TStringList;
end;
end;
rx.Free;
- FLibraries.Add(NetTypeGroup, FoundLibs);
+ FLibraries.Add(NetType, FoundLibs);
end;
- FLibraries.TryGetValue(NetTypeGroup, Result);
+ FLibraries.TryGetValue(NetType, Result);
end;
@@ -2036,6 +2091,28 @@ function TConnectionParameters.GetSessionName: String;
end;
+function TConnectionParameters.GetAllDatabasesList: TStringList;
+var
+ rx: TRegExpr;
+ dbname: String;
+begin
+ Result := TStringList.Create;
+ if FAllDatabases <> '' then begin
+ rx := TRegExpr.Create;
+ rx.Expression := '[^;]+';
+ rx.ModifierG := True;
+ if rx.Exec(FAllDatabases) then while true do begin
+ // Add if not a duplicate
+ dbname := Trim(rx.Match[0]);
+ if Result.IndexOf(dbname) = -1 then
+ Result.Add(dbname);
+ if not rx.ExecNext then
+ break;
+ end;
+ rx.Free;
+ end;
+end;
+
{ TMySQLConnection }
@@ -2044,6 +2121,7 @@ constructor TDBConnection.Create(AOwner: TComponent);
begin
inherited;
FParameters := TConnectionParameters.Create;
+ FOwnsParameters := True;
FRowsFound := 0;
FRowsAffected := 0;
FWarningCount := 0;
@@ -2061,7 +2139,6 @@ constructor TDBConnection.Create(AOwner: TComponent);
FKeyCache := TKeyCache.Create;
FForeignKeyCache := TForeignKeyCache.Create;
FCheckConstraintCache := TCheckConstraintCache.Create;
- FLoginPromptDone := False;
FCurrentUserHostCombination := '';
FKeepAliveTimer := TTimer.Create(Self);
FFavorites := TStringList.Create;
@@ -2075,6 +2152,11 @@ constructor TDBConnection.Create(AOwner: TComponent);
FMaxRowsPerInsert := 10000;
FCaseSensitivity := 0;
FStringQuoteChar := '''';
+ FCollationTable := nil;
+ FCharsetTable := nil;
+ FQuoteChar := '"';
+ FQuoteChars := '"[]';
+ FNamedEnums := TStringList.Create;
end;
@@ -2099,8 +2181,6 @@ constructor TAdoDBConnection.Create(AOwner: TComponent);
i: Integer;
begin
inherited;
- FQuoteChar := '"';
- FQuoteChars := '"[]';
SetLength(FDatatypes, Length(MSSQLDatatypes));
for i:=0 to High(MSSQLDatatypes) do
FDatatypes[i] := MSSQLDatatypes[i];
@@ -2114,7 +2194,6 @@ constructor TPgConnection.Create(AOwner: TComponent);
i: Integer;
begin
inherited;
- FQuoteChar := '"';
FQuoteChars := '"';
SetLength(FDatatypes, Length(PostGreSQLDatatypes));
for i:=0 to High(PostGreSQLDatatypes) do
@@ -2131,8 +2210,6 @@ constructor TSQLiteConnection.Create(AOwner: TComponent);
i: Integer;
begin
inherited;
- FQuoteChar := '"';
- FQuoteChars := '"[]';
SetLength(FDatatypes, Length(SQLiteDatatypes));
for i:=0 to High(SQLiteDatatypes) do
FDatatypes[i] := SQLiteDatatypes[i];
@@ -2146,8 +2223,6 @@ constructor TInterbaseConnection.Create(AOwner: TComponent);
i: Integer;
begin
inherited;
- FQuoteChar := '"';
- FQuoteChars := '"[]';
SetLength(FDatatypes, Length(InterbaseDatatypes));
for i:=0 to High(InterbaseDatatypes) do
FDatatypes[i] := InterbaseDatatypes[i];
@@ -2162,6 +2237,9 @@ destructor TDBConnection.Destroy;
FKeepAliveTimer.Free;
FFavorites.Free;
FInformationSchemaObjects.Free;
+ FNamedEnums.Free;
+ if FOwnsParameters then
+ FreeAndNil(FParameters);
inherited;
end;
@@ -2176,7 +2254,14 @@ destructor TMySQLConnection.Destroy;
destructor TAdoDBConnection.Destroy;
begin
if Active then Active := False;
- FreeAndNil(FAdoHandle);
+ try
+ FreeAndNil(FAdoHandle);
+ except
+ on E:Exception do begin
+ // Destroy > ClearRefs > GetDataSetCount throws some error, but max in Delphi 11.2 yet
+ Log(lcError, E.Message);
+ end;
+ end;
inherited;
end;
@@ -2217,6 +2302,8 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
rx := TRegExpr.Create;
rx.ModifierI := True;
MatchLen := 0;
+ // Remove quotes around PG enums: "UserStatus"
+ DataType := DeQuoteIdent(DataType);
for i:=0 to High(FDatatypes) do begin
Types := FDatatypes[i].Name;
if FDatatypes[i].Names <> '' then begin
@@ -2272,8 +2359,13 @@ function TDBConnection.GetDatatypeByNativeType(NativeType: Integer; Identifier:
begin
rx := TRegExpr.Create;
TypeFound := False;
+
for i:=0 to High(Datatypes) do begin
- if Datatypes[i].NativeTypes = '' then
+ // Skip if native ids / oid's are (yet) empty
+ if Datatypes[i].NativeTypes.IsEmpty then
+ Continue;
+ // Skip ? and e which have a special meaning
+ if Datatypes[i].NativeTypes.Length = 1 then
Continue;
rx.Expression := '\b('+Datatypes[i].NativeTypes+')\b';
if rx.Exec(IntToStr(NativeType)) then begin
@@ -2282,6 +2374,16 @@ function TDBConnection.GetDatatypeByNativeType(NativeType: Integer; Identifier:
break;
end;
end;
+
+ { Dynamically retrieve data type from pg_type.
+ Problematic because we would not know which TDBDatatypeIndex to assign.
+ if (not TypeFound) and Parameters.IsAnyPostgreSQL then begin
+ PgType := GetResults('SELECT * FROM '+QuoteIdent('pg_type')+' WHERE '+QuoteIdent('oid')+'='+NativeType.ToString);
+ if PgType.RecordCount = 1 then begin
+ SetLength(FDatatypes, Length(FDatatypes)+1);
+ end;
+ end;}
+
if not TypeFound then begin
// Fall back to unknown type
Result := Datatypes[0];
@@ -2315,6 +2417,11 @@ procedure TMySQLConnection.SetLockedByThread(Value: TThread);
end;
end;
+function TDBConnection.IsLockedByThread: Boolean;
+begin
+ Result := FLockedByThread <> nil;
+end;
+
{**
(Dis-)Connect to/from server
@@ -2322,15 +2429,14 @@ procedure TMySQLConnection.SetLockedByThread(Value: TThread);
procedure TMySQLConnection.SetActive( Value: Boolean );
var
Connected: PMYSQL;
- ClientFlags, FinalPort: Integer;
+ ClientFlags, FinalPort, SSLoption: Integer;
+ VerifyServerCert: Integer;
Error, StatusName: String;
FinalHost, FinalSocket, FinalUsername, FinalPassword: String;
ErrorHint: String;
- sslca, sslkey, sslcert, sslcipher: PAnsiChar;
- PluginDir: AnsiString;
+ PluginDir, TlsVersions: AnsiString;
Status: TDBQuery;
PasswordChangeDialog: TfrmPasswordChange;
- SetOptionResult: Integer;
UserNameSize: DWORD;
begin
if Value and (FHandle = nil) then begin
@@ -2346,27 +2452,48 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
FinalPort := FParameters.Port;
if FParameters.WantSSL then begin
- // mysql_ssl_set() wants nil, while PAnsiChar(AnsiString()) is never nil
- sslkey := nil;
- sslcert := nil;
- sslca := nil;
- sslcipher := nil;
+ // Define which TLS protocol versions are allowed.
+ // See https://www.heidisql.com/forum.php?t=27158
+ // See https://mariadb.com/kb/en/library/mysql_optionsv/
+ // See issue #1768
+ TlsVersions := 'TLSv1,TLSv1.1,TLSv1.2,TLSv1.3';
+ //TlsVersions := 'TLSv1.1';
+ if FLib.MARIADB_OPT_TLS_VERSION <> FLib.INVALID_OPT then
+ SetOption(FLib.MARIADB_OPT_TLS_VERSION, PAnsiChar(TlsVersions));
+ SetOption(FLib.MYSQL_OPT_TLS_VERSION, PAnsiChar(TlsVersions));
if FParameters.SSLPrivateKey <> '' then
- sslkey := PAnsiChar(AnsiString(FParameters.SSLPrivateKey));
+ SetOption(FLib.MYSQL_OPT_SSL_KEY, PAnsiChar(AnsiString(FParameters.SSLPrivateKey)));
if FParameters.SSLCertificate <> '' then
- sslcert := PAnsiChar(AnsiString(FParameters.SSLCertificate));
+ SetOption(FLib.MYSQL_OPT_SSL_CERT, PAnsiChar(AnsiString(FParameters.SSLCertificate)));
if FParameters.SSLCACertificate <> '' then
- sslca := PAnsiChar(AnsiString(FParameters.SSLCACertificate));
+ SetOption(FLib.MYSQL_OPT_SSL_CA, PAnsiChar(AnsiString(FParameters.SSLCACertificate)));
if FParameters.SSLCipher <> '' then
- sslcipher := PAnsiChar(AnsiString(FParameters.SSLCipher));
- { TODO : Use Cipher and CAPath parameters }
- FLib.mysql_ssl_set(FHandle,
- sslkey,
- sslcert,
- sslca,
- nil,
- sslcipher);
- Log(lcInfo, _('SSL parameters successfully set.'));
+ SetOption(FLib.MYSQL_OPT_SSL_CIPHER, PAnsiChar(AnsiString(FParameters.SSLCipher)));
+ if not FLib.IsLibMariadb then begin
+ // MySQL
+ Log(lcInfo, 'SSL parameters for MySQL');
+ case FParameters.SSLVerification of
+ 0: SSLoption := FLib.SSL_MODE_PREFERRED;
+ 1: SSLoption := FLib.SSL_MODE_VERIFY_CA;
+ 2: SSLoption := FLib.SSL_MODE_VERIFY_IDENTITY;
+ end;
+ SetOption(FLib.MYSQL_OPT_SSL_MODE, @SSLoption);
+ end
+ else begin
+ // MariaDB
+ Log(lcInfo, 'SSL parameters for MariaDB');
+ case FParameters.SSLVerification of
+ 0: VerifyServerCert := FLib.MYBOOL_FALSE;
+ 1,2: VerifyServerCert := FLib.MYBOOL_TRUE;
+ end;
+ SetOption(FLib.MYSQL_OPT_SSL_VERIFY_SERVER_CERT, @VerifyServerCert);
+ end;
+ end;
+
+ // libmariadb v3.4.0+ enables MYSQL_OPT_SSL_VERIFY_SERVER_CERT by default, so we have to disable it.
+ // See https://mariadb.com/kb/en/mariadb-connector-c-3-4-0-release-notes/
+ if not FParameters.WantSSL then begin
+ SetOption(FLib.MYSQL_OPT_SSL_VERIFY_SERVER_CERT, @(FLib.MYBOOL_FALSE));
end;
case FParameters.NetType of
@@ -2408,35 +2535,26 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
or CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA;
if Parameters.Compressed then
ClientFlags := ClientFlags or CLIENT_COMPRESS;
- if Parameters.WantSSL then
+ if Parameters.WantSSL and (not FLib.IsLibMariadb) then
ClientFlags := ClientFlags or CLIENT_SSL;
// Point libmysql to the folder with client plugins
- PluginDir := AnsiString(ExtractFilePath(ParamStr(0))+'plugins');
- SetOptionResult := FLib.mysql_options(FHandle, Integer(MYSQL_PLUGIN_DIR), PAnsiChar(PluginDir));
- if SetOptionResult <> 0 then begin
- raise EDbError.Create(f_('Plugin directory %s could not be set.', [PluginDir]));
- end;
-
- // Define which TLS protocol versions are allowed.
- // See https://www.heidisql.com/forum.php?t=27158
- // See https://mariadb.com/kb/en/library/mysql_optionsv/
- FLib.mysql_options(FHandle, Integer(MARIADB_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
- FLib.mysql_options(FHandle, Integer(MYSQL_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
+ PluginDir := AnsiString(GetAppDir+'plugins');
+ SetOption(FLib.MYSQL_PLUGIN_DIR, PAnsiChar(PluginDir));
// Enable cleartext plugin
if Parameters.CleartextPluginEnabled then
- FLib.mysql_options(FHandle, Integer(MYSQL_ENABLE_CLEARTEXT_PLUGIN), PAnsiChar('1'));
+ SetOption(FLib.MYSQL_ENABLE_CLEARTEXT_PLUGIN, @(FLib.MYBOOL_TRUE));
// Tell server who we are
if Assigned(FLib.mysql_optionsv) then
- FLib.mysql_optionsv(FHandle, Integer(MYSQL_OPT_CONNECT_ATTR_ADD), 'program_name', APPNAME);
+ FLib.mysql_optionsv(FHandle, FLib.MYSQL_OPT_CONNECT_ATTR_ADD, 'program_name', APPNAME);
// Seems to be still required on some systems, for importing CSV files
- FLib.mysql_options(FHandle, Integer(MYSQL_OPT_LOCAL_INFILE), PAnsiChar('1'));
+ SetOption(FLib.MYSQL_OPT_LOCAL_INFILE, @(FLib.MYBOOL_TRUE));
// Ensure we have some connection timeout
- FLib.mysql_options(FHandle, Integer(MYSQL_OPT_CONNECT_TIMEOUT), @FParameters.QueryTimeout);
+ SetOption(FLib.MYSQL_OPT_CONNECT_TIMEOUT, @(FParameters.QueryTimeout));
Connected := FLib.mysql_real_connect(
FHandle,
@@ -2454,11 +2572,20 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
FConnectionStarted := 0;
FHandle := nil;
EndSSHTunnel;
- if (FParameters.DefaultLibrary <> '') and (FParameters.LibraryOrProvider <> FParameters.DefaultLibrary) then begin
+ if Error.Contains('SEC_E_ALGORITHM_MISMATCH') then begin
+ ErrorHint := f_('This is a known issue with older libraries. Try a newer %s in the session settings.',
+ ['libmysql']
+ );
+ end
+ else if Error.Contains('certificate verif') then begin
+ ErrorHint := _('You might need to lower the certificate verification in the SSL settings.');
+ end
+ else if (FParameters.DefaultLibrary <> '') and (FParameters.LibraryOrProvider <> FParameters.DefaultLibrary) then begin
ErrorHint := f_('You could try the default library %s in your session settings. (Current: %s)',
[FParameters.DefaultLibrary, FParameters.LibraryOrProvider]
);
- end else begin
+ end
+ else begin
ErrorHint := '';
end;
raise EDbError.Create(Error, LastErrorCode, ErrorHint);
@@ -2506,8 +2633,6 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
end;
// mysql_character_set_name() reports utf8* if in fact we're on some latin* charset on v5.1 servers
// See https://www.heidisql.com/forum.php?t=39278
- FIsUnicode := CharacterSet.StartsWith('utf', True) and (ServerVersionInt >= 50500);
- if not IsUnicode then
try
CharacterSet := 'utf8mb4';
except
@@ -2530,7 +2655,7 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
Log(lcInfo, _('Characterset')+': '+CharacterSet);
FConnectionStarted := GetTickCount div 1000;
FServerUptime := -1;
- Status := GetResults(GetSQLSpecifity(spGlobalStatus));
+ Status := GetResults(FSqlProvider.GetSql(qGlobalStatus));
while not Status.Eof do begin
StatusName := LowerCase(Status.Col(0));
if (StatusName = 'uptime') or (StatusName = 'proxysql_uptime') then
@@ -2539,7 +2664,7 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
FIsSSL := Status.Col(1) <> '';
Status.Next;
end;
- FServerDateTimeOnStartup := GetVar('SELECT ' + GetSQLSpecifity(spFuncNow));
+ FServerDateTimeOnStartup := GetVar('SELECT ' + FSqlProvider.GetSql(qFuncNow));
FServerOS := GetSessionVariable('version_compile_os');
FRealHostname := GetSessionVariable('hostname');
FCaseSensitivity := MakeInt(GetSessionVariable('lower_case_table_names', IntToStr(FCaseSensitivity)));
@@ -2596,13 +2721,14 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
end;
IsOldProvider := Parameters.LibraryOrProvider = 'SQLOLEDB';
- if IsOldProvider then begin
+ if IsOldProvider and (not WarningShownOldOleProvider) then begin
MessageDialog(
f_('Security issue: Using %s %s with insecure %s.',
[Parameters.LibraryOrProvider, 'ADO provider', 'TLS 1.0']) +
f_('You should install %s from %s',
['Microsoft OLE DB Driver', 'https://www.microsoft.com/en-us/download/confirmation.aspx?id=56730']),
mtWarning, [mbOK]);
+ WarningShownOldOleProvider := True;
end;
NetLib := '';
@@ -2633,7 +2759,7 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
'Data Source='+DataSource+';'+
'Application Name='+AppName+';'
;
- if Parameters.LibraryOrProvider = 'MSOLEDBSQL' then begin
+ if Parameters.LibraryOrProvider.StartsWith('MSOLEDBSQL', true) then begin
// Issue #423: MSOLEDBSQL compatibility with new column types
// See https://docs.microsoft.com/en-us/sql/connect/oledb/applications/using-ado-with-oledb-driver-for-sql-server?view=sql-server-2017
// Do not use with old driver, see https://www.heidisql.com/forum.php?t=35208
@@ -2667,7 +2793,7 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
except
FServerUptime := -1;
end;
- FServerDateTimeOnStartup := GetVar('SELECT ' + GetSQLSpecifity(spFuncNow));
+ FServerDateTimeOnStartup := GetVar('SELECT ' + FSqlProvider.GetSql(qFuncNow));
// Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86)
// Apr 2 2010 15:53:02
// Copyright (c) Microsoft Corporation
@@ -2739,24 +2865,13 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
procedure TPgConnection.SetActive(Value: Boolean);
var
- dbname, ConnInfo, Error: String;
+ ConnectionString, OptionValue, Error: String;
+ ConnectOptions: TStringList;
FinalHost, ErrorHint: String;
- FinalPort: Integer;
-
- function EscapeConnectOption(Option: String): String;
- begin
- // See issue #704 and #1417, and docs: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
- Result := StringReplace(Option, '\', '\\', [rfReplaceAll]);
- Result := StringReplace(Result, '''', '\''', [rfReplaceAll]);
- end;
+ FinalPort, i: Integer;
begin
if Value then begin
DoBeforeConnect;
- // Simon Riggs:
- // "You should connect as "postgres" database by default, with an option to change. Don't use template1"
- dbname := FParameters.AllDatabasesStr;
- if dbname = '' then
- dbname := 'postgres';
// Prepare special stuff for SSH tunnel
FinalHost := FParameters.Hostname;
@@ -2764,25 +2879,45 @@ procedure TPgConnection.SetActive(Value: Boolean);
StartSSHTunnel(FinalHost, FinalPort);
- ConnInfo := 'host='''+EscapeConnectOption(FinalHost)+''' '+
- 'port='''+IntToStr(FinalPort)+''' '+
- 'user='''+EscapeConnectOption(FParameters.Username)+''' ' +
- 'password='''+EscapeConnectOption(FParameters.Password)+''' '+
- 'dbname='''+EscapeConnectOption(dbname)+''' '+
- 'application_name='''+EscapeConnectOption(APPNAME)+'''';
+ // Compose connection string
+ ConnectOptions := TStringList.Create;
+ ConnectOptions.Duplicates := dupIgnore;
+ ConnectOptions
+ .AddPair('host', FinalHost)
+ .AddPair('port', IntToStr(FinalPort))
+ .AddPair('user', FParameters.Username)
+ .AddPair('password', FParameters.Password)
+ .AddPair('application_name', APPNAME)
+ .AddPair('sslmode', 'disable');
+ if not FParameters.AllDatabasesStr.IsEmpty then
+ ConnectOptions.AddPair('dbname', FParameters.AllDatabasesStr);
if FParameters.WantSSL then begin
- ConnInfo := ConnInfo + ' sslmode=''require''';
+ // Be aware .AddPair would add duplicates
+ case FParameters.SSLVerification of
+ 0: ConnectOptions.Values['sslmode'] := 'require';
+ 1: ConnectOptions.Values['sslmode'] := 'verify-ca';
+ 2: ConnectOptions.Values['sslmode'] := 'verify-full';
+ end;
if FParameters.SSLPrivateKey <> '' then
- ConnInfo := ConnInfo + ' sslkey='''+EscapeConnectOption(FParameters.SSLPrivateKey)+'''';
+ ConnectOptions.AddPair('sslkey', FParameters.SSLPrivateKey);
if FParameters.SSLCertificate <> '' then
- ConnInfo := ConnInfo + ' sslcert='''+EscapeConnectOption(FParameters.SSLCertificate)+'''';
+ ConnectOptions.AddPair('sslcert', FParameters.SSLCertificate);
if FParameters.SSLCACertificate <> '' then
- ConnInfo := ConnInfo + ' sslrootcert='''+EscapeConnectOption(FParameters.SSLCACertificate)+'''';
+ ConnectOptions.AddPair('sslrootcert', FParameters.SSLCACertificate);
//if FParameters.SSLCipher <> '' then ??
end;
+ ConnectionString := '';
+ for i:=0 to ConnectOptions.Count-1 do begin
+ // Escape values. See issue #704 and #1417, and docs: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
+ OptionValue := ConnectOptions.ValueFromIndex[i];
+ OptionValue := StringReplace(OptionValue, '\', '\\', [rfReplaceAll]);
+ OptionValue := StringReplace(OptionValue, '''', '\''', [rfReplaceAll]);
+ ConnectionString := ConnectionString + ConnectOptions.Names[i] + '=''' + OptionValue + ''' ';
+ end;
+ ConnectOptions.Free;
+ ConnectionString := ConnectionString.TrimRight;
-
- FHandle := FLib.PQconnectdb(PAnsiChar(AnsiString(ConnInfo)));
+ FHandle := FLib.PQconnectdb(PAnsiChar(UTF8Encode(ConnectionString)));
if FLib.PQstatus(FHandle) = CONNECTION_BAD then begin
Error := LastErrorMsg;
Log(lcError, Error);
@@ -2804,10 +2939,13 @@ procedure TPgConnection.SetActive(Value: Boolean);
raise EDbError.Create(Error, LastErrorCode, ErrorHint);
end;
FActive := True;
- FServerDateTimeOnStartup := GetVar('SELECT ' + GetSQLSpecifity(spFuncNow));
+ CharacterSet := 'UTF8';
+ FServerDateTimeOnStartup := GetVar('SELECT ' + FSqlProvider.GetSql(qFuncNow));
FServerVersionUntouched := GetVar('SELECT VERSION()');
FConnectionStarted := GetTickCount div 1000;
Query('SET statement_timeout TO '+IntToStr(Parameters.QueryTimeout*1000));
+ if ServerVersionInt >= 80300 then
+ Query('SET synchronize_seqscans TO off');
try
FServerUptime := StrToIntDef(GetVar('SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - pg_postmaster_start_time())::INTEGER'), -1);
except
@@ -2824,7 +2962,8 @@ procedure TPgConnection.SetActive(Value: Boolean);
DoAfterConnect;
end else begin
try
- FLib.PQfinish(FHandle);
+ if FActive then
+ FLib.PQfinish(FHandle);
except
on E:EAccessViolation do;
end;
@@ -2840,16 +2979,28 @@ procedure TPgConnection.SetActive(Value: Boolean);
procedure TSQLiteConnection.SetActive(Value: Boolean);
var
ConnectResult: Integer;
+ RawPassword: AnsiString;
ErrorHint: String;
- FileNames: TStringList;
- MainFile, DbAlias: String;
- i: Integer;
+ FileNames, EncryptionParams: TStringList;
+ MainFile, DbAlias, Param, ParamName: String;
+ MainFileDir: String;
+ i, SplitPos, ParamValue: Integer;
+ CipherIndex, ConfigResult: Integer;
+ ParamWasSet: Boolean;
begin
// Support multiple filenames, and use first one as main database
FileNames := Explode(DELIM, Parameters.Hostname);
MainFile := IfThen(FileNames.Count>=1, FileNames[0], '');
if Value then begin
+ // Fixes "out of memory" crash in sqlite3_open, see issue #1367
+ MainFileDir := ExtractFilePath(MainFile);
+ MainFileDir := IncludeTrailingPathDelimiter(MainFileDir);
+ if not DirectoryExists(MainFileDir) then
+ raise EDbError.Create(f_('Folder in path does not exist: %s', [MainFile]));
+ if not FileExists(MainFile) then
+ Log(lcInfo, f_('File does not yet exist, will be created now: %s', [MainFile]));
+
DoBeforeConnect;
ConnectResult := FLib.sqlite3_open(
@@ -2858,6 +3009,56 @@ procedure TSQLiteConnection.SetActive(Value: Boolean);
if ConnectResult = SQLITE_OK then begin
FActive := True;
+ if Parameters.NetType = ntSQLiteEncrypted then begin
+ // Use encryption key
+ CipherIndex := FLib.sqlite3mc_cipher_index(PAnsiChar(AnsiString(Parameters.Username)));
+ //Log(lcinfo, 'CipherIndex:'+CipherIndex.ToString);
+ if CipherIndex = -1 then
+ raise EDbError.Create(f_('Warning: Given cipher scheme name "%s" could not be found', [Parameters.Username]));
+ ConfigResult := FLib.sqlite3mc_config(FHandle, PAnsiChar('default:cipher'), CipherIndex);
+ if ConfigResult = -1 then
+ raise EDbError.Create(f_('Warning: Configuring with cipher index %d failed', [CipherIndex]));
+ // Set encryption parameters:
+ EncryptionParams := Parameters.AllDatabasesList;
+ for Param in EncryptionParams do begin
+ Log(lcDebug, 'Cipher encryption parameter: "'+Param+'"');
+ SplitPos := Param.IndexOf('=');
+ ParamWasSet := False;
+ if SplitPos > -1 then begin
+ ParamName := Copy(Param, 1, SplitPos);
+ ParamValue := StrToIntDef(Copy(Param, SplitPos+2, Length(Param)), -1);
+ if ParamValue > -1 then begin
+ ConfigResult := FLib.sqlite3mc_config_cipher(
+ FHandle,
+ PAnsiChar(AnsiString(Parameters.Username)),
+ PAnsiChar(AnsiString(ParamName)),
+ ParamValue
+ );
+ if ConfigResult <> -1 then
+ ParamWasSet := True;
+ end
+ end;
+ if not ParamWasSet then
+ Log(lcError, f_('Warning: Failed to set cipher encryption parameter "%s"', [Param]))
+ else
+ Log(lcInfo, f_('Info: Cipher encryption parameter "%s" set', [Param]));
+ end;
+ // Set the main database key
+ RawPassword := AnsiString(Parameters.Password);
+ FLib.sqlite3_key(FHandle, Pointer(RawPassword), Length(RawPassword));
+ // See https://utelle.github.io/SQLite3MultipleCiphers/docs/configuration/config_capi/
+ // "These functions return SQLITE_OK even if the provided key isnt correct. This is because the key isnt
+ // actually used until a subsequent attempt to read or write the database is made. To check whether the
+ // provided key was actually correct, you must execute a simple query like e.g. SELECT * FROM sqlite_master;
+ // and check whether that succeeds."
+ try
+ Query(ApplyLimitClause('SELECT', '* FROM sqlite_master', 1, 0));
+ except
+ on E:EDbError do
+ raise EDbError.Create(E.Message, 0, _('You have activated encryption on a probably non-encrypted database.'));
+ end;
+ end;
+
FLib.sqlite3_collation_needed(FHandle, Self, SQLite_CollationNeededCallback);
Query('PRAGMA busy_timeout='+(Parameters.QueryTimeout*1000).ToString);
// Override "main" database name with custom one
@@ -2875,7 +3076,7 @@ procedure TSQLiteConnection.SetActive(Value: Boolean);
Log(lcError, 'Could not enable load_extension()');
end;
- FServerDateTimeOnStartup := GetVar('SELECT ' + GetSQLSpecifity(spFuncNow));
+ FServerDateTimeOnStartup := GetVar('SELECT ' + FSqlProvider.GetSql(qFuncNow));
FServerVersionUntouched := GetVar('SELECT sqlite_version()');
FConnectionStarted := GetTickCount div 1000;
FServerUptime := -1;
@@ -2982,7 +3183,7 @@ procedure TInterbaseConnection.SetActive(Value: Boolean);
FActive := True;
//! Query('PRAGMA busy_timeout='+(Parameters.QueryTimeout*1000).ToString);
- FServerDateTimeOnStartup := GetVar('SELECT ' + GetSQLSpecifity(spFuncNow));
+ FServerDateTimeOnStartup := GetVar('SELECT ' + FSqlProvider.GetSql(qFuncNow));
if Parameters.IsInterbase then
FServerVersionUntouched := ''
@@ -3011,180 +3212,91 @@ procedure TInterbaseConnection.SetActive(Value: Boolean);
end;
+procedure TMySQLConnection.SetOption(Option: Integer; Arg: Pointer);
+var
+ SetOptionResult: Integer;
+ RttiContext: TRttiContext;
+ LibType: TRttiType;
+ LibField: TRttiField;
+ FieldName: String;
+begin
+ // Set one of the MYSQL_* option and log a warning if that failed
+ FieldName := Option.ToString;
+ // Attempt to find readable name of option constant
+ RttiContext := TRttiContext.Create;
+ LibType := RttiContext.GetType(TypeInfo(TMySQLLib));
+ for LibField in LibType.GetFields do begin
+ // Skip assigned procedures
+ if LibField.FieldType = nil then
+ Continue;
+ if LibField.DataType.TypeKind = tkInteger then begin
+ if LibField.GetValue(FLib).AsInteger = Option then begin
+ FieldName := LibField.Name;
+ end;
+ end;
+ end;
+ RttiContext.Free;
+
+ Log(lcDebug, Format('Calling mysql_options(%s, ...)', [FieldName]));
+ SetOptionResult := FLib.mysql_options(FHandle, Option, Arg);
+ if SetOptionResult <> 0 then begin
+ Log(lcError, _(SLogPrefixWarning) + ': mysql_options(' + FieldName + ', ...) failed!');
+ end;
+end;
+
+
procedure TDBConnection.DoBeforeConnect;
var
UsingPass: String;
Dialog: TfrmLogin;
begin
- // Prompt for password on initial connect
- if FParameters.LoginPrompt and (not FLoginPromptDone) then begin
+ // Don't remember prompt values
+ if FParameters.LoginPrompt then begin
Dialog := TfrmLogin.Create(Self);
Dialog.Caption := APPNAME + ' - ' + FParameters.SessionName;
Dialog.lblPrompt.Caption := f_('Login to %s:', [FParameters.Hostname]);
Dialog.editUsername.Text := FParameters.Username;
Dialog.editPassword.Text := FParameters.Password;
- Dialog.ShowModal;
- FParameters.Username := Dialog.editUsername.Text;
- FParameters.Password := Dialog.editPassword.Text;
- Dialog.Free;
- FLoginPromptDone := True;
+ if Dialog.ShowModal = mrOk then begin
+ FParameters.Username := Dialog.editUsername.Text;
+ FParameters.Password := Dialog.editPassword.Text;
+ Dialog.Free;
+ end
+ else begin
+ Dialog.Free;
+ raise EDbError.Create(_('Login cancelled'));
+ end;
end;
// Prepare connection
- if FParameters.Password <> '' then UsingPass := 'Yes' else UsingPass := 'No';
- Log(lcInfo, f_('Connecting to %s via %s, username %s, using password: %s ...',
- [FParameters.Hostname, FParameters.NetTypeName(True), FParameters.Username, UsingPass]
- ));
-
- FSQLSpecifities[spOrderAsc] := 'ASC';
- FSQLSpecifities[spOrderDesc] := 'DESC';
- FSQLSpecifities[spForeignKeyEventAction] := 'RESTRICT,CASCADE,SET NULL,NO ACTION';
-
- case Parameters.NetTypeGroup of
- ngMySQL: begin
- FSQLSpecifities[spDatabaseDrop] := 'DROP DATABASE %s';
- FSQLSpecifities[spEmptyTable] := 'TRUNCATE ';
- FSQLSpecifities[spRenameTable] := 'RENAME TABLE %s TO %s';
- FSQLSpecifities[spRenameView] := FSQLSpecifities[spRenameTable];
- FSQLSpecifities[spCurrentUserHost] := 'SELECT CURRENT_USER()';
- FSQLSpecifities[spLikeCompare] := '%s LIKE %s';
- FSQLSpecifities[spAddColumn] := 'ADD COLUMN %s';
- FSQLSpecifities[spChangeColumn] := 'CHANGE COLUMN %s %s';
- FSQLSpecifities[spGlobalStatus] := IfThen(
- Parameters.IsProxySQLAdmin,
- 'SELECT * FROM stats_mysql_global',
- 'SHOW /*!50002 GLOBAL */ STATUS'
- );
- FSQLSpecifities[spCommandsCounters] := IfThen(
- Parameters.IsProxySQLAdmin,
- 'SELECT * FROM stats_mysql_commands_counters',
- 'SHOW /*!50002 GLOBAL */ STATUS LIKE ''Com\_%'''
- );
- FSQLSpecifities[spSessionVariables] := 'SHOW VARIABLES';
- FSQLSpecifities[spGlobalVariables] := 'SHOW GLOBAL VARIABLES';
- FSQLSpecifities[spISSchemaCol] := '%s_SCHEMA';
- FSQLSpecifities[spUSEQuery] := 'USE %s';
- if Parameters.NetType = ntMySQL_RDS then begin
- FSQLSpecifities[spKillQuery] := 'CALL mysql.rds_kill_query(%d)';
- FSQLSpecifities[spKillProcess] := 'CALL mysql.rds_kill(%d)'
- end
- else begin
- FSQLSpecifities[spKillQuery] := 'KILL %d'; // may be overwritten in DoAfterConnect
- FSQLSpecifities[spKillProcess] := 'KILL %d';
- end;
- FSQLSpecifities[spFuncLength] := 'LENGTH';
- FSQLSpecifities[spFuncCeil] := 'CEIL';
- FSQLSpecifities[spFuncLeft] := IfThen(Parameters.IsProxySQLAdmin, 'SUBSTR(%s, 1, %d)', 'LEFT(%s, %d)');
- FSQLSpecifities[spFuncNow] := IfThen(Parameters.IsProxySQLAdmin, 'CURRENT_TIMESTAMP', 'NOW()');
- FSQLSpecifities[spFuncLastAutoIncNumber] := 'LAST_INSERT_ID()';
- FSQLSpecifities[spLockedTables] := '';
- FSQLSpecifities[spDisableForeignKeyChecks] := 'SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0';
- FSQLSpecifities[spEnableForeignKeyChecks] := 'SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1)';
- end;
- ngMSSQL: begin
- FSQLSpecifities[spDatabaseDrop] := 'DROP DATABASE %s';
- FSQLSpecifities[spEmptyTable] := 'DELETE FROM ';
- FSQLSpecifities[spRenameTable] := 'EXEC sp_rename %s, %s';
- FSQLSpecifities[spRenameView] := FSQLSpecifities[spRenameTable];
- FSQLSpecifities[spCurrentUserHost] := 'SELECT SYSTEM_USER';
- FSQLSpecifities[spLikeCompare] := '%s LIKE %s';
- FSQLSpecifities[spAddColumn] := 'ADD %s';
- FSQLSpecifities[spChangeColumn] := 'ALTER COLUMN %s %s';
- FSQLSpecifities[spSessionVariables] := 'SELECT '+QuoteIdent('comment')+', '+QuoteIdent('value')+' FROM '+QuoteIdent('master')+'.'+QuoteIdent('dbo')+'.'+QuoteIdent('syscurconfigs')+' ORDER BY '+QuoteIdent('comment');
- FSQLSpecifities[spGlobalVariables] := FSQLSpecifities[spSessionVariables];
- FSQLSpecifities[spISSchemaCol] := '%s_CATALOG';
- FSQLSpecifities[spUSEQuery] := 'USE %s';
- FSQLSpecifities[spKillQuery] := 'KILL %d';
- FSQLSpecifities[spKillProcess] := 'KILL %d';
- FSQLSpecifities[spFuncLength] := 'LEN';
- FSQLSpecifities[spFuncCeil] := 'CEILING';
- FSQLSpecifities[spFuncLeft] := 'LEFT(%s, %d)';
- FSQLSpecifities[spFuncNow] := 'GETDATE()';
- FSQLSpecifities[spFuncLastAutoIncNumber] := 'LAST_INSERT_ID()';
- FSQLSpecifities[spLockedTables] := '';
- FSQLSpecifities[spDisableForeignKeyChecks] := '';
- FSQLSpecifities[spEnableForeignKeyChecks] := '';
- end;
- ngPgSQL: begin
- FSQLSpecifities[spDatabaseDrop] := 'DROP SCHEMA %s';
- FSQLSpecifities[spEmptyTable] := 'DELETE FROM ';
- FSQLSpecifities[spRenameTable] := 'ALTER TABLE %s RENAME TO %s';
- FSQLSpecifities[spRenameView] := 'ALTER VIEW %s RENAME TO %s';
- FSQLSpecifities[spCurrentUserHost] := 'SELECT CURRENT_USER';
- FSQLSpecifities[spLikeCompare] := '%s ILIKE %s';
- FSQLSpecifities[spAddColumn] := 'ADD %s';
- FSQLSpecifities[spChangeColumn] := 'ALTER COLUMN %s %s';
- FSQLSpecifities[spRenameColumn] := 'RENAME COLUMN %s TO %s';
- FSQLSpecifities[spForeignKeyEventAction] := 'RESTRICT,CASCADE,SET NULL,NO ACTION,SET DEFAULT';
- FSQLSpecifities[spSessionVariables] := 'SHOW ALL';
- FSQLSpecifities[spGlobalVariables] := FSQLSpecifities[spSessionVariables];
- FSQLSpecifities[spISSchemaCol] := '%s_schema';
- FSQLSpecifities[spUSEQuery] := 'SET search_path TO %s';
- FSQLSpecifities[spKillQuery] := 'SELECT pg_cancel_backend(%d)';
- FSQLSpecifities[spKillProcess] := 'SELECT pg_cancel_backend(%d)';
- FSQLSpecifities[spFuncLength] := 'LENGTH';
- FSQLSpecifities[spFuncCeil] := 'CEIL';
- FSQLSpecifities[spFuncLeft] := 'SUBSTRING(%s, 1, %d)';
- FSQLSpecifities[spFuncNow] := 'NOW()';
- FSQLSpecifities[spFuncLastAutoIncNumber] := 'LASTVAL()';
- FSQLSpecifities[spLockedTables] := '';
- FSQLSpecifities[spDisableForeignKeyChecks] := '';
- FSQLSpecifities[spEnableForeignKeyChecks] := '';
- end;
+ UsingPass := IfThen(FParameters.Password.IsEmpty, 'No', 'Yes');
+ case FParameters.NetTypeGroup of
ngSQLite: begin
- FSQLSpecifities[spDatabaseDrop] := 'DROP DATABASE %s';
- FSQLSpecifities[spEmptyTable] := 'DELETE FROM ';
- FSQLSpecifities[spRenameTable] := 'ALTER TABLE %s RENAME TO %s';
- FSQLSpecifities[spRenameView] := FSQLSpecifities[spRenameTable];
- FSQLSpecifities[spCurrentUserHost] := ''; // unsupported
- FSQLSpecifities[spLikeCompare] := '%s LIKE %s';
- FSQLSpecifities[spAddColumn] := 'ADD COLUMN %s';
- FSQLSpecifities[spChangeColumn] := ''; // SQLite only supports renaming
- FSQLSpecifities[spRenameColumn] := 'RENAME COLUMN %s TO %s';
- FSQLSpecifities[spSessionVariables] := 'SELECT null, null'; // Todo: combine "PRAGMA pragma_list" + "PRAGMA a; PRAGMY b; ..."?
- FSQLSpecifities[spGlobalVariables] := 'SHOW GLOBAL VARIABLES';
- FSQLSpecifities[spISSchemaCol] := '%s_SCHEMA';
- FSQLSpecifities[spUSEQuery] := '';
- FSQLSpecifities[spKillQuery] := 'KILL %d';
- FSQLSpecifities[spKillProcess] := 'KILL %d';
- FSQLSpecifities[spFuncLength] := 'LENGTH';
- FSQLSpecifities[spFuncCeil] := 'CEIL';
- FSQLSpecifities[spFuncLeft] := 'SUBSTR(%s, 1, %d)';
- FSQLSpecifities[spFuncNow] := 'DATETIME()';
- FSQLSpecifities[spFuncLastAutoIncNumber] := 'LAST_INSERT_ID()';
- FSQLSpecifities[spLockedTables] := '';
- FSQLSpecifities[spDisableForeignKeyChecks] := '';
- FSQLSpecifities[spEnableForeignKeyChecks] := '';
+ Log(lcInfo, f_('Connecting to %s via %s, cipher %s, using encryption key: %s ...',
+ [FParameters.Hostname, FParameters.NetTypeName(True), FParameters.Username, UsingPass]
+ ));
end;
- ngInterbase: begin
- FSQLSpecifities[spDatabaseDrop] := 'DROP DATABASE %s';
- FSQLSpecifities[spEmptyTable] := 'TRUNCATE ';
- FSQLSpecifities[spRenameTable] := 'RENAME TABLE %s TO %s';
- FSQLSpecifities[spRenameView] := FSQLSpecifities[spRenameTable];
- if Self.Parameters.LibraryOrProvider = 'IB' then
- FSQLSpecifities[spCurrentUserHost] := 'select user from rdb$database'
- else
- FSQLSpecifities[spCurrentUserHost] := 'select current_user || ''@'' || mon$attachments.mon$remote_host from mon$attachments where mon$attachments.mon$attachment_id = current_connection';
- FSQLSpecifities[spLikeCompare] := '%s LIKE %s';
- FSQLSpecifities[spAddColumn] := 'ADD COLUMN %s';
- FSQLSpecifities[spChangeColumn] := 'CHANGE COLUMN %s %s';
- FSQLSpecifities[spRenameColumn] := '';
- FSQLSpecifities[spSessionVariables] := 'SHOW VARIABLES';
- FSQLSpecifities[spGlobalVariables] := 'SHOW GLOBAL VARIABLES';
- FSQLSpecifities[spISSchemaCol] := '%s_SCHEMA';
- FSQLSpecifities[spUSEQuery] := '';
- FSQLSpecifities[spKillQuery] := 'KILL %d';
- FSQLSpecifities[spKillProcess] := 'KILL %d';
- FSQLSpecifities[spFuncLength] := 'LENGTH';
- FSQLSpecifities[spFuncCeil] := 'CEIL';
- FSQLSpecifities[spFuncLeft] := 'SUBSTR(%s, 1, %d)';
- FSQLSpecifities[spFuncNow] := ' cast(''now'' as timestamp) from rdb$database';
- FSQLSpecifities[spFuncLastAutoIncNumber] := 'LAST_INSERT_ID()';
- FSQLSpecifities[spLockedTables] := '';
- FSQLSpecifities[spDisableForeignKeyChecks] := '';
- FSQLSpecifities[spEnableForeignKeyChecks] := '';
+ else begin
+ Log(lcInfo, f_('Connecting to %s via %s, username %s, using password: %s ...',
+ [FParameters.Hostname, FParameters.NetTypeName(True), FParameters.Username, UsingPass]
+ ));
end;
+ end;
+ // Create SQL provider
+ case FParameters.NetTypeGroup of
+ ngMySQL:
+ FSqlProvider := TMySqlProvider.Create(FParameters.NetType);
+ ngMSSQL:
+ FSqlProvider := TMsSqlProvider.Create(FParameters.NetType);
+ ngPgSQL:
+ FSqlProvider := TPostgreSQLProvider.Create(FParameters.NetType);
+ ngSQLite:
+ FSqlProvider := TSQLiteProvider.Create(FParameters.NetType);
+ ngInterbase:
+ FSqlProvider := TInterbaseProvider.Create(FParameters.NetType);
+ else
+ raise Exception.CreateFmt(_(MsgUnhandledNetType), [Integer(FParameters.NetType)]);
end;
end;
@@ -3195,7 +3307,7 @@ procedure TMySQLConnection.DoBeforeConnect;
LibraryPath: String;
begin
// Init libmysql before actually connecting.
- LibraryPath := ExtractFilePath(ParamStr(0)) + Parameters.LibraryOrProvider;
+ LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
Log(lcDebug, f_('Loading library file %s ...', [LibraryPath]));
// Throws EDbError on any failure:
FLib := TMySQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3210,7 +3322,7 @@ procedure TPgConnection.DoBeforeConnect;
msg: String;
begin
// Init lib before actually connecting.
- LibraryPath := ExtractFilePath(ParamStr(0)) + Parameters.LibraryOrProvider;
+ LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
Log(lcDebug, f_('Loading library file %s ...', [LibraryPath]));
try
FLib := TPostgreSQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3241,10 +3353,13 @@ procedure TSQLiteConnection.DoBeforeConnect;
LibraryPath: String;
begin
// Init lib before actually connecting.
- LibraryPath := ExtractFilePath(ParamStr(0)) + Parameters.LibraryOrProvider;
+ LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
Log(lcDebug, f_('Loading library file %s ...', [LibraryPath]));
// Throws EDbError on any failure:
- FLib := TSQLiteLib.Create(LibraryPath, Parameters.DefaultLibrary);
+ if Parameters.NetType = ntSQLite then
+ FLib := TSQLiteLib.Create(LibraryPath, Parameters.DefaultLibrary)
+ else
+ FLib := TSQLiteLib.CreateWithMultipleCipherFunctions(LibraryPath, Parameters.DefaultLibrary);
Log(lcDebug, FLib.DllFile + ' v' + ServerVersionUntouched + ' loaded.');
inherited;
end;
@@ -3280,8 +3395,60 @@ procedure TDBConnection.EndSSHTunnel;
procedure TDBConnection.DoAfterConnect;
var
+ i: Integer;
+ TypeOid: String;
+ AllEnums: TDBQuery;
+ AllEnumsList: TStringList;
SQLFunctionsFileOrder: String;
+ MajorMinorVer, MajorVer: String;
+ StartupScript: String;
+ StartupBatch: TSQLBatch;
+ SqlQuery: TSQLSentence;
+ TZI: TTimeZoneInformation;
+ Minutes, Hours: Integer;
+ Offset: String;
begin
+ FSqlProvider.ServerVersion := ServerVersionInt;
+
+ for i:=0 to High(Datatypes) do begin
+
+ if Datatypes[i].NativeTypes = '?' then begin
+ // PG oid is set to be populated via '?'
+ TypeOid := GetVar('SELECT oid FROM '+QuoteIdent('pg_type')+' WHERE '+QuoteIdent('typname')+' = '+EscapeString(Datatypes[i].Name.ToLower));
+ if IsNumeric(TypeOid) then begin
+ Datatypes[i].NativeTypes := TypeOid;
+ Log(lcInfo, 'Found oid/NativeTypes of '+Datatypes[i].Name+' data type: '+Datatypes[i].NativeTypes);
+ end
+ else begin
+ Log(lcInfo, 'No support for '+Datatypes[i].Name+' data type on this server.');
+ end;
+ end
+
+ else if (Datatypes[i].NativeTypes = 'e') and FSqlProvider.Has(qGetEnumTypes) then begin
+ // PG ENUM types populated via 'e'
+ AllEnums := GetResults(FSqlProvider.GetSql(qGetEnumTypes));
+ AllEnumsList := TStringList.Create;
+ while not AllEnums.Eof do begin
+ AllEnumsList.Add(AllEnums.Col('enum_name'));
+ AllEnumsList.Add(AllEnums.Col('enum_schema') + '.' + AllEnums.Col('enum_name'));
+ FNamedEnums.AddPair(
+ AllEnums.Col('enum_name'),
+ AllEnums.Col('enum_labels')
+ );
+ FNamedEnums.AddPair(
+ AllEnums.Col('enum_schema') + '.' + AllEnums.Col('enum_name'),
+ AllEnums.Col('enum_labels')
+ );
+ AllEnums.Next;
+ end;
+ AllEnums.Free;
+ Datatypes[i].Names := Implode('|', AllEnumsList);
+ AllEnumsList.Free;
+ end;
+
+ end;
+
+
AppSettings.SessionPath := FParameters.SessionPath;
AppSettings.WriteString(asServerVersionFull, FServerVersionUntouched);
FParameters.ServerVersion := FServerVersionUntouched;
@@ -3293,37 +3460,29 @@ procedure TDBConnection.DoAfterConnect;
FKeepAliveTimer.OnTimer := KeepAliveTimerEvent;
end;
+ MajorMinorVer := RegExprGetMatch('^(\d+\.\d+)', ServerVersionStr, 1);
+ MajorVer := RegExprGetMatch('^(\d+)\.', ServerVersionStr, 1);
+
if FParameters.IsMariaDB then
- SQLFunctionsFileOrder := 'mariadb,mysql'
+ SQLFunctionsFileOrder := 'mariadb'+MajorMinorVer+',mariadb'+MajorVer+',mariadb,mysql'
else if FParameters.IsAnyMySQL then
- SQLFunctionsFileOrder := 'mysql'
+ SQLFunctionsFileOrder := 'mysql'+MajorMinorVer+',mysql'+MajorVer+',mysql'
else if FParameters.IsRedshift then
- SQLFunctionsFileOrder := 'redshift,postgresql'
+ SQLFunctionsFileOrder := 'redshift'+MajorMinorVer+',redshift'+MajorVer+',redshift,postgresql'
else if FParameters.IsAnyPostgreSQL then
- SQLFunctionsFileOrder := 'postgresql'
+ SQLFunctionsFileOrder := 'postgresql'+MajorMinorVer+',postgresql'+MajorVer+',postgresql'
else if FParameters.IsAnyMSSQL then
- SQLFunctionsFileOrder := 'mssql'
+ SQLFunctionsFileOrder := 'mssql'+MajorMinorVer+',mssql'+MajorVer+',mssql'
else if FParameters.IsAnySQLite then
- SQLFunctionsFileOrder := 'sqlite'
+ SQLFunctionsFileOrder := 'sqlite'+MajorMinorVer+',sqlite'+MajorVer+',sqlite'
else if FParameters.IsAnyInterbase then
- SQLFunctionsFileOrder := 'interbase'
+ SQLFunctionsFileOrder := 'interbase'+MajorMinorVer+',interbase'+MajorVer+',interbase'
else
SQLFunctionsFileOrder := '';
FSQLFunctions := TSQLFunctionList.Create(Self, SQLFunctionsFileOrder);
-end;
-
-
-procedure TMySQLConnection.DoAfterConnect;
-var
- TZI: TTimeZoneInformation;
- Minutes, Hours, i: Integer;
- Offset: String;
- ObjNames: TStringList;
-begin
- inherited;
// Set timezone offset to UTC
- if (ServerVersionInt >= 40103) and Parameters.LocalTimeZone then begin
+ if FSqlProvider.Has(qSetTimezone) and Parameters.LocalTimeZone then begin
Minutes := 0;
case GetTimeZoneInformation(TZI) of
TIME_ZONE_ID_STANDARD: Minutes := (TZI.Bias + TZI.StandardBias);
@@ -3338,22 +3497,44 @@ procedure TMySQLConnection.DoAfterConnect;
else
Offset := '-';
Offset := Offset + Format('%.2d:%.2d', [Abs(Hours), Abs(Minutes)]);
- Query('SET time_zone='+EscapeString(Offset));
+ Query(qSetTimezone, [EscapeString(Offset)]);
+ end;
+
+ // Process startup script
+ StartupScript := Trim(FParameters.StartupScriptFilename);
+ if StartupScript <> '' then begin
+ StartupScript := ExpandFileName(StartupScript);
+ if not FileExists(StartupScript) then
+ Log(lcError, f_('Startup script file not found: %s', [StartupScript]))
+ else begin
+ StartupBatch := TSQLBatch.Create(FParameters.NetTypeGroup);
+ StartupBatch.SQL := ReadTextfile(StartupScript, nil);
+ for SqlQuery in StartupBatch do try
+ Query(SqlQuery.SQL);
+ except
+ // Suppress popup, errors get logged into SQL log
+ end;
+ StartupBatch.Free;
+ end;
end;
+end;
+
+
+procedure TMySQLConnection.DoAfterConnect;
+var
+ ObjNames: TStringList;
+ i: Integer;
+begin
+ inherited;
// Support microseconds in some temporal datatypes of MariaDB 5.3+ and MySQL 5.6
- if ((ServerVersionInt >= 50300) and Parameters.IsMariaDB) or
- ((ServerVersionInt >= 50604) and (not Parameters.IsMariaDB)) then begin
+ if Has(frTemporalTypesFraction) then begin
for i:=Low(FDatatypes) to High(FDatatypes) do begin
if FDatatypes[i].Index in [dbdtDatetime, dbdtDatetime2, dbdtTime, dbdtTimestamp] then
FDatatypes[i].HasLength := True;
end;
end;
- if (ServerVersionInt >= 50000) and (not Parameters.IsMySQLonRDS) then begin
- FSQLSpecifities[spKillQuery] := 'KILL QUERY %d';
- end;
-
// List of IS tables
try
ObjNames := GetCol('SHOW TABLES FROM '+QuoteIdent(FInfSch));
@@ -3361,34 +3542,12 @@ procedure TMySQLConnection.DoAfterConnect;
ObjNames.Free;
except // silently fail if IS does not exist, on super old servers
end;
-
- if (ServerVersionInt >= 50124) and (not Parameters.IsProxySQLAdmin) then
- FSQLSpecifities[spLockedTables] := 'SHOW OPEN TABLES FROM %s WHERE '+QuoteIdent('in_use')+'!=0';
end;
procedure TAdoDBConnection.DoAfterConnect;
begin
inherited;
- // See http://sqlserverbuilds.blogspot.de/
- case ServerVersionInt of
- 0..899: begin
- FSQLSpecifities[spDatabaseTable] := QuoteIdent('master')+'..'+QuoteIdent('sysdatabases');
- FSQLSpecifities[spDatabaseTableId] := QuoteIdent('dbid');
- FSQLSpecifities[spDbObjectsTable] := '..'+QuoteIdent('sysobjects');
- FSQLSpecifities[spDbObjectsCreateCol] := 'crdate';
- FSQLSpecifities[spDbObjectsUpdateCol] := '';
- FSQLSpecifities[spDbObjectsTypeCol] := 'xtype';
- end;
- else begin
- FSQLSpecifities[spDatabaseTable] := QuoteIdent('sys')+'.'+QuoteIdent('databases');
- FSQLSpecifities[spDatabaseTableId] := QuoteIdent('database_id');
- FSQLSpecifities[spDbObjectsTable] := '.'+QuoteIdent('sys')+'.'+QuoteIdent('objects');
- FSQLSpecifities[spDbObjectsCreateCol] := 'create_date';
- FSQLSpecifities[spDbObjectsUpdateCol] := 'modify_date';
- FSQLSpecifities[spDbObjectsTypeCol] := 'type';
- end;
- end;
// List of known IS tables
FInformationSchemaObjects.CommaText := 'CHECK_CONSTRAINTS,'+
'COLUMN_DOMAIN_USAGE,'+
@@ -3465,6 +3624,11 @@ function TAdoDBConnection.Ping(Reconnect: Boolean): Boolean;
if Reconnect then
Active := True;
end;
+ end
+ else begin
+ // Not active currently, reconnect
+ if Reconnect then
+ Active := True;
end;
Result := FActive;
// Restart keep-alive timer
@@ -3498,6 +3662,11 @@ function TPGConnection.Ping(Reconnect: Boolean): Boolean;
if Reconnect then
Active := True;
end;
+ end
+ else begin
+ // Not active currently, reconnect
+ if Reconnect then
+ Active := True;
end;
Result := FActive;
// Restart keep-alive timer
@@ -3531,6 +3700,11 @@ function TInterbaseConnection.Ping(Reconnect: Boolean): Boolean;
Log(lcDebug, 'Ping server ...');
if FActive then begin
FFDHandle.Ping;
+ end
+ else begin
+ // Not active currently, reconnect
+ if Reconnect then
+ Active := True;
end;
Result := FActive;
// Restart keep-alive timer
@@ -3542,7 +3716,7 @@ function TInterbaseConnection.Ping(Reconnect: Boolean): Boolean;
procedure TDBConnection.KeepAliveTimerEvent(Sender: TObject);
begin
// Ping server in intervals, without automatically reconnecting
- if Active and (FLockedByThread = nil) then
+ if Active and (not IsLockedByThread) then
Ping(False);
end;
@@ -3552,7 +3726,7 @@ procedure TDBConnection.KeepAliveTimerEvent(Sender: TObject);
}
procedure TDBConnection.Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL);
begin
- if (FLockedByThread <> nil) and (FLockedByThread.ThreadID <> GetCurrentThreadID) then begin
+ if IsLockedByThread and (FLockedByThread.ThreadID <> GetCurrentThreadID) then begin
Log(lcDebug, _('Waiting for running query to finish ...'));
try
FLockedByThread.WaitFor;
@@ -3569,6 +3743,17 @@ procedure TDBConnection.Query(SQL: String; DoStoreResult: Boolean=False; LogCate
end;
+procedure TDBConnection.Query(QueryId: TQueryId);
+begin
+ Query(FSqlProvider.GetSql(QueryId));
+end;
+
+procedure TDBConnection.Query(QueryId: TQueryId; const Args: array of const);
+begin
+ Query(FSqlProvider.GetSql(QueryId, Args));
+end;
+
+
procedure TMySQLConnection.Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TDBLogCategory=lcSQL);
var
QueryStatus: Integer;
@@ -3841,6 +4026,9 @@ procedure TInterbaseConnection.Query(SQL: String; DoStoreResult: Boolean=False;
SetLength(FLastRawResults, 0);
FdQuery := TFDQuery.Create(Self);
FdQuery.Connection := FFDHandle;
+ // Disable paging with 50 rows
+ FdQuery.FetchOptions.Mode := fmAll;
+ FdQuery.FetchOptions.RecsMax := -1;
// Todo: suppress mouse cursor updates
try
FdQuery.ResourceOptions.CmdExecTimeout := Parameters.QueryTimeout;
@@ -3891,7 +4079,7 @@ function TAdoDBConnection.GetLastResults: TDBQueryList;
Batch: TSQLBatch;
begin
Result := TDBQueryList.Create(False);
- Batch := TSQLBatch.Create;
+ Batch := TSQLBatch.Create(FParameters.NetTypeGroup);
Batch.SQL := FLastQuerySQL;
for i:=Low(FLastRawResults) to High(FLastRawResults) do begin
r := Parameters.CreateQuery(Self);
@@ -3925,7 +4113,75 @@ function TMySQLConnection.GetCreateCode(Obj: TDBObject): String;
end;
+function TPgConnection.GetCreateCode(Obj: TDBObject): String;
+var
+ ProcDetails: TDBQuery;
+ DataType: String;
+ ArgNames, ArgTypes, Arguments: TStringList;
+ i: Integer;
+begin
+ Result := '';
+ case Obj.NodeType of
+ lntView: begin
+ // Prefer pg_catalog tables. See http://www.heidisql.com/forum.php?t=16213#p16685
+ Result := 'CREATE VIEW ' + QuoteIdent(Obj.Name) + ' AS ';
+ if not Obj.IsMaterialized then begin // normal view
+ Result := Result + GetVar('SELECT '+QuoteIdent('definition')+
+ ' FROM '+QuoteIdent('pg_views')+
+ ' WHERE '+QuoteIdent('viewname')+'='+EscapeString(Obj.Name)+
+ ' AND '+QuoteIdent('schemaname')+'='+EscapeString(Obj.Schema)
+ );
+ end
+ else begin // materialized view
+ Result := Result + GetVar('SELECT '+QuoteIdent('definition')+
+ ' FROM '+QuoteIdent('pg_matviews')+
+ ' WHERE '+QuoteIdent('matviewname')+'='+EscapeString(Obj.Name)+
+ ' AND '+QuoteIdent('schemaname')+'='+EscapeString(Obj.Schema)
+ );
+ end;
+
+ end;
+ lntFunction, lntProcedure: begin
+ Result := 'CREATE '+Obj.GetObjType.ToUpper+' '+QuoteIdent(Obj.Name);
+ ProcDetails := GetResults('SELECT '+
+ QuoteIdent('p')+'.'+QuoteIdent('prosrc')+', '+
+ QuoteIdent('p')+'.'+QuoteIdent('proargnames')+', '+
+ QuoteIdent('p')+'.'+QuoteIdent('proargtypes')+', '+
+ QuoteIdent('p')+'.'+QuoteIdent('prorettype')+' '+
+ 'FROM '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_namespace')+' AS '+QuoteIdent('n')+' '+
+ 'JOIN '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_proc')+' AS '+QuoteIdent('p')+' ON '+QuoteIdent('p')+'.'+QuoteIdent('pronamespace')+' = '+QuoteIdent('n')+'.'+QuoteIdent('oid')+' '+
+ 'WHERE '+
+ QuoteIdent('n')+'.'+QuoteIdent('nspname')+'='+EscapeString(Obj.Database)+
+ 'AND '+QuoteIdent('p')+'.'+QuoteIdent('proname')+'='+EscapeString(Obj.Name)+
+ 'AND '+QuoteIdent('p')+'.'+QuoteIdent('proargtypes')+'='+EscapeString(Obj.ArgTypes)
+ );
+ ArgNames := Explode(',', Copy(ProcDetails.Col('proargnames'), 2, Length(ProcDetails.Col('proargnames'))-2));
+ ArgTypes := Explode(' ', Copy(ProcDetails.Col('proargtypes'), 1, Length(ProcDetails.Col('proargtypes'))));
+ Arguments := TStringList.Create;
+ for i:=0 to ArgNames.Count-1 do begin
+ if ArgTypes.Count > i then
+ DataType := GetDatatypeByNativeType(MakeInt(ArgTypes[i]), ArgNames[i]).Name
+ else
+ DataType := '';
+ Arguments.Add(ArgNames[i] + ' ' + DataType);
+ end;
+ Result := Result + '(' + Implode(', ', Arguments) + ') '+
+ 'RETURNS '+GetDatatypeByNativeType(MakeInt(ProcDetails.Col('prorettype'))).Name+' '+
+ 'AS $$ '+ProcDetails.Col('prosrc')+' $$'
+ // TODO: 'LANGUAGE SQL IMMUTABLE STRICT'
+ ;
+ end
+ else begin
+ // Let the generic method try to return code
+ Result := inherited;
+ end;
+ end;
+end;
+
+
function TSQLiteConnection.GetCreateCode(Obj: TDBObject): String;
+var
+ CreateList: TStringList;
begin
// PRAGMA table_info(customers):
// cid name type notnull dflt_value pk
@@ -3933,8 +4189,15 @@ function TSQLiteConnection.GetCreateCode(Obj: TDBObject): String;
// 1 FirstName NVARCHAR(40) 1 null 0
case Obj.NodeType of
lntTable: begin
+ CreateList := GetCol('SELECT '+QuoteIdent('sql')+' FROM '+QuoteIdent(Obj.Database)+'.sqlite_master'+
+ ' WHERE '+QuoteIdent('type')+' IN('+EscapeString('table')+', '+EscapeString('index')+')'+
+ ' AND tbl_name='+EscapeString(Obj.Name));
+ Result := Implode(';'+sLineBreak, CreateList);
+ CreateList.Free;
+ end;
+ lntView, lntTrigger: begin
Result := GetVar('SELECT '+QuoteIdent('sql')+' FROM '+QuoteIdent(Obj.Database)+'.sqlite_master'+
- ' WHERE '+QuoteIdent('type')+'='+EscapeString('table')+
+ ' WHERE '+QuoteIdent('type')+'='+EscapeString(Obj.ObjType.ToLower)+
' AND name='+EscapeString(Obj.Name));
end;
else begin
@@ -4011,11 +4274,7 @@ function TMySQLConnection.GetCreateViewCode(Database, Name: String): String;
function TDBConnection.GetCreateCode(Obj: TDBObject): String;
var
- ProcDetails: TDBQuery;
- DataType: String;
- ArgNames, ArgTypes, Arguments: TStringList;
Rows: TStringList;
- i: Integer;
TableCols: TTableColumnList;
TableCol: TTableColumn;
TableKeys: TTableKeyList;
@@ -4030,43 +4289,46 @@ function TDBConnection.GetCreateCode(Obj: TDBObject): String;
Result := 'CREATE TABLE '+QuoteIdent(Obj.Name)+' (';
TableCols := Obj.GetTableColumns;
for TableCol in TableCols do begin
- Result := Result + CRLF + #9 + TableCol.SQLCode + ',';
+ Result := Result + sLineBreak + CodeIndent + TableCol.SQLCode + ',';
end;
TableCols.Free;
TableKeys := Obj.GetTableKeys;
for TableKey in TableKeys do begin
- Result := Result + CRLF + #9 + TableKey.SQLCode + ',';
+ if TableKey.InsideCreateCode then
+ Result := Result + sLineBreak + CodeIndent + TableKey.SQLCode + ',';
end;
TableKeys.Free;
TableForeignKeys := Obj.GetTableForeignKeys;
for TableForeignKey in TableForeignKeys do begin
- Result := Result + CRLF + #9 + TableForeignKey.SQLCode(True) + ',';
+ Result := Result + sLineBreak + CodeIndent + TableForeignKey.SQLCode(True) + ',';
end;
TableForeignKeys.Free;
TableCheckConstraints := Obj.GetTableCheckConstraints;
for TableCheckConstraint in TableCheckConstraints do begin
- Result := Result + CRLF + #9 + TableCheckConstraint.SQLCode + ',';
+ Result := Result + sLineBreak + CodeIndent + TableCheckConstraint.SQLCode + ',';
end;
TableCheckConstraints.Free;
Delete(Result, Length(Result), 1);
- Result := Result + CRLF + ')';
+ Result := Result + sLineBreak + ')';
+
+ TableKeys := Obj.GetTableKeys;
+ for TableKey in TableKeys do begin
+ if not TableKey.InsideCreateCode then begin
+ if TableKeys.IndexOf(TableKey) = 0 then
+ Result := Result + ';';
+ Result := Result + sLineBreak + TableKey.SQLCode + ';';
+ end;
+ end;
+ TableKeys.Free;
end;
lntView: begin
case FParameters.NetTypeGroup of
- ngPgSQL: begin
- // Prefer pg_catalog tables. See http://www.heidisql.com/forum.php?t=16213#p16685
- Result := 'CREATE VIEW ' + QuoteIdent(Obj.Name) + ' AS ' + GetVar('SELECT '+QuoteIdent('definition')+
- ' FROM '+QuoteIdent('pg_views')+
- ' WHERE '+QuoteIdent('viewname')+'='+EscapeString(Obj.Name)+
- ' AND '+QuoteIdent('schemaname')+'='+EscapeString(Obj.Schema)
- );
- end;
ngMSSQL: begin
// Overcome 4000 character limit in IS.VIEW_DEFINITION
// See http://www.heidisql.com/forum.php?t=21097
@@ -4108,36 +4370,6 @@ function TDBConnection.GetCreateCode(Obj: TDBObject): String;
Result := Implode('', Rows);
Rows.Free;
end;
- ngPgSQL: begin
- Result := 'CREATE FUNCTION '+QuoteIdent(Obj.Name);
- ProcDetails := GetResults('SELECT '+
- QuoteIdent('p')+'.'+QuoteIdent('prosrc')+', '+
- QuoteIdent('p')+'.'+QuoteIdent('proargnames')+', '+
- QuoteIdent('p')+'.'+QuoteIdent('proargtypes')+', '+
- QuoteIdent('p')+'.'+QuoteIdent('prorettype')+' '+
- 'FROM '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_namespace')+' AS '+QuoteIdent('n')+' '+
- 'JOIN '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_proc')+' AS '+QuoteIdent('p')+' ON '+QuoteIdent('p')+'.'+QuoteIdent('pronamespace')+' = '+QuoteIdent('n')+'.'+QuoteIdent('oid')+' '+
- 'WHERE '+
- QuoteIdent('n')+'.'+QuoteIdent('nspname')+'='+EscapeString(Obj.Database)+
- 'AND '+QuoteIdent('p')+'.'+QuoteIdent('proname')+'='+EscapeString(Obj.Name)+
- 'AND '+QuoteIdent('p')+'.'+QuoteIdent('proargtypes')+'='+EscapeString(Obj.ArgTypes)
- );
- ArgNames := Explode(',', Copy(ProcDetails.Col('proargnames'), 2, Length(ProcDetails.Col('proargnames'))-2));
- ArgTypes := Explode(' ', Copy(ProcDetails.Col('proargtypes'), 1, Length(ProcDetails.Col('proargtypes'))));
- Arguments := TStringList.Create;
- for i:=0 to ArgNames.Count-1 do begin
- if ArgTypes.Count > i then
- DataType := GetDatatypeByNativeType(MakeInt(ArgTypes[i]), ArgNames[i]).Name
- else
- DataType := '';
- Arguments.Add(ArgNames[i] + ' ' + DataType);
- end;
- Result := Result + '(' + Implode(', ', Arguments) + ') '+
- 'RETURNS '+GetDatatypeByNativeType(MakeInt(ProcDetails.Col('prorettype'))).Name+' '+
- 'AS $$ '+ProcDetails.Col('prosrc')+' $$'
- // TODO: 'LANGUAGE SQL IMMUTABLE STRICT'
- ;
- end;
else begin
Result := GetVar('SELECT ROUTINE_DEFINITION'+
' FROM '+InfSch+'.ROUTINES'+
@@ -4191,7 +4423,7 @@ procedure TDBConnection.PrefetchCreateCode(Objects: TDBObjectList);
// SHOW CREATE TRIGGER was introduced in MySQL 5.1.21
// See #111
if Obj.NodeType = lntTrigger then
- UseIt := UseIt and (ServerVersionInt >= 50121);
+ UseIt := UseIt and FSqlProvider.Has(qShowCreateTrigger);
if UseIt then
Queries.Add('SHOW CREATE '+UpperCase(Obj.ObjType)+' '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name));
end;
@@ -4223,7 +4455,6 @@ procedure TDBConnection.PrefetchCreateCode(Objects: TDBObjectList);
procedure TDBConnection.SetDatabase(Value: String);
var
s: String;
- UseQuery: String;
begin
Log(lcDebug, 'SetDatabase('+Value+'), FDatabase: '+FDatabase);
if Value <> FDatabase then begin
@@ -4243,9 +4474,8 @@ procedure TDBConnection.SetDatabase(Value: String);
s := s + ', ' + EscapeString('public');
end else
s := QuoteIdent(Value);
- UseQuery := GetSQLSpecifity(spUSEQuery);
- if not UseQuery.IsEmpty then begin
- Query(GetSQLSpecifity(spUSEQuery, [s]), False);
+ if FSqlProvider.Has(qUSEQuery) then begin
+ Query(qUSEQuery, [s]);
end;
FDatabase := DeQuoteIdent(Value);
if Assigned(FOnDatabaseChanged) then
@@ -4276,7 +4506,7 @@ procedure TDBConnection.DetectUSEQuery(SQL: String);
// Detect query for switching current working database or schema
rx := TRegExpr.Create;
rx.ModifierI := True;
- rx.Expression := '^'+GetSQLSpecifity(spUSEQuery);
+ rx.Expression := '^'+FSqlProvider.GetSql(qUSEQuery);
Quotes := QuoteRegExprMetaChars(FQuoteChars+''';');
rx.Expression := StringReplace(rx.Expression, ' ', '\s+', [rfReplaceAll]);
rx.Expression := StringReplace(rx.Expression, '%s', '['+Quotes+']?([^'+Quotes+']+)['+Quotes+']*', [rfReplaceAll]);
@@ -4385,17 +4615,21 @@ procedure TMySQLConnection.SetCharacterSet(CharsetName: String);
FStatementNum := 0;
Log(lcInfo, 'Changing character set from '+CharacterSet+' to '+CharsetName);
Return := FLib.mysql_set_character_set(FHandle, PAnsiChar(Utf8Encode(CharsetName)));
+ // Return value never seems to be <> 0, not even on v3.23 servers, we check it anyway:
if Return <> 0 then
- raise EDbError.Create(LastErrorMsg)
- else
- FIsUnicode := CharsetName.StartsWith('utf', True);
+ raise EDbError.Create(LastErrorMsg);
+ // Check opt-out setting: if disabled, align the internal IsUnicode flag to the connection charset
+ if not FParameters.ForceUnicode then begin
+ FIsUnicode := CharacterSet.StartsWith('utf', True);
+ Log(lcInfo, 'ForceUnicode disabled in settings. Internal IsUnicode flag is now: ' + FIsUnicode.ToInteger.ToString)
+ end;
end;
procedure TPGConnection.SetCharacterSet(CharsetName: String);
begin
// See issue #22
- Query('SET CLIENT_ENCODING TO ' + EscapeString('UTF8'));
+ Query('SET CLIENT_ENCODING TO ' + EscapeString(CharsetName));
end;
@@ -4615,27 +4849,41 @@ function TDBConnection.NdbClusterVersionInt: Integer;
end;
-function TDBConnection.GetAllDatabases: TStringList;
+procedure TDBConnection.ShowWarnings;
+begin
+ // Do nothing by default. SHOW WARNINGS is MySQL only.
+end;
+
+
+procedure TMySQLConnection.ShowWarnings;
var
- rx: TRegExpr;
- dbname: String;
+ Warnings: TDBQuery;
+ Info: String;
+begin
+ // Log warnings
+ // SHOW WARNINGS is implemented as of MySQL 4.1.0
+ if (WarningCount > 0) and FSqlProvider.Has(qShowWarnings) then begin
+ Warnings := GetResults(FSqlProvider.GetSql(qShowWarnings));
+ while not Warnings.Eof do begin
+ Log(lcError, _(Warnings.Col('Level')) + ': ('+Warnings.Col('Code')+') ' + Warnings.Col('Message'));
+ Warnings.Next;
+ end;
+ Warnings.Free;
+ end;
+ Info := DecodeAPIString(FLib.mysql_info(FHandle));
+ if not Info.IsEmpty then begin
+ Log(lcInfo, _(SLogPrefixInfo) + ': ' + Info);
+ end;
+end;
+
+
+function TDBConnection.GetAllDatabases: TStringList;
begin
// Get user passed delimited list
+ // Ignore value in case of ntSQLiteEncrypted, when AllDatabasesStr holds encryption parameters
if not Assigned(FAllDatabases) then begin
- if FParameters.AllDatabasesStr <> '' then begin
- FAllDatabases := TStringList.Create;
- rx := TRegExpr.Create;
- rx.Expression := '[^;]+';
- rx.ModifierG := True;
- if rx.Exec(FParameters.AllDatabasesStr) then while true do begin
- // Add if not a duplicate
- dbname := Trim(rx.Match[0]);
- if FAllDatabases.IndexOf(dbname) = -1 then
- FAllDatabases.Add(dbname);
- if not rx.ExecNext then
- break;
- end;
- rx.Free;
+ if (FParameters.AllDatabasesStr <> '') and (not FParameters.IsAnySQLite) then begin
+ FAllDatabases := FParameters.AllDatabasesList;
ApplyIgnoreDatabasePattern(FAllDatabases);
end;
end;
@@ -4670,7 +4918,7 @@ function TAdoDBConnection.GetAllDatabases: TStringList;
Result := inherited;
if not Assigned(Result) then begin
try
- FAllDatabases := GetCol('SELECT '+QuoteIdent('name')+' FROM '+GetSQLSpecifity(spDatabaseTable)+' ORDER BY '+QuoteIdent('name'));
+ FAllDatabases := GetCol('SELECT '+QuoteIdent('name')+' FROM '+FSqlProvider.GetSql(qDatabaseTable)+' ORDER BY '+QuoteIdent('name'));
except on E:EDbError do
FAllDatabases := TStringList.Create;
end;
@@ -4801,7 +5049,7 @@ procedure TDBConnection.PrefetchResults(SQL: String);
i: Integer;
begin
Query(SQL, True);
- Batch := TSQLBatch.Create;
+ Batch := TSQLBatch.Create(FParameters.NetTypeGroup);
Batch.SQL := SQL;
FreeAndNil(FPrefetchResults);
FPrefetchResults := TDBQueryList.Create(True);
@@ -4857,7 +5105,7 @@ procedure TDBConnection.Log(Category: TDBLogCategory; Msg: String);
begin
// If in a thread, synchronize logging with the main thread. Logging within a thread
// causes SynEdit to throw exceptions left and right.
- if (FLockedByThread <> nil) and (FLockedByThread.ThreadID = GetCurrentThreadID) then begin
+ if IsLockedByThread and (FLockedByThread.ThreadID = GetCurrentThreadID) then begin
(FLockedByThread as TQueryThread).LogFromThread(Msg, Category);
Exit;
end;
@@ -4986,6 +5234,11 @@ function TDBConnection.EscapeString(Text: String; ProcessJokerChars: Boolean=fal
if DoQuote then begin
// Add surrounding single quotes
Result := FStringQuoteChar + Result + FStringQuoteChar;
+
+ // Support international characters with National prefix on MSSQL, see #1115, #2250, #41.
+ // Previously only done in some callers of EscapeString(), and only for column types dbdtNchar, dbdtNvarchar, dbdtNtext.
+ if FParameters.IsAnyMSSQL and (ServerVersionInt >= 1100) then
+ Result := 'N' + Result;
end;
end;
@@ -4993,11 +5246,13 @@ function TDBConnection.EscapeString(Text: String; ProcessJokerChars: Boolean=fal
function TDBConnection.EscapeString(Text: String; Datatype: TDBDatatype): String;
var
DoQuote: Boolean;
+ ValuePrefix: String;
const
CategoriesNeedQuote = [dtcText, dtcBinary, dtcTemporal, dtcSpatial, dtcOther];
begin
// Quote text based on the passed datatype
DoQuote := Datatype.Category in CategoriesNeedQuote;
+ ValuePrefix := '';
case Datatype.Category of
// Some special cases
dtcBinary: begin
@@ -5007,11 +5262,13 @@ function TDBConnection.EscapeString(Text: String; Datatype: TDBDatatype): String
dtcInteger, dtcReal: begin
if (not IsNumeric(Text)) and (not IsHex(Text)) then
DoQuote := True;
- if Datatype.Index = dbdtBit then
+ if (Datatype.Index = dbdtBit) and FParameters.IsAnyMySQL then begin
DoQuote := True;
+ ValuePrefix := 'b';
+ end;
end;
end;
- Result := EscapeString(Text, False, DoQuote);
+ Result := ValuePrefix + EscapeString(Text, False, DoQuote);
end;
@@ -5081,6 +5338,53 @@ function TDBConnection.UnescapeString(Text: String): String;
end;
+function TDBConnection.EscapeBin(BinValue: String): String;
+var
+ BinLen: Integer;
+ Ansi: AnsiString;
+begin
+ // Return a binary value as hex AnsiString
+ Ansi := AnsiString(BinValue);
+ BinLen := Length(Ansi);
+ if BinLen = 0 then begin
+ Result := EscapeString('');
+ end else begin
+ if IsHex(BinValue) then begin
+ Result := BinValue; // Already hex encoded
+ end else begin
+ SetLength(Result, BinLen*2);
+ BinToHex(PAnsiChar(Ansi), PChar(Result), BinLen);
+ Result := '0x' + Result;
+ end;
+ if AppSettings.ReadBool(asLowercaseHex) then
+ Result := Result.ToLowerInvariant;
+ end;
+end;
+
+
+function TDBConnection.EscapeBin(var ByteData: TBytes): String;
+var
+ BinLen: Integer;
+ Ansi: AnsiString;
+begin
+ BinLen := Length(ByteData);
+ SetString(Ansi, PAnsiChar(ByteData), BinLen);
+ if BinLen = 0 then begin
+ Result := EscapeString('');
+ end else begin
+ if IsHex(String(Ansi)) then begin
+ Result := String(Ansi); // Already hex encoded
+ end else begin
+ SetLength(Result, BinLen*2);
+ BinToHex(PAnsiChar(Ansi), PChar(Result), BinLen);
+ Result := '0x' + Result;
+ end;
+ if AppSettings.ReadBool(asLowercaseHex) then
+ Result := Result.ToLowerInvariant;
+ end;
+end;
+
+
function TDBConnection.ExtractLiteral(var SQL: String; Prefix: String): String;
var
i, LitStart: Integer;
@@ -5169,8 +5473,9 @@ function TDBConnection.DeQuoteIdent(Identifier: String; Glue: Char=#0): String;
function TDBConnection.CleanIdent(Identifier: string): string;
begin
Result := Trim(Identifier);
- Result := LowerCase(Result);
- Result := ReplaceRegExpr('[^a-z0-9]', Result, '_');
+ // See issue #1947:
+ //Result := LowerCase(Result);
+ Result := ReplaceRegExpr('[^A-Za-z0-9]', Result, '_');
Result := ReplaceRegExpr('_+', Result, '_');
end;
@@ -5321,40 +5626,14 @@ function TDBConnection.GetCollationTable: TDBQuery;
begin
Log(lcDebug, 'Fetching list of collations ...');
Ping(True);
- Result := FCollationTable;
-end;
-
-
-function TMySQLConnection.GetCollationTable: TDBQuery;
-begin
- inherited;
- if (not Assigned(FCollationTable)) and (ServerVersionInt >= 40100) then
- FCollationTable := GetResults('SHOW COLLATION');
- if Assigned(FCollationTable) then
- FCollationTable.First;
- Result := FCollationTable;
-end;
-
-
-function TAdoDBConnection.GetCollationTable: TDBQuery;
-begin
- inherited;
- if (not Assigned(FCollationTable)) then
- FCollationTable := GetResults('SELECT '+EscapeString('')+' AS '+QuoteIdent('Collation')+', '+
- EscapeString('')+' AS '+QuoteIdent('Charset')+', 0 AS '+QuoteIdent('Id')+', '+
- EscapeString('')+' AS '+QuoteIdent('Default')+', '+EscapeString('')+' AS '+QuoteIdent('Compiled')+', '+
- '1 AS '+QuoteIdent('Sortlen'));
- if Assigned(FCollationTable) then
- FCollationTable.First;
- Result := FCollationTable;
-end;
-
-
-function TInterbaseConnection.GetCollationTable: TDBQuery;
-begin
- inherited;
- if not Assigned(FCollationTable) then begin
- FCollationTable := GetResults('SELECT RDB$COLLATION_NAME AS '+QuoteIdent('Collation')+', RDB$COLLATION_ID AS '+QuoteIdent('Id')+', RDB$CHARACTER_SET_ID FROM RDB$COLLATIONS');
+ if (not Assigned(FCollationTable)) and FSqlProvider.Has(qGetCollations) then begin
+ if FSqlProvider.Has(qGetCollationsExtended) then try
+ FCollationTable := GetResults(FSqlProvider.GetSql(qGetCollationsExtended));
+ except
+ on E:EDbError do;
+ end;
+ if not Assigned(FCollationTable) then
+ FCollationTable := GetResults(FSqlProvider.GetSql(qGetCollations));
end;
if Assigned(FCollationTable) then
FCollationTable.First;
@@ -5375,69 +5654,12 @@ function TDBConnection.GetCollationList: TStringList;
end;
-function TSQLiteConnection.GetCollationList: TStringList;
-begin
- // See https://www.sqlite.org/datatype3.html#collation_sequence_examples
- Result := TStringList.Create;
- Result.CommaText := 'nocase,binary,rtrim';
-end;
-
-
function TDBConnection.GetCharsetTable: TDBQuery;
begin
Log(lcDebug, 'Fetching charset list ...');
Ping(True);
- Result := nil;
-end;
-
-
-function TMySQLConnection.GetCharsetTable: TDBQuery;
-begin
- inherited;
- if (not Assigned(FCharsetTable)) and (ServerVersionInt >= 40100) then
- FCharsetTable := GetResults('SHOW CHARSET');
- Result := FCharsetTable;
-end;
-
-
-function TAdoDBConnection.GetCharsetTable: TDBQuery;
-begin
- inherited;
- if not Assigned(FCharsetTable) then
- FCharsetTable := GetResults('SELECT '+QuoteIdent('name')+' AS '+QuoteIdent('Charset')+', '+QuoteIdent('description')+' AS '+QuoteIdent('Description')+
- ' FROM '+QuotedDbAndTableName('master', 'syscharsets')
- );
- Result := FCharsetTable;
-end;
-
-
-function TPgConnection.GetCharsetTable: TDBQuery;
-begin
- inherited;
- if not Assigned(FCharsetTable) then
- FCharsetTable := GetResults('SELECT PG_ENCODING_TO_CHAR('+QuoteIdent('encid')+') AS '+QuoteIdent('Charset')+', '+EscapeString('')+' AS '+QuoteIdent('Description')+' FROM ('+
- 'SELECT '+QuoteIdent('conforencoding')+' AS '+QuoteIdent('encid')+' FROM '+QuoteIdent('pg_conversion')+', '+QuoteIdent('pg_database')+' '+
- 'WHERE '+QuoteIdent('contoencoding')+'='+QuoteIdent('encoding')+' AND '+QuoteIdent('datname')+'=CURRENT_DATABASE()) AS '+QuoteIdent('e')
- );
- Result := FCharsetTable;
-end;
-
-
-function TSQLiteConnection.GetCharsetTable;
-begin
- inherited;
- if not Assigned(FCharsetTable) then begin
- //FCharsetTable := // Todo!
- end;
- Result := FCharsetTable;
-end;
-
-
-function TInterbaseConnection.GetCharsetTable: TDBQuery;
-begin
- inherited;
- if not Assigned(FCharsetTable) then
- FCharsetTable := GetResults('SELECT RDB$CHARACTER_SET_NAME AS '+QuoteIdent('Charset')+', RDB$CHARACTER_SET_NAME AS '+QuoteIdent('Description')+' FROM RDB$CHARACTER_SETS');
+ if (not Assigned(FCharsetTable)) and FSqlProvider.Has(qGetCharsets) then
+ FCharsetTable := GetResults(FSqlProvider.GetSql(qGetCharsets));
Result := FCharsetTable;
end;
@@ -5465,7 +5687,7 @@ function TDBConnection.GetSessionVariables(Refresh: Boolean): TDBQuery;
if (not Assigned(FSessionVariables)) or Refresh then begin
if Assigned(FSessionVariables) then
FreeAndNil(FSessionVariables);
- FSessionVariables := GetResults(GetSQLSpecifity(spSessionVariables));
+ FSessionVariables := GetResults(FSqlProvider.GetSql(qSessionVariables));
end;
FSessionVariables.First;
Result := FSessionVariables;
@@ -5520,7 +5742,7 @@ function TDBConnection.GetLockedTableCount(db: String): Integer;
begin
// Find tables which are currently locked.
// Used to prevent waiting time in GetDBObjects.
- sql := GetSQLSpecifity(spLockedTables);
+ sql := FSqlProvider.GetSql(qLockedTables);
Result := 0;
if not sql.IsEmpty then try
LockedTables := GetCol(Format(sql, [QuoteIdent(db,False)]));
@@ -5555,21 +5777,22 @@ function TDBConnection.IsTextDefault(Value: String; Tp: TDBDatatype): Boolean;
// Inexact fallback detection, wrong if MariaDB allows "0+1" as expression at some point
Result := Result or Value.IsEmpty or IsInt(Value[1]);
end else if FParameters.IsAnyMySQL then begin
- if ServerVersionInt <= 80013 then begin
- // Only MySQL case with expression in default value is as follows:
- if (Tp.Category = dtcTemporal) and Value.StartsWith('CURRENT_TIMESTAMP', True) then begin
- Result := False;
- end else begin
- Result := True;
- end;
+ // Only MySQL case with expression in default value is as follows:
+ if (Tp.Category = dtcTemporal) and Value.StartsWith('CURRENT_TIMESTAMP', True) then begin
+ Result := False;
end
- else begin
- // https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-type-defaults-explicit
- // MySQL 8.0.13+ expect expressions to be wrapped in (..) when you create a table.
- // But checking if first char is an opening parenthesis does not work here, as we get the expression
- // from IS.COLUMNS, not from SHOW CREATE TABLE. So here's a workaround for distinguishing text
- // from an expression:
- Result := not Value.Contains('(');
+ else if Tp.Index = dbdtBit then
+ Result := False
+ else case ServerVersionInt of
+ 0..80013: Result := True;
+ else begin
+ // https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-type-defaults-explicit
+ // MySQL 8.0.13+ expect expressions to be wrapped in (..) when you create a table.
+ // But checking if first char is an opening parenthesis does not work here, as we get the expression
+ // from IS.COLUMNS, not from SHOW CREATE TABLE. So here's a workaround for distinguishing text
+ // from an expression:
+ Result := not Value.Contains('(');
+ end;
end;
end else if FParameters.IsAnyPostgreSQL then begin
// text only if starting with '
@@ -5586,26 +5809,43 @@ function TDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
TableIdx: Integer;
ColQuery: TDBQuery;
Col: TTableColumn;
- dt, DefText, ExtraText, MaxLen: String;
+ dt, DefText, ExtraText, MaxLen, ColSQL: String;
begin
- // Generic: query table columns from IS.COLUMNS
+ // Generic: query table columns from IS.COLUMNS or query from provider
Log(lcDebug, 'Getting fresh columns for '+Table.QuotedDbAndTableName);
Result := TTableColumnList.Create(True);
- TableIdx := InformationSchemaObjects.IndexOf('columns');
- if TableIdx = -1 then begin
- // No is.columns table available
- Exit;
+
+ if FSqlProvider.Has(qGetTableColumns) then begin
+ ColSQL := FSqlProvider.GetSql(qGetTableColumns, [EscapeString(Table.Schema), EscapeString(Table.Name)]);
+ end
+ else begin
+ TableIdx := InformationSchemaObjects.IndexOf('columns');
+ if TableIdx = -1 then begin
+ // No is.columns table available
+ Exit;
+ end;
+ ColSQL := 'SELECT * FROM '+QuoteIdent(InfSch)+'.'+QuoteIdent(InformationSchemaObjects[TableIdx])+
+ ' WHERE '+Table.SchemaClauseIS('TABLE')+' AND TABLE_NAME='+EscapeString(Table.Name)+
+ ' ORDER BY ORDINAL_POSITION';
end;
- ColQuery := GetResults('SELECT * FROM '+QuoteIdent(InfSch)+'.'+QuoteIdent(InformationSchemaObjects[TableIdx])+
- ' WHERE '+Table.SchemaClauseIS('TABLE')+' AND TABLE_NAME='+EscapeString(Table.Name)+
- ' ORDER BY ORDINAL_POSITION');
+ ColQuery := GetResults(ColSQL);
+
while not ColQuery.Eof do begin
Col := TTableColumn.Create(Self);
Result.Add(Col);
Col.Name := ColQuery.Col('COLUMN_NAME');
Col.OldName := Col.Name;
- // PG/MySQL use different fields:
- dt := IfThen(ColQuery.ColExists('COLUMN_TYPE'), 'COLUMN_TYPE', 'DATA_TYPE');
+ // MySQL and most commonly used field:
+ if ColQuery.ColExists('COLUMN_TYPE') then
+ dt := 'COLUMN_TYPE'
+ // PostgreSQL:
+ else if ColQuery.ColExists('DATA_TYPE') then begin
+ // user defined types, like CITEXT:
+ if (ColQuery.Col('DATA_TYPE').ToLower = 'user-defined') and ColQuery.ColExists('UDT_NAME') then
+ dt := 'UDT_NAME'
+ else
+ dt := 'DATA_TYPE';
+ end;
Col.ParseDatatype(ColQuery.Col(dt));
// PG/MSSQL don't include length in data type
if Col.LengthSet.IsEmpty and Col.DataType.HasLength then begin
@@ -5619,7 +5859,8 @@ function TDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
end;
end;
dtcInteger: begin
- if not ColQuery.IsNull('NUMERIC_PRECISION') then begin
+ if (not ColQuery.IsNull('NUMERIC_PRECISION')) and Has(frIntegerDisplayWidth) then begin
+ // Integer display width is deprecated as of MySQL 8.0.17
MaxLen := ColQuery.Col('NUMERIC_PRECISION');
end;
end;
@@ -5646,24 +5887,26 @@ function TDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
Col.Collation := ColQuery.Col('COLLATION_NAME');
// MSSQL has no expression
Col.GenerationExpression := ColQuery.Col('GENERATION_EXPRESSION', True);
+ Col.GenerationExpression := UnescapeString(Col.GenerationExpression);
// PG has no extra:
ExtraText := ColQuery.Col('EXTRA', True);
Col.Virtuality := RegExprGetMatch('\b(\w+)\s+generated\b', ExtraText.ToLowerInvariant, 1);
Col.Invisible := ExecRegExprI('\binvisible\b', ExtraText);
Col.AllowNull := ColQuery.Col('IS_NULLABLE').ToLowerInvariant = 'yes';
+ Col.SRID := StrToUIntDef(ColQuery.Col('SRS_ID', True), 0);
DefText := ColQuery.Col('COLUMN_DEFAULT');
Col.OnUpdateType := cdtNothing;
- if ColQuery.Col('COLUMN_DEFAULT').StartsWith('nextval(', True) then begin
+ if DefText.StartsWith('nextval(', True) then begin
// PG auto increment
Col.DefaultType := cdtAutoInc;
- Col.DefaultText := ColQuery.Col('COLUMN_DEFAULT');
+ Col.DefaultText := DefText;
end
else if ExecRegExpr('\bauto_increment\b', ExtraText.ToLowerInvariant) then begin
// MySQL auto increment
Col.DefaultType := cdtAutoInc;
- Col.DefaultText := Col.AutoIncName;
+ Col.DefaultText := FSqlProvider.GetSql(qAutoInc);
end
else if DefText.ToLowerInvariant = 'null' then begin
Col.DefaultType := cdtNull;
@@ -5751,7 +5994,7 @@ function TMySQLConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
Col.OnUpdateType := cdtNothing;
if ExecRegExpr('^auto_increment$', ExtraText.ToLowerInvariant) then begin
Col.DefaultType := cdtAutoInc;
- Col.DefaultText := Col.AutoIncName;
+ Col.DefaultText := FSqlProvider.GetSql(qAutoInc);
end else if ColQuery.IsNull('Default') then begin
Col.DefaultType := cdtNothing;
end else if IsTextDefault(DefText, Col.DataType) then begin
@@ -5815,34 +6058,6 @@ function TAdoDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
end;
-function TPgConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
-var
- Comments: TDBQuery;
- TableCol: TTableColumn;
-begin
- Result := inherited;
- // Column comments in Postgre. See issue #859
- // Todo: add current schema to WHERE clause?
- Comments := GetResults('SELECT a.attname AS column, des.description AS comment'+
- ' FROM pg_attribute AS a, pg_description AS des, pg_class AS pgc'+
- ' WHERE'+
- ' pgc.oid = a.attrelid'+
- ' AND des.objoid = pgc.oid'+
- ' AND pg_table_is_visible(pgc.oid)'+
- ' AND pgc.relname = '+EscapeString(Table.Name)+
- ' AND a.attnum = des.objsubid'
- );
- while not Comments.Eof do begin
- for TableCol in Result do begin
- if TableCol.Name = Comments.Col('column') then begin
- TableCol.Comment := Comments.Col('comment');
- Break;
- end;
- end;
- Comments.Next;
- end;
-end;
-
function TSQLiteConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
var
ColQuery: TDBQuery;
@@ -5852,7 +6067,7 @@ function TSQLiteConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
// Todo: include database name
// Todo: default values
Result := TTableColumnList.Create(True);
- ColQuery := GetResults('SELECT * FROM '+QuoteIdent(Table.Database)+'.pragma_table_info('+EscapeString(Table.Name)+')');
+ ColQuery := GetResults(FSqlProvider.GetSql(qGetTableColumns, [EscapeString(Table.Name), EscapeString(Table.Database)]));
while not ColQuery.Eof do begin
Col := TTableColumn.Create(Self);
Result.Add(Col);
@@ -5864,6 +6079,11 @@ function TSQLiteConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
Col.DefaultText := '';
Col.OnUpdateType := cdtNothing;
Col.OnUpdateText := '';
+ case StrToIntDef(ColQuery.Col('hidden'), 0) of
+ 1: Col.Invisible := True;
+ 2: Col.Virtuality := 'VIRTUAL';
+ 3: Col.Virtuality := 'STORED';
+ end;
ColQuery.Next;
end;
ColQuery.Free;
@@ -5877,24 +6097,7 @@ function TInterbaseConnection.GetTableColumns(Table: TDBObject): TTableColumnLis
begin
// Todo
Result := TTableColumnList.Create(True);
- ColQuery := GetResults('SELECT r.RDB$FIELD_NAME AS field_name,'+
- ' r.RDB$DESCRIPTION AS field_description,'+
- ' r.RDB$DEFAULT_VALUE AS field_default_value,'+
- ' r.RDB$NULL_FLAG AS null_flag,'+
- ' f.RDB$FIELD_LENGTH AS field_length,'+
- ' f.RDB$FIELD_PRECISION AS field_precision,'+
- ' f.RDB$FIELD_SCALE AS field_scale,'+
- ' f.RDB$FIELD_TYPE AS field_type,'+
- ' f.RDB$FIELD_SUB_TYPE AS field_subtype,'+
- ' coll.RDB$COLLATION_NAME AS field_collation,'+
- ' cset.RDB$CHARACTER_SET_NAME AS field_charset'+
- ' FROM RDB$RELATION_FIELDS r'+
- ' LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME'+
- ' LEFT JOIN RDB$CHARACTER_SETS cset ON f.RDB$CHARACTER_SET_ID = cset.RDB$CHARACTER_SET_ID'+
- ' LEFT JOIN RDB$COLLATIONS coll ON f.RDB$COLLATION_ID = coll.RDB$COLLATION_ID'+
- ' AND F.RDB$CHARACTER_SET_ID = COLL.RDB$CHARACTER_SET_ID'+
- ' WHERE r.RDB$RELATION_NAME='+EscapeString(Table.Name)+
- ' ORDER BY r.RDB$FIELD_POSITION');
+ ColQuery := GetResults(FSqlProvider.GetSql(qGetTableColumns, [EscapeString(Table.Name)]));
while not ColQuery.Eof do begin
Col := TTableColumn.Create(Self);
Result.Add(Col);
@@ -5949,6 +6152,7 @@ function TDBConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
end;
NewKey.Columns.Add(KeyQuery.Col('COLUMN_NAME'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
end;
KeyQuery.Next;
end;
@@ -5980,6 +6184,7 @@ function TMySQLConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
end;
NewKey.Columns.Add(ColQuery.Col('name'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
ColQuery.Next;
end;
ColQuery.Free;
@@ -5999,6 +6204,7 @@ function TMySQLConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
while not ColQuery.Eof do begin
NewKey.Columns.Add(ColQuery.Col('name'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
ColQuery.Next;
end;
ColQuery.Free;
@@ -6008,7 +6214,7 @@ function TMySQLConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
end else begin
- KeyQuery := GetResults('SHOW INDEXES FROM '+QuoteIdent(Table.Name)+' FROM '+QuoteIdent(Table.Database));
+ KeyQuery := GetResults('SHOW KEYS FROM '+QuoteIdent(Table.Name)+' FROM '+QuoteIdent(Table.Database));
NewKey := nil;
while not KeyQuery.Eof do begin
if (not Assigned(NewKey)) or (NewKey.Name <> KeyQuery.Col('Key_name')) then begin
@@ -6024,16 +6230,30 @@ function TMySQLConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
NewKey.IndexType := TTableKey.FULLTEXT
else if CompareText(KeyQuery.Col('Index_type'), TTableKey.SPATIAL) = 0 then
NewKey.IndexType := TTableKey.SPATIAL
+ else if CompareText(KeyQuery.Col('Index_type'), TTableKey.VECTOR) = 0 then
+ NewKey.IndexType := TTableKey.VECTOR
else
NewKey.IndexType := TTableKey.KEY;
NewKey.OldIndexType := NewKey.IndexType;
if ExecRegExpr('(BTREE|HASH)', KeyQuery.Col('Index_type')) then
NewKey.Algorithm := KeyQuery.Col('Index_type');
NewKey.Comment := KeyQuery.Col('Index_comment', True);
+ if KeyQuery.ColumnExists('Visible') then // mysql 8
+ NewKey.Visible := SameText(KeyQuery.Col('Visible'), 'yes')
+ else if KeyQuery.ColumnExists('Ignored') then // mariadb 10.6
+ NewKey.Visible := SameText(KeyQuery.Col('Ignored'), 'NO');
+ end;
+ if KeyQuery.ColumnExists('Expression') and (not KeyQuery.IsNull('Expression')) then begin
+ // Functional key part: enclose expression within parentheses to distinguish them from columns (issue #1777)
+ NewKey.Columns.Add('('+KeyQuery.Col('Expression')+')');
+ end
+ else begin
+ // Normal column
+ NewKey.Columns.Add(KeyQuery.Col('Column_name'));
end;
- NewKey.Columns.Add(KeyQuery.Col('Column_name'));
- if NewKey.IndexType = TTableKey.SPATIAL then
- NewKey.SubParts.Add('') // Prevent "Incorrect prefix key"
+ NewKey.Collations.Add(KeyQuery.Col('Collation', True));
+ if NewKey.IsSpatial then
+ NewKey.SubParts.Add('') // Keep in sync, prevent "Incorrect prefix key"
else
NewKey.SubParts.Add(KeyQuery.Col('Sub_part'));
KeyQuery.Next;
@@ -6107,6 +6327,7 @@ function TPGConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
end;
NewKey.Columns.Add(KeyQuery.Col('COLUMN_NAME'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
KeyQuery.Next;
end;
KeyQuery.Free;
@@ -6120,7 +6341,7 @@ function TSQLiteConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
begin
Result := TTableKeyList.Create(True);
ColQuery := GetResults('SELECT * '+
- 'FROM '+QuoteIdent(Table.Database)+'.pragma_table_info('+EscapeString(Table.Name)+') '+
+ 'FROM pragma_table_xinfo('+EscapeString(Table.Name)+', '+EscapeString(Table.Database)+') '+
'WHERE pk!=0 ORDER BY pk');
NewKey := nil;
while not ColQuery.Eof do begin
@@ -6134,12 +6355,13 @@ function TSQLiteConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
end;
NewKey.Columns.Add(ColQuery.Col('name'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
ColQuery.Next;
end;
ColQuery.Free;
KeyQuery := GetResults('SELECT * '+
- 'FROM '+QuoteIdent(Table.Database)+'.pragma_index_list('+EscapeString(Table.Name)+') '+
+ 'FROM pragma_index_list('+EscapeString(Table.Name)+', '+EscapeString(Table.Database)+') '+
'WHERE origin!='+EscapeString('pk'));
while not KeyQuery.Eof do begin
NewKey := TTableKey.Create(Self);
@@ -6149,10 +6371,11 @@ function TSQLiteConnection.GetTableKeys(Table: TDBObject): TTableKeyList;
NewKey.IndexType := IfThen(KeyQuery.Col('unique')='0', TTableKey.KEY, TTableKey.UNIQUE);
NewKey.OldIndexType := NewKey.IndexType;
ColQuery := GetResults('SELECT * '+
- 'FROM '+QuoteIdent(Table.Database)+'.pragma_index_info('+EscapeString(NewKey.Name)+')');
+ 'FROM pragma_index_info('+EscapeString(NewKey.Name)+', '+EscapeString(Table.Database)+')');
while not ColQuery.Eof do begin
NewKey.Columns.Add(ColQuery.Col('name'));
NewKey.SubParts.Add('');
+ NewKey.Collations.Add('');
ColQuery.Next;
end;
ColQuery.Free;
@@ -6244,14 +6467,17 @@ function TAdoDbConnection.GetTableForeignKeys(Table: TDBObject): TForeignKeyList
ForeignQuery := GetResults('SELECT'+
' f.name AS foreign_key_name,'+
' COL_NAME(fc.parent_object_id, fc.parent_column_id) AS constraint_column_name,'+
- ' OBJECT_NAME (f.referenced_object_id) AS referenced_object,'+
+ ' SCHEMA_NAME(ro.schema_id) AS referenced_schema,'+
+ ' OBJECT_NAME(f.referenced_object_id) AS referenced_object,'+
' COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS referenced_column_name,'+
' update_referential_action_desc,'+
' delete_referential_action_desc'+
' FROM sys.foreign_keys AS f'+
' INNER JOIN sys.foreign_key_columns AS fc'+
' ON f.object_id = fc.constraint_object_id'+
- ' WHERE f.parent_object_id = OBJECT_ID('+EscapeString(Table.Name)+')'
+ ' INNER JOIN sys.objects AS ro'+
+ ' ON ro.object_id = f.referenced_object_id'+
+ ' WHERE f.parent_object_id = OBJECT_ID('+EscapeString(Table.QuotedDbAndTableName)+')'
);
ForeignKey := nil;
while not ForeignQuery.Eof do begin
@@ -6260,7 +6486,8 @@ function TAdoDbConnection.GetTableForeignKeys(Table: TDBObject): TForeignKeyList
Result.Add(ForeignKey);
ForeignKey.KeyName := ForeignQuery.Col('foreign_key_name');
ForeignKey.OldKeyName := ForeignKey.KeyName;
- ForeignKey.ReferenceTable := ForeignQuery.Col('referenced_object');
+ ForeignKey.ReferenceTable :=
+ ForeignQuery.Col('referenced_schema') + '.' + ForeignQuery.Col('referenced_object');
ForeignKey.OnUpdate := ForeignQuery.Col('update_referential_action_desc');
ForeignKey.OnDelete := ForeignQuery.Col('delete_referential_action_desc');
end;
@@ -6280,36 +6507,56 @@ function TPgConnection.GetTableForeignKeys(Table: TDBObject): TForeignKeyList;
// see #158
Result := TForeignKeyList.Create(True);
try
- ForeignQuery := GetResults('SELECT'+
- ' refc.constraint_name,'+
- ' refc.update_rule,'+
- ' refc.delete_rule,'+
- ' kcu.table_name,'+
- ' STRING_AGG(distinct kcu.column_name, '','') AS columns,'+
- ' ccu.table_schema AS ref_schema,'+
- ' ccu.table_name AS ref_table,'+
- ' STRING_AGG(distinct ccu.column_name, '','') AS ref_columns,'+
- ' STRING_AGG(distinct kcu.ordinal_position::text, '','') AS ord_position'+
- ' FROM'+
- ' '+InfSch+'.referential_constraints AS refc,'+
- ' '+InfSch+'.key_column_usage AS kcu,'+
- ' '+InfSch+'.constraint_column_usage AS ccu'+
- ' WHERE'+
- ' refc.constraint_schema = '+EscapeString(Table.Schema)+
- ' AND refc.constraint_name = kcu.constraint_name'+
- ' AND refc.constraint_schema = kcu.table_schema'+
- ' AND ccu.constraint_name = refc.constraint_name'+
- ' AND kcu.table_name = '+EscapeString(Table.Name)+
- ' GROUP BY'+
- ' refc.constraint_name,'+
- ' refc.update_rule,'+
- ' refc.delete_rule,'+
- ' kcu.table_name,'+
- ' ccu.table_schema,'+
- ' ccu.table_name'+
- ' ORDER BY'+
- ' ord_position'
- );
+ ForeignQuery := GetResults(
+ 'SELECT ' +
+ ' con.conname AS constraint_name, ' +
+ ' CASE con.confupdtype ' +
+ ' WHEN ''a'' THEN ''NO ACTION'' ' +
+ ' WHEN ''r'' THEN ''RESTRICT'' ' +
+ ' WHEN ''c'' THEN ''CASCADE'' ' +
+ ' WHEN ''n'' THEN ''SET NULL'' ' +
+ ' WHEN ''d'' THEN ''SET DEFAULT'' ' +
+ ' END AS update_rule, ' +
+ ' CASE con.confdeltype ' +
+ ' WHEN ''a'' THEN ''NO ACTION'' ' +
+ ' WHEN ''r'' THEN ''RESTRICT'' ' +
+ ' WHEN ''c'' THEN ''CASCADE'' ' +
+ ' WHEN ''n'' THEN ''SET NULL'' ' +
+ ' WHEN ''d'' THEN ''SET DEFAULT'' ' +
+ ' END AS delete_rule, ' +
+ ' src_ns.nspname AS table_schema, ' +
+ ' src_tbl.relname AS table_name, ' +
+ ' string_agg(src_col.attname, '','' ORDER BY ord.pos) AS columns, ' +
+ ' ref_ns.nspname AS ref_schema, ' +
+ ' ref_tbl.relname AS ref_table, ' +
+ ' string_agg(ref_col.attname, '','' ORDER BY ord.pos) AS ref_columns, ' +
+ ' string_agg(ord.pos::text, '','' ORDER BY ord.pos) AS ord_position ' +
+ 'FROM pg_constraint con ' +
+ 'JOIN pg_class src_tbl ON src_tbl.oid = con.conrelid ' +
+ 'JOIN pg_namespace src_ns ON src_ns.oid = src_tbl.relnamespace ' +
+ 'JOIN LATERAL unnest(con.conkey) WITH ORDINALITY AS ord(attnum, pos) ON TRUE ' +
+ 'JOIN pg_attribute src_col ON src_col.attrelid = src_tbl.oid AND src_col.attnum = ord.attnum ' +
+ 'JOIN pg_class ref_tbl ON ref_tbl.oid = con.confrelid ' +
+ 'JOIN pg_namespace ref_ns ON ref_ns.oid = ref_tbl.relnamespace ' +
+ 'JOIN LATERAL unnest(con.confkey) WITH ORDINALITY AS ref_ord(attnum, pos) ' +
+ ' ON ref_ord.pos = ord.pos ' +
+ 'JOIN pg_attribute ref_col ON ref_col.attrelid = ref_tbl.oid AND ref_col.attnum = ref_ord.attnum ' +
+ 'WHERE ' +
+ ' con.contype = ''f'' ' +
+ ' AND src_ns.nspname = '+EscapeString(Table.Schema) +
+ ' AND src_tbl.relname = '+EscapeString(Table.Name) +
+ 'GROUP BY ' +
+ ' con.conname, ' +
+ ' con.confupdtype, ' +
+ ' con.confdeltype, ' +
+ ' src_ns.nspname, ' +
+ ' src_tbl.relname, ' +
+ ' ref_ns.nspname, ' +
+ ' ref_tbl.relname ' +
+ 'ORDER BY ' +
+ ' MIN(ord.pos)'
+ );
+
while not ForeignQuery.Eof do begin
ForeignKey := TForeignKey.Create(Self);
Result.Add(ForeignKey);
@@ -6343,7 +6590,7 @@ function TSQLiteConnection.GetTableForeignKeys(Table: TDBObject): TForeignKeyLis
// SQLite: query PRAGMA foreign_key_list
Result := TForeignKeyList.Create(True);
ForeignQuery := GetResults('SELECT * '+
- 'FROM '+QuoteIdent(Table.Database)+'.pragma_foreign_key_list('+EscapeString(Table.Name)+')');
+ 'FROM pragma_foreign_key_list('+EscapeString(Table.Name)+', '+EscapeString(Table.Database)+')');
ForeignKey := nil;
while not ForeignQuery.Eof do begin
if (not Assigned(ForeignKey)) or (ForeignKey.KeyName <> ForeignQuery.Col('id')) then begin
@@ -6488,69 +6735,48 @@ function TDBConnection.IsHex(Text: String): Boolean;
end;
end;
-
-function TMySQLConnection.GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64;
-var
- Rows: String;
-begin
- // Get row number from a mysql table
- if Parameters.IsProxySQLAdmin or ForceExact then
- Rows := GetVar('SELECT COUNT(*) FROM '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name), 0)
- else
- Rows := GetVar('SHOW TABLE STATUS LIKE '+EscapeString(Obj.Name), 'Rows');
- Result := MakeInt(Rows);
-end;
-
-
-function TAdoDBConnection.GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64;
-var
- Rows: String;
+function TDBConnection.Has(Item: TFeatureOrRequirement): Boolean;
begin
- // Get row number from a mssql table
- if ServerVersionInt >= 900 then begin
- Rows := GetVar('SELECT SUM('+QuoteIdent('rows')+') FROM '+QuoteIdent('sys')+'.'+QuoteIdent('partitions')+
- ' WHERE '+QuoteIdent('index_id')+' IN (0, 1)'+
- ' AND '+QuoteIdent('object_id')+' = object_id('+EscapeString(Obj.Database+'.'+Obj.Schema+'.'+Obj.Name)+')'
- );
- end else begin
- Rows := GetVar('SELECT COUNT(*) FROM '+Obj.QuotedDbAndTableName);
+ case FParameters.NetTypeGroup of
+ ngMySQL:
+ case Item of
+ frSrid: Result := FParameters.IsMySQL(True) and (ServerVersionInt >= 80000);
+ frTemporalTypesFraction: Result := (FParameters.IsMariaDB and (ServerVersionInt >= 50300)) or
+ (FParameters.IsMySQL(True) and (ServerVersionInt >= 50604));
+ frIntegerDisplayWidth: Result := (FParameters.IsMySQL(True) and (ServerVersionInt < 80017)) or
+ (not FParameters.IsMySQL(True));
+ frColumnDefaultParentheses: Result := FParameters.IsMySQL(True) and (ServerVersionInt >= 80013);
+ frEditVariables: Result := ServerVersionInt >= 40003;
+ frCreateView: Result := ServerVersionInt >= 50001;
+ frCreateProcedure: Result := ServerVersionInt >= 50003;
+ frCreateFunction: Result := ServerVersionInt >= 50003;
+ frCreateTrigger: Result := ServerVersionInt >= 50002;
+ frCreateEvent: Result := ServerVersionInt >= 50100;
+ frInvisibleColumns: Result := (FParameters.IsMariaDB and (ServerVersionInt >= 100303)) or
+ (FParameters.IsMySQL(True) and (ServerVersionInt >= 80023));
+ frCompressedColumns: Result := (FParameters.IsMariaDB and (ServerVersionInt >= 100301));
+ end;
+ else Result := False;
end;
- Result := MakeInt(Rows);
-end;
-
-
-function TPgConnection.GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64;
-var
- Rows: String;
-begin
- // Get row number from a postgres table
- Rows := GetVar('SELECT '+QuoteIdent('reltuples')+'::bigint FROM '+QuoteIdent('pg_class')+
- ' LEFT JOIN '+QuoteIdent('pg_namespace')+
- ' ON ('+QuoteIdent('pg_namespace')+'.'+QuoteIdent('oid')+' = '+QuoteIdent('pg_class')+'.'+QuoteIdent('relnamespace')+')'+
- ' WHERE '+QuoteIdent('pg_class')+'.'+QuoteIdent('relkind')+'='+EscapeString('r')+
- ' AND '+QuoteIdent('pg_namespace')+'.'+QuoteIdent('nspname')+'='+EscapeString(Obj.Database)+
- ' AND '+QuoteIdent('pg_class')+'.'+QuoteIdent('relname')+'='+EscapeString(Obj.Name)
- );
- Result := MakeInt(Rows);
-end;
-
-
-function TSQLiteConnection.GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64;
-var
- Rows: String;
-begin
- // Get row number from a table
- Rows := GetVar('SELECT COUNT(*) FROM '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name), 0);
- Result := MakeInt(Rows);
end;
-function TInterbaseConnection.GetRowCount(Obj: TDBObject; ForceExact: Bool=False): Int64;
+function TDBConnection.GetRowCount(Obj: TDBObject; ForceExact: Boolean=False): Int64;
var
- Rows: String;
+ Rows, QueryApprox, QueryExact: String;
+ RowsColumn: Integer;
begin
// Get row number from a table
- Rows := GetVar('SELECT COUNT(*) FROM '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name), 0);
+ QueryApprox := FSqlProvider.GetSql(qGetRowCountApprox, Obj.AsStringMap);
+ if QueryApprox.IsEmpty or ForceExact then begin
+ QueryExact := FSqlProvider.GetSql(qGetRowCountExact, Obj.AsStringMap);
+ Rows := GetVar(QueryExact);
+ end
+ else begin
+ // This is ugly: in MySQL 4.x we only have SHOW TABLE STATUS, which cannot be limited to the "Rows" column
+ RowsColumn := IfThen(QueryApprox.StartsWith('SHOW ', True), 4, 0);
+ Rows := GetVar(QueryApprox, RowsColumn);
+ end;
Result := MakeInt(Rows);
end;
@@ -6588,20 +6814,6 @@ procedure TPgConnection.Drop(Obj: TDBObject);
end;
-function TDBConnection.GetSQLSpecifity(Specifity: TSQLSpecifityId): String;
-begin
- // Return some version specific SQL clause or snippet
- Result := FSQLSpecifities[Specifity];
-end;
-
-
-function TDBConnection.GetSQLSpecifity(Specifity: TSQLSpecifityId; const Args: array of const): String;
-begin
- Result := GetSQLSpecifity(Specifity);
- Result := Format(Result, Args);
-end;
-
-
function TDBConnection.ResultCount;
begin
case Parameters.NetTypeGroup of
@@ -6659,8 +6871,8 @@ function TDBConnection.GetCurrentUserHostCombination: String;
// Return current user@host combination, used by various object editors for DEFINER clauses
Log(lcDebug, 'Fetching user@host ...');
Ping(True);
- if FCurrentUserHostCombination.IsEmpty and (not GetSQLSpecifity(spCurrentUserHost).IsEmpty) then
- FCurrentUserHostCombination := GetVar(GetSQLSpecifity(spCurrentUserHost))
+ if FCurrentUserHostCombination.IsEmpty and (not FSqlProvider.GetSql(qCurrentUserHost).IsEmpty) then
+ FCurrentUserHostCombination := GetVar(FSqlProvider.GetSql(qCurrentUserHost))
else
FCurrentUserHostCombination := '';
Result := FCurrentUserHostCombination;
@@ -6902,6 +7114,7 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
obj: TDBObject;
Results: TDBQuery;
rx: TRegExpr;
+ SchemaBug41907Exists, DbNameMatches: Boolean;
begin
// Return a db's table list
try
@@ -6991,8 +7204,8 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
// Stored functions
- if (ServerVersionInt >= 50000) and (not Parameters.IsProxySQLAdmin) then try
- Results := GetResults('SHOW FUNCTION STATUS WHERE '+QuoteIdent('Db')+'='+EscapeString(db));
+ if FSqlProvider.Has(qShowFunctionStatus) then try
+ Results := GetResults(FSqlProvider.GetSql(qShowFunctionStatus, [EscapeString(db)]));
except
on E:EDbError do;
end;
@@ -7012,8 +7225,8 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
// Stored procedures
- if (ServerVersionInt >= 50000) and (not Parameters.IsProxySQLAdmin) then try
- Results := GetResults('SHOW PROCEDURE STATUS WHERE '+QuoteIdent('Db')+'='+EscapeString(db));
+ if FSqlProvider.Has(qShowProcedureStatus) then try
+ Results := GetResults(FSqlProvider.GetSql(qShowProcedureStatus, [EscapeString(db)]));
except
on E:EDbError do;
end;
@@ -7033,8 +7246,8 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
// Triggers
- if (ServerVersionInt >= 50010) and (not Parameters.IsProxySQLAdmin) then try
- Results := GetResults('SHOW TRIGGERS FROM '+QuoteIdent(db));
+ if FSqlProvider.Has(qShowTriggers) then try
+ Results := GetResults(FSqlProvider.GetSql(qShowTriggers, [QuoteIdent(db)]));
except
on E:EDbError do;
end;
@@ -7053,9 +7266,8 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
// Events
- if (ServerVersionInt >= 50100) and (not Parameters.IsProxySQLAdmin) then try
- Results := GetResults('SELECT *, EVENT_SCHEMA AS '+QuoteIdent('Db')+', EVENT_NAME AS '+QuoteIdent('Name')+
- ' FROM '+InfSch+'.'+QuoteIdent('EVENTS')+' WHERE '+QuoteIdent('EVENT_SCHEMA')+'='+EscapeString(db))
+ if FSqlProvider.Has(qShowEvents) then try
+ Results := GetResults(FSqlProvider.GetSql(qShowEvents, [EscapeString(db)]));
except
on E:EDbError do begin
try
@@ -7066,8 +7278,14 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
end;
if Assigned(Results) then begin
+ // Work around old MySQL bug: https://bugs.mysql.com/bug.php?id=41907#c360194
+ // "Noted [fixed] in 5.1.57, 5.5.12, 5.6.3 changelogs."
+ SchemaBug41907Exists := (ServerVersionInt < 50157) or
+ ((ServerVersionInt >= 50500) and (ServerVersionInt < 50512)) or
+ ((ServerVersionInt >= 50600) and (ServerVersionInt < 50603));
while not Results.Eof do begin
- if Results.Col('Db') = db then begin
+ DbNameMatches := CompareText(Results.Col('Db'), db) = 0;
+ if (SchemaBug41907Exists and DbNameMatches) or (not SchemaBug41907Exists) then begin
Obj := TDBObject.Create(Self);
Cache.Add(obj);
Obj.Name := Results.Col('Name');
@@ -7095,13 +7313,19 @@ procedure TAdoDBConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
// Tables, views and procedures
Results := nil;
// Schema support introduced in MSSQL 2005 (9.0). See issue #3212.
+ // RowsInTable added in 12.16
SchemaSelect := EscapeString('');
if ServerVersionInt >= 900 then
SchemaSelect := 'SCHEMA_NAME('+QuoteIdent('schema_id')+')';
try
- Results := GetResults('SELECT *, '+SchemaSelect+' AS '+EscapeString('schema')+
- ' FROM '+QuoteIdent(db)+GetSQLSpecifity(spDbObjectsTable)+
- ' WHERE '+QuoteIdent('type')+' IN ('+EscapeString('P')+', '+EscapeString('U')+', '+EscapeString('V')+', '+EscapeString('TR')+', '+EscapeString('FN')+', '+EscapeString('TF')+', '+EscapeString('IF')+')');
+ Results := GetResults('SELECT o.*, '+SchemaSelect+' AS '+EscapeString('schema')+', rc.RowsInTable'+
+ ' FROM '+QuoteIdent(db)+FSqlProvider.GetSql(qDbObjectsTable)+ ' AS o'+
+ ' LEFT JOIN ('+
+ ' SELECT object_id, SUM(rows) AS RowsInTable FROM '+QuoteIdent(db)+'.sys.partitions'+
+ ' WHERE index_id IN (0,1)'+ // -- heap or clustered index
+ ' GROUP BY object_id'+
+ ' ) AS rc ON rc.object_id = o.object_id'+
+ ' WHERE o.'+QuoteIdent('type')+' IN ('+EscapeString('P')+', '+EscapeString('U')+', '+EscapeString('V')+', '+EscapeString('TR')+', '+EscapeString('FN')+', '+EscapeString('TF')+', '+EscapeString('IF')+')');
except
on E:EDbError do;
end;
@@ -7110,11 +7334,11 @@ procedure TAdoDBConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
obj := TDBObject.Create(Self);
Cache.Add(obj);
obj.Name := Results.Col('name');
- obj.Created := ParseDateTime(Results.Col(GetSQLSpecifity(spDbObjectsCreateCol), True));
- obj.Updated := ParseDateTime(Results.Col(GetSQLSpecifity(spDbObjectsUpdateCol), True));
+ obj.Created := ParseDateTime(Results.Col(FSqlProvider.GetSql(qDbObjectsCreateCol), True));
+ obj.Updated := ParseDateTime(Results.Col(FSqlProvider.GetSql(qDbObjectsUpdateCol), True));
obj.Schema := Results.Col('schema');
obj.Database := db;
- tp := Trim(Results.Col(GetSQLSpecifity(spDbObjectsTypeCol), True));
+ tp := Trim(Results.Col(FSqlProvider.GetSql(qDbObjectsTypeCol), True));
if tp = 'U' then
obj.NodeType := lntTable
else if tp = 'P' then
@@ -7125,6 +7349,8 @@ procedure TAdoDBConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
obj.NodeType := lntTrigger
else if (tp = 'FN') or (tp = 'TF') or (tp = 'IF') then
obj.NodeType := lntFunction;
+ obj.Rows := StrToInt64Def(Results.Col('RowsInTable'), -1);
+ obj.RowsAreExact := False; // approximate, not guaranteed exact.
// Set reasonable default value for calculation of export chunks. See #343
// OFFSET..FETCH supported from v11.0/2012
// Disabled, leave at -1 and prefer a generic calculation in TfrmTableTools.DoExport
@@ -7141,35 +7367,53 @@ procedure TPGConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
var
obj: TDBObject;
Results: TDBQuery;
- tp, SchemaTable: String;
- DataLenClause, IndexLenClause: String;
+ tp: String;
+ DataLenClause, IndexLenClause, ProKindClause: String;
begin
// Tables, views and procedures
Results := nil;
try
- // See http://www.heidisql.com/forum.php?t=16429
- if ServerVersionInt >= 70300 then
- SchemaTable := 'QUOTE_IDENT(t.TABLE_SCHEMA) || '+EscapeString('.')+' || QUOTE_IDENT(t.TABLE_NAME)'
- else
- SchemaTable := EscapeString(FQuoteChar)+' || t.TABLE_SCHEMA || '+EscapeString(FQuoteChar+'.'+FQuoteChar)+' || t.TABLE_NAME || '+EscapeString(FQuoteChar);
// See http://www.heidisql.com/forum.php?t=16996
if Parameters.FullTableStatus and (ServerVersionInt >= 90000) then
- DataLenClause := 'pg_table_size('+SchemaTable+')::bigint'
+ DataLenClause := 'pg_table_size(format(''%I.%I'', n.nspname, c.relname))::bigint'
else
DataLenClause := 'NULL';
// See https://www.heidisql.com/forum.php?t=34635
if Parameters.FullTableStatus and (ServerVersionInt >= 80100) then
- IndexLenClause := 'pg_relation_size('+SchemaTable+')::bigint'
+ IndexLenClause := 'pg_relation_size(format(''%I.%I'', n.nspname, c.relname))::bigint'
else
IndexLenClause := 'relpages::bigint * '+SIZE_KB.ToString;
- Results := GetResults('SELECT *,'+
- ' '+DataLenClause+' AS data_length,'+
- ' '+IndexLenClause+' AS index_length,'+
- ' c.reltuples, obj_description(c.oid) AS comment'+
- ' FROM '+QuoteIdent(InfSch)+'.'+QuoteIdent('tables')+' AS t'+
- ' LEFT JOIN '+QuoteIdent('pg_namespace')+' n ON t.table_schema = n.nspname'+
- ' LEFT JOIN '+QuoteIdent('pg_class')+' c ON n.oid = c.relnamespace AND c.relname=t.table_name'+
- ' WHERE t.'+QuoteIdent('table_schema')+'='+EscapeString(db) // Use table_schema when using schemata
+ if ServerVersionInt >= 110000 then
+ ProKindClause := 'p.prokind'
+ else
+ ProKindClause := EscapeString('p');
+ Results := GetResults('SELECT '+
+ ' n.nspname AS schema_name, '+
+ ' c.relname AS object_name, '+
+ ' c.relkind AS object_kind, '+
+ ' '+DataLenClause+' AS data_length, '+
+ ' '+IndexLenClause+' AS index_length, '+
+ ' c.reltuples, '+
+ ' obj_description(c.oid) AS comment, '+
+ ' NULL AS proargtypes '+
+ 'FROM pg_class c '+
+ 'JOIN pg_namespace n ON n.oid = c.relnamespace '+
+ 'WHERE n.nspname = '+EscapeString(db)+' '+
+ ' AND c.relkind IN (''r'',''v'',''m'') '+
+ 'UNION ALL '+
+ 'SELECT '+
+ ' n.nspname AS schema_name, '+
+ ' p.proname AS object_name, '+
+ ' '+ProKindClause+' AS object_kind, '+
+ ' NULL::bigint AS data_length, '+
+ ' NULL::bigint AS index_length, '+
+ ' NULL::real AS reltuples, '+
+ ' obj_description(p.oid) AS comment, '+
+ ' p.proargtypes '+
+ 'FROM pg_proc p '+
+ 'JOIN pg_namespace n ON n.oid = p.pronamespace '+
+ 'WHERE n.nspname = '+EscapeString(db)+' '+
+ ' AND '+ProKindClause+' IN (''f'',''p'') '
);
except
on E:EDbError do;
@@ -7178,11 +7422,11 @@ procedure TPGConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
while not Results.Eof do begin
obj := TDBObject.Create(Self);
Cache.Add(obj);
- obj.Name := Results.Col('table_name');
+ obj.Name := Results.Col('object_name');
obj.Created := 0;
obj.Updated := 0;
obj.Database := db;
- obj.Schema := Results.Col('table_schema'); // Remove when using schemata
+ obj.Schema := Results.Col('schema_name'); // Remove when using schemata
obj.Comment := Results.Col('comment');
obj.Rows := StrToInt64Def(Results.Col('reltuples'), obj.Rows);
obj.DataLen := StrToInt64Def(Results.Col('data_length'), obj.DataLen);
@@ -7190,35 +7434,22 @@ procedure TPGConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
obj.Size := obj.DataLen + obj.IndexLen;
Inc(Cache.FDataSize, Obj.Size);
Cache.FLargestObjectSize := Max(Cache.FLargestObjectSize, Obj.Size);
- tp := Results.Col('table_type', True);
- if tp = 'VIEW' then
- obj.NodeType := lntView
- else
- obj.NodeType := lntTable;
- Results.Next;
- end;
- FreeAndNil(Results);
- end;
-
- // Stored functions. No procedures in PostgreSQL.
- // See http://dba.stackexchange.com/questions/2357/what-are-the-differences-between-stored-procedures-and-stored-functions
- try
- Results := GetResults('SELECT '+QuoteIdent('p')+'.'+QuoteIdent('proname')+', '+QuoteIdent('p')+'.'+QuoteIdent('proargtypes')+' '+
- 'FROM '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_namespace')+' AS '+QuoteIdent('n')+' '+
- 'JOIN '+QuoteIdent('pg_catalog')+'.'+QuoteIdent('pg_proc')+' AS '+QuoteIdent('p')+' ON '+QuoteIdent('p')+'.'+QuoteIdent('pronamespace')+' = '+QuoteIdent('n')+'.'+QuoteIdent('oid')+' '+
- 'WHERE '+QuoteIdent('n')+'.'+QuoteIdent('nspname')+'='+EscapeString(db)
- );
- except
- on E:EDbError do;
- end;
- if Assigned(Results) then begin
- while not Results.Eof do begin
- obj := TDBObject.Create(Self);
- Cache.Add(obj);
- obj.Name := Results.Col('proname');
+ tp := Results.Col('object_kind', True);
+ if tp = 'r' then
+ obj.NodeType := lntTable
+ else if tp = 'v' then begin
+ obj.NodeType := lntView;
+ obj.IsMaterialized := False;
+ end
+ else if tp = 'm' then begin
+ obj.NodeType := lntView;
+ obj.IsMaterialized := True;
+ end
+ else if tp = 'f' then
+ obj.NodeType := lntFunction
+ else if tp = 'p' then
+ obj.NodeType := lntProcedure;
obj.ArgTypes := Results.Col('proargtypes');
- obj.Database := db;
- obj.NodeType := lntFunction;
Results.Next;
end;
FreeAndNil(Results);
@@ -7231,12 +7462,15 @@ procedure TSQLiteConnection.FetchDbObjects(db: String; var Cache: TDBObjectList)
var
obj: TDBObject;
Results: TDBQuery;
+ TypeS: String;
+ UnionRowCount: TStringList;
begin
// Tables, views and procedures
Results := nil;
try
Results := GetResults('SELECT * FROM '+QuoteIdent(db)+'.sqlite_master '+
- 'WHERE type IN('+EscapeString('table')+', '+EscapeString('view')+') AND name NOT LIKE '+EscapeString('sqlite_%'));
+ 'WHERE type IN('+EscapeString('table')+', '+EscapeString('view')+', '+EscapeString('trigger')+') '+
+ 'AND name NOT LIKE '+EscapeString('sqlite_%'));
except
on E:EDbError do;
end;
@@ -7248,14 +7482,46 @@ procedure TSQLiteConnection.FetchDbObjects(db: String; var Cache: TDBObjectList)
obj.Created := Now;
obj.Updated := Now;
obj.Database := db;
- if Results.Col('type').ToLowerInvariant = 'view' then begin
+ TypeS := Results.Col('type').ToLowerInvariant;
+ if TypeS = 'view' then begin
obj.NodeType := lntView;
obj.FCreateCode := Results.Col('sql');
+ end else if TypeS = 'trigger' then begin
+ obj.NodeType := lntTrigger;
+ obj.FCreateCode := Results.Col('sql');
end else
obj.NodeType := lntTable;
Results.Next;
end;
FreeAndNil(Results);
+
+ if FParameters.FullTableStatus then begin
+ UnionRowCount := TStringList.Create;
+ for obj in Cache do begin
+ if obj.NodeType <> lntTable then
+ Continue;
+ UnionRowCount.Add('SELECT '+EscapeString(obj.Name)+', COUNT(*) FROM '+QuoteIdent(obj.Database)+'.'+QuoteIdent(obj.Name));
+ end;
+ if UnionRowCount.Count > 0 then
+ try
+ Results := GetResults(Implode(' UNION ', UnionRowCount));
+ while not Results.Eof do begin
+ for obj in Cache do begin
+ if (obj.NodeType = lntTable) and (obj.Name = Results.Col(0)) then begin
+ obj.Rows := StrToInt64Def(Results.Col(1), -1);
+ obj.RowsAreExact := True;
+ break;
+ end;
+ end;
+ Results.Next;
+ end;
+ FreeAndNil(Results);
+ except
+ on E:EDbError do
+ Log(lcError, 'Full table status with row count not available in this database');
+ end;
+ UnionRowCount.Free;
+ end;
end;
end;
@@ -7375,37 +7641,45 @@ procedure TInterbaseConnection.FetchDbObjects(db: String; var Cache: TDBObjectLi
end;
-function TDBConnection.GetKeyColumns(Columns: TTableColumnList; Keys: TTableKeyList): TStringList;
+function TDBConnection.GetKeyColumns(Columns: TTableColumnList; Keys: TTableKeyList): TTableColumnList;
var
- i: Integer;
AllowsNull: Boolean;
Key: TTableKey;
Col: TTableColumn;
+ ColName: String;
begin
- Result := TStringList.Create;
+ Result := TTableColumnList.Create;
// Find best key for updates
// 1. round: find a primary key
for Key in Keys do begin
- if Key.IndexType = TTableKey.PRIMARY then
- Result.Assign(Key.Columns);
+ if Key.IsPrimary then
+ begin
+ for ColName in Key.Columns do begin
+ Col := Columns.FindByName(ColName);
+ if Assigned(Col) then
+ Result.Add(Col);
+ end;
+ end;
end;
if Result.Count = 0 then begin
// no primary key available -> 2. round: find a unique key
for Key in Keys do begin
- if Key.IndexType = TTableKey.UNIQUE then begin
+ if Key.IsUnique then begin
// We found a UNIQUE key - better than nothing. Check if one of the key
// columns allows NULLs which makes it dangerous to use in UPDATES + DELETES.
AllowsNull := False;
- for i:=0 to Key.Columns.Count-1 do begin
- for Col in Columns do begin
- if Col.Name = Key.Columns[i] then
- AllowsNull := Col.AllowNull;
- if AllowsNull then break;
- end;
- if AllowsNull then break;
+ for ColName in Key.Columns do begin
+ Col := Columns.FindByName(ColName);
+ AllowsNull := Assigned(Col) and Col.AllowNull;
+ if AllowsNull then
+ break; // Unusable, don't use this key
end;
if not AllowsNull then begin
- Result.Assign(Key.Columns);
+ for ColName in Key.Columns do begin
+ Col := Columns.FindByName(ColName);
+ if Assigned(Col) then
+ Result.Add(Col);
+ end;
break;
end;
end;
@@ -7548,7 +7822,7 @@ procedure TDBConnection.ParseViewStructure(CreateCode: String; DBObj: TDBObject;
CheckOption := Trim(rx.Match[11]);
SelectCode := rx.Match[9];
end else
- raise Exception.CreateFmt(_('Regular expression did not match the VIEW code in %s: %s'), ['ParseViewStructure()', CRLF+CRLF+CreateCode]);
+ Log(lcError, f_('Regular expression did not match the VIEW code in %s: %s', ['ParseViewStructure()', CRLF+CRLF+CreateCode]));
rx.Free;
end;
@@ -7623,7 +7897,7 @@ procedure TDBConnection.ParseRoutineStructure(Obj: TDBObject; Parameters: TRouti
// | SQL SECURITY { DEFINER | INVOKER }
// | COMMENT 'string'
rx.Expression := '^\s*('+
- 'RETURNS\s+(\S+(\s+UNSIGNED)?(\s+CHARSET\s+\S+)?(\s+COLLATE\s\S+)?)|'+
+ 'RETURNS\s+((\S+\([^\)]+\)|\S+)(\s+UNSIGNED)?(\s+CHARSET\s+\S+)?(\s+COLLATE\s\S+)?)|'+
// MySQL function characteristics - see http://dev.mysql.com/doc/refman/5.1/de/create-procedure.html
'LANGUAGE\s+SQL|'+
'(NOT\s+)?DETERMINISTIC|'+
@@ -7651,7 +7925,7 @@ procedure TDBConnection.ParseRoutineStructure(Obj: TDBObject; Parameters: TRouti
else if (Pos('CONTAINS SQL', Match) = 1) or (Pos('NO SQL', Match) = 1) or (Pos('READS SQL DATA', Match) = 1) or (Pos('MODIFIES SQL DATA', Match) = 1) then
Obj.DataAccess := rx.Match[1]
else if Pos('SQL SECURITY', Match) = 1 then
- Obj.Security := rx.Match[7];
+ Obj.Security := rx.Match[8];
Delete(Body, 1, rx.MatchLen[0]);
@@ -7873,6 +8147,21 @@ destructor TInterbaseQuery.Destroy;
end;
+procedure TDBQuery.LogMetaInfo(NumResult: Integer);
+var
+ MetaInfo: String;
+begin
+ // Debug log output after DBQuery.Execute with result
+ MetaInfo := 'Result #'+IntToStr(NumResult)+' fetched in ';
+ if Connection.LastQueryDuration < 60*1000 then
+ MetaInfo := MetaInfo + FormatNumber(Connection.LastQueryDuration/1000, 3) +' ' + _('sec.')
+ else
+ MetaInfo := MetaInfo + FormatTimeNumber(Connection.LastQueryDuration/1000, True);
+ if Connection.LastQueryNetworkDuration > 0 then
+ MetaInfo := MetaInfo + ' (+ '+FormatNumber(Connection.LastQueryNetworkDuration/1000, 3) +' ' + _('sec.') + ' ' + _('network') + ')';
+ Connection.Log(lcDebug, MetaInfo);
+end;
+
procedure TMySQLQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1);
var
i, j, NumFields, NumResults: Integer;
@@ -7905,7 +8194,7 @@ procedure TMySQLQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1
FEditingPrepared := False;
end;
if LastResult <> nil then begin
- Connection.Log(lcDebug, 'Result #'+IntToStr(NumResults)+' fetched.');
+ LogMetaInfo(NumResults);
SetLength(FResultList, NumResults);
FResultList[NumResults-1] := LastResult;
FRecordCount := FRecordCount + LastResult.row_count;
@@ -7997,7 +8286,7 @@ procedure TAdoDBQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1
FEditingPrepared := False;
end;
if LastResult <> nil then begin
- Connection.Log(lcDebug, 'Result #'+IntToStr(NumResults)+' fetched.');
+ LogMetaInfo(NumResults);
SetLength(FResultList, NumResults);
FResultList[NumResults-1] := LastResult;
FRecordCount := FRecordCount + LastResult.RecordCount;
@@ -8109,7 +8398,7 @@ procedure TPGQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1);
FEditingPrepared := False;
end;
if LastResult <> nil then begin
- Connection.Log(lcDebug, 'Result #'+IntToStr(NumResults)+' fetched.');
+ LogMetaInfo(NumResults);
SetLength(FResultList, NumResults);
FResultList[NumResults-1] := LastResult;
FRecordCount := FRecordCount + FConnection.Lib.PQntuples(LastResult);
@@ -8171,7 +8460,7 @@ procedure TSQLiteQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-
FEditingPrepared := False;
end;
if LastResult <> nil then begin
- Connection.Log(lcDebug, 'Result #'+IntToStr(NumResults)+' fetched.');
+ LogMetaInfo(NumResults);
SetLength(FResultList, NumResults);
FResultList[NumResults-1] := LastResult;
FRecordCount := FRecordCount + LastResult.Count;
@@ -8254,7 +8543,7 @@ procedure TInterbaseQuery.Execute(AddResult: Boolean; UseRawResult: Integer);
FEditingPrepared := False;
end;
if LastResult <> nil then begin
- Connection.Log(lcDebug, 'Result #'+IntToStr(NumResults)+' fetched.');
+ LogMetaInfo(NumResults);
SetLength(FResultList, NumResults);
FResultList[NumResults-1] := LastResult;
FRecordCount := FRecordCount + LastResult.RecordCount;
@@ -8646,6 +8935,12 @@ function TDBQuery.ColumnExists(Column: Integer): Boolean;
end;
+function TDBQuery.ColumnExists(ColumnName: String): Boolean;
+begin
+ Result := FConnection.Active and ColumnNames.Contains(ColumnName);
+end;
+
+
function TDBQuery.GetColBinData(Column: Integer; var baData: TBytes): Boolean;
begin
Raise EDbError.Create(SNotImplemented);
@@ -8718,8 +9013,9 @@ function TMySQLQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
end;
end;
- end else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_(MsgInvalidColumn), [Column, ColumnCount, RecordCount]);
+ end
+ else
+ Result := TextInvalidColumn;
end;
@@ -8741,15 +9037,16 @@ function TAdoDBQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
except
Result := String(FCurrentResults.Fields[Column].AsAnsiString);
end;
- if Datatype(Column).Index = dbdtBit then begin
- if UpperCase(Result) = 'TRUE' then
- Result := '1'
- else
- Result := '0';
- end
end;
- end else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_(MsgInvalidColumn), [Column, ColumnCount, RecordCount]);
+ if Datatype(Column).Index = dbdtBit then begin
+ if (UpperCase(Result) = 'TRUE') or (Result = '1') then
+ Result := '1'
+ else
+ Result := '0';
+ end
+ end
+ else
+ Result := TextInvalidColumn;
end;
@@ -8764,13 +9061,14 @@ function TPGQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
SetString(AnsiStr, FConnection.Lib.PQgetvalue(FCurrentResults, FRecNoLocal, Column), FColumnLengths[Column]);
if Datatype(Column).Category in [dtcBinary, dtcSpatial] then
Result := String(AnsiStr)
- else if Datatype(Column).Index = dbdtBool then
- if AnsiStr='t' then Result := 'true' else Result := 'false'
+ else if (Datatype(Column).Index = dbdtBool) and (Length(AnsiStr) > 0) then
+ Result := IfThen(AnsiStr='t', 'true', 'false')
else
Result := Connection.DecodeAPIString(AnsiStr);
end;
- end else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_(MsgInvalidColumn), [Column, ColumnCount, RecordCount]);
+ end
+ else
+ Result := TextInvalidColumn;
end;
@@ -8782,8 +9080,9 @@ function TSQLiteQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
end else begin
Result := FCurrentResults[FRecNoLocal][Column].OldText;
end;
- end else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_(MsgInvalidColumn), [Column, ColumnCount, RecordCount]);
+ end
+ else
+ Result := TextInvalidColumn;
end;
@@ -8795,8 +9094,9 @@ function TInterbaseQuery.Col(Column: Integer; IgnoreErrors: Boolean): String;
end else begin
Result := FCurrentResults.Fields[Column].AsString;
end;
- end else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_(MsgInvalidColumn), [Column, ColumnCount, RecordCount]);
+ end
+ else
+ Result := TextInvalidColumn;
end;
@@ -8809,8 +9109,8 @@ function TDBQuery.Col(ColumnName: String; IgnoreErrors: Boolean=False): String;
idx := ColumnNames.IndexOf(ColumnName);
if idx > -1 then
Result := Col(idx)
- else if not IgnoreErrors then
- Raise EDbError.CreateFmt(_('Column "%s" not available.'), [ColumnName]);
+ else
+ Result := TextInvalidColumn;
end;
@@ -8827,57 +9127,12 @@ function TDBQuery.HexValue(Column: Integer; IgnoreErrors: Boolean=False): String
// Return a binary column value as hex AnsiString
if FConnection.Parameters.IsAnyMysql then begin
GetColBinData(Column, baData);
- Result := HexValue(baData);
+ Result := FConnection.EscapeBin(baData);
end else
- Result := HexValue(Col(Column, IgnoreErrors));
+ Result := FConnection.EscapeBin(Col(Column, IgnoreErrors));
end;
-function TDBQuery.HexValue(BinValue: String): String;
-var
- BinLen: Integer;
- Ansi: AnsiString;
-begin
- // Return a binary value as hex AnsiString
- Ansi := AnsiString(BinValue);
- BinLen := Length(Ansi);
- if BinLen = 0 then begin
- Result := Connection.EscapeString('');
- end else begin
- if FConnection.IsHex(BinValue) then begin
- Result := BinValue; // Already hex encoded
- end else begin
- SetLength(Result, BinLen*2);
- BinToHex(PAnsiChar(Ansi), PChar(Result), BinLen);
- Result := '0x' + Result;
- end;
- if AppSettings.ReadBool(asLowercaseHex) then
- Result := Result.ToLowerInvariant;
- end;
-end;
-
-function TDBQuery.HexValue(var ByteData: TBytes): String;
-var
- BinLen: Integer;
- Ansi: AnsiString;
-begin
- BinLen := Length(ByteData);
- SetString(Ansi, PAnsiChar(ByteData), BinLen);
- if BinLen = 0 then begin
- Result := Connection.EscapeString('');
- end else begin
- if FConnection.IsHex(String(Ansi)) then begin
- Result := String(Ansi); // Already hex encoded
- end else begin
- SetLength(Result, BinLen*2);
- BinToHex(PAnsiChar(Ansi), PChar(Result), BinLen);
- Result := '0x' + Result;
- end;
- if AppSettings.ReadBool(asLowercaseHex) then
- Result := Result.ToLowerInvariant;
- end;
-end;
-
function TDBQuery.DataType(Column: Integer): TDBDataType;
var
Col: TTableColumn;
@@ -8919,16 +9174,36 @@ function TDBQuery.MaxLength(Column: Integer): Int64;
function TDBQuery.ValueList(Column: Integer): TStringList;
var
ColAttr: TTableColumn;
+ i: Integer;
begin
Result := TStringList.Create;
- Result.QuoteChar := '''';
- Result.Delimiter := ',';
ColAttr := ColAttributes(Column);
if Assigned(ColAttr) then case ColAttr.DataType.Index of
- dbdtEnum, dbdtSet:
- Result.DelimitedText := ColAttr.LengthSet;
- dbdtBool:
+
+ dbdtEnum, dbdtSet: begin
+ // Lool up PostgreSQL enum labels in prefetched list
+ i := FConnection.NamedEnums.IndexOfName(ColAttr.LengthSet);
+ if i > -1 then begin
+ Result.Delimiter := '|';
+ Result.DelimitedText := FConnection.NamedEnums.ValueFromIndex[i];
+ end
+ else begin
+ // .. or in MySQL Length/Set
+ Result.QuoteChar := '''';
+ Result.Delimiter := ',';
+ Result.DelimitedText := ColAttr.LengthSet;
+ end;
+ // In any case, take care for escaped ENUM definitions, see issue #799
+ for i:=0 to Result.Count-1 do begin
+ Result[i] := FConnection.UnescapeString(Result[i]);
+ end;
+ end;
+
+ dbdtBool: begin
+ Result.Delimiter := ',';
Result.DelimitedText := 'true,false';
+ end;
+
end;
end;
@@ -8938,8 +9213,9 @@ function TDBQuery.ColAttributes(Column: Integer): TTableColumn;
i: Integer;
begin
Result := nil;
- if (Column < 0) or (Column >= FColumnOrgNames.Count) then
- raise EDbError.CreateFmt(_('Column #%s not available.'), [IntToStr(Column)]);
+ if (Column < 0) or (Column >= FColumnOrgNames.Count) then begin
+ // Just return nil
+ end;
if FColumns <> nil then begin
for i:=0 to FColumns.Count-1 do begin
if FColumns[i].Name = FColumnOrgNames[Column] then begin
@@ -9243,6 +9519,7 @@ procedure TDBQuery.DeleteRow;
var
sql: String;
IsVirtual: Boolean;
+ TempRowsAffected: Int64;
begin
// Delete current row from result
PrepareEditing;
@@ -9250,8 +9527,10 @@ procedure TDBQuery.DeleteRow;
if not IsVirtual then begin
sql := GridQuery('DELETE', 'FROM ' + QuotedDbAndTableName + ' WHERE ' + GetWhereClause);
Connection.Query(sql);
- if Connection.RowsAffected = 0 then
- raise EDbError.Create(FormatNumber(Connection.RowsAffected)+' rows deleted when that should have been 1.');
+ TempRowsAffected := Connection.RowsAffected;
+ Connection.ShowWarnings;
+ if TempRowsAffected = 0 then
+ raise EDbError.Create(FormatNumber(TempRowsAffected)+' rows deleted when that should have been 1.');
end;
if Assigned(FCurrentUpdateRow) then begin
FUpdateData.Remove(FCurrentUpdateRow);
@@ -9277,12 +9556,23 @@ function TDBQuery.InsertRow: Int64;
Row.Add(c);
c.OldText := '';
c.OldIsFunction := False;
- c.OldIsNull := False;
+ c.OldIsNull := True;
ColAttr := ColAttributes(i);
if Assigned(ColAttr) then begin
- c.OldIsNull := ColAttr.DefaultType in [cdtNull, cdtAutoInc, cdtExpression];
- if ColAttr.DefaultType in [cdtText] then
- c.OldText := FConnection.UnescapeString(ColAttr.DefaultText);
+ case ColAttr.DefaultType of
+ cdtText: begin
+ c.OldText := FConnection.UnescapeString(ColAttr.DefaultText);
+ c.OldIsNull := False;
+ end;
+ cdtExpression: begin
+ // Overtake expression, if it's a simple integer
+ if ColAttr.DefaultText = MakeInt(ColAttr.DefaultText).ToString then begin
+ c.OldText := ColAttr.DefaultText;
+ c.OldIsNull := False;
+ end;
+ end;
+ end;
+
end;
c.NewText := c.OldText;
c.NewIsFunction := c.OldIsFunction;
@@ -9368,6 +9658,7 @@ function TDBQuery.EnsureFullRow(Refresh: Boolean): Boolean;
sql := sql + ' FROM '+QuotedDbAndTableName+' WHERE '+GetWhereClause;
sql := GridQuery('SELECT', sql);
Data := Connection.GetResults(sql);
+ Connection.ShowWarnings;
Result := Data.RecordCount = 1;
if Result then begin
if not Assigned(FCurrentUpdateRow) then
@@ -9379,6 +9670,7 @@ function TDBQuery.EnsureFullRow(Refresh: Boolean): Boolean;
FCurrentUpdateRow[i].NewIsNull := FCurrentUpdateRow[i].OldIsNull;
FCurrentUpdateRow[i].OldIsFunction := False;
FCurrentUpdateRow[i].NewIsFunction := FCurrentUpdateRow[i].OldIsFunction;
+ FColumnLengths[i] := Length(FCurrentUpdateRow[i].NewText);
end;
Data.Free;
end;
@@ -9434,6 +9726,7 @@ function TDBQuery.HasFullData: Boolean;
function TDBQuery.SaveModifications: Boolean;
var
i: Integer;
+ TempRowsAffected: Int64;
Row: TGridRow;
Cell: TGridValue;
sqlUpdate, sqlInsertColumns, sqlInsertValues, Val: String;
@@ -9466,21 +9759,14 @@ function TDBQuery.SaveModifications: Boolean;
else if Cell.NewIsFunction then
Val := Cell.NewText
else case Datatype(i).Category of
- dtcInteger, dtcReal: begin
+ dtcInteger, dtcReal:
Val := Connection.EscapeString(Cell.NewText, Datatype(i));
- if (Datatype(i).Index = dbdtBit) and FConnection.Parameters.IsAnyMySQL then
- Val := 'b' + Val;
- end;
dtcBinary, dtcSpatial:
- Val := HexValue(Cell.NewText);
- else begin
- if Datatype(i).Index in [dbdtNchar, dbdtNvarchar, dbdtNtext] then
- Val := 'N' + Connection.EscapeString(Cell.NewText)
- else if Datatype(i).Category = dtcTemporal then
- Val := Connection.EscapeString(Connection.GetDateTimeValue(Cell.NewText, Datatype(i).Index))
- else
- Val := Connection.EscapeString(Cell.NewText);
- end;
+ Val := FConnection.EscapeBin(Cell.NewText);
+ dtcTemporal:
+ Val := Connection.EscapeString(Connection.GetDateTimeValue(Cell.NewText, Datatype(i).Index))
+ else
+ Val := Connection.EscapeString(Cell.NewText, Datatype(i));
end;
sqlUpdate := sqlUpdate + Connection.QuoteIdent(FColumnOrgNames[i]) + '=' + Val;
sqlInsertColumns := sqlInsertColumns + Connection.QuoteIdent(FColumnOrgNames[i]);
@@ -9491,12 +9777,13 @@ function TDBQuery.SaveModifications: Boolean;
if RowModified then try
if Row.Inserted then begin
Connection.Query('INSERT INTO '+QuotedDbAndTableName+' ('+sqlInsertColumns+') VALUES ('+sqlInsertValues+')');
+ Connection.ShowWarnings;
for i:=0 to ColumnCount-1 do begin
ColAttr := ColAttributes(i);
if Assigned(ColAttr) and (ColAttr.DefaultType = cdtAutoInc) then begin
Row[i].NewText := UnformatNumber(Row[i].NewText);
if Row[i].NewText = '0' then
- Row[i].NewText := Connection.GetVar('SELECT ' + Connection.GetSQLSpecifity(spFuncLastAutoIncNumber));
+ Row[i].NewText := Connection.GetVar('SELECT ' + Connection.SqlProvider.GetSql(qFuncLastAutoIncNumber));
Row[i].NewIsNull := False;
break;
end;
@@ -9505,8 +9792,10 @@ function TDBQuery.SaveModifications: Boolean;
sqlUpdate := QuotedDbAndTableName+' SET '+sqlUpdate+' WHERE '+GetWhereClause;
sqlUpdate := GridQuery('UPDATE', sqlUpdate);
Connection.Query(sqlUpdate);
- if Connection.RowsAffected = 0 then begin
- raise EDbError.Create(FormatNumber(Connection.RowsAffected)+' rows updated when that should have been 1.');
+ TempRowsAffected := Connection.RowsAffected;
+ Connection.ShowWarnings;
+ if TempRowsAffected = 0 then begin
+ raise EDbError.Create(FormatNumber(TempRowsAffected)+' rows updated when that should have been 1.');
Result := False;
end;
end;
@@ -9678,16 +9967,12 @@ function TMySQLQuery.TableName(Column: Integer): String;
Objects: TDBObjectList;
Obj: TDBObject;
begin
+ Result := '';
Field := FConnection.Lib.mysql_fetch_field_direct(FCurrentResults, Column);
- {Connection.Log(lcDebug, FColumnNames[Column]+':'+
- ' org_table:'+Field.org_table+
- ' table:'+Field.table+
- ' table^=org_table^:'+(Field.table^ = Field.org_table^).ToInteger.ToString+
- ' table=org_table:'+(Field.table = Field.org_table).ToInteger.ToString
- );}
FieldDb := FConnection.DecodeAPIString(Field.db);
FieldTable := FConnection.DecodeAPIString(Field.table);
FieldOrgTable := FConnection.DecodeAPIString(Field.org_table);
+ // Connection.Log(lcInfo, FColumnNames[Column]+': org_table:'+FieldOrgTable+' table:'+FieldTable);
if FieldTable <> FieldOrgTable then begin
// Probably a VIEW, in which case we rely on the first column's table name.
@@ -9701,10 +9986,13 @@ function TMySQLQuery.TableName(Column: Integer): String;
end;
end;
end;
- end else begin
+ end;
+
+ if Result.IsEmpty then begin
// Normal table column
// Note: this is empty on data tab TEXT columns with LEFT(..) clause
Result := FieldOrgTable;
+ StripNewLines(Result);
end;
end;
@@ -9716,18 +10004,21 @@ function TAdoDBQuery.TableName(Column: Integer): String;
function TPGQuery.TableName(Column: Integer): String;
var
- FieldTypeOID: POid;
+ TableOid: POid;
begin
// Get table name from a result set
// "123::regclass" results are quoted if they contain special characters
- Result := EmptyStr;
- FieldTypeOID := FConnection.Lib.PQftable(FCurrentResults, Column);
- if not FConnection.RegClasses.ContainsKey(FieldTypeOID) then begin
- Result := FConnection.GetVar('SELECT '+IntToStr(FieldTypeOID)+'::regclass');
- Result := FConnection.DeQuoteIdent(Result);
- FConnection.RegClasses.Add(FieldTypeOID, Result);
+ TableOid := FConnection.Lib.PQftable(FCurrentResults, Column);
+ if TableOid = InvalidOid then begin
+ // 0 => not a simple reference to a table column, e.g. on SUBSTRING(col, 1, 256)
+ Result := EmptyStr;
+ end
+ else if FConnection.RegClasses.ContainsKey(TableOid) then begin
+ FConnection.RegClasses.TryGetValue(TableOid, Result);
end else begin
- FConnection.RegClasses.TryGetValue(FieldTypeOID, Result);
+ Result := FConnection.GetVar('SELECT '+IntToStr(TableOid)+'::regclass');
+ Result := FConnection.DeQuoteIdent(Result);
+ FConnection.RegClasses.Add(TableOid, Result);
end;
end;
@@ -9758,7 +10049,14 @@ function TDBQuery.QuotedDbAndTableName: String;
end;
-function TDBQuery.GetKeyColumns: TStringList;
+function TDBQuery.ResultName: String;
+begin
+ // Return name of query defined in a comment above the actual query
+ Result := RegExprGetMatch('--\s+name\:\s*([^\r\n]+)', FSQL, 1, False, True);
+ Result := Trim(Result);
+end;
+
+function TDBQuery.GetKeyColumns: TTableColumnList;
var
i: Integer;
begin
@@ -9768,7 +10066,7 @@ function TDBQuery.GetKeyColumns: TStringList;
if Result.Count = 0 then begin
// No good key found. Just expect all columns to be present.
for i:=0 to FColumns.Count-1 do
- Result.Add(FColumns[i].Name);
+ Result.Add(FColumns[i]);
end;
end;
@@ -9776,14 +10074,14 @@ function TDBQuery.GetKeyColumns: TStringList;
procedure TDBQuery.CheckEditable;
var
i: Integer;
- KeyCols: TStringList;
+ KeyCols: TTableColumnList;
begin
KeyCols := GetKeyColumns;
if KeyCols.Count = 0 then
raise EDbError.Create(_(MSG_NOGRIDEDITING));
// All column names must be present in order to send valid INSERT/UPDATE/DELETE queries
for i:=0 to KeyCols.Count-1 do begin
- if FColumnOrgNames.IndexOf(KeyCols[i]) = -1 then
+ if FColumnOrgNames.IndexOf(KeyCols[i].Name) = -1 then
raise EDbError.Create(_(MSG_NOGRIDEDITING));
end;
for i:=0 to FColumnOrgNames.Count-1 do begin
@@ -9799,7 +10097,7 @@ function TDBQuery.IsEditable: Boolean;
Result := True;
except
on E:EDbError do begin
- FConnection.Log(lcDebug, E.Message);
+ FConnection.Log(lcInfo, E.Message);
Result := False;
end;
end;
@@ -9809,7 +10107,7 @@ function TDBQuery.IsEditable: Boolean;
function TDBQuery.GetWhereClause: String;
var
i, j: Integer;
- NeededCols: TStringList;
+ NeededCols: TTableColumnList;
ColVal: String;
ColIsNull: Boolean;
begin
@@ -9818,16 +10116,13 @@ function TDBQuery.GetWhereClause: String;
Result := '';
for i:=0 to NeededCols.Count-1 do begin
- j := FColumnOrgNames.IndexOf(NeededCols[i]);
+ j := FColumnOrgNames.IndexOf(NeededCols[i].Name);
if j = -1 then
- raise EDbError.CreateFmt(_('Cannot compose WHERE clause - column missing: %s'), [NeededCols[i]]);
+ raise EDbError.CreateFmt(_('Cannot compose WHERE clause - column missing: %s'), [NeededCols[i].Name]);
if Result <> '' then
Result := Result + ' AND';
-
- Result := Result + ' ' + Connection.QuoteIdent(FColumnOrgNames[j]);
- if (DataType(j).Index = dbdtJson) and (Self is TPGQuery) then begin
- Result := Result + '::text';
- end;
+ // See issue #769 and #2031 for why we need CastAsText
+ Result := Result + ' ' + NeededCols[i].CastAsText;
if Modified(j) then begin
ColVal := FCurrentUpdateRow[j].OldText;
@@ -9843,7 +10138,7 @@ function TDBQuery.GetWhereClause: String;
case DataType(j).Category of
dtcInteger, dtcReal: begin
if DataType(j).Index = dbdtBit then
- Result := Result + '=b' + Connection.EscapeString(ColVal)
+ Result := Result + '=' + Connection.EscapeString(ColVal, DataType(j))
else begin
// Guess (!) the default value silently inserted by the server. This is likely
// to be incomplete in cases where a UNIQUE key allows NULL here
@@ -9855,16 +10150,10 @@ function TDBQuery.GetWhereClause: String;
dtcTemporal:
Result := Result + '=' + Connection.EscapeString(Connection.GetDateTimeValue(ColVal, DataType(j).Index));
dtcBinary, dtcSpatial:
- Result := Result + '=' + HexValue(ColVal);
+ Result := Result + '=' + FConnection.EscapeBin(ColVal);
else begin
// Any other data type goes here, including text:
- case DataType(j).Index of
- // Support international characters with N-prefix on MSSQL, see #1115:
- dbdtNchar, dbdtNvarchar, dbdtNtext:
- Result := Result + '=N' + Connection.EscapeString(ColVal);
- else
- Result := Result + '=' + Connection.EscapeString(ColVal);
- end;
+ Result := Result + '=' + Connection.EscapeString(ColVal, DataType(j));
end;
end;
end;
@@ -9874,7 +10163,7 @@ function TDBQuery.GetWhereClause: String;
function TDBQuery.GridQuery(QueryType, QueryBody: String): String;
var
- KeyColumns: TStringList;
+ KeyColumns: TTableColumnList;
begin
// Return automatic grid UPDATE/DELETE/SELECT, and apply LIMIT clause if no good key is present
KeyColumns := Connection.GetKeyColumns(FColumns, FKeys);
@@ -9948,33 +10237,51 @@ function TDBObjectDropComparer.Compare(const Left, Right: TDBObject): Integer;
constructor TDBObject.Create(OwnerConnection: TDBConnection);
begin
- NodeType := lntNone;
- GroupType := lntNone;
+ // Take care, when adding properties here, add them in Assign() below as well
Name := '';
- Database := '';
Schema := '';
- Rows := -1;
- Size := -1;
- Created := 0;
- Updated := 0;
+ Database := '';
+ Column := '';
Engine := '';
Comment := '';
- Version := -1;
- AutoInc := -1;
RowFormat := '';
+ CreateOptions := '';
+ Collation := '';
+ Created := 0;
+ Updated := 0;
+ LastChecked := 0;
+ Rows := -1;
+ Size := -1;
+ Version := -1;
AvgRowLen := -1;
MaxDataLen := -1;
IndexLen := -1;
DataLen := -1;
DataFree := -1;
- LastChecked := 0;
- Collation := '';
+ AutoInc := -1;
CheckSum := -1;
- CreateOptions := '';
+ Body := '';
+ Definer := '';
+ Returns := '';
+ DataAccess := '';
+ Security := '';
+ ArgTypes := '';
+ Deterministic := False;
+ RowsAreExact := False;
+ IsMaterialized := False;
+ NodeType := lntNone;
+ GroupType := lntNone;
FCreateCode := '';
FCreateCodeLoaded := False;
- RowsAreExact := False;
+ FWasSelected := False;
FConnection := OwnerConnection;
+ FMap := TStringMap.Create;
+end;
+
+destructor TDBObject.Destroy;
+begin
+ FMap.Free;
+ inherited;
end;
@@ -9985,22 +10292,41 @@ procedure TDBObject.Assign(Source: TPersistent);
if Source is TDBObject then begin
s := Source as TDBObject;
Name := s.Name;
- Column := s.Column;
- Collation := s.Collation;
- Engine := s.Engine;
Schema := s.Schema;
Database := s.Database;
- NodeType := s.NodeType;
- GroupType := s.GroupType;
+ Column := s.Column;
+ Engine := s.Engine;
+ Comment := s.Comment;
+ RowFormat := s.RowFormat;
+ CreateOptions := s.CreateOptions;
+ Collation := s.Collation;
Created := s.Created;
Updated := s.Updated;
- Comment := s.Comment;
+ LastChecked := s.LastChecked;
Rows := s.Rows;
- RowsAreExact := s.RowsAreExact;
Size := s.Size;
+ Version := s.Version;
+ AvgRowLen := s.AvgRowLen;
+ MaxDataLen := s.MaxDataLen;
+ IndexLen := s.IndexLen;
+ DataLen := s.DataLen;
+ DataFree := s.DataFree;
+ AutoInc := s.AutoInc;
+ CheckSum := s.CheckSum;
+ Body := s.Body;
+ Definer := s.Definer;
+ Returns := s.Returns;
+ DataAccess := s.DataAccess;
+ Security := s.Security;
ArgTypes := s.ArgTypes;
+ Deterministic := s.Deterministic;
+ RowsAreExact := s.RowsAreExact;
+ IsMaterialized := s.IsMaterialized;
+ NodeType := s.NodeType;
+ GroupType := s.GroupType;
FCreateCode := s.FCreateCode;
FCreateCodeLoaded := s.FCreateCodeLoaded;
+ FWasSelected := s.FWasSelected;
end else
inherited;
end;
@@ -10235,10 +10561,10 @@ function TDBObject.SchemaClauseIS(Prefix: String): String;
if Schema <> '' then
Result := Prefix+'_SCHEMA' + '=' + Connection.EscapeString(Schema)
else
- Result := Connection.GetSQLSpecifity(spISSchemaCol, [Prefix]) + '=' + Connection.EscapeString(Database);
+ Result := Connection.SqlProvider.GetSql(qISSchemaCol, [Prefix]) + '=' + Connection.EscapeString(Database);
end;
-function TDBObject.RowCount(Reload: Boolean; ForceExact: Bool=False): Int64;
+function TDBObject.RowCount(Reload: Boolean; ForceExact: Boolean=False): Int64;
begin
if (Rows = -1) or Reload then begin
Rows := Connection.GetRowCount(Self, ForceExact);
@@ -10305,6 +10631,21 @@ function TDBObject.GetTableCheckConstraints: TCheckConstraintList;
Result.Assign(CheckConstraintsInCache);
end;
+function TDBObject.AsStringMap: TStringMap;
+begin
+ FMap.Clear;
+ FMap.Add('EscapedName', FConnection.EscapeString(Name));
+ FMap.Add('EscapedSchema', FConnection.EscapeString(Schema));
+ FMap.Add('EscapedDatabase', FConnection.EscapeString(Database));
+ FMap.Add('EscapedDbSchemaName', FConnection.EscapeString(Database+'.'+Schema+'.'+Name));
+ FMap.Add('QuotedDatabase', QuotedDatabase);
+ FMap.Add('QuotedName', QuotedName);
+ FMap.Add('QuotedDbAndTableName', QuotedDbAndTableName);
+ FMap.Add('ObjType', UpperCase(ObjType));
+ Result := FMap;
+end;
+
+
{ *** TTableColumn }
@@ -10362,8 +10703,10 @@ constructor TTableColumn.Create(AOwner: TDBConnection; Serialized: String='');
GenerationExpression := FromSerialized('Expression', '');
Virtuality := FromSerialized('Virtuality', '');
Invisible := FromSerialized('Invisible', '0').ToInteger.ToBoolean;
+ SRID := FromSerialized('SRID', '0').ToInteger;
NumVal := FromSerialized('Status', Integer(esUntouched).ToString);
FStatus := TEditingStatus(NumVal.ToInteger);
+ Compressed := FromSerialized('Compressed', '0').ToInteger.ToBoolean;
Attributes.Free;
end;
@@ -10398,6 +10741,8 @@ procedure TTableColumn.Assign(Source: TPersistent);
GenerationExpression := s.GenerationExpression;
Virtuality := s.Virtuality;
Invisible := s.Invisible;
+ SRID := s.SRID;
+ Compressed := s.Compressed;
FStatus := s.FStatus;
end else
inherited;
@@ -10431,6 +10776,8 @@ function TTableColumn.Serialize: String;
s.AddPair('GenerationExpression', GenerationExpression);
s.AddPair('Virtuality', Virtuality);
s.AddPair('Invisible', Invisible.ToInteger.ToString);
+ s.AddPair('SRID', SRID.ToString);
+ s.AddPair('Compressed', Compressed.ToInteger.ToString);
s.AddPair('Status', Integer(FStatus).ToString);
Result := Implode(DELIMITER, s);
@@ -10452,6 +10799,7 @@ procedure TTableColumn.SetStatus(Value: TEditingStatus);
function TTableColumn.SQLCode(OverrideCollation: String=''; Parts: TColumnParts=[cpAll]): String;
var
IsVirtual: Boolean;
+ QuoteCollation: Boolean;
function InParts(Part: TColumnPart): Boolean;
begin
@@ -10466,32 +10814,45 @@ function TTableColumn.SQLCode(OverrideCollation: String=''; Parts: TColumnParts=
end;
if InParts(cpType) then begin
- case FConnection.Parameters.NetTypeGroup of
- ngPgSQL: begin
- if DefaultType = cdtAutoInc then
- Result := Result + 'SERIAL'
- else
- Result := Result + DataType.Name;
+
+ if FConnection.Parameters.IsAnyPostgreSQL and (DefaultType = cdtAutoInc) then begin
+ Result := Result + 'SERIAL';
+ end
+ else begin
+
+ if (DataType.Index = dbdtEnum) and (FConnection.NamedEnums.IndexOfName(LengthSet) > -1) then begin
+ Result := Result + LengthSet;
+ end
+ else begin
+ Result := Result + DataType.Name;
+ if (LengthSet <> '') and DataType.HasLength then
+ Result := Result + '(' + LengthSet + ')';
end;
- else Result := Result + DataType.Name;
+
+ if (DataType.Category in [dtcInteger, dtcReal]) and Unsigned then
+ Result := Result + ' UNSIGNED';
+ if (DataType.Category in [dtcInteger, dtcReal]) and ZeroFill then
+ Result := Result + ' ZEROFILL';
+ if Compressed and FConnection.Parameters.IsMariaDB then
+ Result := Result + ' /*!100301 COMPRESSED*/';
end;
- if (LengthSet <> '') and DataType.HasLength then
- Result := Result + '(' + LengthSet + ')';
- if (DataType.Category in [dtcInteger, dtcReal]) and Unsigned then
- Result := Result + ' UNSIGNED';
- if (DataType.Category in [dtcInteger, dtcReal]) and ZeroFill then
- Result := Result + ' ZEROFILL';
Result := Result + ' '; // Add space after each part
end;
- if InParts(cpAllowNull) and (not IsVirtual) then begin
+ if InParts(cpAllowNull) and (not IsVirtual) and (not FConnection.Parameters.IsAnyMSSQL) then begin
if not AllowNull then
Result := Result + 'NOT NULL '
else if not FConnection.Parameters.IsAnyInterbase then
Result := Result + 'NULL ';
end;
+ // SRID for spatial columns supported since MySQL 8.0
+ if InParts(cpSRID) and (DataType.Category = dtcSpatial) and FConnection.Has(frSrid) then begin
+ Result := Result + 'SRID ' + SRID.ToString + ' ';
+ end;
+
+
if InParts(cpDefault) and (not IsVirtual) then begin
if DefaultType <> cdtNothing then begin
case DefaultType of
@@ -10501,11 +10862,11 @@ function TTableColumn.SQLCode(OverrideCollation: String=''; Parts: TColumnParts=
cdtAutoInc: begin
case FConnection.Parameters.NetTypeGroup of
ngPgSQL:;
- else Result := Result + AutoIncName;
+ else Result := Result + FConnection.SqlProvider.GetSql(qAutoInc);
end;
end;
cdtExpression: begin
- if FConnection.Parameters.IsMySQL(True) and (FConnection.ServerVersionInt >= 80013) then
+ if FConnection.Has(frColumnDefaultParentheses) then
Result := Result + 'DEFAULT ('+DefaultText+')'
else
Result := Result + 'DEFAULT '+DefaultText;
@@ -10528,6 +10889,10 @@ function TTableColumn.SQLCode(OverrideCollation: String=''; Parts: TColumnParts=
Result := Result + 'AS ('+GenerationExpression+') ' + Virtuality + ' ';
end;
+ if InParts(cpInvisible) and Invisible and FConnection.Has(frInvisibleColumns) then begin
+ Result := Result + 'INVISIBLE ';
+ end;
+
if InParts(cpComment) then begin
if (Comment <> '') and FConnection.Parameters.IsAnyMySQL then
Result := Result + 'COMMENT ' + FConnection.EscapeString(Comment) + ' ';
@@ -10536,10 +10901,11 @@ function TTableColumn.SQLCode(OverrideCollation: String=''; Parts: TColumnParts=
if InParts(cpCollation) and (not IsVirtual) and (DataType.Index <> dbdtJson) then begin
if Collation <> '' then begin
Result := Result + 'COLLATE ';
+ QuoteCollation := not FConnection.Parameters.IsAnyMSSQL;
if OverrideCollation <> '' then
- Result := Result + FConnection.EscapeString(OverrideCollation) + ' '
+ Result := Result + IfThen(QuoteCollation, FConnection.EscapeString(OverrideCollation), OverrideCollation) + ' '
else
- Result := Result + FConnection.EscapeString(Collation) + ' ';
+ Result := Result + IfThen(QuoteCollation, FConnection.EscapeString(Collation), Collation) + ' ';
end;
end;
@@ -10562,7 +10928,9 @@ procedure TTableColumn.ParseDatatype(Source: String);
var
InLiteral: Boolean;
ParenthLeft, i: Integer;
+ OrgSource: String;
begin
+ OrgSource := Source;
DataType := Connection.GetDatatypeByName(Source, True);
// Length / Set
// Various datatypes, e.g. BLOBs, don't have any length property
@@ -10575,14 +10943,20 @@ procedure TTableColumn.ParseDatatype(Source: String);
if Source[i] = '''' then
InLiteral := not InLiteral;
end;
- LengthSet := Copy(Source, ParenthLeft+1, i-2);
+ LengthSet := Copy(Source, ParenthLeft+1, i-1-ParenthLeft);
if LengthSet = DataType.DefaultSize.ToString then
LengthSet := '';
end else begin
LengthSet := '';
+ if DataType.Index = dbdtEnum then begin
+ // Assign PostgreSQL enum type to LengthSet, so we can provide it in table editor
+ // Some enum types are wrapped in double quotes
+ LengthSet := OrgSource.Trim([FConnection.QuoteChar]);
+ end;
end;
Unsigned := ExecRegExpr('\bunsigned\b', Source.ToLowerInvariant);
ZeroFill := ExecRegExpr('\bzerofill\b', Source.ToLowerInvariant);
+ Compressed := ExecRegExpr('\bcompressed\W', Source.ToLowerInvariant);
end;
@@ -10592,7 +10966,7 @@ function TTableColumn.CastAsText: String;
Result := FConnection.QuoteIdent(Name);
case FConnection.Parameters.NetTypeGroup of
ngMySQL, ngSQLite: begin
- if DataType.Index in [dbdtUnknown, dbdtDate, dbdtDatetime, dbdtTime, dbdtTimestamp] then
+ if DataType.Index in [dbdtUnknown, dbdtDate, dbdtDatetime, dbdtTime, dbdtTimestamp, dbdtJson, dbdtJsonB] then
Result := 'CAST('+Result+' AS CHAR)';
end;
ngMSSQL: begin
@@ -10602,18 +10976,22 @@ function TTableColumn.CastAsText: String;
Result := 'CAST('+Result+' AS NVARCHAR('+IntToStr(GRIDMAXDATA)+'))';
end;
ngPgSQL: begin
- if (DataType.Index = dbdtUnknown) or (DataType.Category = dtcBinary) then
+ // Cast most datatypes, including VARCHAR and TEXT, which may have an [] array attribute
+ if not (DataType.Category in [dtcInteger, dtcReal]) then
Result := Result + '::text';
end;
end;
end;
-function TTableColumn.AutoIncName: String;
+function TTableColumn.FullDataType: String;
begin
- case FConnection.Parameters.NetTypeGroup of
- ngPgSQL: Result := 'SERIAL';
- else Result := 'AUTO_INCREMENT';
+ Result := DataType.Name;
+ if not LengthSet.IsEmpty then begin
+ if (DataType.Index = dbdtEnum) and (FConnection.NamedEnums.IndexOfName(LengthSet) > -1) then
+ Result := LengthSet
+ else
+ Result := Result + '(' + LengthSet + ')';
end;
end;
@@ -10630,6 +11008,45 @@ procedure TTableColumnList.Assign(Source: TTableColumnList);
end;
+function TTableColumnList.FindByName(const Value: String): TTableColumn;
+var
+ Col: TTableColumn;
+begin
+ Result := nil;
+ for Col in Self do begin
+ if Col.Name = Value then begin
+ Result := Col;
+ break;
+ end;
+ end;
+end;
+
+function TTableColumnList.HasInvisibleColumns: Boolean;
+var
+ Col: TTableColumn;
+begin
+ Result := False;
+ for Col in Self do begin
+ if Col.Invisible then begin
+ Result := True;
+ Break;
+ end;
+ end;
+end;
+
+function TTableColumnList.QuoteIdents: String;
+var
+ Col: TTableColumn;
+ QuotedNames: TStringList;
+begin
+ QuotedNames := TStringList.Create;
+ for Col in Self do begin
+ QuotedNames.Add(Col.Connection.QuoteIdent(Col.Name));
+ end;
+ Result := Implode(', ', QuotedNames);
+ QuotedNames.Free;
+end;
+
{ *** TTableKey }
@@ -10639,14 +11056,18 @@ constructor TTableKey.Create(AOwner: TDBConnection);
FConnection := AOwner;
Columns := TStringList.Create;
SubParts := TStringList.Create;
+ Collations := TStringList.Create;
Columns.OnChange := Modification;
Subparts.OnChange := Modification;
+ Collations.OnChange := Modification;
+ Visible := True;
end;
destructor TTableKey.Destroy;
begin
FreeAndNil(Columns);
FreeAndNil(SubParts);
+ FreeAndNil(Collations);
inherited Destroy;
end;
@@ -10662,14 +11083,52 @@ procedure TTableKey.Assign(Source: TPersistent);
OldIndexType := s.OldIndexType;
Algorithm := s.Algorithm;
Comment := s.Comment;
+ Visible := s.Visible;
Columns.Assign(s.Columns);
SubParts.Assign(s.SubParts);
+ Collations.Assign(s.Collations);
Modified := s.Modified;
Added := s.Added;
end else
inherited;
end;
+function TTableKey.IsPrimary: Boolean;
+begin
+ Result := IndexType = PRIMARY;
+end;
+
+function TTableKey.IsIndex: Boolean;
+begin
+ Result := IndexType = KEY;
+end;
+
+function TTableKey.IsUnique: Boolean;
+begin
+ Result := IndexType = UNIQUE;
+end;
+
+function TTableKey.IsFulltext: Boolean;
+begin
+ Result := IndexType = FULLTEXT;
+end;
+
+function TTableKey.IsSpatial: Boolean;
+begin
+ Result := IndexType = SPATIAL;
+end;
+
+function TTableKey.IsVector: Boolean;
+begin
+ Result := IndexType = VECTOR;
+end;
+
+function TTableKey.IsExpression(KeyPart: Integer): Boolean;
+begin
+ Result := Columns[KeyPart].StartsWith('(');
+end;
+
+
procedure TTableKey.Modification(Sender: TObject);
begin
if not Added then
@@ -10679,15 +11138,26 @@ procedure TTableKey.Modification(Sender: TObject);
function TTableKey.GetImageIndex: Integer;
begin
// Detect key icon index for specified index
- if IndexType = TTableKey.PRIMARY then Result := ICONINDEX_PRIMARYKEY
- else if IndexType = TTableKey.KEY then Result := ICONINDEX_INDEXKEY
- else if IndexType = TTableKey.UNIQUE then Result := ICONINDEX_UNIQUEKEY
- else if IndexType = TTableKey.FULLTEXT then Result := ICONINDEX_FULLTEXTKEY
- else if IndexType = TTableKey.SPATIAL then Result := ICONINDEX_SPATIALKEY
+ if IsPrimary then Result := ICONINDEX_PRIMARYKEY
+ else if IsIndex then Result := ICONINDEX_INDEXKEY
+ else if IsUnique then Result := ICONINDEX_UNIQUEKEY
+ else if IsFulltext then Result := ICONINDEX_FULLTEXTKEY
+ else if IsSpatial then Result := ICONINDEX_SPATIALKEY
+ else if IsVector then Result := ICONINDEX_VECTORKEY
else Result := -1;
end;
-function TTableKey.SQLCode: String;
+function TTableKey.GetInsideCreateCode: Boolean;
+begin
+ case FConnection.Parameters.NetTypeGroup of
+ ngMySQL: Result := True;
+ ngSQLite: Result := IsPrimary;
+ ngPgSQL: Result := IsPrimary or IsUnique;
+ else Result := True;
+ end;
+end;
+
+function TTableKey.SQLCode(TableName: String=''): String;
var
i: Integer;
begin
@@ -10695,30 +11165,61 @@ function TTableKey.SQLCode: String;
// Supress SQL error trying index creation with 0 column
if Columns.Count = 0 then
Exit;
- if IndexType = TTableKey.PRIMARY then
- Result := Result + 'PRIMARY KEY '
+ if InsideCreateCode then begin
+ if IsPrimary then
+ Result := Result + 'PRIMARY KEY '
+ else begin
+ if FConnection.Parameters.IsAnyPostgreSQL then begin
+ Result := Result + IndexType + ' ';
+ end
+ else begin
+ if not IsIndex then
+ Result := Result + IndexType + ' ';
+ Result := Result + 'INDEX ' + FConnection.QuoteIdent(Name) + ' ';
+ end;
+ end;
+ Result := Result + '(';
+ for i:=0 to Columns.Count-1 do begin
+ if IsExpression(i) then
+ Result := Result + Columns[i] // Don't quote functional key part
+ else
+ Result := Result + FConnection.QuoteIdent(Columns[i]);
+ if (SubParts.Count > i) and (SubParts[i] <> '') then
+ Result := Result + '(' + SubParts[i] + ')';
+ // Collation / sort order, see issue #1512
+ if (Collations.Count > i) and (Collations[i].ToLower = 'd') then
+ Result := Result + ' DESC';
+ Result := Result + ', ';
+ end;
+ if Columns.Count > 0 then
+ Delete(Result, Length(Result)-1, 2);
+
+ Result := Result + ')';
+
+ if Algorithm <> '' then
+ Result := Result + ' USING ' + Algorithm;
+
+ if not Comment.IsEmpty then
+ Result := Result + ' COMMENT ' + FConnection.EscapeString(Comment);
+
+ end
else begin
- if IndexType <> TTableKey.KEY then
+ // SQLite syntax:
+ // CREATE INDEX myindex ON table1 ("Column 1")
+ // TODO: test on PG, MS, IB
+ Result := 'CREATE ';
+ if not IsIndex then
Result := Result + IndexType + ' ';
- Result := Result + 'INDEX ' + FConnection.QuoteIdent(Name) + ' ';
- end;
- Result := Result + '(';
- for i:=0 to Columns.Count-1 do begin
- Result := Result + FConnection.QuoteIdent(Columns[i]);
- if SubParts[i] <> '' then
- Result := Result + '(' + SubParts[i] + ')';
- Result := Result + ', ';
+ Result := Result + 'INDEX '+FConnection.QuoteIdent(Name)+' ON ' + FConnection.QuoteIdent(TableName) + ' (';
+ for i:=0 to Columns.Count-1 do begin
+ Result := Result + FConnection.QuoteIdent(Columns[i]);
+ Result := Result + ', ';
+ end;
+ if Columns.Count > 0 then
+ Delete(Result, Length(Result)-1, 2);
+ Result := Result + ')';
end;
- if Columns.Count > 0 then
- Delete(Result, Length(Result)-1, 2);
-
- Result := Result + ')';
-
- if Algorithm <> '' then
- Result := Result + ' USING ' + Algorithm;
- if not Comment.IsEmpty then
- Result := Result + ' COMMENT ' + FConnection.EscapeString(Comment);
end;
procedure TTableKeyList.Assign(Source: TTableKeyList);
@@ -10825,13 +11326,14 @@ function TForeignKey.ReferenceTableObj: TDBObject;
RefTable := ReferenceTable.Substring(Length(ReferenceDb) + 1);
end else begin
RefDb := ReferenceTable.Substring(0, Pos('.', ReferenceTable)-1);
- if not RefDb.IsEmpty then begin
+ if (not RefDb.IsEmpty) and (FConnection.FAllDatabases.IndexOf(RefDb) > -1) then begin
RefTable := ReferenceTable.Substring(Length(RefDb)+1);
end else begin
RefDb := FConnection.Database;
RefTable := ReferenceTable;
end;
end;
+ FConnection.Log(lcDebug, 'Find object "'+RefTable+'" in db "'+RefDb+'"');
Result := FConnection.FindObject(RefDb, RefTable);
end;
@@ -10911,7 +11413,8 @@ constructor TSQLFunctionList.Create(AOwner: TDBConnection; SQLFunctionsFileOrder
TryFiles := Explode(',', SQLFunctionsFileOrder);
for TryFile in TryFiles do begin
- IniFilePath := ExtractFilePath(Application.ExeName) + 'functions-'+TryFile+'.ini';
+ IniFilePath := GetAppDir + 'functions-'+TryFile+'.ini';
+ FOwner.Log(lcDebug, 'Trying '+IniFilePath);
if FileExists(IniFilePath) then begin
FOwner.Log(lcInfo, 'Reading function definitions from '+IniFilePath);
Ini := TMemIniFile.Create(IniFilePath);
diff --git a/source/dbstructures.interbase.pas b/source/dbstructures.interbase.pas
index ad466f929..cb2364391 100644
--- a/source/dbstructures.interbase.pas
+++ b/source/dbstructures.interbase.pas
@@ -4,7 +4,13 @@
interface
uses
- dbstructures;
+ dbstructures, StrUtils;
+
+type
+ TInterbaseProvider = class(TSqlProvider)
+ public
+ function GetSql(AId: TQueryId): string; override;
+ end;
var
@@ -171,4 +177,65 @@ interface
implementation
+
+{ TInterbaseProvider }
+
+function TInterbaseProvider.GetSql(AId: TQueryId): string;
+begin
+ case AId of
+ qDatabaseDrop: Result := 'DROP DATABASE %s';
+ qEmptyTable: Result := 'TRUNCATE %s';
+ qRenameTable: Result := 'RENAME TABLE %s TO %s';
+ qRenameView: Result := 'RENAME TABLE %s TO %s';
+ qCurrentUserHost: Result := IfThen(
+ FNetType in [ntInterbase_TCPIP, ntInterbase_Local],
+ 'select user from rdb$database',
+ 'select current_user || ''@'' || mon$attachments.mon$remote_host from mon$attachments where mon$attachments.mon$attachment_id = current_connection'
+ );
+ qLikeCompare: Result := '%s LIKE %s';
+ qAddColumn: Result := 'ADD COLUMN %s';
+ qChangeColumn: Result := 'CHANGE COLUMN %s %s';
+ qRenameColumn: Result := '';
+ qSessionVariables: Result := 'SHOW VARIABLES';
+ qGlobalVariables: Result := 'SHOW GLOBAL VARIABLES';
+ qISSchemaCol: Result := '%s_SCHEMA';
+ qUSEQuery: Result := '';
+ qKillQuery: Result := 'KILL %d';
+ qKillProcess: Result := 'KILL %d';
+ qFuncLength: Result := 'LENGTH';
+ qFuncCeil: Result := 'CEIL';
+ qFuncLeft: Result := 'SUBSTR(%s, 1, %d)';
+ qFuncNow: Result := ' cast(''now'' as timestamp) from rdb$database';
+ qFuncLastAutoIncNumber: Result := 'LAST_INSERT_ID()';
+ qLockedTables: Result := '';
+ qDisableForeignKeyChecks: Result := '';
+ qEnableForeignKeyChecks: Result := '';
+ qForeignKeyDrop: Result := 'DROP FOREIGN KEY %s';
+ qGetTableColumns: Result := 'SELECT r.RDB$FIELD_NAME AS field_name,'+
+ ' r.RDB$DESCRIPTION AS field_description,'+
+ ' r.RDB$DEFAULT_VALUE AS field_default_value,'+
+ ' r.RDB$NULL_FLAG AS null_flag,'+
+ ' f.RDB$FIELD_LENGTH AS field_length,'+
+ ' f.RDB$FIELD_PRECISION AS field_precision,'+
+ ' f.RDB$FIELD_SCALE AS field_scale,'+
+ ' f.RDB$FIELD_TYPE AS field_type,'+
+ ' f.RDB$FIELD_SUB_TYPE AS field_subtype,'+
+ ' coll.RDB$COLLATION_NAME AS field_collation,'+
+ ' cset.RDB$CHARACTER_SET_NAME AS field_charset'+
+ ' FROM RDB$RELATION_FIELDS r'+
+ ' LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME'+
+ ' LEFT JOIN RDB$CHARACTER_SETS cset ON f.RDB$CHARACTER_SET_ID = cset.RDB$CHARACTER_SET_ID'+
+ ' LEFT JOIN RDB$COLLATIONS coll ON f.RDB$COLLATION_ID = coll.RDB$COLLATION_ID'+
+ ' AND F.RDB$CHARACTER_SET_ID = COLL.RDB$CHARACTER_SET_ID'+
+ ' WHERE r.RDB$RELATION_NAME=%s'+
+ ' ORDER BY r.RDB$FIELD_POSITION';
+ qGetCollations: Result := 'SELECT RDB$COLLATION_NAME AS "Collation",'+
+ ' RDB$COLLATION_ID AS "Id",'+
+ ' RDB$CHARACTER_SET_ID'+
+ ' FROM RDB$COLLATIONS';
+ qGetCharsets: Result := 'SELECT RDB$CHARACTER_SET_NAME AS "Charset", RDB$CHARACTER_SET_NAME AS "Description" FROM RDB$CHARACTER_SETS';
+ end;
+end;
+
+
end.
\ No newline at end of file
diff --git a/source/dbstructures.mssql.pas b/source/dbstructures.mssql.pas
index 2072334ba..c10bb5793 100644
--- a/source/dbstructures.mssql.pas
+++ b/source/dbstructures.mssql.pas
@@ -3,7 +3,13 @@
interface
uses
- dbstructures;
+ dbstructures, StrUtils;
+
+type
+ TMsSqlProvider = class(TSqlProvider)
+ public
+ function GetSql(AId: TQueryId): string; override;
+ end;
var
@@ -407,4 +413,76 @@ interface
implementation
+
+function TMsSqlProvider.GetSql(AId: TQueryId): string;
+begin
+ case AId of
+ qDatabaseTable: Result := IfThen(
+ ServerVersion<=899,
+ 'master..sysdatabases',
+ 'sys.databases'
+ );
+ qDatabaseTableId: Result := IfThen(
+ ServerVersion<=899,
+ 'dbid',
+ 'database_id'
+ );
+ qDatabaseDrop: Result := 'DROP DATABASE %s';
+ qDbObjectsTable: Result := IfThen(
+ ServerVersion<=899,
+ '..sysobjects',
+ '.sys.objects'
+ );
+ qDbObjectsCreateCol: Result := IfThen(
+ ServerVersion<=899,
+ 'crdate',
+ 'create_date'
+ );
+ qDbObjectsUpdateCol: Result := IfThen(
+ ServerVersion<=899,
+ '',
+ 'modify_date'
+ );
+ qDbObjectsTypeCol: Result := IfThen(
+ ServerVersion<=899,
+ 'xtype',
+ 'type'
+ );
+ qRenameTable: Result := 'EXEC sp_rename %s, %s';
+ qRenameView: Result := 'EXEC sp_rename %s, %s';
+ qCurrentUserHost: Result := 'SELECT SYSTEM_USER';
+ qLikeCompare: Result := '%s LIKE %s';
+ qAddColumn: Result := 'ADD %s';
+ qChangeColumn: Result := 'ALTER COLUMN %s %s';
+ qSessionVariables: Result := 'SELECT comment, value FROM master.dbo.syscurconfigs ORDER BY comment';
+ qGlobalVariables: Result := 'SELECT comment, value FROM master.dbo.syscurconfigs ORDER BY comment';
+ qISSchemaCol: Result := '%s_CATALOG';
+ qUSEQuery: Result := 'USE %s';
+ qKillQuery: Result := 'KILL %d';
+ qKillProcess: Result := 'KILL %d';
+ qFuncLength: Result := 'LEN';
+ qFuncCeil: Result := 'CEILING';
+ qFuncLeft: Result := 'LEFT(%s, %d)';
+ qFuncNow: Result := 'GETDATE()';
+ qFuncLastAutoIncNumber: Result := 'LAST_INSERT_ID()';
+ qLockedTables: Result := '';
+ qDisableForeignKeyChecks: Result := '';
+ qEnableForeignKeyChecks: Result := '';
+ qForeignKeyDrop: Result := 'DROP FOREIGN KEY %s';
+ qGetTableColumns: Result := '';
+ qGetCollations: Result := 'SELECT '''' AS "Collation", '+
+ ''''' AS "Charset", 0 AS "Id", '+
+ ''''' AS "Default", '''' AS "Compiled", '+
+ '1 AS "Sortlen"';
+ qGetCharsets: Result := 'SELECT name AS Charset, description AS Description FROM master.sys.syscharsets';
+ qGetRowCountApprox: Result := IfThen(
+ FServerVersion >= 900,
+ 'SELECT SUM("rows") FROM "sys"."partitions" WHERE "index_id" IN (0, 1) AND "object_id" = object_id(:EscapedDbSchemaName)',
+ ''
+ );
+ else Result := inherited;
+ end;
+end;
+
+
end.
diff --git a/source/dbstructures.mysql.pas b/source/dbstructures.mysql.pas
index c05246252..6020fa61c 100644
--- a/source/dbstructures.mysql.pas
+++ b/source/dbstructures.mysql.pas
@@ -4,7 +4,7 @@
interface
uses
- System.Classes, dbstructures;
+ System.Classes, System.SysUtils, dbstructures, StrUtils;
const
@@ -259,83 +259,6 @@ MYSQL_RES = record
end;
PMYSQL_RES = ^MYSQL_RES;
- TMySQLOption = (
- MYSQL_OPT_CONNECT_TIMEOUT,
- MYSQL_OPT_COMPRESS,
- MYSQL_OPT_NAMED_PIPE,
- MYSQL_INIT_COMMAND,
- MYSQL_READ_DEFAULT_FILE,
- MYSQL_READ_DEFAULT_GROUP,
- MYSQL_SET_CHARSET_DIR,
- MYSQL_SET_CHARSET_NAME,
- MYSQL_OPT_LOCAL_INFILE,
- MYSQL_OPT_PROTOCOL,
- MYSQL_SHARED_MEMORY_BASE_NAME,
- MYSQL_OPT_READ_TIMEOUT,
- MYSQL_OPT_WRITE_TIMEOUT,
- MYSQL_OPT_USE_RESULT,
- MYSQL_OPT_USE_REMOTE_CONNECTION,
- MYSQL_OPT_USE_EMBEDDED_CONNECTION,
- MYSQL_OPT_GUESS_CONNECTION,
- MYSQL_SET_CLIENT_IP,
- MYSQL_SECURE_AUTH,
- MYSQL_REPORT_DATA_TRUNCATION,
- MYSQL_OPT_RECONNECT,
- MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
- MYSQL_PLUGIN_DIR,
- MYSQL_DEFAULT_AUTH,
- MYSQL_OPT_BIND,
- MYSQL_OPT_SSL_KEY,
- MYSQL_OPT_SSL_CERT,
- MYSQL_OPT_SSL_CA,
- MYSQL_OPT_SSL_CAPATH,
- MYSQL_OPT_SSL_CIPHER,
- MYSQL_OPT_SSL_CRL,
- MYSQL_OPT_SSL_CRLPATH,
- // Connection attribute options
- MYSQL_OPT_CONNECT_ATTR_RESET,
- MYSQL_OPT_CONNECT_ATTR_ADD,
- MYSQL_OPT_CONNECT_ATTR_DELETE,
- MYSQL_SERVER_PUBLIC_KEY,
- MYSQL_ENABLE_CLEARTEXT_PLUGIN,
- MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
- MYSQL_OPT_SSL_ENFORCE,
- MYSQL_OPT_MAX_ALLOWED_PACKET,
- MYSQL_OPT_NET_BUFFER_LENGTH,
- MYSQL_OPT_TLS_VERSION,
- MYSQL_OPT_SSL_MODE,
- MYSQL_OPT_GET_SERVER_PUBLIC_KEY,
-
- // MariaDB specific
- MYSQL_PROGRESS_CALLBACK=5999,
- MYSQL_OPT_NONBLOCK,
- // MariaDB Connector/C specific
- MYSQL_DATABASE_DRIVER=7000,
- MARIADB_OPT_SSL_FP, // deprecated, use MARIADB_OPT_TLS_PEER_FP instead
- MARIADB_OPT_SSL_FP_LIST, // deprecated, use MARIADB_OPT_TLS_PEER_FP_LIST instead
- MARIADB_OPT_TLS_PASSPHRASE, // passphrase for encrypted certificates
- MARIADB_OPT_TLS_CIPHER_STRENGTH,
- MARIADB_OPT_TLS_VERSION,
- MARIADB_OPT_TLS_PEER_FP, // single finger print for server certificate verification
- MARIADB_OPT_TLS_PEER_FP_LIST, // finger print white list for server certificate verification
- MARIADB_OPT_CONNECTION_READ_ONLY,
- MYSQL_OPT_CONNECT_ATTRS, // for mysql_get_optionv
- MARIADB_OPT_USERDATA,
- MARIADB_OPT_CONNECTION_HANDLER,
- MARIADB_OPT_PORT,
- MARIADB_OPT_UNIXSOCKET,
- MARIADB_OPT_PASSWORD,
- MARIADB_OPT_HOST,
- MARIADB_OPT_USER,
- MARIADB_OPT_SCHEMA,
- MARIADB_OPT_DEBUG,
- MARIADB_OPT_FOUND_ROWS,
- MARIADB_OPT_MULTI_RESULTS,
- MARIADB_OPT_MULTI_STATEMENTS,
- MARIADB_OPT_INTERACTIVE,
- MARIADB_OPT_PROXY_HEADER
- );
-
TMySQLLib = class(TDbLib)
mysql_affected_rows: function(Handle: PMYSQL): Int64; stdcall;
mysql_character_set_name: function(Handle: PMYSQL): PAnsiChar; stdcall;
@@ -351,14 +274,14 @@ TMySQLLib = class(TDbLib)
mysql_get_client_info: function: PAnsiChar; stdcall;
mysql_get_server_info: function(Handle: PMYSQL): PAnsiChar; stdcall;
mysql_init: function(Handle: PMYSQL): PMYSQL; stdcall;
+ mysql_info: function(Handle: PMYSQL): PAnsiChar; stdcall;
mysql_num_fields: function(Result: PMYSQL_RES): Integer; stdcall;
mysql_num_rows: function(Result: PMYSQL_RES): Int64; stdcall;
- mysql_options: function(Handle: PMYSQL; Option: Integer; arg: PAnsiChar): Integer; stdcall;
+ mysql_options: function(Handle: PMYSQL; Option: Integer; arg: Pointer): Integer; stdcall;
mysql_optionsv: function(Handle: PMYSQL; Option: Integer; arg, val: PAnsiChar): Integer; stdcall;
mysql_ping: function(Handle: PMYSQL): Integer; stdcall;
mysql_real_connect: function(Handle: PMYSQL; const Host, User, Passwd, Db: PAnsiChar; Port: Cardinal; const UnixSocket: PAnsiChar; ClientFlag: Cardinal): PMYSQL; stdcall;
mysql_real_query: function(Handle: PMYSQL; const Query: PAnsiChar; Length: Cardinal): Integer; stdcall;
- mysql_ssl_set: function(Handle: PMYSQL; const key, cert, CA, CApath, cipher: PAnsiChar): Byte; stdcall;
mysql_stat: function(Handle: PMYSQL): PAnsiChar; stdcall;
mysql_store_result: function(Handle: PMYSQL): PMYSQL_RES; stdcall;
mysql_thread_id: function(Handle: PMYSQL): Cardinal; stdcall;
@@ -367,16 +290,48 @@ TMySQLLib = class(TDbLib)
mysql_thread_init: function: Byte; stdcall;
mysql_thread_end: procedure; stdcall;
mysql_warning_count: function(Handle: PMYSQL): Cardinal; stdcall;
+ const
+ INVALID_OPT = -1;
+ MYBOOL_FALSE: Integer = 0;
+ MYBOOL_TRUE: Integer = 1;
protected
procedure AssignProcedures; override;
+ public
+ MYSQL_OPT_LOCAL_INFILE,
+ MYSQL_OPT_CONNECT_TIMEOUT,
+ MARIADB_OPT_TLS_VERSION,
+ MYSQL_OPT_TLS_VERSION,
+ MYSQL_PLUGIN_DIR,
+ MYSQL_OPT_SSL_KEY,
+ MYSQL_OPT_SSL_CERT,
+ MYSQL_OPT_SSL_CA,
+ MYSQL_OPT_SSL_CIPHER,
+ MYSQL_OPT_CONNECT_ATTR_ADD,
+ MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ MYSQL_OPT_SSL_MODE,
+ MYSQL_OPT_SSL_VERIFY_SERVER_CERT: Integer;
+ SSL_MODE_DISABLED,
+ SSL_MODE_PREFERRED,
+ SSL_MODE_REQUIRED,
+ SSL_MODE_VERIFY_CA,
+ SSL_MODE_VERIFY_IDENTITY: Integer;
+ constructor Create(DllFile, DefaultDll: String); override;
+ function IsLibMariadb: Boolean;
+ end;
+
+ TMySqlProvider = class(TSqlProvider)
+ public
+ function GetSql(AId: TQueryId): string; override;
end;
+
+
var
MySQLKeywords: TStringList;
MySQLErrorCodes: TStringList;
// MySQL Data Type List and Properties
- MySQLDatatypes: array [0..38] of TDBDatatype =
+ MySQLDatatypes: array [0..42] of TDBDatatype =
(
(
Index: dbdtUnknown;
@@ -405,6 +360,19 @@ TMySQLLib = class(TDbLib)
LoadPart: False;
Category: dtcInteger;
),
+ (
+ Index: dbdtBool;
+ NativeType: 1;
+ Name: 'BOOLEAN';
+ Description: 'Synonym of TINYINT(1)';
+ HasLength: False;
+ RequiresLength: False;
+ MaxSize: 127;
+ HasBinary: False;
+ HasDefault: True;
+ LoadPart: False;
+ Category: dtcInteger;
+ ),
(
Index: dbdtSmallint;
NativeType: 2;
@@ -737,7 +705,7 @@ TMySQLLib = class(TDbLib)
RequiresLength: False;
HasBinary: False;
HasDefault: False;
- LoadPart: False;
+ LoadPart: True;
Category: dtcText;
),
(
@@ -755,6 +723,39 @@ TMySQLLib = class(TDbLib)
LoadPart: False;
Category: dtcText;
),
+ (
+ Index: dbdtInet4;
+ NativeType: 255;
+ Name: 'INET4';
+ Description: 'INET4' + sLineBreak +
+ 'INET4 is a data type to store IPv4 addresses, as 4-byte binary strings. '+
+ 'It was added in MariaDB 10.10.0';
+ HasLength: False;
+ RequiresLength: False;
+ HasBinary: False;
+ HasDefault: True;
+ LoadPart: False;
+ Category: dtcText;
+ MinVersion: 10100;
+ ),
+ (
+ Index: dbdtInet6;
+ NativeType: 255;
+ Name: 'INET6';
+ Description: 'INET6' + sLineBreak +
+ 'The INET6 data type is intended for storage of IPv6 addresses, as well as ' +
+ 'IPv4 addresses assuming conventional mapping of IPv4 addresses into IPv6 ' +
+ 'addresses. ' + slineBreak +
+ 'Both short and long IPv6 notation are permitted, according to RFC-5952. '+
+ 'It was added in MariaDB 10.5.0';
+ HasLength: False;
+ RequiresLength: False;
+ HasBinary: False;
+ HasDefault: True;
+ LoadPart: False;
+ Category: dtcText;
+ MinVersion: 10050;
+ ),
(
Index: dbdtBinary;
NativeType: 254;
@@ -854,6 +855,20 @@ TMySQLLib = class(TDbLib)
LoadPart: True;
Category: dtcBinary;
),
+ (
+ Index: dbdtVector;
+ NativeType: 253;
+ Name: 'VECTOR';
+ Description: 'VECTOR(N)' + sLineBreak +
+ 'VECTOR data type with a built-in data validation. N is the number of dimensions ' +
+ 'that all vector values in the column will have.';
+ HasLength: True;
+ RequiresLength: True;
+ HasBinary: False;
+ HasDefault: False;
+ LoadPart: False;
+ Category: dtcBinary;
+ ),
(
Index: dbdtEnum;
NativeType: 247;
@@ -3137,6 +3152,54 @@ implementation
uses apphelpers;
+constructor TMySQLLib.Create(DllFile, DefaultDll: String);
+begin
+ inherited;
+ // MYSQL_OPT_* constants
+ MYSQL_OPT_CONNECT_TIMEOUT := 0;
+ MYSQL_OPT_LOCAL_INFILE := 8;
+ MYSQL_PLUGIN_DIR := 22;
+ MYSQL_OPT_SSL_KEY := 25;
+ MYSQL_OPT_SSL_CERT := 26;
+ MYSQL_OPT_SSL_CA := 27;
+ MYSQL_OPT_SSL_CIPHER := 29;
+ MYSQL_OPT_CONNECT_ATTR_ADD := 33;
+ MYSQL_ENABLE_CLEARTEXT_PLUGIN := 36;
+ MYSQL_OPT_TLS_VERSION := 41;
+ MARIADB_OPT_TLS_VERSION := INVALID_OPT;
+ MYSQL_OPT_SSL_MODE := INVALID_OPT;
+ MYSQL_OPT_SSL_VERIFY_SERVER_CERT := INVALID_OPT;
+ // Option values
+ SSL_MODE_DISABLED := 1;
+ SSL_MODE_PREFERRED := 2;
+ SSL_MODE_REQUIRED := 3;
+ SSL_MODE_VERIFY_CA := 4;
+ SSL_MODE_VERIFY_IDENTITY := 5;
+ if IsLibMariadb then begin
+ // Differences in libmariadb
+ MYSQL_OPT_SSL_VERIFY_SERVER_CERT := 21;
+ MARIADB_OPT_TLS_VERSION := 7005;
+ end
+ else if String(mysql_get_client_info).StartsWith('8.') then begin
+ // Some constants were removed in MySQL 8.0, so the offsets differ
+ MYSQL_PLUGIN_DIR := 16;
+ MYSQL_OPT_SSL_KEY := 19;
+ MYSQL_OPT_SSL_CERT := 20;
+ MYSQL_OPT_SSL_CA := 21;
+ MYSQL_OPT_SSL_CIPHER := 23;
+ MYSQL_OPT_CONNECT_ATTR_ADD := 27;
+ MYSQL_ENABLE_CLEARTEXT_PLUGIN := 30;
+ MYSQL_OPT_TLS_VERSION := 34;
+ MYSQL_OPT_SSL_MODE := 35;
+ end;
+end;
+
+function TMySQLLib.IsLibMariadb: Boolean;
+begin
+ // libmariadb used (not libmysql) ?
+ Result := ExtractFileName(FDllFile).StartsWith('libmariadb', True);
+end;
+
procedure TMySQLLib.AssignProcedures;
begin
AssignProc(@mysql_affected_rows, 'mysql_affected_rows');
@@ -3153,6 +3216,7 @@ procedure TMySQLLib.AssignProcedures;
AssignProc(@mysql_get_client_info, 'mysql_get_client_info');
AssignProc(@mysql_get_server_info, 'mysql_get_server_info');
AssignProc(@mysql_init, 'mysql_init');
+ AssignProc(@mysql_info, 'mysql_info');
AssignProc(@mysql_num_fields, 'mysql_num_fields');
AssignProc(@mysql_num_rows, 'mysql_num_rows');
AssignProc(@mysql_ping, 'mysql_ping');
@@ -3160,7 +3224,6 @@ procedure TMySQLLib.AssignProcedures;
AssignProc(@mysql_optionsv, 'mysql_optionsv', False);
AssignProc(@mysql_real_connect, 'mysql_real_connect');
AssignProc(@mysql_real_query, 'mysql_real_query');
- AssignProc(@mysql_ssl_set, 'mysql_ssl_set');
AssignProc(@mysql_stat, 'mysql_stat');
AssignProc(@mysql_store_result, 'mysql_store_result');
AssignProc(@mysql_thread_id, 'mysql_thread_id');
@@ -3172,46 +3235,293 @@ procedure TMySQLLib.AssignProcedures;
end;
+{ TMySqlProvider }
+
+function TMySqlProvider.GetSql(AId: TQueryId): string;
+var
+ IsMariaDB: Boolean;
+begin
+ IsMariaDB := ServerVersion >= 100000;
+ case AId of
+ qDatabaseDrop: Result := 'DROP DATABASE %s';
+ qEmptyTable: Result := 'TRUNCATE %s';
+ qRenameTable: Result := 'RENAME TABLE %s TO %s';
+ qRenameView: Result := 'RENAME TABLE %s TO %s';
+ qCurrentUserHost: Result := 'SELECT CURRENT_USER()';
+ qLikeCompare: Result := '%s LIKE %s';
+ qAddColumn: Result := 'ADD COLUMN %s';
+ qChangeColumn: Result := 'CHANGE COLUMN %s %s';
+ qGlobalStatus: Result := IfThen(
+ FNetType = ntMySQL_ProxySQLAdmin,
+ 'SELECT * FROM stats_mysql_global',
+ 'SHOW /*!50002 GLOBAL */ STATUS'
+ );
+ qCommandsCounters: Result := IfThen(
+ FNetType = ntMySQL_ProxySQLAdmin,
+ 'SELECT * FROM stats_mysql_commands_counters',
+ 'SHOW /*!50002 GLOBAL */ STATUS LIKE ''Com\_%'''
+ );
+ qSessionVariables: Result := 'SHOW VARIABLES';
+ qGlobalVariables: Result := 'SHOW GLOBAL VARIABLES';
+ qISSchemaCol: Result := '%s_SCHEMA';
+ qUSEQuery: Result := 'USE %s';
+ qKillQuery: Result := IfThen(
+ FNetType = ntMySQL_RDS,
+ 'CALL mysql.rds_kill_query(%d)',
+ IfThen(
+ FServerVersion >= 50000,
+ 'KILL QUERY %d',
+ 'KILL %d'
+ )
+ );
+ qKillProcess: Result := IfThen(
+ FNetType = ntMySQL_RDS,
+ 'CALL mysql.rds_kill(%d)',
+ 'KILL %d'
+ );
+ qFuncLength: Result := 'LENGTH';
+ qFuncCeil: Result := 'CEIL';
+ qFuncLeft: Result := IfThen(
+ FNetType = ntMySQL_ProxySQLAdmin,
+ 'SUBSTR(%s, 1, %d)',
+ 'LEFT(%s, %d)'
+ );
+ qFuncNow: Result := IfThen(
+ FNetType = ntMySQL_ProxySQLAdmin,
+ 'CURRENT_TIMESTAMP',
+ 'NOW()'
+ );
+ qFuncLastAutoIncNumber: Result := 'LAST_INSERT_ID()';
+ qLockedTables: Result := IfThen(
+ (FNetType <> ntMySQL_ProxySQLAdmin) and (FServerVersion >= 50124),
+ 'SHOW OPEN TABLES FROM %s WHERE in_use!=0',
+ ''
+ );
+ qDisableForeignKeyChecks: Result := IfThen(
+ FServerVersion >= 40014,
+ 'SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0',
+ ''
+ );
+ qEnableForeignKeyChecks: Result := IfThen(
+ FServerVersion >= 40014,
+ 'SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1)',
+ ''
+ );
+ qForeignKeyDrop: Result := 'DROP FOREIGN KEY %s';
+ qGetTableColumns: Result := '';
+ qGetCollations: Result := IfThen(
+ FServerVersion >= 40100,
+ 'SHOW COLLATION',
+ ''
+ );
+ // Issue #1917: MariaDB 10.10.1+ versions have additional collations in IS.COLLATION_CHARACTER_SET_APPLICABILITY
+ qGetCollationsExtended: Result := IfThen(
+ FServerVersion >= 101001,
+ 'SELECT'+
+ ' FULL_COLLATION_NAME AS `Collation`'+
+ ', CHARACTER_SET_NAME AS `Charset`'+
+ ', ID AS `Id`'+
+ ', IS_DEFAULT AS `Default`'+
+ ', 0 AS `Sortlen`'+
+ ' FROM INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY'+
+ ' ORDER BY `Collation`',
+ ''
+ );
+ qGetCharsets: Result := IfThen(
+ FServerVersion >= 40100,
+ 'SHOW CHARSET',
+ ''
+ );
+ qGetRowCountApprox: Result := IfThen(
+ FNetType <> ntMySQL_ProxySQLAdmin,
+ 'SHOW TABLE STATUS FROM :QuotedDatabase LIKE :EscapedName',
+ ''
+ );
+ qGetReverseForeignKeys: Result := 'SELECT DISTINCT'+
+ ' k.TABLE_SCHEMA, k.TABLE_NAME'+
+ ' FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k'+
+ ' WHERE'+
+ ' REFERENCED_TABLE_SCHEMA = :EscapedDatabase AND'+
+ ' REFERENCED_TABLE_NAME = :EscapedName';
+ qExplain: Result := IfThen(
+ (FServerVersion >= 80400) and (FServerVersion < 100000), // Not MariaDB
+ 'EXPLAIN FORMAT=TRADITIONAL %s',
+ 'EXPLAIN %s'
+ );
+ qSetTimezone: Result := IfThen(
+ FServerVersion >= 40103,
+ 'SET time_zone=%s',
+ ''
+ );
+ qShowFunctionStatus: Result := IfThen(
+ (FServerVersion >= 50000) and (FNetType <> ntMySQL_ProxySQLAdmin),
+ 'SHOW FUNCTION STATUS WHERE Db = %s',
+ ''
+ );
+ qShowProcedureStatus: Result := IfThen(
+ (FServerVersion >= 50000) and (FNetType <> ntMySQL_ProxySQLAdmin),
+ 'SHOW PROCEDURE STATUS WHERE Db = %s',
+ ''
+ );
+ qShowTriggers: Result := IfThen(
+ (FServerVersion >= 50010) and (FNetType <> ntMySQL_ProxySQLAdmin),
+ 'SHOW TRIGGERS FROM %s',
+ ''
+ );
+ qShowEvents: Result := IfThen(
+ (FServerVersion >= 50010) and (FNetType <> ntMySQL_ProxySQLAdmin),
+ 'SELECT *, EVENT_SCHEMA AS `Db`, EVENT_NAME AS `Name` FROM INFORMATION_SCHEMA.`EVENTS` WHERE EVENT_SCHEMA=%s',
+ ''
+ );
+ qHelpKeyword: Result := IfThen(
+ (FServerVersion >= 40100) and (FNetType <> ntMySQL_ProxySQLAdmin),
+ 'HELP %s',
+ ''
+ );
+ qShowCreateTrigger: Result := IfThen(
+ FServerVersion >= 50121,
+ 'SHOW CREATE TRIGGER :QuotedDatabase.:QuotedName',
+ ''
+ );
+ qShowWarnings: Result := IfThen(
+ FServerVersion >= 40100,
+ 'SHOW WARNINGS',
+ ''
+ );
+ qDropUser: Result := IfThen(
+ FServerVersion < 40101,
+ 'DELETE FROM mysql.user WHERE User=%s AND Host=%s',
+ 'DROP USER %s@%s'
+ );
+ qCreateRole: Result := 'CREATE ROLE %s';
+ qDropRole: Result := 'DROP ROLE %s';
+ qReloadPrivileges: Result := 'FLUSH PRIVILEGES';
+ qGrantRole: Result := 'GRANT %s TO %s%s';
+ qRevokeRole: Result := 'REVOKE %s FROM %s';
+ qSetDefaultRole: Result := 'SET DEFAULT ROLE %s FOR %s';
+ qIndexVisible: Result := IfThen(
+ FServerVersion >= 100600, // mariadb
+ 'NOT IGNORED',
+ IfThen(
+ FServerVersion >= 80000, // mysql
+ 'VISIBLE',
+ ''
+ )
+ );
+ qIndexInvisible: Result := IfThen(
+ FServerVersion >= 100600, // mariadb
+ 'IGNORED',
+ IfThen(
+ FServerVersion >= 80000, // mysql
+ 'INVISIBLE',
+ ''
+ )
+ );
+ qGetAuthPlugins: Result := IfThen(
+ (FServerVersion >= 50100) or IsMariaDB, // mysql 5.1+ and all mariadb versions
+ 'SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_TYPE=''AUTHENTICATION'' AND PLUGIN_STATUS=''ACTIVE''',
+ ''
+ );
+ else Result := inherited;
+ end;
+end;
+
+
initialization
// Keywords copied from SynHighligherSQL
MySQLKeywords := TStringList.Create;
-MySQLKeywords.CommaText := 'ACCESSIBLE,ACTION,ADD,AFTER,AGAINST,AGGREGATE,ALGORITHM,ALL,ALTER,ANALYZE,AND,ANY,AS,' +
- 'ASC,ASENSITIVE,AT,AUTO_INCREMENT,AVG_ROW_LENGTH,BACKUP,BEFORE,BEGIN,BENCHMARK,BETWEEN,BINLOG,BIT,' +
- 'BOOL,BOTH,BY,CACHE,CALL,CASCADE,CASCADED,CASE,CHANGE,CHARACTER,CHARSET,CHECK,' +
- 'CHECKSUM,CLIENT,COLLATE,COLLATION,COLUMN,COLUMNS,COMMENT,COMMIT,' +
- 'COMMITTED,COMPLETION,CONCURRENT,CONNECTION,CONSISTENT,CONSTRAINT,' +
- 'CONVERT,CONTAINS,CONTENTS,CREATE,CROSS,DATA,DATABASE,DATABASES,DAY_HOUR,' +
- 'DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DEALLOCATE,DEC,DEFAULT,DEFINER,DELAYED,DELAY_KEY_WRITE,DELETE,DESC,' +
- 'DETERMINISTIC,DIRECTORY,DISABLE,DISCARD,DESCRIBE,DISTINCT,DISTINCTROW,' +
- 'DIV,DROP,DUAL,DUMPFILE,DUPLICATE,EACH,ELSE,ELSEIF,ENABLE,ENCLOSED,END,ENDS,' +
- 'ENGINE,ENGINES,ESCAPE,ESCAPED,ERRORS,EVENT,EVENTS,EVERY,EXECUTE,EXISTS,' +
- 'EXPANSION,EXPLAIN,FALSE,FIELDS,FILE,FIRST,FLOAT4,FLOAT8,FLUSH,FOR,FORCE,FOREIGN,FROM,' +
- 'FULL,FULLTEXT,FUNCTION,FUNCTIONS,GLOBAL,GRANT,GRANTS,GROUP,HAVING,HELP,' +
- 'HIGH_PRIORITY,HOSTS,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IDENTIFIED,IGNORE,IGNORE_SERVER_IDS,INDEX,INFILE,INNER,INOUT,INSENSITIVE,INSERT,' +
- 'INSERT_METHOD,INSTALL,INT1,INT2,INT3,INT4,INT8,INTEGER,INTO,IO_THREAD,IS,' +
- 'ISOLATION,INVOKER,JOIN,KEY,KEYS,KILL,LAST,LEADING,LEAVES,LEVEL,LESS,' +
- 'LIKE,LIMIT,LINEAR,LINES,LIST,LOAD,LOCAL,LOCK,LOGS,LONG,LOW_PRIORITY,' +
- 'MASTER,MASTER_HOST,MASTER_HEARTBEAT_PERIOD,MASTER_LOG_FILE,MASTER_LOG_POS,MASTER_CONNECT_RETRY,' +
- 'MASTER_PASSWORD,MASTER_PORT,MASTER_SSL,MASTER_SSL_CA,MASTER_SSL_CAPATH,' +
- 'MASTER_SSL_CERT,MASTER_SSL_CIPHER,MASTER_SSL_KEY,MASTER_SSL_VERIFY_SERVER_CERT,MASTER_USER,MATCH,' +
- 'MAX_ROWS,MAXVALUE,MIDDLEINT,MIN_ROWS,MINUTE_MICROSECOND,MINUTE_SECOND,MOD,MODE,MODIFY,MODIFIES,NAMES,' +
- 'NATURAL,NEW,NO,NODEGROUP,NOT,NO_WRITE_TO_BINLOG,NULL,NUMERIC,OJ,OFFSET,OLD,ON,OPTIMIZE,OPTION,' +
- 'OPTIONALLY,OPEN,OR,ORDER,OUT,OUTER,OUTFILE,PACK_KEYS,PARTIAL,PARTITION,' +
- 'PARTITIONS,PERSISTENT,PLUGIN,PLUGINS,PRECISION,PREPARE,PRESERVE,PRIMARY,PRIVILEGES,PROCEDURE,' +
- 'PROCESS,PROCESSLIST,PURGE,QUERY,RAID_CHUNKS,RAID_CHUNKSIZE,RAID_TYPE,RANGE,' +
- 'READ,READS,READ_WRITE,REAL,REBUILD,REFERENCES,REGEXP,RELAY_LOG_FILE,RELAY_LOG_POS,RELEASE,RELOAD,' +
- 'RENAME,REORGANIZE,REPAIR,REPEATABLE,REPLACE,REPLICATION,REQUIRE,RESIGNAL,RESTRICT,RESET,' +
- 'RESTORE,RETURN,RETURNS,REVOKE,RLIKE,ROLLBACK,ROLLUP,ROUTINE,ROW,' +
- 'ROW_FORMAT,ROWS,SAVEPOINT,SCHEDULE,SCHEMA,SCHEMAS,SECOND_MICROSECOND,SECURITY,SELECT,' +
- 'SENSITIVE,SEPARATOR,SERIALIZABLE,SESSION,SET,SHARE,SHOW,SHUTDOWN,SIGNAL,SIMPLE,SLAVE,SNAPSHOT,SOME,' +
- 'SONAME,SPECIFIC,SQL,SQLEXCEPTION,SQLSTATE,SQLWARNING,SQL_BIG_RESULT,SQL_BUFFER_RESULT,SQL_CACHE,' +
- 'SQL_CALC_FOUND_ROWS,SQL_NO_CACHE,SQL_SMALL_RESULT,SPATIAL,SQL_THREAD,SSL,START,' +
- 'STARTING,STARTS,STATUS,STOP,STORAGE,STRAIGHT_JOIN,SUBPARTITION,' +
- 'SUBPARTITIONS,SUPER,TABLE,TABLES,TABLESPACE,TEMPORARY,TERMINATED,THAN,' +
- 'THEN,TO,TRAILING,TRANSACTION,TRIGGER,TRIGGERS,TRUE,TYPE,UNCOMMITTED,UNDO,' +
- 'UNINSTALL,UNIQUE,UNLOCK,UNSIGNED,UPDATE,UPGRADE,UNION,USAGE,USE,USING,VALUES,VARCHARACTER,' +
- 'VARIABLES,VARYING,VIEW,VIRTUAL,WARNINGS,WHEN,WHERE,WITH,WORK,WRITE,XOR,YEAR_MONTH,ZEROFILL,'
+MySQLKeywords.CommaText := 'ACCESSIBLE,ACCOUNT,ACTION,ACTIVE,ADD,ADMIN,AFTER,AGAINST,AGGREGATE,' +
+ 'ALGORITHM,ALL,ALTER,ALWAYS,ANALYSE,ANALYZE,AND,ANY,ARRAY,AS,ASC,' +
+ 'ASENSITIVE,AT,ATTRIBUTE,AUTHENTICATION,AUTOEXTEND_SIZE,AUTO_INCREMENT,' +
+ 'AVG_ROW_LENGTH,BACKUP,BEFORE,BEGIN,BETWEEN,BINLOG,BIT,BLOCK,BOTH,BUCKETS,' +
+ 'BULK,BY,CACHE,CALL,CASCADE,CASCADED,CATALOG_NAME,CHAIN,CHALLENGE_RESPONSE,' +
+ 'CHANGE,CHANGED,CHANNEL,CHARACTER,CHARSET,CHECK,CHECKSUM,CIPHER,' +
+ 'CLASS_ORIGIN,CLIENT,CLONE,CODE,COLLATE,COLLATION,COLUMN,COLUMNS,' +
+ 'COLUMN_FORMAT,COLUMN_NAME,COMMENT,COMMIT,COMMITTED,COMPLETION,COMPONENT,' +
+ 'COMPRESSION,CONCURRENT,CONDITION,CONNECTION,CONSISTENT,CONSTRAINT,' +
+ 'CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,CONTAINS,CONTEXT,' +
+ 'CONTINUE,CONVERT,CPU,CREATE,CROSS,CUBE,CUME_DIST,CURRENT,CURSOR,' +
+ 'CURSOR_NAME,DATA,DATABASE,DATABASES,DATAFILE,DAY_HOUR,DAY_MICROSECOND,' +
+ 'DAY_MINUTE,DAY_SECOND,DEALLOCATE,DEC,DECLARE,DEFAULT,DEFAULT_AUTH,DEFINER,' +
+ 'DEFINITION,DELAYED,DELAY_KEY_WRITE,DELETE,DENSE_RANK,DESC,DESCRIBE,' +
+ 'DESCRIPTION,DES_KEY_FILE,DETERMINISTIC,DIAGNOSTICS,DIRECTORY,DISABLE,' +
+ 'DISCARD,DISTINCT,DISTINCTROW,DIV,DO,DROP,DUAL,DUMPFILE,DUPLICATE,EACH,' +
+ 'ELSE,ELSEIF,EMPTY,ENABLE,ENCLOSED,ENCRYPTION,END,ENDS,ENFORCED,ENGINE,' +
+ 'ENGINES,ENGINE_ATTRIBUTE,ERROR,ERRORS,ESCAPE,ESCAPED,EVENT,EVENTS,EVERY,' +
+ 'EXCEPT,EXCHANGE,EXCLUDE,EXECUTE,EXISTS,EXPANSION,EXPIRE,EXPLAIN,EXPORT,' +
+ 'EXTENDED,EXTENT_SIZE,FACTOR,FAILED_LOGIN_ATTEMPTS,FALSE,FAST,FAULTS,' +
+ 'FIELDS,FILE,FILE_BLOCK_SIZE,FILTER,FINISH,FIRST,FIRST_VALUE,FLOAT4,FLOAT8,' +
+ 'FLUSH,FOLLOWING,FOLLOWS,FOR,FORCE,FOREIGN,FOUND,FROM,FULL,FULLTEXT,' +
+ 'FUNCTION,GENERAL,GENERATE,GENERATED,GEOMCOLLECTION,GET,' +
+ 'GET_MASTER_PUBLIC_KEY,GET_SOURCE_PUBLIC_KEY,GLOBAL,GRANT,GRANTS,GROUP,' +
+ 'GROUPING,GROUPS,GROUP_REPLICATION,GTID_ONLY,HAVING,HELP,HIGH_PRIORITY,' +
+ 'HISTOGRAM,HISTORY,HOST,HOSTS,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,' +
+ 'IDENTIFIED,IGNORE,IGNORE_SERVER_IDS,IMPORT,IN,INACTIVE,INDEX,INDEXES,' +
+ 'INFILE,INITIAL,INITIAL_SIZE,INITIATE,INNER,INOUT,INSENSITIVE,INSERT,' +
+ 'INSERT_METHOD,INSTALL,INSTANCE,INT1,INT2,INT3,INT4,INT8,INTERSECT,INTO,' +
+ 'INVISIBLE,INVOKER,IO,IO_AFTER_GTIDS,IO_BEFORE_GTIDS,IO_THREAD,IPC,IS,' +
+ 'ISOLATION,ISSUER,JOIN,JSON,JSON_TABLE,JSON_VALUE,KEY,KEYRING,KEYS,' +
+ 'KEY_BLOCK_SIZE,KILL,LAG,LANGUAGE,LAST,LAST_VALUE,LATERAL,LEAD,LEADING,' +
+ 'LEAVES,LESS,LEVEL,LIKE,LIMIT,LINEAR,LINES,LIST,LOAD,LOCAL,LOCK,LOCKED,' +
+ 'LOCKS,LOGFILE,LOGS,LONG,LOW_PRIORITY,MASTER,MASTER_AUTO_POSITION,' +
+ 'MASTER_BIND,MASTER_COMPRESSION_ALGORITHMS,MASTER_CONNECT_RETRY,' +
+ 'MASTER_DELAY,MASTER_HEARTBEAT_PERIOD,MASTER_HOST,MASTER_LOG_FILE,' +
+ 'MASTER_LOG_POS,MASTER_PASSWORD,MASTER_PORT,MASTER_PUBLIC_KEY_PATH,' +
+ 'MASTER_RETRY_COUNT,MASTER_SERVER_ID,MASTER_SSL,MASTER_SSL_CA,' +
+ 'MASTER_SSL_CAPATH,MASTER_SSL_CERT,MASTER_SSL_CIPHER,MASTER_SSL_CRL,' +
+ 'MASTER_SSL_CRLPATH,MASTER_SSL_KEY,MASTER_SSL_VERIFY_SERVER_CERT,' +
+ 'MASTER_TLS_CIPHERSUITES,MASTER_TLS_VERSION,MASTER_USER,' +
+ 'MASTER_ZSTD_COMPRESSION_LEVEL,MATCH,MAXVALUE,MAX_CONNECTIONS_PER_HOUR,' +
+ 'MAX_QUERIES_PER_HOUR,MAX_ROWS,MAX_SIZE,MAX_UPDATES_PER_HOUR,' +
+ 'MAX_USER_CONNECTIONS,MEDIUM,MEMBER,MESSAGE_TEXT,MIDDLEINT,MIGRATE,' +
+ 'MINUTE_MICROSECOND,MINUTE_SECOND,MIN_ROWS,MOD,MODE,MODIFIES,MODIFY,MUTEX,' +
+ 'MYSQL_ERRNO,NAME,NAMES,NATURAL,NCHAR,NESTED,NETWORK_NAMESPACE,NEVER,NEW,' +
+ 'NEXT,NO,NODEGROUP,NONE,NOT,NOWAIT,NO_WAIT,NO_WRITE_TO_BINLOG,NTH_VALUE,' +
+ 'NTILE,NULL,NULLS,NUMBER,NVARCHAR,OF,OFF,OFFSET,OJ,OLD,ON,ONE,ONLY,OPEN,' +
+ 'OPTIMIZE,OPTIMIZER_COSTS,OPTION,OPTIONAL,OPTIONALLY,OPTIONS,OR,ORDER,' +
+ 'ORDINALITY,ORGANIZATION,OTHERS,OUT,OUTER,OUTFILE,OVER,OWNER,PACK_KEYS,' +
+ 'PAGE,PARSER,PARSE_GCOL_EXPR,PARTIAL,PARTITION,PARTITIONING,PARTITIONS,' +
+ 'PASSWORD_LOCK_TIME,PATH,PERCENT_RANK,PERSIST,PERSIST_ONLY,PHASE,PLUGIN,' +
+ 'PLUGINS,PLUGIN_DIR,PORT,PRECEDES,PRECEDING,PREPARE,PRESERVE,PREV,PRIMARY,' +
+ 'PRIVILEGES,PRIVILEGE_CHECKS_USER,PROCEDURE,PROCESS,PROCESSLIST,PROFILE,' +
+ 'PROFILES,PROXY,PURGE,QUERY,QUICK,RANDOM,RANGE,RANK,READ,READS,READ_ONLY,' +
+ 'READ_WRITE,REBUILD,RECOVER,RECURSIVE,REDOFILE,REDO_BUFFER_SIZE,REFERENCE,' +
+ 'REFERENCES,REGEXP,REGISTRATION,RELAY,RELAYLOG,RELAY_LOG_FILE,' +
+ 'RELAY_LOG_POS,RELAY_THREAD,RELEASE,RELOAD,REMOTE,REMOVE,RENAME,REORGANIZE,' +
+ 'REPAIR,REPEATABLE,REPLACE,REPLICA,REPLICAS,REPLICATE_DO_DB,' +
+ 'REPLICATE_DO_TABLE,REPLICATE_IGNORE_DB,REPLICATE_IGNORE_TABLE,' +
+ 'REPLICATE_REWRITE_DB,REPLICATE_WILD_DO_TABLE,REPLICATE_WILD_IGNORE_TABLE,' +
+ 'REPLICATION,REQUIRE,REQUIRE_ROW_FORMAT,RESET,RESIGNAL,RESOURCE,RESPECT,' +
+ 'RESTART,RESTORE,RESTRICT,RESUME,RETAIN,RETURN,RETURNED_SQLSTATE,RETURNING,' +
+ 'RETURNS,REUSE,REVOKE,RLIKE,ROLE,ROLLBACK,ROLLUP,ROTATE,ROUTINE,ROW,ROWS,' +
+ 'ROW_FORMAT,ROW_NUMBER,RTREE,SAVEPOINT,SCHEDULE,SCHEMA,SCHEMAS,SCHEMA_NAME,' +
+ 'SECONDARY,SECONDARY_ENGINE,SECONDARY_ENGINE_ATTRIBUTE,SECONDARY_LOAD,' +
+ 'SECONDARY_UNLOAD,SECOND_MICROSECOND,SECURITY,SELECT,SENSITIVE,SEPARATOR,' +
+ 'SERIALIZABLE,SERVER,SESSION,SET,SHARE,SHOW,SHUTDOWN,SIGNAL,SIMPLE,SKIP,' +
+ 'SLAVE,SLOW,SNAPSHOT,SOCKET,SOME,SONAME,SOUNDS,SOURCE,SOURCE_AUTO_POSITION,' +
+ 'SOURCE_BIND,SOURCE_COMPRESSION_ALGORITHMS,SOURCE_CONNECT_RETRY,' +
+ 'SOURCE_DELAY,SOURCE_HEARTBEAT_PERIOD,SOURCE_HOST,SOURCE_LOG_FILE,' +
+ 'SOURCE_LOG_POS,SOURCE_PASSWORD,SOURCE_PORT,SOURCE_PUBLIC_KEY_PATH,' +
+ 'SOURCE_RETRY_COUNT,SOURCE_SSL,SOURCE_SSL_CA,SOURCE_SSL_CAPATH,' +
+ 'SOURCE_SSL_CERT,SOURCE_SSL_CIPHER,SOURCE_SSL_CRL,SOURCE_SSL_CRLPATH,' +
+ 'SOURCE_SSL_KEY,SOURCE_SSL_VERIFY_SERVER_CERT,SOURCE_TLS_CIPHERSUITES,' +
+ 'SOURCE_TLS_VERSION,SOURCE_USER,SOURCE_ZSTD_COMPRESSION_LEVEL,SPATIAL,' +
+ 'SPECIFIC,SQL,SQLEXCEPTION,SQLSTATE,SQLWARNING,SQL_AFTER_GTIDS,' +
+ 'SQL_AFTER_MTS_GAPS,SQL_BEFORE_GTIDS,SQL_BIG_RESULT,SQL_BUFFER_RESULT,' +
+ 'SQL_CACHE,SQL_CALC_FOUND_ROWS,SQL_NO_CACHE,SQL_SMALL_RESULT,SQL_THREAD,' +
+ 'SQL_TSI_DAY,SQL_TSI_HOUR,SQL_TSI_MINUTE,SQL_TSI_MONTH,SQL_TSI_QUARTER,' +
+ 'SQL_TSI_SECOND,SQL_TSI_WEEK,SQL_TSI_YEAR,SSL,STACKED,START,STARTING,' +
+ 'STARTS,STATS_AUTO_RECALC,STATS_PERSISTENT,STATS_SAMPLE_PAGES,STATUS,STOP,' +
+ 'STORAGE,STORED,STRAIGHT_JOIN,STREAM,SUBCLASS_ORIGIN,SUBJECT,SUBPARTITION,' +
+ 'SUBPARTITIONS,SUPER,SUSPEND,SWAPS,SWITCHES,SYSTEM,TABLE,TABLES,TABLESPACE,' +
+ 'TABLE_CHECKSUM,TABLE_NAME,TEMPORARY,TERMINATED,THAN,THREAD_PRIORITY,TIES,' +
+ 'TLS,TO,TRAILING,TRANSACTION,TRIGGER,TRIGGERS,TRUE,TYPE,TYPES,UNBOUNDED,' +
+ 'UNCOMMITTED,UNDO,UNDOFILE,UNDO_BUFFER_SIZE,UNINSTALL,UNION,UNIQUE,UNKNOWN,' +
+ 'UNLOCK,UNREGISTER,UPDATE,UPGRADE,URL,USAGE,USE,USER_RESOURCES,USE_FRM,' +
+ 'USING,VALIDATION,VALUE,VALUES,VARCHARACTER,VARIABLES,VARYING,VCPU,VIEW,' +
+ 'VIRTUAL,VISIBLE,WAIT,WARNINGS,WHERE,WINDOW,WITH,WITHOUT,WORK,WRAPPER,' +
+ 'WRITE,X509,XA,XID,XML,XOR,YEAR_MONTH,ZONE,'
// SQL Plus commands:
+ 'CLOSE,CONDITION,CONTINUE,CURSOR,DECLARE,DO,EXIT,FETCH,FOUND,GOTO,' +
'HANDLER,ITERATE,LANGUAGE,LEAVE,LOOP,UNTIL,WHILE';
diff --git a/source/dbstructures.pas b/source/dbstructures.pas
index fb031e322..da2902c71 100644
--- a/source/dbstructures.pas
+++ b/source/dbstructures.pas
@@ -6,20 +6,78 @@
interface
uses
- gnugettext, Vcl.Graphics, Winapi.Windows, System.SysUtils;
+ gnugettext, Vcl.Graphics, Winapi.Windows, System.SysUtils, System.Classes, System.IOUtils,
+ System.Generics.Collections, StrUtils;
type
+ TNetType = (
+ ntMySQL_TCPIP,
+ ntMySQL_NamedPipe,
+ ntMySQL_SSHtunnel,
+ ntMSSQL_NamedPipe,
+ ntMSSQL_TCPIP,
+ ntMSSQL_SPX,
+ ntMSSQL_VINES,
+ ntMSSQL_RPC,
+ ntPgSQL_TCPIP,
+ ntPgSQL_SSHtunnel,
+ ntSQLite,
+ ntMySQL_ProxySQLAdmin,
+ ntInterbase_TCPIP,
+ ntInterbase_Local,
+ ntFirebird_TCPIP,
+ ntFirebird_Local,
+ ntMySQL_RDS,
+ ntSQLiteEncrypted
+ );
+ TNetTypeGroup = (ngMySQL, ngMSSQL, ngPgSQL, ngSQLite, ngInterbase);
+ TNetTypeLibs = TDictionary;
+
+ // SQL query ids and provider
+ TStringMap = TDictionary;
+ TQueryId = (qDatabaseTable, qDatabaseTableId, qDatabaseDrop,
+ qDbObjectsTable, qDbObjectsCreateCol, qDbObjectsUpdateCol, qDbObjectsTypeCol,
+ qEmptyTable, qRenameTable, qRenameView, qCurrentUserHost, qLikeCompare,
+ qAddColumn, qChangeColumn, qRenameColumn, qForeignKeyEventAction,
+ qGlobalStatus, qCommandsCounters, qSessionVariables, qGlobalVariables,
+ qISSchemaCol,
+ qUSEQuery, qKillQuery, qKillProcess,
+ qFuncLength, qFuncCeil, qFuncLeft, qFuncNow, qFuncLastAutoIncNumber,
+ qLockedTables, qDisableForeignKeyChecks, qEnableForeignKeyChecks,
+ qOrderAsc, qOrderDesc, qGetRowCountExact, qGetRowCountApprox,
+ qForeignKeyDrop, qGetTableColumns, qGetCollations, qGetCollationsExtended, qGetCharsets,
+ qGetReverseForeignKeys, qExplain, qSetTimezone,
+ qShowFunctionStatus, qShowProcedureStatus, qShowTriggers, qShowEvents, qShowCreateTrigger,
+ qHelpKeyword, qShowWarnings, qGetEnumTypes,
+ qDropUser, qCreateRole, qDropRole, qReloadPrivileges, qGrantRole, qRevokeRole, qSetDefaultRole,
+ qAutoInc, qIndexVisible, qIndexInvisible, qGetAuthPlugins);
+ TSqlProvider = class
+ strict protected
+ FNetType: TNetType;
+ FServerVersion: Integer;
+ public
+ constructor Create(ANetType: TNetType);
+ function Has(AId: TQueryId): Boolean;
+ // Base version, just returns the original SQL string
+ function GetSql(AId: TQueryId): string; overload; virtual;
+ // Version for simple strings passed to Format()
+ function GetSql(AId: TQueryId; const Args: array of const): string; overload;
+ // Version for named parameters
+ function GetSql(AId: TQueryId; NamedParameters: TStringMap): string; overload;
+ property ServerVersion: Integer read FServerVersion write FServerVersion;
+ end;
+
// Column types
TDBDatatypeIndex = (dbdtTinyint, dbdtSmallint, dbdtMediumint, dbdtInt, dbdtUint, dbdtBigint, dbdtSerial, dbdtBigSerial,
dbdtFloat, dbdtDouble, dbdtDecimal, dbdtNumeric, dbdtReal, dbdtDoublePrecision, dbdtMoney, dbdtSmallmoney,
dbdtDate, dbdtTime, dbdtYear, dbdtDatetime, dbdtDatetime2, dbdtDatetimeOffset, dbdtSmalldatetime, dbdtTimestamp, dbdtInterval,
- dbdtChar, dbdtNchar, dbdtVarchar, dbdtNvarchar, dbdtTinytext, dbdtText, dbdtNtext, dbdtMediumtext, dbdtLongtext,
+ dbdtChar, dbdtNchar, dbdtVarchar, dbdtNvarchar, dbdtTinytext, dbdtText, dbdtCiText, dbdtNtext, dbdtMediumtext, dbdtLongtext,
dbdtJson, dbdtJsonB, dbdtCidr, dbdtInet, dbdtMacaddr,
- dbdtBinary, dbdtVarbinary, dbdtTinyblob, dbdtBlob, dbdtMediumblob, dbdtLongblob, dbdtImage,
+ dbdtBinary, dbdtVarbinary, dbdtTinyblob, dbdtBlob, dbdtMediumblob, dbdtLongblob, dbdtVector, dbdtImage,
dbdtEnum, dbdtSet, dbdtBit, dbdtVarBit, dbdtBool, dbdtRegClass, dbdtRegProc, dbdtUnknown,
- dbdtCursor, dbdtSqlvariant, dbdtTable, dbdtUniqueidentifier, dbdtHierarchyid, dbdtXML,
+ dbdtCursor, dbdtSqlvariant, dbdtTable, dbdtUniqueidentifier, dbdtInet4, dbdtInet6, dbdtHierarchyid, dbdtXML,
dbdtPoint, dbdtLinestring, dbdtLineSegment, dbdtPolygon, dbdtGeometry, dbdtBox, dbdtPath, dbdtCircle, dbdtMultipoint, dbdtMultilinestring, dbdtMultipolygon, dbdtGeometrycollection
);
@@ -45,6 +103,7 @@ TDBDatatype = record
Format: String; // Used for date/time values when displaying and generating queries
ValueMustMatch: String;
Category: TDBDatatypeCategoryIndex;
+ MinVersion: Integer;
end;
// Column type category structure
@@ -72,7 +131,7 @@ EDbError = class(Exception)
public
property ErrorCode: Cardinal read FErrorCode;
property Hint: String read FHint;
- constructor Create(const Msg: string; const ErrorCode: Cardinal=0; const Hint: String='');
+ constructor Create(const Msg: string; const ErrorCode_: Cardinal=0; const Hint_: String='');
end;
// DLL loading
@@ -80,15 +139,15 @@ TDbLib = class(TObject)
const
LIB_PROC_ERROR: Cardinal = 1000;
private
- FDllFile: String;
FHandle: HMODULE;
protected
+ FDllFile: String;
procedure AssignProc(var Proc: FARPROC; Name: PAnsiChar; Mandantory: Boolean=True);
procedure AssignProcedures; virtual; abstract;
public
property Handle: HMODULE read FHandle;
property DllFile: String read FDllFile;
- constructor Create(DllFile, DefaultDll: String);
+ constructor Create(UsedDllFile, HintDefaultDll: String); virtual;
destructor Destroy; override;
end;
@@ -134,13 +193,61 @@ implementation
uses apphelpers;
+{ TSqlProvider }
+
+constructor TSqlProvider.Create(ANetType: TNetType);
+begin
+ FNetType := ANetType;
+ FServerVersion := 0;
+end;
+
+function TSqlProvider.Has(AId: TQueryId): Boolean;
+begin
+ Result := not GetSql(AId).IsEmpty;
+end;
+
+function TSqlProvider.GetSql(AId: TQueryId): string;
+begin
+ // Basic default SQL snippets compatible to all or most servers
+ case AId of
+ qEmptyTable: Result := 'DELETE FROM %s';
+ qForeignKeyEventAction: Result := 'RESTRICT,CASCADE,SET NULL,NO ACTION';
+ qOrderAsc: Result := 'ASC';
+ qOrderDesc: Result := 'DESC';
+ qGetRowCountExact: Result := 'SELECT COUNT(*) FROM :QuotedDbAndTableName';
+ qAutoInc: Result := 'AUTO_INCREMENT';
+ else Result := '';
+ end;
+end;
+
+function TSqlProvider.GetSql(AId: TQueryId; const Args: array of const): string;
+begin
+ Result := GetSql(AId);
+ if Result.IsEmpty then
+ Exit;
+ Result := Format(Result, Args);
+end;
+
+function TSqlProvider.GetSql(AId: TQueryId; NamedParameters: TStringMap): string;
+var
+ Key: String;
+begin
+ Result := GetSql(AId);
+ if Result.IsEmpty then
+ Exit;
+ for Key in NamedParameters.Keys do begin
+ Result := StringReplace(Result, ':'+Key, NamedParameters[Key], [rfReplaceAll]);
+ end;
+end;
+
+
{ EDbError }
-constructor EDbError.Create(const Msg: string; const ErrorCode: Cardinal=0; const Hint: String='');
+constructor EDbError.Create(const Msg: string; const ErrorCode_: Cardinal=0; const Hint_: String='');
begin
- FErrorCode := ErrorCode;
- FHint := Hint;
+ FErrorCode := ErrorCode_;
+ FHint := Hint_;
inherited Create(Msg);
end;
@@ -148,19 +255,16 @@ constructor EDbError.Create(const Msg: string; const ErrorCode: Cardinal=0; cons
{ TDbLib }
-constructor TDbLib.Create(DllFile, DefaultDll: String);
+constructor TDbLib.Create(UsedDllFile, HintDefaultDll: String);
var
msg, ErrorHint: String;
begin
// Load DLL as is (with or without path)
inherited Create;
- FDllFile := DllFile;
+ FDllFile := UsedDllFile;
+ // On Windows, we have the full path to the dll file here, so even if the file portion is empty, FDllFile contains a path / non-empty string
if not FileExists(FDllFile) then begin
- msg := f_('File does not exist: %s', [FDllFile]) +
- sLineBreak + sLineBreak +
- f_('Please launch %s from the directory where you have installed it. Or just reinstall %s.', [APPNAME, APPNAME]
- );
- Raise EdbError.Create(msg);
+ Raise EdbError.Create(_('No library selected. Please select one of the provided libraries in the drop-down.'));
end;
FHandle := LoadLibrary(PWideChar(FDllFile));
@@ -171,9 +275,9 @@ constructor TDbLib.Create(DllFile, DefaultDll: String);
if GetLastError <> 0 then begin
msg := msg + sLineBreak + sLineBreak + f_('Internal error %d: %s', [GetLastError, SysErrorMessage(GetLastError)]);
end;
- if (DefaultDll <> '') and (ExtractFileName(FDllFile) <> DefaultDll) then begin
+ if (HintDefaultDll <> '') and (ExtractFileName(FDllFile) <> HintDefaultDll) then begin
ErrorHint := f_('You could try the default library %s in your session settings. (Current: %s)',
- [DefaultDll, ExtractFileName(FDllFile)]
+ [HintDefaultDll, ExtractFileName(FDllFile)]
);
end else begin
ErrorHint := '';
diff --git a/source/dbstructures.postgresql.pas b/source/dbstructures.postgresql.pas
index 37cf2f10d..207deb9e9 100644
--- a/source/dbstructures.postgresql.pas
+++ b/source/dbstructures.postgresql.pas
@@ -3,14 +3,14 @@
interface
uses
- dbstructures;
+ dbstructures, StrUtils;
type
// PostgreSQL structures
TPQConnectStatus = (CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE, CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV, CONNECTION_SSL_STARTUP, CONNECTION_NEEDED);
PPGconn = Pointer;
PPGresult = Pointer;
- POid = Cardinal;
+ POid = Cardinal; // Object ID is a fundamental type in Postgres.
TPostgreSQLLib = class(TDbLib)
PQconnectdb: function(const ConnInfo: PAnsiChar): PPGconn cdecl;
PQerrorMessage: function(const Handle: PPGconn): PAnsiChar cdecl;
@@ -36,8 +36,15 @@ TPostgreSQLLib = class(TDbLib)
procedure AssignProcedures; override;
end;
+ TPostgreSQLProvider = class(TSqlProvider)
+ public
+ function GetSql(AId: TQueryId): string; override;
+ end;
+
+const InvalidOid: POid = 0;
+
var
- PostgreSQLDatatypes: Array[0..37] of TDBDatatype =
+ PostgreSQLDatatypes: Array[0..39] of TDBDatatype =
(
(
Index: dbdtUnknown;
@@ -183,18 +190,6 @@ TPostgreSQLLib = class(TDbLib)
LoadPart: False;
Category: dtcReal;
),
- (
- Index: dbdtMoney;
- NativeTypes: '790';
- Name: 'MONEY';
- Description: 'Currency amount. Range: -92233720368547758.08 to +92233720368547758.07. Storage Size: 8 Bytes.';
- HasLength: True;
- RequiresLength: False;
- HasBinary: False;
- HasDefault: False;
- LoadPart: False;
- Category: dtcReal;
- ),
(
Index: dbdtChar;
NativeTypes: '18|1042';
@@ -234,6 +229,19 @@ TPostgreSQLLib = class(TDbLib)
LoadPart: True;
Category: dtcText;
),
+ (
+ Index: dbdtCiText;
+ NativeTypes: '?';
+ Name: 'CITEXT';
+ Names: 'citext';
+ Description: 'A case-insensitive character string type. Essentially, it internally calls lower when comparing values. Otherwise, it behaves almost exactly like text.';
+ HasLength: False;
+ RequiresLength: False;
+ HasBinary: False;
+ HasDefault: False;
+ LoadPart: True;
+ Category: dtcText;
+ ),
(
Index: dbdtCidr;
NativeTypes: '650';
@@ -273,6 +281,18 @@ TPostgreSQLLib = class(TDbLib)
LoadPart: False;
Category: dtcText;
),
+ (
+ Index: dbdtMoney;
+ NativeTypes: '790';
+ Name: 'MONEY';
+ Description: 'Currency amount. Range: -92233720368547758.08 to +92233720368547758.07. Storage Size: 8 Bytes.';
+ HasLength: True;
+ RequiresLength: False;
+ HasBinary: False;
+ HasDefault: False;
+ LoadPart: False;
+ Category: dtcText;
+ ),
(
Index: dbdtDate;
NativeTypes: '1082';
@@ -489,6 +509,19 @@ TPostgreSQLLib = class(TDbLib)
LoadPart: False;
Category: dtcOther;
),
+ (
+ Index: dbdtEnum;
+ NativeTypes: 'e';
+ Name: 'ENUM';
+ Names: '';
+ Description: 'A list of quoted labels, each of which must be less than NAMEDATALEN bytes long (64 bytes in a standard PostgreSQL build)';
+ HasLength: True; // Enables the Length/set field in table editor
+ RequiresLength: True;
+ HasBinary: False;
+ HasDefault: True;
+ LoadPart: False;
+ Category: dtcOther;
+ ),
(
Index: dbdtJson;
NativeTypes: '114';
@@ -558,4 +591,161 @@ procedure TPostgreSQLLib.AssignProcedures;
end;
+{ TPostgreSQLProvider }
+
+function TPostgreSQLProvider.GetSql(AId: TQueryId): string;
+begin
+ case AId of
+ qDatabaseDrop: Result := 'DROP SCHEMA %s';
+ qRenameTable: Result := 'ALTER TABLE %s RENAME TO %s';
+ qRenameView: Result := 'ALTER VIEW %s RENAME TO %s';
+ qCurrentUserHost: Result := 'SELECT CURRENT_USER';
+ qLikeCompare: Result := '%s ILIKE %s';
+ qAddColumn: Result := 'ADD %s';
+ qChangeColumn: Result := 'ALTER COLUMN %s %s';
+ qRenameColumn: Result := 'RENAME COLUMN %s TO %s';
+ qForeignKeyEventAction: Result := 'RESTRICT,CASCADE,SET NULL,NO ACTION,SET DEFAULT';
+ qSessionVariables: Result := 'SHOW ALL';
+ qGlobalVariables: Result := 'SHOW ALL';
+ qISSchemaCol: Result := '%s_schema';
+ qUSEQuery: Result := 'SET search_path TO %s';
+ qKillQuery: Result := 'SELECT pg_cancel_backend(%d)';
+ qKillProcess: Result := 'SELECT pg_cancel_backend(%d)';
+ qFuncLength: Result := 'LENGTH';
+ qFuncCeil: Result := 'CEIL';
+ qFuncLeft: Result := 'SUBSTRING(%s, 1, %d)';
+ qFuncNow: Result := 'NOW()';
+ qFuncLastAutoIncNumber: Result := 'LASTVAL()';
+ qLockedTables: Result := '';
+ qDisableForeignKeyChecks: Result := '';
+ qEnableForeignKeyChecks: Result := '';
+ qForeignKeyDrop: Result := 'DROP CONSTRAINT %s';
+
+ // This uses pg_attribute.attgenerated, which only exists starting in PostgreSQL 12
+ qGetTableColumns: Result := IfThen(
+ FServerVersion >= 120000,
+ 'SELECT ' +
+ ' n.nspname AS table_schema, ' +
+ ' c.relname AS table_name, ' +
+ ' a.attname AS column_name, ' +
+ ' a.attnum AS ordinal_position, ' +
+ ' pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type, ' +
+ // YES/NO like information_schema.is_nullable
+ ' CASE ' +
+ ' WHEN a.attnotnull THEN ''NO'' ' +
+ ' ELSE ''YES'' ' +
+ ' END AS is_nullable, ' +
+ // Character maximum length (in characters)
+ ' CASE ' +
+ ' WHEN (bt.typcategory = ''S'' OR (bt.oid IS NULL AND t.typcategory = ''S'')) ' +
+ ' AND a.atttypmod <> -1 ' +
+ ' THEN a.atttypmod - 4 ' +
+ ' ELSE NULL ' +
+ ' END AS character_maximum_length, ' +
+ // Numeric precision / scale (NULL for non-numeric)
+ ' CASE ' +
+ ' WHEN (bt.typcategory IN (''N'',''F'')) OR (bt.oid IS NULL AND t.typcategory IN (''N'',''F'')) ' +
+ ' THEN ' +
+ ' CASE ' +
+ ' WHEN a.atttypmod = -1 THEN NULL ' +
+ ' ELSE ((a.atttypmod - 4) >> 16)::integer ' +
+ ' END ' +
+ ' END AS numeric_precision, ' +
+ ' CASE ' +
+ ' WHEN (bt.typcategory IN (''N'',''F'')) OR (bt.oid IS NULL AND t.typcategory IN (''N'',''F'')) ' +
+ ' THEN ' +
+ ' CASE ' +
+ ' WHEN a.atttypmod = -1 THEN NULL ' +
+ ' ELSE ((a.atttypmod - 4) & 65535)::integer ' +
+ ' END ' +
+ ' END AS numeric_scale, ' +
+ // Datetime precision (for time/timestamp/interval)
+ ' CASE ' +
+ ' WHEN (bt.typcategory = ''D'' OR (bt.oid IS NULL AND t.typcategory = ''D'')) ' +
+ ' AND a.atttypmod <> -1 ' +
+ ' THEN a.atttypmod ' +
+ ' ELSE NULL ' +
+ ' END AS datetime_precision, ' +
+ // Character set name: PostgreSQL has one per DB; mimic information_schema
+ ' CASE ' +
+ ' WHEN (bt.typcategory = ''S'' OR (bt.oid IS NULL AND t.typcategory = ''S'')) ' +
+ ' THEN current_database() ' +
+ ' ELSE NULL ' +
+ ' END AS character_set_name, ' +
+ // Collation name for collatable columns
+ ' CASE ' +
+ ' WHEN (bt.typcategory = ''S'' OR (bt.oid IS NULL AND t.typcategory = ''S'')) ' +
+ ' THEN ' +
+ ' CASE ' +
+ ' WHEN a.attcollation <> t.typcollation ' +
+ ' THEN coll.collname ' +
+ ' ELSE NULL ' +
+ ' END ' +
+ ' ELSE NULL ' +
+ ' END AS collation_name, ' +
+ // Default expression for non-generated columns
+ ' CASE ' +
+ ' WHEN a.attgenerated = '''' AND a.atthasdef ' +
+ ' THEN pg_get_expr(ad.adbin, ad.adrelid) ' +
+ ' ELSE NULL ' +
+ ' END AS column_default, ' +
+ // Generation expression for generated columns
+ ' CASE ' +
+ ' WHEN a.attgenerated <> '''' AND a.atthasdef ' +
+ ' THEN pg_get_expr(ad.adbin, ad.adrelid) ' +
+ ' ELSE NULL ' +
+ ' END AS generation_expression, ' +
+ ' d.description AS column_comment ' +
+ 'FROM pg_catalog.pg_class AS c ' +
+ 'JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace ' +
+ 'JOIN pg_catalog.pg_attribute AS a ON a.attrelid = c.oid ' +
+ 'JOIN pg_catalog.pg_type AS t ON t.oid = a.atttypid ' +
+ 'LEFT JOIN pg_catalog.pg_type AS bt ON bt.oid = t.typbasetype ' +
+ 'LEFT JOIN pg_catalog.pg_attrdef AS ad ' +
+ ' ON ad.adrelid = a.attrelid ' +
+ ' AND ad.adnum = a.attnum ' +
+ 'LEFT JOIN pg_catalog.pg_description AS d ' +
+ ' ON d.objoid = a.attrelid ' +
+ ' AND d.objsubid = a.attnum ' +
+ 'LEFT JOIN pg_catalog.pg_collation AS coll ' +
+ ' ON coll.oid = a.attcollation ' +
+ 'WHERE n.nspname = %s ' +
+ ' AND a.attnum > 0 ' +
+ ' AND NOT a.attisdropped ' +
+ ' AND c.relname = %s ' +
+ 'ORDER BY ordinal_position',
+ '' // ServerVersion < 12
+ );
+
+ qGetCharsets: Result := 'SELECT DISTINCT pg_encoding_to_char(enc) AS "Charset" FROM '+
+ '(SELECT conforencoding AS enc FROM pg_catalog.pg_conversion '+
+ ' UNION '+
+ ' SELECT contoencoding AS enc FROM pg_catalog.pg_conversion) AS x';
+ qGetRowCountApprox: Result := 'SELECT reltuples::bigint FROM pg_class'+
+ ' LEFT JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace'+
+ ' WHERE pg_class.relkind=''r'''+
+ ' AND pg_namespace.nspname=:EscapedDatabase'+
+ ' AND pg_class.relname=:EscapedName';
+ qGetEnumTypes: Result := IfThen(
+ FServerVersion >= 90000,
+ 'SELECT ' +
+ ' n.nspname AS enum_schema, ' +
+ ' t.typname AS enum_name, ' +
+ ' string_agg(e.enumlabel, ''|'' ORDER BY e.enumsortorder) AS enum_labels ' +
+ 'FROM pg_type AS t ' +
+ 'JOIN pg_enum AS e ' +
+ ' ON t.oid = e.enumtypid ' +
+ 'JOIN pg_namespace AS n ' +
+ ' ON n.oid = t.typnamespace ' +
+ 'WHERE t.typtype = ''e'' ' +
+ 'GROUP BY n.nspname, t.typname ' +
+ 'ORDER BY UPPER(t.typname)',
+ '' // ServerVersion < 9
+ );
+ qAutoInc: Result := 'SERIAL';
+ else Result := inherited;
+ end;
+end;
+
+
end.
diff --git a/source/dbstructures.sqlite.pas b/source/dbstructures.sqlite.pas
index 5267935c9..f34faa97e 100644
--- a/source/dbstructures.sqlite.pas
+++ b/source/dbstructures.sqlite.pas
@@ -136,8 +136,25 @@ TSQLiteLib = class(TDbLib)
): Integer; cdecl;
sqlite3_collation_needed: function(ppDb: Psqlite3; userData: Pointer; Func: TSQLiteCollationNeededCallback): Integer; cdecl;
sqlite3_create_collation: function(ppDb: Psqlite3; const zName: PAnsiChar; eTextRep: Integer; pArg: Pointer; xCompare: TSQLiteCollation): Integer; cdecl;
+ // Additionally, for use in Multiple Ciphers library:
+ sqlite3_key: function(ppDb: Psqlite3; const pKey: Pointer; nKey: Integer): Integer; cdecl;
+ sqlite3mc_cipher_count: function(): Integer; cdecl;
+ sqlite3mc_cipher_name: function(cipherIndex: Integer): PAnsiChar; cdecl;
+ sqlite3mc_cipher_index: function(const cipherName: PAnsiChar): Integer; cdecl;
+ sqlite3mc_config: function(ppDb: Psqlite3; const paramName: PAnsiChar; newValue: Integer): Integer; cdecl;
+ sqlite3mc_config_cipher: function(ppDb: Psqlite3; const cipherName: PAnsiChar; const paramName: PAnsiChar; newValue: Integer): Integer; cdecl;
+ private
+ FWithMultipleCipherFunctions: Boolean;
protected
procedure AssignProcedures; override;
+ public
+ constructor Create(DllFile, DefaultDll: String); override;
+ constructor CreateWithMultipleCipherFunctions(DllFile, DefaultDll: String);
+ end;
+
+ TSQLiteProvider = class(TSqlProvider)
+ public
+ function GetSql(AId: TQueryId): string; override;
end;
var
@@ -322,6 +339,20 @@ TSQLiteLib = class(TDbLib)
implementation
+
+constructor TSQLiteLib.Create(DllFile, DefaultDll: String);
+begin
+ FWithMultipleCipherFunctions := False;
+ inherited;
+end;
+
+constructor TSQLiteLib.CreateWithMultipleCipherFunctions(DllFile, DefaultDll: String);
+begin
+ FWithMultipleCipherFunctions := True;
+ inherited Create(DllFile, DefaultDll);
+end;
+
+
procedure TSQLiteLib.AssignProcedures;
begin
AssignProc(@sqlite3_open, 'sqlite3_open');
@@ -350,6 +381,55 @@ procedure TSQLiteLib.AssignProcedures;
AssignProc(@sqlite3_table_column_metadata, 'sqlite3_table_column_metadata');
AssignProc(@sqlite3_collation_needed, 'sqlite3_collation_needed');
AssignProc(@sqlite3_create_collation, 'sqlite3_create_collation');
+ if FWithMultipleCipherFunctions then begin
+ // Additionally, for use in Multiple Ciphers library:
+ AssignProc(@sqlite3_key, 'sqlite3_key', False);
+ AssignProc(@sqlite3mc_cipher_count, 'sqlite3mc_cipher_count');
+ AssignProc(@sqlite3mc_cipher_name, 'sqlite3mc_cipher_name');
+ AssignProc(@sqlite3mc_cipher_index, 'sqlite3mc_cipher_index');
+ AssignProc(@sqlite3mc_config, 'sqlite3mc_config');
+ AssignProc(@sqlite3mc_config_cipher, 'sqlite3mc_config_cipher');
+ end;
end;
+
+{ TSQLiteProvider }
+
+function TSQLiteProvider.GetSql(AId: TQueryId): string;
+begin
+ case AId of
+ qDatabaseDrop: Result := 'DROP DATABASE %s';
+ qRenameTable: Result := 'ALTER TABLE %s RENAME TO %s';
+ qRenameView: Result := 'ALTER TABLE %s RENAME TO %s';
+ qCurrentUserHost: Result := ''; // unsupported
+ qLikeCompare: Result := '%s LIKE %s';
+ qAddColumn: Result := 'ADD COLUMN %s';
+ qChangeColumn: Result := ''; // SQLite only supports renaming
+ qRenameColumn: Result := 'RENAME COLUMN %s TO %s';
+ qSessionVariables: Result := 'SELECT null, null'; // Todo: combine "PRAGMA pragma_list" + "PRAGMA a; PRAGMY b; ..."?
+ qGlobalVariables: Result := 'SHOW GLOBAL VARIABLES';
+ qISSchemaCol: Result := '%s_SCHEMA';
+ qUSEQuery: Result := '';
+ qKillQuery: Result := 'KILL %d';
+ qKillProcess: Result := 'KILL %d';
+ qFuncLength: Result := 'LENGTH';
+ qFuncCeil: Result := 'CEIL';
+ qFuncLeft: Result := 'SUBSTR(%s, 1, %d)';
+ qFuncNow: Result := 'DATETIME()';
+ qFuncLastAutoIncNumber: Result := 'LAST_INSERT_ID()';
+ qLockedTables: Result := '';
+ qDisableForeignKeyChecks: Result := '';
+ qEnableForeignKeyChecks: Result := '';
+ qForeignKeyDrop: Result := 'DROP FOREIGN KEY %s';
+ qGetTableColumns: Result := 'SELECT * FROM pragma_table_xinfo(%s, %s)';
+ // See https://www.sqlite.org/datatype3.html#collation_sequence_examples
+ qGetCollations: Result := 'SELECT name AS "Collation", '''' AS "Charset", '''' AS "Id", '''' AS "Default", '''' AS "Compiled", ''1'' AS Sortlen from pragma_collation_list';
+ qGetCharsets: Result := 'SELECT ''UTF-8'' AS "Charset", ''UTF-8'' AS "Description" '+
+ 'UNION SELECT ''UTF-16le'', ''UTF-16 Little Endian'' '+
+ 'UNION SELECT ''UTF-16be'', ''UTF-16 Big Endian''';
+ else Result := inherited;
+ end;
+end;
+
+
end.
\ No newline at end of file
diff --git a/source/editvar.pas b/source/editvar.pas
index d522fa1cb..9d1a7b2ee 100644
--- a/source/editvar.pas
+++ b/source/editvar.pas
@@ -158,6 +158,7 @@ procedure TfrmEditVariable.FormShow(Sender: TObject);
procedure TfrmEditVariable.btnOKClick(Sender: TObject);
var
sql, val: String;
+ Conn: TDBConnection;
begin
// Syntax taken from http://dev.mysql.com/doc/refman/4.1/en/using-system-variables.html
sql := 'SET @@';
@@ -167,6 +168,8 @@ procedure TfrmEditVariable.btnOKClick(Sender: TObject);
sql := sql + 'global';
sql := sql + '.' + FVar.Name + ' = ';
+ Conn := MainForm.ActiveConnection;
+
case FVarType of
vtNumeric: val := IntToStr(UpDownNumber.Position);
vtString: begin
@@ -176,16 +179,17 @@ procedure TfrmEditVariable.btnOKClick(Sender: TObject);
if ExecRegExpr('^\d+(\.\d*)?$', FVarValue) then
val := editString.Text
else
- val := MainForm.ActiveConnection.EscapeString(editString.Text);
+ val := Conn.EscapeString(editString.Text);
end;
vtBoolean: val := IntToStr(Integer(radioBooleanOn.Checked));
- vtEnum: val := MainForm.ActiveConnection.EscapeString(comboEnum.Text);
+ vtEnum: val := Conn.EscapeString(comboEnum.Text);
end;
sql := sql + val;
// Set the value and keep the form open in any error case
try
- MainForm.ActiveConnection.Query(sql);
+ Conn.Query(sql);
+ Conn.ShowWarnings;
except
on E:EDbError do begin
ModalResult := mrNone;
diff --git a/source/event_editor.pas b/source/event_editor.pas
index c8940d750..9fc4d2ef0 100644
--- a/source/event_editor.pas
+++ b/source/event_editor.pas
@@ -231,6 +231,7 @@ function TfrmEventEditor.ApplyModifications: TModalResult;
sql := ComposeAlterStatement;
try
MainForm.ActiveConnection.Query(sql);
+ MainForm.ActiveConnection.ShowWarnings;
DBObject.Name := editName.Text;
DBObject.UnloadDetails;
tabALTERcode.TabVisible := ObjectExists;
@@ -272,7 +273,7 @@ function TfrmEventEditor.ComposeStatement(CreateOrAlter, ObjName: String): Strin
Result := CreateOrAlter + ' ';
if comboDefiner.Text <> '' then
Result := Result + 'DEFINER='+DBObject.Connection.QuoteIdent(comboDefiner.Text, True, '@')+' ';
- Result := Result + 'EVENT ' + DBObject.Connection.QuoteIdent(ObjName) + CRLF + #9 + 'ON SCHEDULE' + CRLF + #9#9;
+ Result := Result + 'EVENT ' + DBObject.Connection.QuoteIdent(ObjName) + sLineBreak + CodeIndent + 'ON SCHEDULE' + sLineBreak + CodeIndent(2);
if radioOnce.Checked then begin
d := dateOnce.DateTime;
ReplaceTime(d, timeOnce.DateTime);
@@ -297,14 +298,14 @@ function TfrmEventEditor.ComposeStatement(CreateOrAlter, ObjName: String): Strin
end;
if chkDropAfterExpiration.Checked then
- Result := Result + #9 + 'ON COMPLETION NOT PRESERVE'
+ Result := Result + CodeIndent + 'ON COMPLETION NOT PRESERVE'
else
- Result := Result + #9 + 'ON COMPLETION PRESERVE';
+ Result := Result + CodeIndent + 'ON COMPLETION PRESERVE';
if ObjectExists and (DBObject.Name <> editName.Text) then
- Result := Result + CRLF + #9 + 'RENAME TO ' + DBObject.Connection.QuoteIdent(editName.Text);
- Result := Result + CRLF + #9 + UpperCase(grpState.Items[grpState.ItemIndex]);
- Result := Result + CRLF + #9 + 'COMMENT ' + DBObject.Connection.EscapeString(editComment.Text);
- Result := Result + CRLF + #9 + 'DO ' + SynMemoBody.Text;
+ Result := Result + sLineBreak + CodeIndent + 'RENAME TO ' + DBObject.Connection.QuoteIdent(editName.Text);
+ Result := Result + sLineBreak + CodeIndent + UpperCase(grpState.Items[grpState.ItemIndex]);
+ Result := Result + sLineBreak + CodeIndent + 'COMMENT ' + DBObject.Connection.EscapeString(editComment.Text);
+ Result := Result + sLineBreak + CodeIndent + 'DO ' + SynMemoBody.Text;
end;
diff --git a/source/exportgrid.dfm b/source/exportgrid.dfm
index 03aaff976..efbaf7bcf 100644
--- a/source/exportgrid.dfm
+++ b/source/exportgrid.dfm
@@ -3,11 +3,11 @@ object frmExportGrid: TfrmExportGrid
Top = 0
BorderIcons = [biSystemMenu]
Caption = 'Export grid rows'
- ClientHeight = 445
- ClientWidth = 373
+ ClientHeight = 412
+ ClientWidth = 574
Color = clBtnFace
- Constraints.MinHeight = 480
- Constraints.MinWidth = 350
+ Constraints.MinHeight = 450
+ Constraints.MinWidth = 530
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
@@ -16,91 +16,69 @@ object frmExportGrid: TfrmExportGrid
Position = poMainFormCenter
OnClose = FormClose
OnCreate = FormCreate
- OnResize = FormResize
OnShow = FormShow
DesignSize = (
- 373
- 445)
+ 574
+ 412)
TextHeight = 14
object btnOK: TButton
- Left = 209
- Top = 412
+ Left = 410
+ Top = 379
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'OK'
Default = True
ModalResult = 1
- TabOrder = 0
+ TabOrder = 5
OnClick = btnOKClick
end
object btnCancel: TButton
- Left = 290
- Top = 412
+ Left = 491
+ Top = 379
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Cancel = True
Caption = 'Cancel'
ModalResult = 2
- TabOrder = 1
- end
- object grpFormat: TRadioGroup
- Left = 8
- Top = 112
- Width = 137
- Height = 294
- Anchors = [akLeft, akTop, akBottom]
- Caption = 'Output format'
- ItemIndex = 0
- Items.Strings = (
- 'Excel compatible'
- 'Delimited text'
- 'HTML table'
- 'XML'
- 'SQL INSERTs'
- 'SQL REPLACEs'
- 'LaTeX'
- 'Wiki markup'
- 'PHP Array')
- TabOrder = 2
- OnClick = grpFormatClick
+ TabOrder = 6
end
object grpSelection: TRadioGroup
- Left = 151
- Top = 112
- Width = 214
+ Left = 8
+ Top = 168
+ Width = 558
Height = 66
- Anchors = [akTop, akRight]
+ Anchors = [akLeft, akTop, akRight]
Caption = 'Row selection'
ItemIndex = 1
Items.Strings = (
'Selected rows'
'All loaded rows')
- TabOrder = 3
+ TabOrder = 2
end
object grpOutput: TGroupBox
Left = 8
Top = 8
- Width = 357
+ Width = 558
Height = 98
Anchors = [akLeft, akTop, akRight]
Caption = 'Output target'
- TabOrder = 4
+ TabOrder = 0
DesignSize = (
- 357
+ 558
98)
object lblEncoding: TLabel
Left = 8
Top = 72
- Width = 47
- Height = 13
+ Width = 54
+ Height = 14
Caption = 'Encoding:'
end
object radioOutputCopyToClipboard: TRadioButton
Left = 8
Top = 18
- Width = 335
+ Width = 540
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Copy to clipboard'
@@ -121,8 +99,8 @@ object frmExportGrid: TfrmExportGrid
object editFilename: TButtonedEdit
Left = 79
Top = 42
- Width = 264
- Height = 21
+ Width = 469
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
LeftButton.DropDownMenu = popupRecentFiles
@@ -139,152 +117,164 @@ object frmExportGrid: TfrmExportGrid
object comboEncoding: TComboBox
Left = 79
Top = 69
- Width = 264
- Height = 21
+ Width = 469
+ Height = 22
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
TabOrder = 3
end
end
object grpOptions: TGroupBox
- Left = 151
- Top = 184
- Width = 214
- Height = 222
- Anchors = [akTop, akRight, akBottom]
+ Left = 8
+ Top = 240
+ Width = 558
+ Height = 133
+ Anchors = [akLeft, akTop, akRight, akBottom]
Caption = 'Options'
- TabOrder = 5
+ TabOrder = 3
DesignSize = (
- 214
- 222)
+ 558
+ 133)
object lblSeparator: TLabel
- Left = 6
- Top = 116
- Width = 76
- Height = 13
+ Left = 279
+ Top = 18
+ Width = 83
+ Height = 14
Caption = 'Field separator:'
end
object lblEncloser: TLabel
- Left = 6
- Top = 141
- Width = 44
- Height = 13
+ Left = 279
+ Top = 44
+ Width = 49
+ Height = 14
Caption = 'Encloser:'
end
object lblTerminator: TLabel
- Left = 6
- Top = 167
- Width = 76
- Height = 13
+ Left = 279
+ Top = 71
+ Width = 87
+ Height = 14
Caption = 'Line terminator:'
end
object lblNull: TLabel
- Left = 6
- Top = 194
- Width = 57
- Height = 13
+ Left = 279
+ Top = 97
+ Width = 64
+ Height = 14
Caption = 'NULL value:'
end
object chkIncludeColumnNames: TCheckBox
- Left = 6
+ Left = 8
Top = 18
- Width = 191
+ Width = 257
Height = 17
- Anchors = [akLeft, akTop, akRight]
Caption = 'Include column names'
Checked = True
State = cbChecked
TabOrder = 0
end
object editSeparator: TButtonedEdit
- Left = 106
- Top = 112
- Width = 93
- Height = 21
+ Left = 400
+ Top = 15
+ Width = 148
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.DisabledImageIndex = 107
RightButton.ImageIndex = 108
RightButton.Visible = True
- TabOrder = 3
+ TabOrder = 6
Text = ';'
OnChange = editCSVChange
OnRightButtonClick = editCSVRightButtonClick
end
object editEncloser: TButtonedEdit
- Left = 106
- Top = 138
- Width = 93
- Height = 21
+ Left = 400
+ Top = 41
+ Width = 148
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.DisabledImageIndex = 107
RightButton.ImageIndex = 108
RightButton.Visible = True
- TabOrder = 4
+ TabOrder = 7
OnChange = editCSVChange
OnRightButtonClick = editCSVRightButtonClick
end
object editTerminator: TButtonedEdit
- Left = 106
- Top = 164
- Width = 93
- Height = 21
+ Left = 400
+ Top = 68
+ Width = 148
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.DisabledImageIndex = 107
RightButton.ImageIndex = 108
RightButton.Visible = True
- TabOrder = 5
+ TabOrder = 8
Text = '\r\n'
OnChange = editCSVChange
OnRightButtonClick = editCSVRightButtonClick
end
object chkIncludeAutoIncrement: TCheckBox
- Left = 6
+ Left = 8
Top = 41
- Width = 191
+ Width = 257
Height = 17
- Anchors = [akLeft, akTop, akRight]
Caption = 'Include auto increment column'
TabOrder = 1
end
object chkIncludeQuery: TCheckBox
- Left = 6
- Top = 64
- Width = 191
+ Left = 8
+ Top = 87
+ Width = 257
Height = 17
- Anchors = [akLeft, akTop, akRight]
Caption = 'Include SQL query'
- TabOrder = 2
+ TabOrder = 3
end
object editNull: TButtonedEdit
- Left = 106
- Top = 191
- Width = 93
- Height = 21
+ Left = 400
+ Top = 94
+ Width = 148
+ Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.DisabledImageIndex = 107
RightButton.ImageIndex = 108
RightButton.Visible = True
- TabOrder = 6
+ TabOrder = 9
OnChange = editCSVChange
OnRightButtonClick = editCSVRightButtonClick
end
object chkRemoveLinebreaks: TCheckBox
- Left = 6
- Top = 87
- Width = 191
+ Left = 8
+ Top = 110
+ Width = 257
Height = 17
- Anchors = [akLeft, akTop, akRight]
Caption = 'Remove linebreaks from contents'
- TabOrder = 7
+ TabOrder = 4
+ end
+ object chkOpenFile: TCheckBox
+ Left = 8
+ Top = 133
+ Width = 257
+ Height = 17
+ Caption = 'Open file after creation'
+ TabOrder = 5
+ end
+ object chkFocusedColumnOnly: TCheckBox
+ Left = 8
+ Top = 64
+ Width = 265
+ Height = 17
+ Caption = 'Only focused column (%s)'
+ TabOrder = 2
end
end
object btnSetClipboardDefaults: TButton
Left = 8
- Top = 412
+ Top = 379
Width = 153
Height = 25
Anchors = [akLeft, akBottom]
@@ -292,12 +282,50 @@ object frmExportGrid: TfrmExportGrid
ImageIndex = 4
ImageName = 'icons8-paste-100'
Images = MainForm.VirtualImageListMain
- TabOrder = 6
+ TabOrder = 4
OnClick = btnSetClipboardDefaultsClick
end
+ object grpFormat: TGroupBox
+ Left = 8
+ Top = 112
+ Width = 558
+ Height = 50
+ Anchors = [akLeft, akTop, akRight]
+ Caption = 'Output format'
+ TabOrder = 1
+ DesignSize = (
+ 558
+ 50)
+ object comboFormat: TComboBoxEx
+ Left = 8
+ Top = 18
+ Width = 540
+ Height = 23
+ ItemsEx = <
+ item
+ Caption = 'Excel CSV'
+ ImageIndex = 49
+ SelectedImageIndex = 49
+ end
+ item
+ Caption = 'CSV'
+ ImageIndex = 50
+ SelectedImageIndex = 50
+ end
+ item
+ Caption = '...'
+ end>
+ Style = csExDropDownList
+ Anchors = [akLeft, akTop, akRight]
+ TabOrder = 0
+ OnSelect = comboFormatSelect
+ Images = MainForm.VirtualImageListMain
+ DropDownCount = 20
+ end
+ end
object popupCSVchar: TPopupMenu
AutoHotkeys = maManual
- Left = 224
+ Left = 160
Top = 6
object menuCSVtab: TMenuItem
Caption = 'Tab'
@@ -367,7 +395,7 @@ object frmExportGrid: TfrmExportGrid
object popupRecentFiles: TPopupMenu
AutoHotkeys = maManual
OnPopup = popupRecentFilesPopup
- Left = 312
+ Left = 248
Top = 6
end
end
diff --git a/source/exportgrid.pas b/source/exportgrid.pas
index 863a37758..ff2ff207b 100644
--- a/source/exportgrid.pas
+++ b/source/exportgrid.pas
@@ -5,7 +5,7 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms,
Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Menus, Vcl.ComCtrls, VirtualTrees, SynExportHTML, gnugettext, Vcl.ActnList,
- extra_controls, dbstructures, SynRegExpr, System.StrUtils, System.IOUtils;
+ extra_controls, dbstructures, SynRegExpr, System.StrUtils, System.IOUtils, VirtualTrees.BaseTree, VirtualTrees.Types;
type
TGridExportFormat = (
@@ -23,13 +23,14 @@ interface
efJiraTextile,
efPHPArray,
efMarkDown,
- efJSON
+ efJSON,
+ efJSONLines
);
TfrmExportGrid = class(TExtForm)
btnOK: TButton;
btnCancel: TButton;
- grpFormat: TRadioGroup;
+ chkFocusedColumnOnly: TCheckBox;
grpSelection: TRadioGroup;
grpOutput: TGroupBox;
radioOutputCopyToClipboard: TRadioButton;
@@ -67,6 +68,9 @@ TfrmExportGrid = class(TExtForm)
editNull: TButtonedEdit;
btnSetClipboardDefaults: TButton;
chkRemoveLinebreaks: TCheckBox;
+ grpFormat: TGroupBox;
+ comboFormat: TComboBoxEx;
+ chkOpenFile: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure CalcSize(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -79,9 +83,8 @@ TfrmExportGrid = class(TExtForm)
procedure ValidateControls(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
- procedure grpFormatClick(Sender: TObject);
+ procedure comboFormatSelect(Sender: TObject);
procedure btnSetClipboardDefaultsClick(Sender: TObject);
- procedure FormResize(Sender: TObject);
private
{ Private declarations }
FCSVEditor: TButtonedEdit;
@@ -95,7 +98,8 @@ TfrmExportGrid = class(TExtForm)
procedure SetExportFormatByFilename;
procedure SelectRecentFile(Sender: TObject);
procedure PutFilenamePlaceholder(Sender: TObject);
- function FormatExcelCsv(Text, Encloser: String; DataType: TDBDatatype): String;
+ function FormatCsv(Text, Encloser: String; DataType: TDBDatatype; SubFormat: TGridExportFormat): String;
+ function FormatJson(Text: String): String;
function FormatPhp(Text: String): String;
function FormatLatex(Text: String): String;
public
@@ -116,7 +120,8 @@ TfrmExportGrid = class(TExtForm)
('jira-textile'),
('php'),
('md'),
- ('json')
+ ('json'),
+ ('jsonl')
);
const FormatToDescription: Array[TGridExportFormat] of String =
(
@@ -134,7 +139,8 @@ TfrmExportGrid = class(TExtForm)
('Jira Textile'),
('PHP Array'),
('Markdown Here'),
- ('JSON')
+ ('JSON'),
+ ('JSON Lines')
);
const FormatToImageIndex: Array[TGridExportFormat] of Integer =
(
@@ -152,7 +158,8 @@ TfrmExportGrid = class(TExtForm)
154, // Jira
202, // PHP
199, // Markdown
- 200 // JSON
+ 200, // JSON
+ 200 // JSON Lines
);
const CopyAsActionPrefix = 'actCopyAs';
property Grid: TVirtualStringTree read FGrid write FGrid;
@@ -170,8 +177,9 @@ implementation
procedure TfrmExportGrid.FormCreate(Sender: TObject);
var
- FormatDesc: String;
+ ef: TGridExportFormat;
SenderName: String;
+ comboItem: TComboExItem;
begin
HasSizeGrip := True;
editFilename.Text := AppSettings.ReadString(asGridExportFilename);
@@ -179,20 +187,25 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
comboEncoding.Items.Assign(MainForm.FileEncodings);
comboEncoding.Items.Delete(0); // Remove "Auto detect"
comboEncoding.ItemIndex := AppSettings.ReadInt(asGridExportEncoding);
- grpFormat.Items.Clear;
- for FormatDesc in FormatToDescription do
- grpFormat.Items.Add(FormatDesc);
+ comboFormat.Items.Clear;
+ for ef:=Low(TGridExportFormat) to High(TGridExportFormat) do begin
+ comboItem := TComboExItem.Create(comboFormat.ItemsEx);
+ comboItem.Caption := FormatToDescription[ef];
+ comboItem.ImageIndex := FormatToImageIndex[ef];
+ end;
SenderName := Owner.Name;
FHiddenCopyMode := SenderName.StartsWith(CopyAsActionPrefix);
if FHiddenCopyMode then begin
radioOutputCopyToClipboard.Checked := True;
- grpFormat.ItemIndex := Owner.Tag;
+ comboFormat.ItemIndex := Owner.Tag;
grpSelection.ItemIndex := 0; // Always use selected cells in copy mode
chkIncludeColumnNames.Checked := AppSettings.ReadBool(asGridExportClpColumnNames);
chkIncludeAutoIncrement.Checked := AppSettings.ReadBool(asGridExportClpIncludeAutoInc);
+ chkFocusedColumnOnly.Checked := False;
chkIncludeQuery.Checked := False; // Always off in copy mode
chkRemoveLinebreaks.Checked := AppSettings.ReadBool(asGridExportClpRemoveLinebreaks);
+ chkOpenFile.Checked := False; // Always off in copy mode
FCSVSeparator := AppSettings.ReadString(asGridExportClpSeparator);
FCSVEncloser := AppSettings.ReadString(asGridExportClpEncloser);
FCSVTerminator := AppSettings.ReadString(asGridExportClpTerminator);
@@ -200,12 +213,14 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
end else begin
radioOutputCopyToClipboard.Checked := AppSettings.ReadBool(asGridExportOutputCopy);
radioOutputFile.Checked := AppSettings.ReadBool(asGridExportOutputFile);
- grpFormat.ItemIndex := AppSettings.ReadInt(asGridExportFormat);
+ comboFormat.ItemIndex := AppSettings.ReadInt(asGridExportFormat);
grpSelection.ItemIndex := AppSettings.ReadInt(asGridExportSelection);
chkIncludeColumnNames.Checked := AppSettings.ReadBool(asGridExportColumnNames);
chkIncludeAutoIncrement.Checked := AppSettings.ReadBool(asGridExportIncludeAutoInc);
+ chkFocusedColumnOnly.Checked := AppSettings.ReadBool(asGridExportFocusedColumnOnly);
chkIncludeQuery.Checked := AppSettings.ReadBool(asGridExportIncludeQuery);
chkRemoveLinebreaks.Checked := AppSettings.ReadBool(asGridExportRemoveLinebreaks);
+ chkOpenFile.Checked := AppSettings.ReadBool(asGridExportOpenFile);
FCSVSeparator := AppSettings.ReadString(asGridExportSeparator);
FCSVEncloser := AppSettings.ReadString(asGridExportEncloser);
FCSVTerminator := AppSettings.ReadString(asGridExportTerminator);
@@ -215,22 +230,20 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
end;
-procedure TfrmExportGrid.FormResize(Sender: TObject);
-begin
- grpFormat.Width := Width div 3;
- grpSelection.Left := grpFormat.Left + grpFormat.Width + 8;
- grpSelection.Width := Width - grpSelection.Left - 24;
- grpOptions.Left := grpSelection.Left;
- grpOptions.Width := grpSelection.Width;
-end;
-
procedure TfrmExportGrid.FormShow(Sender: TObject);
+var
+ FocusedCol: String;
begin
// Show dialog. Expect "Grid" property to be set now by the caller.
Width := AppSettings.ReadIntDpiAware(asGridExportWindowWidth, Self);
Height := AppSettings.ReadIntDpiAware(asGridExportWindowHeight, Self);
chkIncludeAutoIncrement.OnClick := CalcSize;
+ chkFocusedColumnOnly.OnClick := CalcSize;
CalcSize(Sender);
+ // Show name of focused column
+ FocusedCol := IfThen(Grid.FocusedColumn > NoColumn, Grid.Header.Columns[Grid.FocusedColumn].Text, '');
+ chkFocusedColumnOnly.Caption := f_('Only focused column (%s)', [FocusedCol]);
+ chkFocusedColumnOnly.Enabled := not FocusedCol.IsEmpty;
end;
@@ -245,12 +258,14 @@ procedure TfrmExportGrid.FormClose(Sender: TObject; var Action: TCloseAction);
AppSettings.WriteString(asGridExportFilename, editFilename.Text);
AppSettings.WriteString(asGridExportRecentFiles, Implode(DELIM, FRecentFiles));
AppSettings.WriteInt(asGridExportEncoding, comboEncoding.ItemIndex);
- AppSettings.WriteInt(asGridExportFormat, grpFormat.ItemIndex);
+ AppSettings.WriteInt(asGridExportFormat, comboFormat.ItemIndex);
AppSettings.WriteInt(asGridExportSelection, grpSelection.ItemIndex);
AppSettings.WriteBool(asGridExportColumnNames, chkIncludeColumnNames.Checked);
AppSettings.WriteBool(asGridExportIncludeAutoInc, chkIncludeAutoIncrement.Checked);
+ AppSettings.WriteBool(asGridExportFocusedColumnOnly, chkFocusedColumnOnly.Checked);
AppSettings.WriteBool(asGridExportIncludeQuery, chkIncludeQuery.Checked);
AppSettings.WriteBool(asGridExportRemoveLinebreaks, chkRemoveLinebreaks.Checked);
+ AppSettings.WriteBool(asGridExportOpenFile, chkOpenFile.Checked);
AppSettings.WriteString(asGridExportSeparator, FCSVSeparator);
AppSettings.WriteString(asGridExportEncloser, FCSVEncloser);
AppSettings.WriteString(asGridExportTerminator, FCSVTerminator);
@@ -295,6 +310,7 @@ procedure TfrmExportGrid.ValidateControls(Sender: TObject);
end;
chkIncludeQuery.Enabled := ExportFormat in [efHTML, efXML, efMarkDown, efJSON];
+ chkOpenFile.Enabled := radioOutputFile.Checked;
Enable := ExportFormat = efCSV;
lblSeparator.Enabled := Enable;
editSeparator.Enabled := Enable;
@@ -320,17 +336,19 @@ procedure TfrmExportGrid.ValidateControls(Sender: TObject);
function TfrmExportGrid.GetExportFormat: TGridExportFormat;
begin
- Result := TGridExportFormat(grpFormat.ItemIndex);
+ // This is slow, don't use in large loops
+ Result := TGridExportFormat(comboFormat.ItemIndex);
end;
procedure TfrmExportGrid.SetExportFormat(Value: TGridExportFormat);
begin
- grpFormat.ItemIndex := Integer(Value);
+ comboFormat.ItemIndex := Integer(Value);
+ ValidateControls(Self);
end;
-procedure TfrmExportGrid.grpFormatClick(Sender: TObject);
+procedure TfrmExportGrid.comboFormatSelect(Sender: TObject);
var
Filename: String;
begin
@@ -387,7 +405,7 @@ procedure TfrmExportGrid.editFilenameRightButtonClick(Sender: TObject);
Dialog.Filter := Dialog.Filter + FormatToDescription[ef] + ' (*.'+FormatToFileExtension[ef]+')|*.'+FormatToFileExtension[ef]+'|';
Dialog.Filter := Dialog.Filter + _('All files')+' (*.*)|*.*';
Dialog.OnTypeChange := SaveDialogTypeChange;
- Dialog.FilterIndex := grpFormat.ItemIndex+1;
+ Dialog.FilterIndex := comboFormat.ItemIndex+1;
Dialog.OnTypeChange(Dialog);
if Dialog.Execute then begin
editFilename.Text := Dialog.FileName;
@@ -469,45 +487,63 @@ procedure TfrmExportGrid.CalcSize(Sender: TObject);
var
GridData: TDBQuery;
Node: PVirtualNode;
- Col, ExcludeCol: TColumnIndex;
+ Col, ExcludeAutoIncCol, IncludeFocusedCol: TColumnIndex;
ResultCol: Integer;
RowNum: PInt64;
- SelectionSize, AllSize, RowsCalculated: Int64;
+ SelectedSize, AllSize: Int64;
+ CalculatedCount, SelectedCount, AllCount: Int64;
+ DoIncludeCol: Boolean;
begin
GridData := Mainform.GridResult(Grid);
+ if not Assigned(GridData) then begin
+ MainForm.LogSQL('Failed to get current results');
+ Exit;
+ end;
AllSize := 0;
- SelectionSize := 0;
- chkIncludeAutoIncrement.Enabled := GridData.AutoIncrementColumn > -1;
- ExcludeCol := -1;
+ SelectedSize := 0;
+ chkIncludeAutoIncrement.Enabled := (GridData.AutoIncrementColumn > -1) and (not chkFocusedColumnOnly.Checked);
+ ExcludeAutoIncCol := -1;
if chkIncludeAutoIncrement.Enabled and (not chkIncludeAutoIncrement.Checked) then
- ExcludeCol := GridData.AutoIncrementColumn;
+ ExcludeAutoIncCol := GridData.AutoIncrementColumn;
+ IncludeFocusedCol := -1;
+ if chkFocusedColumnOnly.Enabled and chkFocusedColumnOnly.Checked then
+ IncludeFocusedCol := Grid.FocusedColumn;
Node := GetNextNode(Grid, nil, False);
- RowsCalculated := 0;
+ CalculatedCount := 0;
+ AllCount := 0;
+ SelectedCount := 0;
while Assigned(Node) do begin
- RowNum := Grid.GetNodeData(Node);
- GridData.RecNo := RowNum^;
- Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
- while Col > NoColumn do begin
- ResultCol := Col - 1;
- if Col <> ExcludeCol then begin
- Inc(AllSize, GridData.ColumnLengths(ResultCol));
- if vsSelected in Node.States then
- Inc(SelectionSize, GridData.ColumnLengths(ResultCol));
+ Inc(AllCount);
+ if vsSelected in Node.States then
+ Inc(SelectedCount);
+
+ if CalculatedCount < 1000 then begin
+ // Performance: use first rows only, and interpolate the rest, see issue #804
+ RowNum := Grid.GetNodeData(Node);
+ GridData.RecNo := RowNum^;
+ Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
+ while Col > NoColumn do begin
+ ResultCol := Col - 1;
+ DoIncludeCol := (Col <> ExcludeAutoIncCol) and
+ ((IncludeFocusedCol < 0) or (Col = IncludeFocusedCol));
+ if DoIncludeCol then begin
+ Inc(AllSize, GridData.ColumnLengths(ResultCol));
+ if vsSelected in Node.States then
+ Inc(SelectedSize, GridData.ColumnLengths(ResultCol));
+ end;
+ Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
end;
- Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
+ Inc(CalculatedCount);
end;
- // Performance: use first rows only, and interpolate the rest, see issue #804
- Inc(RowsCalculated);
- if RowsCalculated >= 1000 then
- Break;
+
Node := GetNextNode(Grid, Node, False);
end;
- if GridData.RecordCount > RowsCalculated then begin
- AllSize := Round(AllSize / RowsCalculated * GridData.RecordCount);
+ if AllCount > CalculatedCount then begin
+ AllSize := Round(AllSize / CalculatedCount * AllCount);
end;
- grpSelection.Items[0] := f_('Selection (%s rows, %s)', [FormatNumber(Grid.SelectedCount), FormatByteNumber(SelectionSize)]);
- grpSelection.Items[1] := f_('Complete (%s rows, %s)', [FormatNumber(Grid.RootNodeCount), FormatByteNumber(AllSize)]);
+ grpSelection.Items[0] := f_('Selection (%s rows, %s)', [FormatNumber(SelectedCount), FormatByteNumber(SelectedSize)]);
+ grpSelection.Items[1] := f_('Complete (%s rows, %s)', [FormatNumber(AllCount), FormatByteNumber(AllSize)]);
end;
@@ -567,19 +603,20 @@ procedure TfrmExportGrid.menuCSVClick(Sender: TObject);
end;
-function TfrmExportGrid.FormatExcelCsv(Text, Encloser: String; DataType: TDBDatatype): String;
+function TfrmExportGrid.FormatCsv(Text, Encloser: String; DataType: TDBDatatype; SubFormat: TGridExportFormat): String;
begin
Result := Text;
// Escape encloser characters inside data per de-facto CSV.
if not Encloser.IsEmpty then
Result := StringReplace(Result, Encloser, Encloser+Encloser, [rfReplaceAll]);
- if DataType.Category = dtcTemporal then begin
- Result := ReplaceRegExpr('\.(\d+)$', Result, FormatSettings.DecimalSeparator + '$1', True);
+ // Remove milliseconds from date/time values, unsupported by Excel. See issue #922
+ if (SubFormat = efExcel) and (DataType.Category = dtcTemporal) then begin
+ Result := ReplaceRegExpr('\.(\d+)$', Result, '');
end;
end;
-function TfrmExportGrid.FormatPhp(Text: String): String;
+function TfrmExportGrid.FormatJson(Text: String): String;
begin
// String escaping for PHP output. Incompatible to TDBConnection.EscapeString.
Result := StringReplace(Text, '\', '\\', [rfReplaceAll]);
@@ -590,6 +627,28 @@ function TfrmExportGrid.FormatPhp(Text: String): String;
Result := '"' + Result + '"';
end;
+function TfrmExportGrid.FormatPhp(Text: String): String;
+begin
+ if Text.IndexOfAny([#10, #13, #9, #11, #27, #12]) > -1 then begin
+ // https://www.php.net/manual/it/language.types.string.php#language.types.string.syntax.double
+ Result := StringReplace(Text, '\', '\\', [rfReplaceAll]);
+ Result := StringReplace(Result, #10, '\n', [rfReplaceAll]);
+ Result := StringReplace(Result, #13, '\r', [rfReplaceAll]);
+ Result := StringReplace(Result, #9, '\t', [rfReplaceAll]);
+ Result := StringReplace(Result, #11, '\v', [rfReplaceAll]);
+ Result := StringReplace(Result, #27, '\e', [rfReplaceAll]);
+ Result := StringReplace(Result, #12, '\f', [rfReplaceAll]);
+ Result := StringReplace(Result, '$', '\$', [rfReplaceAll]);
+ Result := StringReplace(Result, '"', '\"', [rfReplaceAll]);
+ Result := '"' + Result + '"';
+ end else begin
+ // https://www.php.net/manual/it/language.types.string.php#language.types.string.syntax.single
+ Result := StringReplace(Text, '\', '\\', [rfReplaceAll]);
+ Result := StringReplace(Text, '''', '\''', [rfReplaceAll]);
+ Result := '''' + Result + '''';
+ end;
+end;
+
function TfrmExportGrid.FormatLatex(Text: String): String;
var
@@ -609,7 +668,7 @@ function TfrmExportGrid.FormatLatex(Text: String): String;
procedure TfrmExportGrid.btnOKClick(Sender: TObject);
var
- Col, ExcludeCol: TColumnIndex;
+ Col, ExcludeAutoIncCol, IncludeFocusedCol: TColumnIndex;
ResultCol: Integer;
Header, Data, tmp, Encloser, Separator, Terminator, TableName, Filename: String;
Node: PVirtualNode;
@@ -623,6 +682,13 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
Exporter: TSynExporterHTML;
Encoding: TEncoding;
Bom: TBytes;
+ CurrentExportFormat: TGridExportFormat;
+
+ function DoIncludeCol: Boolean;
+ begin
+ Result := (Col <> ExcludeAutoIncCol) and
+ ((IncludeFocusedCol < 0) or (Col = IncludeFocusedCol))
+ end;
begin
Filename := GetOutputFilename(editFilename.Text, MainForm.ActiveDbObj);
@@ -651,9 +717,14 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
except
TableName := _('UnknownTable');
end;
- ExcludeCol := NoColumn;
- if (not chkIncludeAutoIncrement.Checked) or (not chkIncludeAutoIncrement.Enabled) then
- ExcludeCol := GridData.AutoIncrementColumn + 1;
+ ExcludeAutoIncCol := NoColumn;
+ if chkIncludeAutoIncrement.Enabled and (not chkIncludeAutoIncrement.Checked) then
+ ExcludeAutoIncCol := GridData.AutoIncrementColumn + 1;
+ IncludeFocusedCol := NoColumn;
+ if chkFocusedColumnOnly.Checked then
+ IncludeFocusedCol := Grid.FocusedColumn;
+ // Calling (Get)ExportFormat is slow, so we store it in a local variable
+ CurrentExportFormat := ExportFormat;
if radioOutputCopyToClipboard.Checked then
Encoding := TEncoding.UTF8
@@ -672,57 +743,57 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
// Note that TStringStream + TEncoding.UTF8 do not write a BOM (which is nice),
// although it should do so according to TUTF8Encoding.GetPreamble.
// Now, only newer Excel versions need that BOM, so we add it explicitly here
- S := TStringStream.Create(Header, Encoding);
- if (ExportFormat = efExcel) and (Encoding = TEncoding.UTF8) and radioOutputFile.Checked then begin
+ // P.S.: Note the boolean/False parameter for OwnsEncoding, so our global encodings are not destroyed after usage
+ S := TStringStream.Create(Header, Encoding, False);
+ if (CurrentExportFormat = efExcel) and (Encoding = TEncoding.UTF8) and radioOutputFile.Checked then begin
Bom := TBytes.Create($EF, $BB, $BF);
S.Write(Bom, 3);
end;
Header := '';
- case ExportFormat of
+ case CurrentExportFormat of
efHTML: begin
Header :=
- '' + CRLF + CRLF +
- '' + CRLF +
- ' ' + CRLF +
- ' ' + TableName + '' + CRLF +
- ' ' + CRLF +
- ' ' + CRLF +
- ' ' + CRLF +
- ' ' + CRLF + CRLF +
- ' ' + CRLF + CRLF;
+ CodeIndent(2) + '' + sLineBreak +
+ CodeIndent + '' + sLineBreak + sLineBreak +
+ CodeIndent + '' + sLineBreak + sLineBreak;
if chkIncludeQuery.Checked then
- Header := Header + '
' + sLineBreak;
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
- if Col <> ExcludeCol then
- Header := Header + '
' + Grid.Header.Columns[Col].Text + '
' + CRLF;
+ if DoIncludeCol then
+ Header := Header + CodeIndent(5) + '
' + sLineBreak +
+ CodeIndent(3) + '' + sLineBreak;
end;
- Header := Header +
- ' ' + CRLF;
+ Header := Header + CodeIndent(3) + '' + sLineBreak;
end;
efExcel, efCSV: begin
@@ -734,7 +805,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
while Col > NoColumn do begin
// Alter column name in header if data is not raw.
ResultCol := Col - 1;
- if Col <> ExcludeCol then begin
+ if DoIncludeCol then begin
Data := Grid.Header.Columns[Col].Text;
if (GridData.DataType(ResultCol).Category in [dtcBinary, dtcSpatial]) and (not Mainform.actBlobAsText.Checked) then
Data := 'HEX(' + Data + ')';
@@ -766,7 +837,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
Header := Header + '{';
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
- if Col <> ExcludeCol then
+ if DoIncludeCol then
Header := Header + ' c ';
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
end;
@@ -774,7 +845,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
if chkIncludeColumnNames.Checked then begin
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
- if Col <> ExcludeCol then
+ if DoIncludeCol then
Header := Header + FormatLatex(Grid.Header.Columns[Col].Text) + Separator;
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
end;
@@ -784,14 +855,14 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
end;
efTextile, efJiraTextile: begin
- Separator := IfThen(ExportFormat=efTextile, ' |_. ', ' || ');
+ Separator := IfThen(CurrentExportFormat=efTextile, ' |_. ', ' || ');
Encloser := '';
- Terminator := IfThen(ExportFormat=efTextile, ' |', ' ||') + CRLF;
+ Terminator := IfThen(CurrentExportFormat=efTextile, ' |', ' ||') + CRLF;
if chkIncludeColumnNames.Checked then begin
Header := TrimLeft(Separator);
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
- if Col <> ExcludeCol then
+ if DoIncludeCol then
Header := Header + Grid.Header.Columns[Col].Text + Separator;
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
end;
@@ -804,9 +875,9 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
efPHPArray: begin
if radioOutputFile.Checked then
- Header := ' NoColumn do begin
- if Col <> ExcludeCol then begin
+ if DoIncludeCol then begin
if chkIncludeColumnNames.Checked then
Header := Header + Grid.Header.Columns[Col].Text + Separator
else
@@ -833,7 +904,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
ResultCol := Col - 1;
- if Col <> ExcludeCol then begin
+ if DoIncludeCol then begin
Header := Header + '---';
if GridData.DataType(ResultCol).Category in [dtcInteger, dtcReal] then
Header := Header + ':';
@@ -846,12 +917,12 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
efJSON: begin
// JavaScript Object Notation
- Header := '{' + CRLF;
+ Header := '{' + sLineBreak;
if chkIncludeQuery.Checked then
- Header := Header + #9 + '"query": '+FormatPhp(GridData.SQL)+',' + CRLF
+ Header := Header + #9 + '"query": '+FormatJson(GridData.SQL)+',' + sLineBreak
else
- Header := Header + #9 + '"table": '+FormatPhp(TableName)+',' + CRLF ;
- Header := Header + #9 + '"rows":' + CRLF + #9 + '[';
+ Header := Header + #9 + '"table": '+FormatJson(TableName)+',' + sLineBreak;
+ Header := Header + #9 + '"rows":' + sLineBreak + #9 + '[';
end;
end;
@@ -873,10 +944,10 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
GridData.RecNo := RowNum^;
// Row preamble
- case ExportFormat of
- efHTML: tmp := '
' + CRLF;
+ case CurrentExportFormat of
+ efHTML: tmp := CodeIndent(4) + '
' + sLineBreak;
- efXML: tmp := #9'' + CRLF;
+ efXML: tmp := CodeIndent + '' + sLineBreak;
efSQLUpdate: begin
tmp := '';
@@ -885,14 +956,14 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
efSQLInsert, efSQLInsertIgnore, efSQLReplace, efSQLDeleteInsert: begin
tmp := '';
- if ExportFormat = efSQLDeleteInsert then begin
+ if CurrentExportFormat = efSQLDeleteInsert then begin
tmp := tmp + 'DELETE FROM ' + GridData.Connection.QuoteIdent(Tablename) + ' WHERE' + GridData.GetWhereClause + ';' + CRLF;
end;
- if ExportFormat in [efSQLInsert, efSQLDeleteInsert] then
+ if CurrentExportFormat in [efSQLInsert, efSQLDeleteInsert] then
tmp := tmp + 'INSERT'
- else if ExportFormat = efSQLInsertIgnore then
- tmp := tmp + 'INSERT IGNORE'
+ else if CurrentExportFormat = efSQLInsertIgnore then
+ tmp := tmp + 'INSERT IGNORE'
else
tmp := tmp + 'REPLACE';
tmp := tmp + ' INTO '+GridData.Connection.QuoteIdent(Tablename);
@@ -901,7 +972,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
ResultCol := Col - 1;
- if (Col <> ExcludeCol) and (not GridData.ColIsVirtual(ResultCol)) then
+ if DoIncludeCol and (not GridData.ColIsVirtual(ResultCol)) then
tmp := tmp + GridData.Connection.QuoteIdent(Grid.Header.Columns[Col].Text)+', ';
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
end;
@@ -913,15 +984,22 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
efTextile, efJiraTextile: tmp := TrimLeft(Separator);
- efPHPArray: tmp := #9 + 'array('+CRLF;
+ efPHPArray: tmp := CodeIndent + '[' + sLineBreak;
efMarkDown: tmp := '| ';
efJSON: begin
if chkIncludeColumnNames.Checked then
- tmp := CRLF + #9#9 + '{' + CRLF
+ tmp := sLineBreak + CodeIndent(2) + '{' + sLineBreak
+ else
+ tmp := sLineBreak + CodeIndent(2) + '[' + sLineBreak
+ end;
+
+ efJSONLines: begin
+ if chkIncludeColumnNames.Checked then
+ tmp := '{'
else
- tmp := CRLF + #9#9 + '[' + CRLF
+ tmp := '[';
end
else tmp := '';
@@ -931,7 +1009,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
while Col > NoColumn do begin
ResultCol := Col - 1;
- if Col <> ExcludeCol then begin
+ if DoIncludeCol then begin
if (GridData.DataType(ResultCol).Category in [dtcBinary, dtcSpatial])
and (not Mainform.actBlobAsText.Checked) then begin
Data := GridData.HexValue(ResultCol);
@@ -942,29 +1020,28 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
// Keep formatted numeric values
if (GridData.DataType(ResultCol).Category in [dtcInteger, dtcReal])
- and (ExportFormat in [efExcel, efHTML, efMarkDown]) then begin
+ and (CurrentExportFormat in [efExcel, efHTML, efMarkDown])
+ then begin
Data := FormatNumber(Data, False);
end;
// Remove linebreaks, see #474
if chkRemoveLinebreaks.Checked then begin
- Data := StringReplace(Data, #13#10, ' ', [rfReplaceAll]);
- Data := StringReplace(Data, #13, ' ', [rfReplaceAll]);
- Data := StringReplace(Data, #10, ' ', [rfReplaceAll]);
+ StripNewLines(Data);
end;
- case ExportFormat of
+ case CurrentExportFormat of
efHTML: begin
// Escape HTML control characters in data.
Data := HTMLSpecialChars(Data);
- tmp := tmp + '
' + Data + '
' + CRLF;
+ tmp := tmp + CodeIndent(5) + '
' + Data + '
' + sLineBreak;
end;
efExcel, efCSV: begin
if GridData.IsNull(ResultCol) then
Data := editNull.Text
else begin
- Data := FormatExcelCsv(Data, Encloser, GridData.DataType(ResultCol));
+ Data := FormatCsv(Data, Encloser, GridData.DataType(ResultCol), CurrentExportFormat);
Data := Encloser + Data + Encloser;
end;
tmp := tmp + Data + Separator;
@@ -990,7 +1067,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
efXML: begin
// Print cell start tag.
- tmp := tmp + #9#9' integer conversion in PHP
@@ -1036,15 +1113,15 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
end;
if chkIncludeColumnNames.Checked then
- tmp := tmp + #9#9 + FormatPhp(Grid.Header.Columns[Col].Text) + ' => ' + Data + ','+CRLF
+ tmp := tmp + CodeIndent(2) + FormatPhp(Grid.Header.Columns[Col].Text) + ' => ' + Data + ',' + sLineBreak
else
- tmp := tmp + #9#9 + Data + ','+CRLF;
+ tmp := tmp + CodeIndent(2) + Data + ',' + sLineBreak;
end;
efJSON: begin
- tmp := tmp + #9#9#9;
+ tmp := tmp + CodeIndent(3);
if chkIncludeColumnNames.Checked then
- tmp := tmp + FormatPhp(Grid.Header.Columns[Col].Text) + ': ';
+ tmp := tmp + FormatJson(Grid.Header.Columns[Col].Text) + ': ';
if GridData.IsNull(ResultCol) then
tmp := tmp + 'null,' +CRLF
else begin
@@ -1052,12 +1129,28 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
dtcInteger, dtcReal:
tmp := tmp + Data;
else
- tmp := tmp + FormatPhp(Data)
+ tmp := tmp + FormatJson(Data)
end;
tmp := tmp + ',' + CRLF;
end;
end;
+ efJSONLines: begin
+ if chkIncludeColumnNames.Checked then
+ tmp := tmp + FormatJson(Grid.Header.Columns[Col].Text) + ': ';
+ if GridData.IsNull(ResultCol) then
+ tmp := tmp + 'null, '
+ else begin
+ case GridData.DataType(ResultCol).Category of
+ dtcInteger, dtcReal:
+ tmp := tmp + Data;
+ else
+ tmp := tmp + FormatJson(Data)
+ end;
+ tmp := tmp + ', ';
+ end;
+ end;
+
end;
end;
@@ -1065,15 +1158,15 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
end;
// Row epilogue
- case ExportFormat of
+ case CurrentExportFormat of
efHTML:
- tmp := tmp + '