implemented DB driver call DrvGetFieldUnbufferedUTF8 (for databases with native UTF...
[public/netxms.git] / src / db / libnxdb / main.cpp
CommitLineData
4cd1e46b
AK
1/*
2** NetXMS - Network Management System
3** Database Abstraction Library
2df047f4 4** Copyright (C) 2003-2016 Victor Kirhenshtein
4cd1e46b
AK
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU Lesser General Public License as published by
8** the Free Software Foundation; either version 3 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU Lesser General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19**
20** File: main.cpp
21**
22**/
23
24#include "libnxdb.h"
25
58f1f627
VK
26/**
27 * Write log
28 */
4cd1e46b
AK
29void __DBWriteLog(WORD level, const TCHAR *format, ...)
30{
31 TCHAR buffer[4096];
32 va_list args;
33
34 va_start(args, format);
35 _vsntprintf(buffer, 4096, format, args);
36 va_end(args);
37 nxlog_write(g_logMsgCode, level, "s", buffer);
38}
39
58f1f627
VK
40/**
41 * Set long running query threshold (milliseconds)
42 */
43void LIBNXDB_EXPORTABLE DBSetLongRunningThreshold(UINT32 threshold)
44{
45 g_sqlQueryExecTimeThreshold = threshold;
2df047f4 46 nxlog_debug(3, _T("DB Library: long running query threshold set to %u"), threshold);
58f1f627 47}
4cd1e46b
AK
48
49#ifdef _WIN32
50
58f1f627
VK
51/**
52 * DLL entry point
53 */
4cd1e46b
AK
54BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
55{
56 if (dwReason == DLL_PROCESS_ATTACH)
57 DisableThreadLibraryCalls(hInstance);
58 return TRUE;
59}
60
61#endif /* _WIN32 */