mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
ast_str_SQLGetData is *not* part of the ast_str API, it's part of the ast_odbc API and just happens to use an ast_str as the buffer; move all of it to res_odbc.c and res_odbc.h, renaming appropriately
along the way fix some minor coding style issues in strings.h and add some attribute_pure annotations to functions in the ast_str API git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -48,6 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/res_odbc.h"
|
||||
#include "asterisk/time.h"
|
||||
#include "asterisk/astobj2.h"
|
||||
#include "asterisk/strings.h"
|
||||
|
||||
struct odbc_class
|
||||
{
|
||||
@@ -366,6 +367,22 @@ int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt)
|
||||
return res;
|
||||
}
|
||||
|
||||
SQLRETURN ast_odbc_ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind)
|
||||
{
|
||||
SQLRETURN res;
|
||||
|
||||
if (pmaxlen == 0) {
|
||||
if (SQLGetData(StatementHandle, ColumnNumber, TargetType, ast_str_buffer(*buf), 0, StrLen_or_Ind) == SQL_SUCCESS_WITH_INFO) {
|
||||
ast_str_make_space(buf, *StrLen_or_Ind + 1);
|
||||
}
|
||||
} else if (pmaxlen > 0) {
|
||||
ast_str_make_space(buf, pmaxlen);
|
||||
}
|
||||
res = SQLGetData(StatementHandle, ColumnNumber, TargetType, ast_str_buffer(*buf), ast_str_size(*buf), StrLen_or_Ind);
|
||||
ast_str_update(*buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_odbc_sanity_check(struct odbc_obj *obj)
|
||||
{
|
||||
|
Reference in New Issue
Block a user