diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-19 21:42:46 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-19 21:42:46 +0000 |
commit | a343f7a275dd6cf3762cb42bdb7108fd7b0cfa07 (patch) | |
tree | 3d2b6ec3c7b9411ab8529c172387a75dfdd2d053 /res | |
parent | 1bd2376769465415348ca59d9995dd2250f852a7 (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@169438 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_odbc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c index 165cf872b..3a9b8eea6 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -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) { |