added Cursor class
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1140 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include "dbconnector.h"
|
||||
#include "dbexpression.h"
|
||||
#include "model.h"
|
||||
@@ -75,36 +76,22 @@ void DbConnector::set_logger(PT::Logger & logger)
|
||||
|
||||
|
||||
|
||||
void DbConnector::clear_last_query_result()
|
||||
bool DbConnector::query(const PT::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
std::string query_str;
|
||||
stream.to_string(query_str);
|
||||
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
|
||||
bool DbConnector::query(const PT::TextStream & stream)
|
||||
bool DbConnector::query(const std::string & query_str, QueryResult & query_result)
|
||||
{
|
||||
return false;
|
||||
return query(query_str.c_str(), query_result);
|
||||
}
|
||||
|
||||
|
||||
//bool DbConnector::query(const std::wstring & query)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
bool DbConnector::query(const std::string & query_str)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//bool DbConnector::query(const wchar_t * query)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
bool DbConnector::query(const char * query_str)
|
||||
bool DbConnector::query(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
// do query
|
||||
return false;
|
||||
@@ -112,55 +99,48 @@ bool DbConnector::query(const char * query_str)
|
||||
|
||||
|
||||
|
||||
bool DbConnector::query_select(const PT::TextStream & stream)
|
||||
bool DbConnector::query_select(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
return false;
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_update(const PT::TextStream & stream)
|
||||
bool DbConnector::query_update(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
return false;
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_insert(const PT::TextStream & stream)
|
||||
bool DbConnector::query_insert(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
return false;
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_remove(const PT::TextStream & stream)
|
||||
bool DbConnector::query_remove(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t DbConnector::last_select_size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring DbConnector::get_last_query_error_msg()
|
||||
{
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
bool DbConnector::was_error_in_last_query()
|
||||
{
|
||||
return false;
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
|
||||
void DbConnector::set_current_row_at_beginning()
|
||||
|
||||
bool DbConnector::query_select(const PT::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
void DbConnector::advance_current_row()
|
||||
bool DbConnector::query_update(const PT::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_insert(const PT::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_remove(const PT::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
//void DbConnector::map_values_from_query(Model & model)
|
||||
//{
|
||||
// model.clear();
|
||||
//}
|
||||
|
||||
|
||||
DbExpression * DbConnector::get_expression()
|
||||
@@ -249,22 +229,28 @@ void DbConnector::generate_remove_query(PT::TextStream & stream, Model & model)
|
||||
|
||||
bool DbConnector::insert(PT::TextStream & stream, Model & model)
|
||||
{
|
||||
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
|
||||
|
||||
generate_insert_query(stream, model);
|
||||
return query_insert(stream);
|
||||
return query_insert(stream, *query_result_ptr);
|
||||
}
|
||||
|
||||
|
||||
bool DbConnector::update(PT::TextStream & stream, Model & model)
|
||||
{
|
||||
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
|
||||
|
||||
generate_update_query(stream, model);
|
||||
return query_update(stream);
|
||||
return query_update(stream, *query_result_ptr);
|
||||
}
|
||||
|
||||
|
||||
bool DbConnector::remove(PT::TextStream & stream, Model & model)
|
||||
{
|
||||
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
|
||||
|
||||
generate_remove_query(stream, model);
|
||||
return query_remove(stream);
|
||||
return query_remove(stream, *query_result_ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -288,15 +274,6 @@ void DbConnector::allocate_default_expression_if_needed()
|
||||
}
|
||||
}
|
||||
|
||||
const char * DbConnector::get_field_string_value(const char * field_name)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * DbConnector::get_field_string_value(const wchar_t * field_name)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user