@@ -153,6 +153,8 @@ static PRESTOCLIENT* new_prestoclient()
153153 client -> port = PRESTOCLIENT_DEFAULT_PORT ;
154154 client -> catalog = NULL ;
155155 client -> user = NULL ;
156+ client -> timezone = NULL ;
157+ client -> language = NULL ;
156158 client -> results = NULL ;
157159 client -> active_results = 0 ;
158160
@@ -310,6 +312,8 @@ static unsigned int openuri(enum E_HTTP_REQUEST_TYPES in_request_type,
310312 const char * in_schema ,
311313 const char * in_useragent ,
312314 const char * in_user ,
315+ const char * in_timezone ,
316+ const char * in_language ,
313317 const unsigned long * in_buffersize ,
314318 PRESTOCLIENT_RESULT * result
315319 )
@@ -410,11 +414,13 @@ static unsigned int openuri(enum E_HTTP_REQUEST_TYPES in_request_type,
410414 }
411415
412416 // HTTP Headers
413- if (in_catalog ) add_headerline (& headers , "X-Presto-Catalog" , (char * )in_catalog );
414- add_headerline (& headers , "X-Presto-Source" , uasource );
415- if (in_schema ) add_headerline (& headers , "X-Presto-Schema" , (char * )in_schema );
416- if (in_useragent ) add_headerline (& headers , "User-Agent" , (char * )in_useragent );
417- if (in_user ) add_headerline (& headers , "X-Presto-User" , (char * )in_user );
417+ if (in_catalog ) add_headerline (& headers , "X-Presto-Catalog" , (char * )in_catalog );
418+ add_headerline (& headers , "X-Presto-Source" , uasource );
419+ if (in_schema ) add_headerline (& headers , "X-Presto-Schema" , (char * )in_schema );
420+ if (in_useragent ) add_headerline (& headers , "User-Agent" , (char * )in_useragent );
421+ if (in_user ) add_headerline (& headers , "X-Presto-User" , (char * )in_user );
422+ if (in_timezone ) add_headerline (& headers , "X-Presto-Time-Zone" , (char * )in_timezone );
423+ if (in_language ) add_headerline (& headers , "X-Presto-Language" , (char * )in_language );
418424
419425 // Set Writeback function and request body
420426 if (in_request_type == PRESTOCLIENT_HTTP_REQUEST_TYPE_POST || in_request_type == PRESTOCLIENT_HTTP_REQUEST_TYPE_GET )
@@ -505,6 +511,8 @@ static void cancel(PRESTOCLIENT_RESULT *result)
505511 result -> client -> useragent ,
506512 result -> client -> user ,
507513 NULL ,
514+ NULL ,
515+ NULL ,
508516 (void * )result );
509517 }
510518}
@@ -543,6 +551,8 @@ static bool prestoclient_queryisrunning(PRESTOCLIENT_RESULT *result)
543551 prestoclient -> useragent ,
544552 prestoclient -> user ,
545553 NULL ,
554+ NULL ,
555+ NULL ,
546556 (void * )result ) == PRESTOCLIENT_RESULT_OK )
547557 {
548558 // Determine client state
@@ -607,7 +617,8 @@ char* prestoclient_getversion()
607617}
608618
609619PRESTOCLIENT * prestoclient_init (const char * in_server , const unsigned int * in_port , const char * in_catalog ,
610- const char * in_user , const char * in_pwd )
620+ const char * in_user , const char * in_pwd , const char * in_timezone ,
621+ const char * in_language )
611622{
612623 PRESTOCLIENT * client = NULL ;
613624 char * uasource , * uaversion , * defaultcatalog ;
@@ -649,6 +660,12 @@ PRESTOCLIENT* prestoclient_init(const char *in_server, const unsigned int *in_po
649660 {
650661 client -> user = get_username ();
651662 }
663+
664+ if (in_timezone )
665+ alloc_copy (& client -> timezone , in_timezone );
666+
667+ if (in_language )
668+ alloc_copy (& client -> language , in_language );
652669 }
653670
654671 return client ;
@@ -672,6 +689,12 @@ void prestoclient_close(PRESTOCLIENT *prestoclient)
672689 if (prestoclient -> user )
673690 free (prestoclient -> user );
674691
692+ if (prestoclient -> timezone )
693+ free (prestoclient -> timezone );
694+
695+ if (prestoclient -> language )
696+ free (prestoclient -> language );
697+
675698 if (prestoclient -> results )
676699 {
677700 for (i = 0 ; i < prestoclient -> active_results ; i ++ )
@@ -741,6 +764,8 @@ PRESTOCLIENT_RESULT* prestoclient_query(PRESTOCLIENT *prestoclient, const char *
741764 in_schema ? in_schema : defschema ,
742765 prestoclient -> useragent ,
743766 prestoclient -> user ,
767+ prestoclient -> timezone ,
768+ prestoclient -> language ,
744769 & buffersize ,
745770 (void * )result ) == PRESTOCLIENT_RESULT_OK )
746771 {
@@ -840,6 +865,48 @@ char* prestoclient_getcolumntypedescription(PRESTOCLIENT_RESULT *result, const u
840865 break ;
841866 }
842867
868+ case PRESTOCLIENT_TYPE_DATE :
869+ {
870+ return "PRESTO_DATE" ;
871+ break ;
872+ }
873+
874+ case PRESTOCLIENT_TYPE_TIME :
875+ {
876+ return "PRESTO_TIME" ;
877+ break ;
878+ }
879+
880+ case PRESTOCLIENT_TYPE_TIME_WITH_TIME_ZONE :
881+ {
882+ return "PRESTO_TIME_WITH_TIME_ZONE" ;
883+ break ;
884+ }
885+
886+ case PRESTOCLIENT_TYPE_TIMESTAMP :
887+ {
888+ return "PRESTO_TIMESTAMP" ;
889+ break ;
890+ }
891+
892+ case PRESTOCLIENT_TYPE_TIMESTAMP_WITH_TIME_ZONE :
893+ {
894+ return "PRESTO_TIMESTAMP_WITH_TIME_ZONE" ;
895+ break ;
896+ }
897+
898+ case PRESTOCLIENT_TYPE_INTERVAL_YEAR_TO_MONTH :
899+ {
900+ return "PRESTO_INTERVAL_YEAR_TO_MONTH" ;
901+ break ;
902+ }
903+
904+ case PRESTOCLIENT_TYPE_INTERVAL_DAY_TO_SECOND :
905+ {
906+ return "PRESTO_INTERVAL_DAY_TO_SECOND" ;
907+ break ;
908+ }
909+
843910 default :
844911 {
845912 return "PRESTO_UNDEFINED" ;
0 commit comments