Property changes on: dba/test/querytest.h
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
|
|
| | 1 | // |
| | 2 | // C++ Implementation: querytest |
| | 3 | // |
| | 4 | // Description: |
| | 5 | // |
| | 6 | // |
| | 7 | // Author: Lukasz Michalski <lm@zork.pl>, (C) 2008 |
| | 8 | // |
| | 9 | // Copyright: See COPYING file that comes with this distribution |
| | 10 | // |
| | 11 | // |
| | 12 | #include "querytest.h" |
| | 13 | #include "dba/query.h" |
| | 14 | #include <iostream> |
| | 15 | |
| | 16 | namespace dba_tests { |
| | 17 | |
| | 18 | CPPUNIT_TEST_SUITE_REGISTRATION(QueryTest); |
| | 19 | |
| | 20 | class A { |
| | 21 | public: |
| | 22 | void operator<<(const char* pArg) { |
| | 23 | std::cout << pArg << std::endl; |
| | 24 | }; |
| | 25 | }; |
| | 26 | |
| | 27 | class B { |
| | 28 | }; |
| | 29 | |
| | 30 | void |
| | 31 | into(const char* t) { |
| | 32 | std::cout << "into " << t << std::endl; |
| | 33 | }; |
| | 34 | |
| | 35 | void |
| | 36 | QueryTest::type_string() { |
| | 37 | /* dba::Query q; |
| | 38 | int val = 4; |
| | 39 | q << "INSERT INTO test_tbl VALUES" << val; |
| | 40 | CPPUNIT_ASSERT(q == "SELECT somefield FROM sometable");*/ |
| | 41 | A a; |
| | 42 | B b; |
| | 43 | a << "avs",into("b"); |
| | 44 | |
| | 45 | dba::Query q("INSERT into t(a,b) values %d, %s"); |
| | 46 | q << MyFilter(a) << MyFilter(b); |
| | 47 | |
| | 48 | dba::DbResult* res = stream.sendQuery("SELECT a FROM t"); |
| | 49 | while(res->fetchRow()) |
| | 50 | res->getCustom(new MyFilter(a),1); |
| | 51 | |
| | 52 | }; |
| | 53 | |
| | 54 | } //namespace |
Property changes on: dba/test/querytest.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
|
|
| | 1 | // |
| | 2 | // C++ Implementation: query |
| | 3 | // |
| | 4 | // Description: |
| | 5 | // |
| | 6 | // |
| | 7 | // Author: Lukasz Michalski <lm@zork.pl>, (C) 2008 |
| | 8 | // |
| | 9 | // Copyright: See COPYING file that comes with this distribution |
| | 10 | // |
| | 11 | // |
| | 12 | #include "query.h" |
| | 13 | |
| | 14 | namespace dba { |
| | 15 | |
| | 16 | Query::Query() |
| | 17 | : std::string() |
| | 18 | { |
| | 19 | } |
| | 20 | |
| | 21 | Query::Query(const char* pTemplate) |
| | 22 | : std::string(pTemplate) |
| | 23 | {}; |
| | 24 | |
| | 25 | Query::~Query() |
| | 26 | { |
| | 27 | } |
| | 28 | |
| | 29 | } //namespace |
Property changes on: dba/dba/query.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
|
|
| | 1 | // |
| | 2 | // C++ Interface: query |
| | 3 | // |
| | 4 | // Description: |
| | 5 | // |
| | 6 | // |
| | 7 | // Author: Lukasz Michalski <lm@zork.pl>, (C) 2008 |
| | 8 | // |
| | 9 | // Copyright: See COPYING file that comes with this distribution |
| | 10 | // |
| | 11 | // |
| | 12 | #ifndef DBAQUERY_H |
| | 13 | #define DBAQUERY_H |
| | 14 | |
| | 15 | #include <string> |
| | 16 | |
| | 17 | namespace dba { |
| | 18 | |
| | 19 | /** |
| | 20 | Helper class for simple query construction |
| | 21 | |
| | 22 | @author Lukasz Michalski <lm@zork.pl> |
| | 23 | */ |
| | 24 | class Query : public std::string { |
| | 25 | public: |
| | 26 | Query(); |
| | 27 | Query(const char* pTemplate); |
| | 28 | ~Query(); |
| | 29 | }; |
| | 30 | |
| | 31 | } //namespace |
| | 32 | |
| | 33 | #endif |