summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-01-19 21:42:46 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-01-19 21:42:46 +0000
commit1c2911f5a1affb71f41cf68cb53292eb5901f295 (patch)
tree3d2b6ec3c7b9411ab8529c172387a75dfdd2d053 /res
parentfae3ba742186f65600ef035715da0056278300d9 (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: https://origsvn.digium.com/svn/asterisk/trunk@169438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_odbc.c17
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)
{