implemented DB driver call DrvGetFieldUnbufferedUTF8 (for databases with native UTF...
[public/netxms.git] / src / db / dbdrv / sqlite / sqlite.cpp
index bb34031..b28a39f 100644 (file)
@@ -700,6 +700,27 @@ extern "C" WCHAR EXPORT *DrvGetFieldUnbuffered(SQLITE_UNBUFFERED_RESULT *result,
    return pwszRet;
 }
 
    return pwszRet;
 }
 
+/**
+ * Get field from current row in unbuffered query result as UTF-8 string
+ */
+extern "C" char EXPORT *DrvGetFieldUnbufferedUTF8(SQLITE_UNBUFFERED_RESULT *result, int iColumn, char *pBuffer, int iBufSize)
+{
+   char *pszData;
+   char *value = NULL;
+
+   if ((iColumn >= 0) && (iColumn < result->numColumns))
+   {
+      pszData = (char *)sqlite3_column_text(result->stmt, iColumn);
+      if (pszData != NULL)
+      {
+         strncpy(pBuffer, pszData, iBufSize);
+         pBuffer[iBufSize - 1] = 0;
+         value = pBuffer;
+      }
+   }
+   return value;
+}
+
 /**
  * Get column count in async query result
  */
 /**
  * Get column count in async query result
  */