修复部分问题
This commit is contained in:
@@ -92,9 +92,9 @@ module::select& module::select::limit(uint32 start, uint32 count)
|
||||
return *this;
|
||||
}
|
||||
|
||||
module::select& module::select::orderby(const std::string& field, int sort)
|
||||
module::select& module::select::orderby(const std::string& exp)
|
||||
{
|
||||
m_select->orderby(field,(ylib::sort)sort);
|
||||
m_select->orderby(exp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -235,9 +235,9 @@ module::update& module::update::limit(uint32 start, uint32 count)
|
||||
return *this;
|
||||
}
|
||||
|
||||
module::update& module::update::orderby(const std::string& field, int sort)
|
||||
module::update& module::update::orderby(const std::string& exp)
|
||||
{
|
||||
m_update->orderby(field,(ylib::sort)sort);
|
||||
m_update->orderby(exp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -418,9 +418,9 @@ module::delete_& module::delete_::limit(uint32 start, uint32 count)
|
||||
return *this;
|
||||
}
|
||||
|
||||
module::delete_& module::delete_::orderby(const std::string& field, int sort)
|
||||
module::delete_& module::delete_::orderby(const std::string& exp)
|
||||
{
|
||||
m_delete->orderby(field, (ylib::sort)sort);
|
||||
m_delete->orderby(exp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -453,9 +453,6 @@ void module::delete_::regist(sol::state* lua)
|
||||
|
||||
void module::mysql_regist(sol::state* lua)
|
||||
{
|
||||
(*lua)["DESC"] = ylib::sort::DESC;
|
||||
(*lua)["ASC"] = ylib::sort::ASC;
|
||||
|
||||
//lua->new_usertype<ylib::mysql::conn>("mysql_conn",
|
||||
// "clear", &ylib::mysql::conn::clear,
|
||||
// "close", &ylib::mysql::conn::close,
|
||||
@@ -569,10 +566,10 @@ uint32 module::mysql_result::field_count()
|
||||
std::string module::mysql_result::field_type(sol::object obj)
|
||||
{
|
||||
if (obj.is<int>() || obj.is<double>()) {
|
||||
m_result->field_type((uint32)obj.as<int>());
|
||||
return m_result->field_type((uint32)obj.as<int>());
|
||||
}
|
||||
else if (obj.is<std::string>()) {
|
||||
m_result->field_type((std::string)obj.as<std::string>());
|
||||
return m_result->field_type((std::string)obj.as<std::string>());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -610,7 +607,7 @@ sol::object module::mysql_result::get(sol::object obj, sol::this_state s)
|
||||
GET_VALUE(get_int32);
|
||||
}
|
||||
|
||||
else if (type == "varchar" || type == "char" || type == "text" || type == "datetime")
|
||||
else if (type == "varchar" || type == "char" || type == "text" || type == "datetime" || type == "date")
|
||||
{
|
||||
GET_VALUE(get_string);
|
||||
}
|
||||
@@ -643,6 +640,10 @@ sol::object module::mysql_result::get(sol::object obj, sol::this_state s)
|
||||
rd[i] = rb[i];
|
||||
return sol::make_object(s,rd);
|
||||
}
|
||||
else
|
||||
{
|
||||
GET_VALUE(get_string);
|
||||
}
|
||||
return sol::make_object(s, sol::nil);
|
||||
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace module
|
||||
module::select& field(sol::table table);
|
||||
module::select& page(uint32 page, uint32 count);
|
||||
module::select& limit(uint32 start, uint32 count);
|
||||
module::select& orderby(const std::string& field, int sort);
|
||||
module::select& orderby(const std::string& exp);
|
||||
void clear();
|
||||
std::shared_ptr<module::mysql_result> query();
|
||||
uint64 count();
|
||||
@@ -120,7 +120,7 @@ namespace module
|
||||
module::update& where_expression(const std::string& expression);
|
||||
module::update& page(uint32 page, uint32 count);
|
||||
module::update& limit(uint32 start, uint32 count);
|
||||
module::update& orderby(const std::string& field, int sort);
|
||||
module::update& orderby(const std::string& exp);
|
||||
uint64 exec();
|
||||
void clear();
|
||||
static void regist(sol::state* lua);
|
||||
@@ -158,7 +158,7 @@ namespace module
|
||||
module::delete_& where_expression(const std::string& expression);
|
||||
module::delete_& page(uint32 page, uint32 count);
|
||||
module::delete_& limit(uint32 start, uint32 count);
|
||||
module::delete_& orderby(const std::string& field, int sort);
|
||||
module::delete_& orderby(const std::string& exp);
|
||||
uint64 exec();
|
||||
void clear();
|
||||
static void regist(sol::state* lua);
|
||||
|
||||
@@ -102,14 +102,14 @@ function mysql_builder_delete:limit(start, count)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
设置排序
|
||||
@param field 字段名称
|
||||
@param sort 排序方式(升序或降序)
|
||||
@return 返回 mysql_builder_delete 对象自身,以便链式调用
|
||||
@param orderby 排序语句
|
||||
@return 返回 mysql_builder_select 对象自身,以便链式调用
|
||||
]]
|
||||
function mysql_builder_delete:orderby(field, sort)
|
||||
self.module:orderby(field, sort)
|
||||
function mysql_builder_delete:orderby(orderby)
|
||||
self.module:orderby(orderby)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -126,12 +126,11 @@ end
|
||||
|
||||
--[[
|
||||
设置排序
|
||||
@param field 字段名称
|
||||
@param sort 排序方式(升序或降序)
|
||||
@param orderby 排序语句
|
||||
@return 返回 mysql_builder_select 对象自身,以便链式调用
|
||||
]]
|
||||
function mysql_builder_select:orderby(field, sort)
|
||||
self.module:orderby(field, sort)
|
||||
function mysql_builder_select:orderby(orderby)
|
||||
self.module:orderby(orderby)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -169,15 +169,13 @@ end
|
||||
|
||||
--[[
|
||||
设置排序
|
||||
@param field 字段名称
|
||||
@param sort 排序方式(升序或降序)
|
||||
@return 返回 mysql_builder_update 对象自身,以便链式调用
|
||||
@param orderby 排序语句
|
||||
@return 返回 mysql_builder_select 对象自身,以便链式调用
|
||||
]]
|
||||
function mysql_builder_update:orderby(field, sort)
|
||||
self.module:orderby(field, sort)
|
||||
function mysql_builder_update:orderby(orderby)
|
||||
self.module:orderby(orderby)
|
||||
return self
|
||||
end
|
||||
|
||||
--[[
|
||||
执行更新操作
|
||||
@return 返回受影响的行数
|
||||
|
||||
@@ -19,7 +19,7 @@ function mysql_conn.new(__module)
|
||||
else
|
||||
instance.module = __module
|
||||
end
|
||||
|
||||
print("M:",instance.module)
|
||||
return instance
|
||||
end
|
||||
--[[
|
||||
@@ -65,7 +65,10 @@ end
|
||||
@param autocommit 是否自动提交
|
||||
]]
|
||||
function mysql_conn:begin(autocommit)
|
||||
self.module:begin(autocommit or false)
|
||||
if autocommit == nil then
|
||||
autocommit = false
|
||||
end
|
||||
self.module:begin(autocommit)
|
||||
end
|
||||
|
||||
--[[
|
||||
|
||||
Reference in New Issue
Block a user