X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_sql.h;h=0fe4f4bcca3442cf5f5f8f5347c86448af17c32c;hb=c60652e38ac6afd74bd8225e9dae5406f13aaa4f;hp=3b123a94ab0d04756d77a4297f3b581ad597a54b;hpb=d944e22711dcc66d9eead206d0db62a593f24d31;p=vlc diff --git a/include/vlc_sql.h b/include/vlc_sql.h index 3b123a94ab..0fe4f4bcca 100644 --- a/include/vlc_sql.h +++ b/include/vlc_sql.h @@ -110,7 +110,7 @@ struct sql_t int (*pf_commit) ( sql_t* ); /** Rollback transaction */ - int (*pf_rollback) ( sql_t* ); + void (*pf_rollback) ( sql_t* ); /** Create a statement object */ sql_stmt_t* (*pf_prepare) ( sql_t* p_sql, const char* p_fmt, @@ -136,6 +136,9 @@ struct sql_t /** Get the data from a specified column */ int (*pf_getcolumn) ( sql_t* p_sql, sql_stmt_t* p_stmt, int i_col, int type, sql_value_t *p_res ); + + /** Get column size of a specified column */ + int (*pf_getcolumnsize) ( sql_t* p_sql, sql_stmt_t* p_stmt, int i_col ); }; /***************************************************************************** @@ -295,9 +298,9 @@ static inline int sql_CommitTransaction( sql_t *p_sql ) * @return VLC error code or success * @note This function is threadsafe **/ -static inline int sql_RollbackTransaction( sql_t *p_sql ) +static inline void sql_RollbackTransaction( sql_t *p_sql ) { - return p_sql->pf_rollback( p_sql ); + p_sql->pf_rollback( p_sql ); } /** @@ -557,6 +560,19 @@ static inline int sql_GetColumnBlob( sql_t* p_sql, sql_stmt_t* p_stmt, return i_ret; } +/** + * @brief Get the size of the column in bytes + * @param p_sql The SQL object + * @param p_stmt The sql statement object + * @param i_col The column + * @return Size of the column in bytes, excluding the zero terminator + */ +static inline int sql_GetColumnSize( sql_t* p_sql, sql_stmt_t* p_stmt, + int i_col ) +{ + return p_sql->pf_getcolumnsize( p_sql, p_stmt, i_col ); +} + # ifdef __cplusplus } # endif /* C++ extern "C" */