diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 9d6d0fc3044d06d16d0dc372e94e81a5e9d2b04e..22bc45bf1793565962577901777865a50d8d8208 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -296,7 +296,7 @@ static int connection_dead(struct odbc_obj *connection) * to callers in most cases. * * When finished with the returned structure, the caller must call - * \ref release_dsn + * \ref release_obj_or_dsn * * \param name Name of the DSN as found in res_odbc.conf * \retval NULL Unable to retrieve or create the DSN diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h index 789cabac2cfaaa5ca458693a670ef3b5c3a298c1..9827c812e11d630bcfd4c8b39cc7e74cf7182bd3 100644 --- a/include/asterisk/res_odbc.h +++ b/include/asterisk/res_odbc.h @@ -103,6 +103,7 @@ int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((d * * This is only around for backwards-compatibility with older versions of Asterisk. */ +#define ast_odbc_request_obj2(name, check) _ast_odbc_request_obj2(name, check, __FILE__, __PRETTY_FUNCTION__, __LINE__) struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags, const char *file, const char *function, int lineno); /*! @@ -116,11 +117,9 @@ struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags * \param check unused * \return A connection to the database. Call ast_odbc_release_obj() when finished. */ +#define ast_odbc_request_obj(name, check) _ast_odbc_request_obj(name, check, __FILE__, __PRETTY_FUNCTION__, __LINE__) struct odbc_obj *_ast_odbc_request_obj(const char *name, int check, const char *file, const char *function, int lineno); -#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define ast_odbc_request_obj(a, b) _ast_odbc_request_obj(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__) - /*! * \brief Releases an ODBC object previously allocated by ast_odbc_request_obj() * \param obj The ODBC object @@ -137,7 +136,8 @@ int ast_odbc_sanity_check(struct odbc_obj *obj); /*! \brief Checks if the database natively supports backslash as an escape character. * \param obj The ODBC object - * \return Returns 1 if backslash is a native escape character, 0 if an ESCAPE clause is needed to support '\' + * \retval 1 if backslash is a native escape character + * \retval 0 if an ESCAPE clause is needed to support '\' */ int ast_odbc_backslash_is_escape(struct odbc_obj *obj); @@ -146,7 +146,7 @@ int ast_odbc_backslash_is_escape(struct odbc_obj *obj); * \param obj The ODBC object * \param exec_cb A function callback, which, when called, should return a statement handle with result columns bound. * \param data A parameter to be passed to the exec_cb parameter function, indicating which statement handle is to be prepared. - * \retval a statement handle + * \return a statement handle * \retval NULL on error */ SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struct odbc_obj *obj, void *data), void *data); @@ -156,7 +156,7 @@ SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struc * \param obj The ODBC object * \param prepare_cb A function callback, which, when called, should return a statement handle prepared, with any necessary parameters or result columns bound. * \param data A parameter to be passed to the prepare_cb parameter function, indicating which statement handle is to be prepared. - * \retval a statement handle + * \return a statement handle * \retval NULL on error */ SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_cb)(struct odbc_obj *obj, void *data), void *data); @@ -165,13 +165,14 @@ SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_c * \brief Prepares a SQL query on a statement. * \param obj The ODBC object * \param stmt The statement - * \parma sql The SQL query + * \param sql The SQL query * \note This should be used in place of SQLPrepare */ int ast_odbc_prepare(struct odbc_obj *obj, SQLHSTMT *stmt, const char *sql); /*! \brief Execute a unprepared SQL query. * \param obj The ODBC object + * \param stmt The statement * \param sql The SQL query * \note This should be used in place of SQLExecDirect */ @@ -181,7 +182,8 @@ SQLRETURN ast_odbc_execute_sql(struct odbc_obj *obj, SQLHSTMT *stmt, const char * \brief Find or create an entry describing the table specified. * \param database Name of an ODBC class on which to query the table * \param tablename Tablename to describe - * \retval A structure describing the table layout, or NULL, if the table is not found or another error occurs. + * \return A structure describing the table layout. + * \retval NULL if the table is not found or another error occurs. * When a structure is returned, the contained columns list will be * rdlock'ed, to ensure that it will be retained in memory. The information * will be cached until a reload event or when ast_odbc_clear_cache() is called @@ -194,7 +196,7 @@ struct odbc_cache_tables *ast_odbc_find_table(const char *database, const char * * \brief Find a column entry within a cached table structure * \param table Cached table structure, as returned from ast_odbc_find_table() * \param colname The column name requested - * \retval A structure describing the column type, or NULL, if the column is not found. + * \return A structure describing the column type, or NULL, if the column is not found. * \since 1.6.1 */ struct odbc_cache_columns *ast_odbc_find_column(struct odbc_cache_tables *table, const char *colname); @@ -205,7 +207,8 @@ struct odbc_cache_columns *ast_odbc_find_column(struct odbc_cache_tables *table, * ast_odbc_find_table() API call. * \param database Name of an ODBC class (used to ensure like-named tables in different databases are not confused) * \param tablename Tablename for which a cached record should be removed - * \retval 0 if the cache entry was removed, or -1 if no matching entry was found. + * \retval 0 if the cache entry was removed. + * \retval -1 if no matching entry was found. * \since 1.6.1 */ int ast_odbc_clear_cache(const char *database, const char *tablename); diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index 0d4f767d347f1444191b8b9a8c33f188e35581c3..178a4837a9cba5784505488dbaa04d197ed83d2f 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -158,13 +158,13 @@ static SQLHSTMT custom_prepare(struct odbc_obj *obj, void *data) * \brief Execute an SQL query and return ast_variable list * \param database * \param table - * \param ap list containing one or more field/operator/value set. + * \param fields list containing one or more field/operator/value set. * * Select database and preform query on table, prepare the sql statement * Sub-in the values to the prepared statement and execute it. Return results * as a ast_variable list. * - * \retval var on success + * \return var on success * \retval NULL on failure */ static struct ast_variable *realtime_odbc(const char *database, const char *table, const struct ast_variable *fields) @@ -329,14 +329,14 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl * \brief Execute an Select query and return ast_config list * \param database * \param table - * \param ap list containing one or more field/operator/value set. + * \param fields list containing one or more field/operator/value set. * * Select database and preform query on table, prepare the sql statement * Sub-in the values to the prepared statement and execute it. * Execute this prepared query against several ODBC connected databases. * Return results as an ast_config variable. * - * \retval var on success + * \return var on success * \retval NULL on failure */ static struct ast_config *realtime_multi_odbc(const char *database, const char *table, const struct ast_variable *fields) @@ -504,13 +504,13 @@ next_sql_fetch:; * \param table * \param keyfield where clause field * \param lookup value of field for where clause - * \param ap list containing one or more field/value set(s). + * \param fields list containing one or more field/value set(s). * * Update a database table, prepare the sql statement using keyfield and lookup * control the number of records to change. All values to be changed are stored in ap list. * Sub-in the values to the prepared statement and execute it. * - * \retval number of rows affected + * \return number of rows affected * \retval -1 on failure */ static int update_odbc(const char *database, const char *table, const char *keyfield, const char *lookup, const struct ast_variable *fields) @@ -660,16 +660,15 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data) /*! * \brief Execute an UPDATE query - * \param database - * \param table - * \param ap list containing one or more field/value set(s). + * \param database, table, lookup_fields + * \param update_fields list containing one or more field/value set(s). * * Update a database table, preparing the sql statement from a list of * key/value pairs specified in ap. The lookup pairs are specified first * and are separated from the update pairs by a sentinel value. * Sub-in the values to the prepared statement and execute it. * - * \retval number of rows affected + * \return number of rows affected * \retval -1 on failure */ static int update2_odbc(const char *database, const char *table, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields) @@ -729,13 +728,13 @@ static int update2_odbc(const char *database, const char *table, const struct as * \brief Execute an INSERT query * \param database * \param table - * \param ap list containing one or more field/value set(s) + * \param fields list containing one or more field/value set(s) * * Insert a new record into database table, prepare the sql statement. * All values to be changed are stored in ap list. * Sub-in the values to the prepared statement and execute it. * - * \retval number of rows affected + * \return number of rows affected * \retval -1 on failure */ static int store_odbc(const char *database, const char *table, const struct ast_variable *fields) @@ -812,13 +811,13 @@ static int store_odbc(const char *database, const char *table, const struct ast_ * \param table * \param keyfield where clause field * \param lookup value of field for where clause - * \param ap list containing one or more field/value set(s) + * \param fields list containing one or more field/value set(s) * * Delete a row from a database table, prepare the sql statement using keyfield and lookup * control the number of records to change. Additional params to match rows are stored in ap list. * Sub-in the values to the prepared statement and execute it. * - * \retval number of rows affected + * \return number of rows affected * \retval -1 on failure */ static int destroy_odbc(const char *database, const char *table, const char *keyfield, const char *lookup, const struct ast_variable *fields) diff --git a/res/res_odbc.c b/res/res_odbc.c index 0dc812429f2c67f000a7b18227c3510084bf960b..7cc087460b66db2c548dca08de3de85d94c5da09 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -27,7 +27,7 @@ * \author Anthony Minessale II <anthmct@yahoo.com> * \author Tilghman Lesher <tilghman@digium.com> * - * \arg See also: \ref cdr_odbc + * \arg See also: \ref cdr_odbc.c */ /*! \li \ref res_odbc.c uses the configuration file \ref res_odbc.conf @@ -215,13 +215,6 @@ static void destroy_table_cache(struct odbc_cache_tables *table) } /*! - * \brief Find or create an entry describing the table specified. - * \param database Name of an ODBC class on which to query the table - * \param tablename Tablename to describe - * \retval A structure describing the table layout, or NULL, if the table is not found or another error occurs. - * When a structure is returned, the contained columns list will be - * rdlock'ed, to ensure that it will be retained in memory. - * * XXX This creates a connection and disconnects it. In some situations, the caller of * this function has its own connection and could donate it to this function instead of * needing to create another one. @@ -235,8 +228,6 @@ static void destroy_table_cache(struct odbc_cache_tables *table) * the need to cache tables is questionable. Instead, the table structure can be fetched from * the DB directly each time, resulting in a single owner of the data. * * Make odbc_cache_tables a refcounted object. - * - * \since 1.6.1 */ struct odbc_cache_tables *ast_odbc_find_table(const char *database, const char *tablename) {