[Tarantool-patches] [PATCH v3 15/20] sql: introduce sql_stmt_query_str() method

Sergey Ostanevich sergos at tarantool.org
Wed Dec 25 17:36:01 MSK 2019


Hi!

Tahnks for the patch, LGTM.

Sergos

On 20 Dec 15:47, Nikita Pettik wrote:
> It is getter to fetch string of SQL query from prepared statement.
> 
> Needed for #2592
> ---
>  src/box/execute.h     | 6 ++++++
>  src/box/sql/vdbeapi.c | 7 +++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/src/box/execute.h b/src/box/execute.h
> index 2dd4fca03..f3d6c38b3 100644
> --- a/src/box/execute.h
> +++ b/src/box/execute.h
> @@ -121,6 +121,12 @@ sql_stmt_finalize(struct sql_stmt *stmt);
>  size_t
>  sql_stmt_est_size(const struct sql_stmt *stmt);
>  
> +/**
> + * Return string of SQL query.
> + */
> +const char *
> +sql_stmt_query_str(const struct sql_stmt *stmt);
> +
>  /**
>   * Prepare (compile into VDBE byte-code) statement.
>   *
> diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
> index 2ac174112..7278d2ab3 100644
> --- a/src/box/sql/vdbeapi.c
> +++ b/src/box/sql/vdbeapi.c
> @@ -858,6 +858,13 @@ sql_stmt_est_size(const struct sql_stmt *stmt)
>  	return size;
>  }
>  
> +const char *
> +sql_stmt_query_str(const struct sql_stmt *stmt)
> +{
> +	const struct Vdbe *v = (const struct Vdbe *) stmt;
> +	return v->zSql;
> +}
> +
>  /******************************* sql_bind_  **************************
>   *
>   * Routines used to attach values to wildcards in a compiled SQL statement.
> -- 
> 2.15.1
> 


More information about the Tarantool-patches mailing list