summaryrefslogtreecommitdiff
path: root/libodbcpp/string.cpp
blob: d04e141b2a8b569ca48e34b53dbbfd9952e22a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdarg.h>
#include "string.h"

ODBC::String::String()
{
}
ODBC::String::String(std::basic_string<unsigned char> s) :
	std::basic_string<unsigned char>(s)
{
}
ODBC::String::String(std::basic_string<char> s) :
	std::basic_string<unsigned char>((unsigned char *)s.c_str())
{
}
ODBC::String::String(const char * s) :
	std::basic_string<unsigned char>((unsigned char *)s)
{
}
ODBC::String::String(const unsigned char * s) :
	std::basic_string<unsigned char>(s)
{
}

ODBC::String::operator unsigned char * () const
{
	return (unsigned char*)c_str();
}

ODBC::String
ODBC::String::Format(const char * fmt, ...)
{
	char * buf;
	va_list va;
	va_start(va, fmt);
	vasprintf(&buf, fmt, va);
	va_end(va);
	return buf;
}