Commit a575d90f authored by Olivier Bertrand's avatar Olivier Bertrand

Fold all json UDF names to lower case

  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h
  modified:   storage/connect/mysql-test/connect/r/json_udf.result
  modified:   storage/connect/mysql-test/connect/t/json_udf.inc
  modified:   storage/connect/value.cpp
parent 9c6405fe
This diff is collapsed.
This diff is collapsed.
...@@ -14,14 +14,14 @@ SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL); ...@@ -14,14 +14,14 @@ SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL);
Json_Array(56,3.1416,'My name is "Foo"',NULL) Json_Array(56,3.1416,'My name is "Foo"',NULL)
[56,3.141600,"My name is \"Foo\"",null] [56,3.141600,"My name is \"Foo\"",null]
SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array; SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array;
ERROR HY000: Can't initialize function 'Json_Array_Add'; Json_Array_Add must have at least 2 arguments ERROR HY000: Can't initialize function 'json_array_add'; json_array_add must have at least 2 arguments
SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array; SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array;
Array Array
[56,3.141600,"foo",null,"One more"] [56,3.141600,"foo",null,"One more"]
SELECT Json_Array_Add(JsonValue('one value'),'One more'); SELECT Json_Array_Add(JsonValue('one value'),'One more');
ERROR HY000: Can't initialize function 'Json_Array_Add'; Json_Array_Add first argument must be a json item ERROR HY000: Can't initialize function 'json_array_add'; json_array_add first argument must be a json item
SELECT Json_Array_Add('one value','One more'); SELECT Json_Array_Add('one value','One more');
ERROR HY000: Can't initialize function 'Json_Array_Add'; Json_Array_Add first argument must be a json item ERROR HY000: Can't initialize function 'json_array_add'; json_array_add first argument must be a json item
SELECT Json_Array_Add('one value' json_,'One more'); SELECT Json_Array_Add('one value' json_,'One more');
Json_Array_Add('one value' json_,'One more') Json_Array_Add('one value' json_,'One more')
NULL NULL
...@@ -30,7 +30,7 @@ Warning 1105 Error 2 opening one value ...@@ -30,7 +30,7 @@ Warning 1105 Error 2 opening one value
Warning 1105 Void JSON object Warning 1105 Void JSON object
Warning 1105 First argument is not an array Warning 1105 First argument is not an array
SELECT JsonValue(56,3.1416,'foo',NULL); SELECT JsonValue(56,3.1416,'foo',NULL);
ERROR HY000: Can't initialize function 'JsonValue'; JsonValue cannot accept more than 1 argument ERROR HY000: Can't initialize function 'jsonvalue'; jsonvalue cannot accept more than 1 argument
SELECT JsonValue(3.1416); SELECT JsonValue(3.1416);
JsonValue(3.1416) JsonValue(3.1416)
3.141600 3.141600
...@@ -79,7 +79,7 @@ Json_Object(AUTHOR, TITLE, DATEPUB) ...@@ -79,7 +79,7 @@ Json_Object(AUTHOR, TITLE, DATEPUB)
{"AUTHOR":"Jean-Christophe Bernadac","TITLE":"Construire une application XML","DATEPUB":1999} {"AUTHOR":"Jean-Christophe Bernadac","TITLE":"Construire une application XML","DATEPUB":1999}
{"AUTHOR":"William J. Pardi","TITLE":"XML en Action","DATEPUB":1999} {"AUTHOR":"William J. Pardi","TITLE":"XML en Action","DATEPUB":1999}
SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1; SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1;
ERROR HY000: Can't initialize function 'Json_Array_Grp'; Json_Array_Grp can only accept 1 argument ERROR HY000: Can't initialize function 'json_array_grp'; json_array_grp can only accept 1 argument
SELECT Json_Array_Grp(TITLE) FROM t1; SELECT Json_Array_Grp(TITLE) FROM t1;
Json_Array_Grp(TITLE) Json_Array_Grp(TITLE)
["Construire une application XML","XML en Action"] ["Construire une application XML","XML en Action"]
...@@ -145,7 +145,7 @@ Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY ...@@ -145,7 +145,7 @@ Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY
{"DEPARTMENT":"2452","TITLE":"SCIENTIST","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","SALARY":8000.000000},{"SERIALNO":"36666","NAME":"BIGHORN","SALARY":11000.000000}]} {"DEPARTMENT":"2452","TITLE":"SCIENTIST","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","SALARY":8000.000000},{"SERIALNO":"36666","NAME":"BIGHORN","SALARY":11000.000000}]}
{"DEPARTMENT":"2452","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"11111","NAME":"CHERRY","SALARY":4500.000000}]} {"DEPARTMENT":"2452","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"11111","NAME":"CHERRY","SALARY":4500.000000}]}
SELECT Json_Object_Grp(SALARY) FROM t1; SELECT Json_Object_Grp(SALARY) FROM t1;
ERROR HY000: Can't initialize function 'Json_Object_Grp'; Json_Object_Grp can only accept 2 arguments ERROR HY000: Can't initialize function 'json_object_grp'; json_object_grp can only accept 2 arguments
SELECT Json_Object_Grp(SALARY, NAME) FROM t1; SELECT Json_Object_Grp(SALARY, NAME) FROM t1;
Json_Object_Grp(SALARY, NAME) Json_Object_Grp(SALARY, NAME)
{"BANCROFT":9600.000000,"SMITH":9000.000000,"MERCHANT":8700.000000,"FUNNIGUY":8500.000000,"BUGHAPPY":8500.000000,"BIGHEAD":8000.000000,"SHRINKY":7500.000000,"WALTER":7400.000000,"FODDERMAN":7000.000000,"TONGHO":6800.000000,"SHORTSIGHT":5500.000000,"MESSIFUL":5000.500000,"HONEY":4900.000000,"GOOSEPEN":4700.000000,"CHERRY":4500.000000,"MONAPENNY":3800.000000,"KITTY":3000.450000,"PLUMHEAD":2800.000000,"STRONG":23000.000000,"BULLOZER":14800.000000,"WERTHER":14500.000000,"QUINN":14000.000000,"ORELLY":13400.000000,"BIGHORN":11000.000000,"BROWNY":10500.000000,"WHEELFOR":10030.000000,"MARTIN":10000.000000} {"BANCROFT":9600.000000,"SMITH":9000.000000,"MERCHANT":8700.000000,"FUNNIGUY":8500.000000,"BUGHAPPY":8500.000000,"BIGHEAD":8000.000000,"SHRINKY":7500.000000,"WALTER":7400.000000,"FODDERMAN":7000.000000,"TONGHO":6800.000000,"SHORTSIGHT":5500.000000,"MESSIFUL":5000.500000,"HONEY":4900.000000,"GOOSEPEN":4700.000000,"CHERRY":4500.000000,"MONAPENNY":3800.000000,"KITTY":3000.450000,"PLUMHEAD":2800.000000,"STRONG":23000.000000,"BULLOZER":14800.000000,"WERTHER":14500.000000,"QUINN":14000.000000,"ORELLY":13400.000000,"BIGHORN":11000.000000,"BROWNY":10500.000000,"WHEELFOR":10030.000000,"MARTIN":10000.000000}
......
...@@ -9,13 +9,13 @@ if (!$HA_CONNECT_SO) { ...@@ -9,13 +9,13 @@ if (!$HA_CONNECT_SO) {
--skip Needs a dynamically built ha_connect.so --skip Needs a dynamically built ha_connect.so
} }
CREATE FUNCTION Json_Array RETURNS STRING SONAME 'ha_connect'; CREATE FUNCTION json_array RETURNS STRING SONAME 'ha_connect';
CREATE FUNCTION Json_Array_Add RETURNS STRING SONAME 'ha_connect'; CREATE FUNCTION json_array_add RETURNS STRING SONAME 'ha_connect';
CREATE FUNCTION Json_Object RETURNS STRING SONAME 'ha_connect'; CREATE FUNCTION json_object RETURNS STRING SONAME 'ha_connect';
CREATE FUNCTION Json_Object_Nonull RETURNS STRING SONAME 'ha_connect'; CREATE FUNCTION json_object_nonull RETURNS STRING SONAME 'ha_connect';
CREATE FUNCTION JsonValue RETURNS STRING SONAME 'ha_connect'; CREATE FUNCTION jsonvalue RETURNS STRING SONAME 'ha_connect';
CREATE AGGREGATE FUNCTION Json_Array_Grp RETURNS STRING SONAME 'ha_connect'; CREATE AGGREGATE FUNCTION json_array_grp RETURNS STRING SONAME 'ha_connect';
CREATE AGGREGATE FUNCTION Json_Object_Grp RETURNS STRING SONAME 'ha_connect'; CREATE AGGREGATE FUNCTION json_object_grp RETURNS STRING SONAME 'ha_connect';
--enable_query_log --enable_query_log
...@@ -2440,6 +2440,7 @@ void DTVAL::SetTimeShift(void) ...@@ -2440,6 +2440,7 @@ void DTVAL::SetTimeShift(void)
} // end of SetTimeShift } // end of SetTimeShift
#if defined(connect_EXPORTS)
// Added by Alexander Barkov // Added by Alexander Barkov
static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime) static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime)
{ {
...@@ -2461,6 +2462,9 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm) ...@@ -2461,6 +2462,9 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm)
TIME_to_localtime(tm, &ltime); TIME_to_localtime(tm, &ltime);
return tm; return tm;
} // end of gmtime_mysql } // end of gmtime_mysql
#else
#define gmtime_mysql(T,B) gmtime((const time_t *)T)
#endif
/***********************************************************************/ /***********************************************************************/
/* GetGmTime: returns a pointer to a static tm structure obtained */ /* GetGmTime: returns a pointer to a static tm structure obtained */
...@@ -2489,6 +2493,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer) ...@@ -2489,6 +2493,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
return datm; return datm;
} // end of GetGmTime } // end of GetGmTime
#if defined(connect_EXPORTS)
// Added by Alexander Barkov // Added by Alexander Barkov
static time_t mktime_mysql(struct tm *ptm) static time_t mktime_mysql(struct tm *ptm)
{ {
...@@ -2499,6 +2504,9 @@ static time_t mktime_mysql(struct tm *ptm) ...@@ -2499,6 +2504,9 @@ static time_t mktime_mysql(struct tm *ptm)
time_t t= TIME_to_timestamp(current_thd, &ltime, &error_code); time_t t= TIME_to_timestamp(current_thd, &ltime, &error_code);
return error_code ? (time_t) -1 : t; return error_code ? (time_t) -1 : t;
} }
#else
#define mktime_mysql mktime
#endif
/***********************************************************************/ /***********************************************************************/
/* MakeTime: calculates a date value from a tm structures using the */ /* MakeTime: calculates a date value from a tm structures using the */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment