1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Empty registration of the MySQL statement and result set.

This commit is contained in:
Sandu Liviu Catalin 2016-06-03 22:25:06 +03:00
parent 525148ccd1
commit 201a6e0016
4 changed files with 51 additions and 1 deletions

View File

@ -44,7 +44,7 @@ CSStr Connection::ToString() const
ToStringF("%s:%s@%s:%u", m_Handle->mUser.c_str(), m_Handle->mPass.c_str(), ToStringF("%s:%s@%s:%u", m_Handle->mUser.c_str(), m_Handle->mPass.c_str(),
m_Handle->mHost.c_str(), m_Handle->mPort); m_Handle->mHost.c_str(), m_Handle->mPort);
} }
// Default to an epty string // Default to an empty string
return _SC(""); return _SC("");
} }

View File

@ -248,6 +248,32 @@ void RegisterAPI(HSQUIRRELVM vm)
.Func(_SC("Transaction"), &Connection::GetTransaction) .Func(_SC("Transaction"), &Connection::GetTransaction)
); );
sqlns.Bind(_SC("Statement"), Class< Statement >(vm, _SC("SqMySQLStatement"))
// Constructors
.Ctor()
// Core Meta-methods
.Func(_SC("_cmp"), &Statement::Cmp)
.SquirrelFunc(_SC("_typename"), &Statement::Typename)
.Func(_SC("_tostring"), &Statement::ToString)
// Properties
//.Prop(_SC("Connected"), &Statement::Connected)
// Member Methods
//.Func(_SC("Disconnect"), &Statement::Disconnect)
);
sqlns.Bind(_SC("ResultSet"), Class< ResultSet >(vm, _SC("SqMySQLResultSet"))
// Constructors
.Ctor()
// Core Meta-methods
.Func(_SC("_cmp"), &ResultSet::Cmp)
.SquirrelFunc(_SC("_typename"), &ResultSet::Typename)
.Func(_SC("_tostring"), &ResultSet::ToString)
// Properties
//.Prop(_SC("Connected"), &ResultSet::Connected)
// Member Methods
//.Func(_SC("Disconnect"), &ResultSet::Disconnect)
);
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -29,6 +29,18 @@ Int32 ResultSet::Cmp(const ResultSet & o) const
} }
} }
// ------------------------------------------------------------------------------------------------
CSStr ResultSet::ToString() const
{
// Do we have a valid handle?
if (m_Handle)
{
ToStrF("%u", m_Handle->mFieldCount);
}
// Default to an empty string
return _SC("");
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQInteger ResultSet::GetInt8(Uint32 idx) const SQInteger ResultSet::GetInt8(Uint32 idx) const
{ {

View File

@ -33,6 +33,18 @@ Int32 Statement::Cmp(const Statement & o) const
} }
} }
// ------------------------------------------------------------------------------------------------
CSStr Statement::ToString() const
{
// Do we have a valid handle?
if (m_Handle)
{
m_Handle->mQuery.c_str();
}
// Default to an empty string
return _SC("");
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Statement::Statement() Statement::Statement()
: m_Handle() : m_Handle()