~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.cc

  • Committer: Tim Penhey
  • Date: 2010-01-20 04:08:49 UTC
  • mto: (1271.2.7)
  • mto: This revision was merged to the branch mainline in revision 1275.
  • Revision ID: tim.penhey@canonical.com-20100120040849-k8cl44c0480kts34
Extracted the string conversion functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "drizzled/internal/my_sys.h"
21
21
#include "drizzled/internal/m_string.h"
22
22
#include "drizzled/charset.h"
 
23
#include "drizzled/global_charset_info.h"
23
24
 
24
25
#include <algorithm>
25
26
 
28
29
using namespace drizzled;
29
30
using namespace std;
30
31
 
 
32
 
 
33
// Converstion functions to and from std::string.
 
34
 
 
35
String std_string_to_String(std::string const& s)
 
36
{
 
37
   return String(s.c_str(), s.length(), system_charset_info);
 
38
}
 
39
 
 
40
std::string String_to_std_string(String const& s)
 
41
{
 
42
   return std::string(s.ptr(), s.length());
 
43
}
 
44
 
 
45
String* set_String_from_std_string(String* s, std::string const& cs)
 
46
{
 
47
   s->set_ascii(cs.c_str(), cs.length());
 
48
   return s;
 
49
}
 
50
 
31
51
/*****************************************************************************
32
52
** String functions
33
53
*****************************************************************************/