mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-19 16:47:14 +02:00
Expand the host plug-in API and not just the Squirrel API.
Extend the host plug-in API with a few more date/time functions. Update some of the plugins to use the expanded functions of the host plug-in API.
This commit is contained in:
@ -195,7 +195,7 @@ Object Column::GetValue() const
|
||||
// Retrieve the the actual blob data that must be returned
|
||||
CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, m_Index));
|
||||
// Attempt to create a buffer with the blob data on the stack
|
||||
if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
{
|
||||
STHROWF("Unable to allocate buffer of at least (%d) bytes", size);
|
||||
}
|
||||
@ -325,7 +325,7 @@ Object Column::GetBuffer() const
|
||||
// Retrieve the the actual blob data that must be returned
|
||||
CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, m_Index));
|
||||
// Attempt to create a buffer with the blob data on the stack
|
||||
if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
{
|
||||
STHROWF("Unable to allocate buffer of at least (%d) bytes", size);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ Object GetMemoryUsage()
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(_SqVM);
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushSLongObject(_SqVM, sqlite3_memory_used());
|
||||
SqMod_PushSLongObject(_SqVM, sqlite3_memory_used());
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(_SqVM, -1).value;
|
||||
}
|
||||
@ -82,7 +82,7 @@ Object GetMemoryHighwaterMark(bool reset)
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(_SqVM);
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushSLongObject(_SqVM, sqlite3_memory_highwater(reset));
|
||||
SqMod_PushSLongObject(_SqVM, sqlite3_memory_highwater(reset));
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(_SqVM, -1).value;
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ SQInteger Connection::Typename(HSQUIRRELVM vm)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Connection::TraceOutput(void * /*ptr*/, CCStr sql)
|
||||
{
|
||||
_SqMod->LogInf("SQLite Trace: %s", sql);
|
||||
SqMod_LogInf("SQLite Trace: %s", sql);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Connection::ProfileOutput(void * /*ptr*/, CCStr sql, sqlite3_uint64 time)
|
||||
{
|
||||
_SqMod->LogInf("SQLite profile (time: %llu): %s", time, sql);
|
||||
SqMod_LogInf("SQLite profile (time: %llu): %s", time, sql);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -31,7 +31,7 @@ ConnHnd::~ConnHnd()
|
||||
// Attempt to close the database
|
||||
if ((sqlite3_close(mPtr)) != SQLITE_OK)
|
||||
{
|
||||
_SqMod->LogErr("Unable to close SQLite connection [%s]", sqlite3_errmsg(mPtr));
|
||||
SqMod_LogErr("Unable to close SQLite connection [%s]", sqlite3_errmsg(mPtr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,15 +127,15 @@ Int32 ConnHnd::Flush(Uint32 num, Object & env, Function & func)
|
||||
}
|
||||
catch (const Sqrat::Exception & e)
|
||||
{
|
||||
_SqMod->LogErr("Squirrel error caught in flush handler [%s]", e.Message().c_str());
|
||||
SqMod_LogErr("Squirrel error caught in flush handler [%s]", e.Message().c_str());
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
_SqMod->LogErr("Program error caught in flush handler [%s]", e.what());
|
||||
SqMod_LogErr("Program error caught in flush handler [%s]", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
_SqMod->LogErr("Unknown error caught in flush handler");
|
||||
SqMod_LogErr("Unknown error caught in flush handler");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ StmtHnd::~StmtHnd()
|
||||
// Attempt to finalize the statement
|
||||
if ((sqlite3_finalize(mPtr)) != SQLITE_OK)
|
||||
{
|
||||
_SqMod->LogErr("Unable to finalize SQLite statement [%s]", mConn->ErrMsg());
|
||||
SqMod_LogErr("Unable to finalize SQLite statement [%s]", mConn->ErrMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,10 @@ void OnSquirrelInitialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Expand the Squirrel plug-in API into global functions
|
||||
sqmod_api_expand(_SqMod);
|
||||
// Obtain the Squirrel API
|
||||
_SqAPI = _SqMod->GetSquirrelAPI();
|
||||
_SqAPI = SqMod_GetSquirrelAPI();
|
||||
// Expand the Squirrel API into global functions
|
||||
sq_api_expand(_SqAPI);
|
||||
}
|
||||
@ -55,7 +57,7 @@ void OnSquirrelLoad()
|
||||
return; // Unable to proceed!
|
||||
}
|
||||
// Obtain the Squirrel API and VM
|
||||
_SqVM = _SqMod->GetSquirrelVM();
|
||||
_SqVM = SqMod_GetSquirrelVM();
|
||||
// Make sure that a valid virtual machine exists
|
||||
if (!_SqVM)
|
||||
{
|
||||
|
@ -756,7 +756,7 @@ Object Statement::FetchColumnIndex(Int32 idx) const
|
||||
// Retrieve the the actual blob data that must be returned
|
||||
CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx));
|
||||
// Attempt to create a buffer with the blob data on the stack
|
||||
if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
{
|
||||
STHROWF("Unable to allocate buffer of at least (%d) bytes", size);
|
||||
}
|
||||
@ -874,7 +874,7 @@ Array Statement::FetchArray(Int32 min, Int32 max) const
|
||||
// Retrieve the the actual blob data that must be returned
|
||||
CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx));
|
||||
// Attempt to create a buffer with the blob data on the stack
|
||||
if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
{
|
||||
STHROWF("Unable to allocate buffer of at least (%d) bytes", size);
|
||||
}
|
||||
@ -981,7 +981,7 @@ Table Statement::FetchTable(Int32 min, Int32 max) const
|
||||
// Retrieve the the actual blob data that must be returned
|
||||
CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx));
|
||||
// Attempt to create a buffer with the blob data on the stack
|
||||
if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size)))
|
||||
{
|
||||
STHROWF("Unable to allocate buffer of at least (%d) bytes", size);
|
||||
}
|
||||
|
Reference in New Issue
Block a user