@@ -220,7 +220,7 @@ typedef struct mysqlx_client_struct mysqlx_client_t;
220
220
and can be manipulated using related functions.
221
221
222
222
@see mysqlx_get_session_from_options(), mysqlx_session_options_new(),
223
- mysqlx_session_option_set(), mysqlx_free_options ().
223
+ mysqlx_session_option_set(), mysqlx_free ().
224
224
*/
225
225
226
226
typedef struct mysqlx_session_options_struct mysqlx_session_options_t ;
@@ -267,6 +267,8 @@ typedef struct mysqlx_table_struct mysqlx_table_t;
267
267
268
268
typedef struct mysqlx_stmt_struct mysqlx_stmt_t ;
269
269
270
+ typedef struct Mysqlx_diag_base mysqlx_object_t ;
271
+
270
272
271
273
/**
272
274
Type of row handles.
@@ -515,24 +517,25 @@ mysqlx_lock_contention_t;
515
517
516
518
@param conn_string connection string
517
519
@param client_opts client options in the form of a JSON string.
518
- @param[out] out_error if error happens during connect the error message
519
- is returned through this parameter
520
- @param[out] err_code if error happens during connect the error code
520
+ @param[out] error if error happens during connect the error object
521
521
is returned through this parameter
522
522
523
523
@return client handle if client could be created, otherwise NULL
524
524
is returned and the error information is returned through
525
- the out_error and err_code output parameters .
525
+ the error output parameter .
526
526
527
527
@note The client returned by the function must be properly closed using
528
528
`mysqlx_client_close()`.
529
529
530
+ @note If an error object returned through the output parameter it must be
531
+ freed using `mysqlx_free()`.
532
+
530
533
@ingroup xapi_sess
531
534
*/
532
535
533
536
PUBLIC_API mysqlx_client_t *
534
537
mysqlx_get_client_from_url (const char * conn_string , const char * client_opts ,
535
- char out_error [ MYSQLX_MAX_ERROR_LEN ], int * err_code );
538
+ mysqlx_error_t * * error );
536
539
537
540
538
541
/**
@@ -568,25 +571,25 @@ mysqlx_get_client_from_url(http://github.com/const%20char%20*conn_string,%20const%20char%20*client_opts,%3C/div%3E%3C/code%3E%3C/div%3E%3C/td%3E%3C/tr%3E%3Ctr%20class=%22diff-line-row%22%3E%3Ctd%20data-grid-cell-id=%22diff-b6658fd3a7ff3e9e86a9e43cc349168f8a65baad705d5788511de6c9e6bd75cc-568-571-0%22%20data-selected=%22false%22%20role=%22gridcell%22%20style=%22background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">568
571
569
572
@param opt handle to client configuration data
570
573
@param client_opts client options in the form of a JSON string.
571
- @param[out] out_error if error happens during connect the error message
572
- is returned through this parameter
573
- @param[out] err_code if error happens during connect the error code
574
+ @param[out] error if error happens during connect the error object
574
575
is returned through this parameter
575
576
576
577
@return client handle if client could be created, otherwise NULL
577
578
is returned and the error information is returned through
578
- the out_error and err_code output parameters .
579
+ the error output parameter .
579
580
580
581
@note The client returned by the function must be properly closed using
581
582
`mysqlx_client_close()`.
582
583
584
+ @note If an error object returned through the output parameter it must be
585
+ freed using `mysqlx_free()`.
586
+
583
587
@ingroup xapi_sess
584
588
*/
585
589
586
590
PUBLIC_API mysqlx_client_t *
587
591
mysqlx_get_client_from_options (mysqlx_session_options_t * opt ,
588
- char out_error [MYSQLX_MAX_ERROR_LEN ],
589
- int * err_code );
592
+ mysqlx_error_t * * error );
590
593
591
594
/**
592
595
Close the client pool and all sessions created by them.
@@ -614,19 +617,16 @@ PUBLIC_API void mysqlx_client_close(mysqlx_client_t *client);
614
617
Create a new session
615
618
616
619
@param client client pool to get session from
617
- @param[out] out_error if error happens during getting the session handle from
618
- the pool, the error message is returned through this
619
- parameter
620
- @param[out] err_code if error happens during getting the session handle from
621
- the pool, the error code is returned through this
622
- parameter
620
+ @param[out] error if error happens during connect the error object
621
+ is returned through this parameter
623
622
623
+ @note If an error object returned through the output parameter it must be
624
+ freed using `mysqlx_free()`.
624
625
*/
625
626
626
627
PUBLIC_API mysqlx_session_t *
627
- mysqlx_get_session_from_client (mysqlx_client_t * client ,
628
- char out_error [MYSQLX_MAX_ERROR_LEN ],
629
- int * err_code );
628
+ mysqlx_get_session_from_client (mysqlx_client_t * cli ,
629
+ mysqlx_error_t * * error );
630
630
631
631
/**
632
632
Create a new session.
@@ -636,26 +636,26 @@ mysqlx_get_session_from_client(mysqlx_client_t *client,
636
636
@param user user name
637
637
@param password password
638
638
@param database default database name
639
- @param[out] out_error if error happens during connect the error message
640
- is returned through this parameter
641
- @param[out] err_code if error happens during connect the error code
639
+ @param[out] error if error happens during connect the error object
642
640
is returned through this parameter
643
641
644
642
@return session handle if session could be created, otherwise NULL
645
643
is returned and the error information is returned through
646
- the out_error and err_code output parameters .
644
+ output error parameter .
647
645
648
646
@note The session returned by the function must be properly closed using
649
647
`mysqlx_session_close()`.
650
648
@note This function always establishes connection with SSL enabled
649
+ @note If an error object returned through the output parameter it must be
650
+ freed using `mysqlx_free()`.
651
651
652
652
@ingroup xapi_sess
653
653
*/
654
654
655
655
PUBLIC_API mysqlx_session_t *
656
656
mysqlx_get_session (const char * host , int port , const char * user ,
657
- const char * password , const char * database ,
658
- char out_error [ MYSQLX_MAX_ERROR_LEN ], int * err_code );
657
+ const char * password , const char * database ,
658
+ mysqlx_error_t * * error );
659
659
660
660
661
661
/**
@@ -673,49 +673,48 @@ mysqlx_get_session(const char *host, int port, const char *user,
673
673
674
674
Specifying `ssl-ca` option implies `ssl-mode=VERIFY_CA`.
675
675
676
- @param conn_string connection string
677
- @param[out] out_error if error happens during connect the error message
678
- is returned through this parameter
679
- @param[out] err_code if error happens during connect the error code
680
- is returned through this parameter
676
+ @param conn_string connection string
677
+ @param[out] error if error happens during connect the error object
678
+ is returned through this parameter
681
679
682
680
@return session handle if session could be created, otherwise NULL
683
681
is returned and the error information is returned through
684
- the out_error and err_code output parameters .
682
+ the error output parameter .
685
683
686
684
@note The session returned by the function must be properly closed using
687
685
`mysqlx_session_close()`.
686
+ @note If an error object returned through the output parameter it must be
687
+ freed using `mysqlx_free()`.
688
688
689
689
@ingroup xapi_sess
690
690
*/
691
691
692
692
PUBLIC_API mysqlx_session_t *
693
693
mysqlx_get_session_from_url (const char * conn_string ,
694
- char out_error [MYSQLX_MAX_ERROR_LEN ], int * err_code );
695
-
694
+ mysqlx_error_t * * error );
696
695
697
696
/**
698
697
Create a session using session configuration data.
699
698
700
- @param opt handle to session configuration data
701
- @param[out] out_error if error happens during connect the error message
702
- is returned through this parameter
703
- @param[out] err_code if error happens during connect the error code
704
- is returned through this parameter
699
+ @param opt handle to session configuration data
700
+ @param[out] error if error happens during connect the error object
701
+ is returned through this parameter
705
702
706
703
@return session handle if session could be created, otherwise NULL
707
704
is returned and the error information is returned through
708
- the out_error and err_code output parameters .
705
+ the error output parameter .
709
706
710
707
@note The session returned by the function must be properly closed using
711
708
`mysqlx_session_close()`.
709
+ @note If an error object returned through the output parameter it must be
710
+ freed using `mysqlx_free()`.
712
711
713
712
@ingroup xapi_sess
714
713
*/
715
714
716
715
PUBLIC_API mysqlx_session_t *
717
716
mysqlx_get_session_from_options (mysqlx_session_options_t * opt ,
718
- char out_error [ MYSQLX_MAX_ERROR_LEN ], int * err_code );
717
+ mysqlx_error_t * * error );
719
718
720
719
721
720
@@ -1018,7 +1017,7 @@ mysqlx_rollback_to( mysqlx_session_t *sess, const char *name);
1018
1017
@return handle to the newly allocated configuration data
1019
1018
1020
1019
@note The allocated object must be eventually freed by
1021
- `mysqlx_free_options ()` to prevent memory leaks
1020
+ `mysqlx_free ()` to prevent memory leaks
1022
1021
1023
1022
@ingroup xapi_sess
1024
1023
*/
@@ -1032,6 +1031,8 @@ PUBLIC_API mysqlx_session_options_t * mysqlx_session_options_new();
1032
1031
@param opt handle to sessin configuartion data object
1033
1032
that has to be freed
1034
1033
1034
+ @note This function is DEPRECATED. Use `mysqlx_free()` instead.
1035
+
1035
1036
@ingroup xapi_sess
1036
1037
*/
1037
1038
@@ -2214,7 +2215,7 @@ PUBLIC_API int mysqlx_set_update_values(mysqlx_stmt_t *stmt, ...);
2214
2215
`mysqlx_free()`) or until another call to `mysqlx_execute()`
2215
2216
on the same statement handle is made. It is also possible to close
2216
2217
a result handle and free all resources used by it earlier with
2217
- `mysqlx_result_free ()` call.
2218
+ `mysqlx_free ()` call.
2218
2219
On error NULL is returned. The statement is set to an error state and
2219
2220
errors can be examined using the statement handle.
2220
2221
@@ -2491,17 +2492,28 @@ PUBLIC_API int
2491
2492
mysqlx_set_row_locking (mysqlx_stmt_t * stmt , int locking , int contention );
2492
2493
2493
2494
/**
2494
- Free the statement handle explicitly.
2495
+ Free the allocated handle explicitly.
2495
2496
2496
- @note Statement handles are also freed automatically when
2497
- statement's session is closed .
2497
+ After calling this function on a handle it becomes invalid and
2498
+ should not be used any more .
2498
2499
2499
- @param stmt statement handle
2500
+ @note Statement, result, schema, collection, table and some error
2501
+ handles are also freed automatically when the session is closed.
2502
+
2503
+ @note Only errors that originate from an already established session are
2504
+ freed automatically when that session is closed.
2505
+ Errors reported from one of the following functions when they
2506
+ fail to create a new session or a new client must be freed explicitly:
2507
+ `mysqlx_get_session()`, `mysqlx_get_session_from_url()`,
2508
+ `mysqlx_get_session_from_options()`, `mysqlx_get_session_from_client()`,
2509
+ `mysqlx_get_client_from_url()` and `mysqlx_get_client_from_options()`.
2510
+
2511
+ @param obj object handle
2500
2512
2501
2513
@ingroup xapi_stmt
2502
2514
*/
2503
2515
2504
- PUBLIC_API void mysqlx_free (mysqlx_stmt_t * stmt );
2516
+ PUBLIC_API void mysqlx_free (void * obj );
2505
2517
2506
2518
2507
2519
/*
@@ -2799,6 +2811,8 @@ mysqlx_get_double(mysqlx_row_t* row, uint32_t col, double *val);
2799
2811
/**
2800
2812
Free the result explicitly.
2801
2813
2814
+ @note This function is DEPRECATED. Use `mysqlx_free()` instead.
2815
+
2802
2816
@note Results are also freed automatically when the corresponding
2803
2817
statement handle is freed.
2804
2818
0 commit comments