diff options
| author | Hiroshi Inoue | 2020-05-18 10:53:48 +0000 |
|---|---|---|
| committer | Hiroshi Inoue | 2020-05-20 04:56:36 +0000 |
| commit | 26b30efd0cf93478be68218090435f995809e546 (patch) | |
| tree | 24444ce41cdfcc1b8ea116f03915610e99057e27 /statement.h | |
| parent | 241f4578ec878a0bd9cad3a6a539059860c18d14 (diff) | |
Improve execution of parameterized SQL statements with arrays of parameters by sending chunks of SQL statements.
If SQL_ATTR_CURSOR_TYPE of an statement is SQL_CURSOR_FORWARD_ONLY, SQL_ATTR_CONCURRENCY is SQL_CONCUR_READ_ONLY and extended protocol isn't used, the batch execution of the statement is possible.
A new option Batch Size was introduced for such cases.
Batch Size: Split an array (of parameters) into chunks of Batch Size to execute statements. The last chunk may contain less than Batch Size elements. Setting 1 to this option forces the current one by one execution.
Also turn off use_server_side_prepare option temporarily when batch executuion is possible.
Diffstat (limited to 'statement.h')
| -rw-r--r-- | statement.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/statement.h b/statement.h index 5abeca8..02f7ad5 100644 --- a/statement.h +++ b/statement.h @@ -12,6 +12,7 @@ #include "psqlodbc.h" #include <time.h> +#include "pqexpbuffer.h" #include "pgtypes.h" #include "bind.h" #include "descriptor.h" @@ -167,6 +168,12 @@ enum STMT_FETCH_NORMAL, STMT_FETCH_EXTENDED }; +/* Type of the 3rd parameter of Exec_with_parameters_resolved() */ +typedef enum { + DIRECT_EXEC, + DEFFERED_EXEC, + LAST_EXEC +} EXEC_TYPE; #define PG_NUM_NORMAL_KEYS 2 @@ -271,6 +278,7 @@ struct StatementClass_ po_ind_t join_info; /* have joins ? */ po_ind_t parse_method; /* parse_statement is forced or ? */ po_ind_t curr_param_result; /* current param result is set ? */ + po_ind_t has_notice; /* exec result contains notice messages ? */ pgNAME cursor_name; char *plan_name; @@ -291,6 +299,12 @@ struct StatementClass_ SQLLEN last_fetch_count_include_ommitted; time_t stmt_time; struct tm localtime; + // for batch execution + signed char use_server_side_prepare; + int batch_size; + EXEC_TYPE exec_type; + int count_of_deffered; + PQExpBufferData stmt_deffered; /* SQL_NEED_DATA Callback list */ StatementClass *execute_delegate; StatementClass *execute_parent; |
