mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Implement the pure typename meta-methods in SQLite module types using the standard method.
This commit is contained in:
parent
568bc385e9
commit
873438d8e0
@ -9,6 +9,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqLiteColumn"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static inline bool IsDigitsOnly(CSStr str)
|
||||
{
|
||||
@ -20,14 +23,6 @@ static inline bool IsDigitsOnly(CSStr str)
|
||||
return *str == '\0';
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Column::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSQLiteColumn");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC)
|
||||
void Column::Validate(CCStr file, Int32 line) const
|
||||
@ -513,12 +508,12 @@ Object Column::GetBlob() const
|
||||
void Register_Column(Table & sqlns)
|
||||
{
|
||||
sqlns.Bind(_SC("Column"),
|
||||
Class< Column >(sqlns.GetVM(), _SC("SqSQLiteColumn"))
|
||||
Class< Column >(sqlns.GetVM(), Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< const Column & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &Column::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Column::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("IsValid"), &Column::IsValid)
|
||||
|
@ -218,11 +218,6 @@ public:
|
||||
return val ? val : _SC("");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* See whether the column is valid.
|
||||
*/
|
||||
|
@ -6,12 +6,7 @@
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Connection::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSQLiteConnection");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqLiteConnection"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Connection::TraceOutput(void * /*ptr*/, CCStr sql)
|
||||
@ -348,14 +343,14 @@ Int32 Connection::Flush(SQInteger num, Object & env, Function & func)
|
||||
void Register_Connection(Table & sqlns)
|
||||
{
|
||||
sqlns.Bind(_SC("Connection"),
|
||||
Class< Connection >(sqlns.GetVM(), _SC("SqSQLiteConnection"))
|
||||
Class< Connection >(sqlns.GetVM(), Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< const StackStrF & >()
|
||||
.Ctor< const StackStrF &, Int32 >()
|
||||
.Ctor< const StackStrF &, Int32, const StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &Connection::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Connection::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("IsValid"), &Connection::IsValid)
|
||||
|
@ -172,11 +172,6 @@ public:
|
||||
return m_Handle ? m_Handle->mName : NullString();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the associated connection handle.
|
||||
*/
|
||||
|
@ -14,6 +14,9 @@ namespace SqMod {
|
||||
// Error message when failed to bind value to parameter index.
|
||||
#define SQMOD_BINDFAILED "Unable to bind (%s) parameter (%d) because [%s]"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqLiteParameter"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static inline bool IsDigitsOnly(CSStr str)
|
||||
{
|
||||
@ -25,14 +28,6 @@ static inline bool IsDigitsOnly(CSStr str)
|
||||
return *str == '\0';
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Parameter::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSQLiteParameter");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC)
|
||||
void Parameter::Validate(CCStr file, Int32 line) const
|
||||
@ -734,12 +729,12 @@ void Parameter::SetNull()
|
||||
void Register_Parameter(Table & sqlns)
|
||||
{
|
||||
sqlns.Bind(_SC("Parameter"),
|
||||
Class< Parameter >(sqlns.GetVM(), _SC("SqSQLiteParameter"))
|
||||
Class< Parameter >(sqlns.GetVM(), Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< const Parameter & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &Parameter::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Parameter::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("IsValid"), &Parameter::IsValid)
|
||||
|
@ -212,11 +212,6 @@ public:
|
||||
return val ? val : _SC("");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* See whether this statement is valid.
|
||||
*/
|
||||
|
@ -10,12 +10,7 @@
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Statement::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSQLiteStatement");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqLiteStatement"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC)
|
||||
@ -426,13 +421,13 @@ Table Statement::GetTable(Int32 min, Int32 max) const
|
||||
void Register_Statement(Table & sqlns)
|
||||
{
|
||||
sqlns.Bind(_SC("Statement"),
|
||||
Class< Statement >(sqlns.GetVM(), _SC("SqSQLiteStatement"))
|
||||
Class< Statement >(sqlns.GetVM(), Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< const Statement & >()
|
||||
.FmtCtor< const Connection & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &Statement::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Statement::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("IsValid"), &Statement::IsValid)
|
||||
|
@ -178,11 +178,6 @@ public:
|
||||
return m_Handle ? m_Handle->mQuery : NullString();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the associated statement handle.
|
||||
*/
|
||||
|
@ -6,12 +6,7 @@
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Transaction::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSQLiteTransaction");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqLiteTransaction"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Transaction::Transaction(const Connection & db)
|
||||
@ -88,11 +83,11 @@ bool Transaction::Commit()
|
||||
void Register_Transaction(Table & sqlns)
|
||||
{
|
||||
sqlns.Bind(_SC("Transaction"),
|
||||
Class< Transaction, NoCopy< Transaction > >(sqlns.GetVM(), _SC("SqSQLiteTransaction"))
|
||||
Class< Transaction, NoCopy< Transaction > >(sqlns.GetVM(), Typename::Str)
|
||||
// Constructors
|
||||
.Ctor< const Connection & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &Transaction::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Transaction::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("IsValid"), &Transaction::IsValid)
|
||||
|
@ -57,11 +57,6 @@ public:
|
||||
return m_Handle ? m_Handle->mName : NullString();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the associated statement handle.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user