DSL
DB_Common.cpp
1 //@AUTOHEADER@BEGIN@
2 /***********************************************************************\
3 | Drift Standard Libraries v1.01 |
4 | Copyright 2010-2023 Drift Solutions / Indy Sams |
5 | Docs and more information available at https://www.driftsolutions.dev |
6 | This file released under the 3-clause BSD license, |
7 | see included DSL.LICENSE.TXT file for details. |
8 \***********************************************************************/
9 //@AUTOHEADER@END@
10 
11 #include <drift/dslcore.h>
12 #include <drift/DB_Common.h>
13 
14 SC_Row::SC_Row() {
15  NumFields = 0;
16 }
17 
18 SC_Row::~SC_Row() {
19  Reset();
20 }
21 
22 void SC_Row::Reset() {
23  Values.clear();
24  NumFields = 0;
25 }
26 
27 string SC_Row::Get(const string& fieldname, const string& sDefault) const {
28  auto x = Values.find(fieldname);
29  if (x != Values.end()) {
30  return x->second;
31  }
32  return sDefault;
33 }
34 
35 SQLConxMulti::~SQLConxMulti() {
36  queries.clear();
37 }
38 
39 void SQLConxMulti::Query(const string& query) {
40  queries.push_back(query + ";");
41 }
42 
43 size_t SQLConxMulti::Count() {
44  return queries.size();
45 }
46 
47 void SQLConx::SetOutput(sql_printf_type pprintf) {
48  sql_printf = (pprintf != NULL) ? pprintf : printf;
49 }