mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-24 02:27:46 +00:00
Removing some unused sql functions
This commit is contained in:
parent
0eeeb020eb
commit
350fc84947
5 changed files with 16 additions and 60 deletions
|
@ -116,7 +116,7 @@ bool Database::initialize( const DatabaseParams& params )
|
||||||
|
|
||||||
uint64_t Database::getNextUId()
|
uint64_t Database::getNextUId()
|
||||||
{
|
{
|
||||||
execute( "INSERT INTO uniqueiddata( IdName ) VALUES( 'NOT_SET' );" );
|
execute( std::string( "INSERT INTO uniqueiddata( IdName ) VALUES( 'NOT_SET' );" ) );
|
||||||
auto res = query( "SELECT LAST_INSERT_ID();" );
|
auto res = query( "SELECT LAST_INSERT_ID();" );
|
||||||
|
|
||||||
if( !res )
|
if( !res )
|
||||||
|
@ -193,53 +193,11 @@ QueryResult * Database::fQuery( const char * QueryString, DatabaseConnection * c
|
||||||
return qResult;
|
return qResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::fWaitExecute( const char * QueryString, DatabaseConnection * con )
|
|
||||||
{
|
|
||||||
// Send the query
|
|
||||||
_SendQuery( con, QueryString, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Database::execute( const char* QueryString, ... ) {
|
|
||||||
char query[16384];
|
|
||||||
|
|
||||||
va_list vlist;
|
|
||||||
va_start( vlist, QueryString );
|
|
||||||
vsnprintf( query, 16384, QueryString, vlist );
|
|
||||||
va_end( vlist );
|
|
||||||
|
|
||||||
|
|
||||||
return waitExecuteNA( query );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Database::execute( const std::string& QueryString )
|
bool Database::execute( const std::string& QueryString )
|
||||||
{
|
{
|
||||||
return waitExecuteNA( QueryString.c_str() );
|
return waitExecuteNA( QueryString.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::executeNA( const char* QueryString )
|
|
||||||
{
|
|
||||||
|
|
||||||
return waitExecuteNA( QueryString );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//this will wait for completion
|
|
||||||
bool Database::waitExecute( const char* QueryString, ... )
|
|
||||||
{
|
|
||||||
char sql[16384];
|
|
||||||
va_list vlist;
|
|
||||||
va_start( vlist, QueryString );
|
|
||||||
vsnprintf( sql, 16384, QueryString, vlist );
|
|
||||||
va_end( vlist );
|
|
||||||
|
|
||||||
DatabaseConnection * con = getFreeConnection();
|
|
||||||
bool Result = _SendQuery( con, sql, false );
|
|
||||||
con->lock.unlock();
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Database::waitExecuteNA( const char* QueryString )
|
bool Database::waitExecuteNA( const char* QueryString )
|
||||||
{
|
{
|
||||||
DatabaseConnection * con = getFreeConnection();
|
DatabaseConnection * con = getFreeConnection();
|
||||||
|
@ -301,7 +259,6 @@ std::string Database::escapeString( const char * esc, DatabaseConnection * con )
|
||||||
|
|
||||||
bool Database::_SendQuery( DatabaseConnection *con, const char* Sql, bool Self )
|
bool Database::_SendQuery( DatabaseConnection *con, const char* Sql, bool Self )
|
||||||
{
|
{
|
||||||
//dunno what it does ...leaving untouched
|
|
||||||
int32_t result = mysql_query( con->conn, Sql );
|
int32_t result = mysql_query( con->conn, Sql );
|
||||||
if( result > 0 )
|
if( result > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,11 +99,11 @@ bool Core::Network::SapphireAPI::createAccount( const std::string& username, con
|
||||||
int32_t accountId = pQR->fetch()[0].getUInt32() + 1;
|
int32_t accountId = pQR->fetch()[0].getUInt32() + 1;
|
||||||
|
|
||||||
// store the account to the db
|
// store the account to the db
|
||||||
g_database.execute( "INSERT INTO accounts (account_Id, account_name, account_pass, account_created) VALUE(%i, '%s', '%s', %i);",
|
g_database.execute( "INSERT INTO accounts (account_Id, account_name, account_pass, account_created) VALUE( " +
|
||||||
accountId,
|
std::to_string( accountId ) + ", '" +
|
||||||
username.c_str(),
|
username + "', '" +
|
||||||
pass.c_str(),
|
pass + "', " +
|
||||||
time( NULL ) );
|
std::to_string( time( nullptr ) ) + ");");
|
||||||
|
|
||||||
|
|
||||||
if( !login( username, pass, sId ) )
|
if( !login( username, pass, sId ) )
|
||||||
|
@ -305,4 +305,4 @@ bool Core::Network::SapphireAPI::removeSession( const std::string& sId )
|
||||||
m_sessionMap.erase( sId );
|
m_sessionMap.erase( sId );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
updateCharaInfoSearch += entry + ", ";
|
updateCharaInfoSearch += entry + ", ";
|
||||||
|
|
||||||
updateCharaInfoSearch += condition;
|
updateCharaInfoSearch += condition;
|
||||||
g_database.execute( updateCharaInfoSearch.c_str() );
|
g_database.execute( updateCharaInfoSearch );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !charaBaseSet.empty() )
|
if( !charaBaseSet.empty() )
|
||||||
|
@ -413,7 +413,7 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
updateCharaBase += entry + ", ";
|
updateCharaBase += entry + ", ";
|
||||||
|
|
||||||
updateCharaBase += condition;
|
updateCharaBase += condition;
|
||||||
g_database.execute( updateCharaBase.c_str() );
|
g_database.execute( updateCharaBase );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !charaDetailSet.empty() )
|
if( !charaDetailSet.empty() )
|
||||||
|
@ -422,7 +422,7 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
updateCharaDetail += entry + ", ";
|
updateCharaDetail += entry + ", ";
|
||||||
|
|
||||||
updateCharaDetail += condition;
|
updateCharaDetail += condition;
|
||||||
g_database.execute( updateCharaDetail.c_str() );
|
g_database.execute( updateCharaDetail );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !charaClassSet.empty() )
|
if( !charaClassSet.empty() )
|
||||||
|
@ -431,7 +431,7 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
updateCharaClass += entry + ", ";
|
updateCharaClass += entry + ", ";
|
||||||
|
|
||||||
updateCharaClass += condition;
|
updateCharaClass += condition;
|
||||||
g_database.execute( updateCharaClass.c_str() );
|
g_database.execute( updateCharaClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !charaQuestSet.empty() )
|
if( !charaQuestSet.empty() )
|
||||||
|
@ -440,7 +440,7 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
updateCharaQuest += entry + ", ";
|
updateCharaQuest += entry + ", ";
|
||||||
|
|
||||||
updateCharaQuest += condition;
|
updateCharaQuest += condition;
|
||||||
g_database.execute( updateCharaQuest.c_str() );
|
g_database.execute( updateCharaQuest );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateFlags = PlayerSyncFlags::None;
|
m_updateFlags = PlayerSyncFlags::None;
|
||||||
|
|
|
@ -237,8 +237,8 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
||||||
"', '" + std::to_string( map_id ) +
|
"', '" + std::to_string( map_id ) +
|
||||||
"', '" + std::to_string( discover_id ) + "')";
|
"', '" + std::to_string( discover_id ) + "')";
|
||||||
|
|
||||||
g_database.execute( query1.c_str() );
|
g_database.execute( query1 );
|
||||||
g_database.execute( query2.c_str() );
|
g_database.execute( query2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,8 @@ void Core::ItemContainer::removeItem( uint8_t slotId )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
g_database.execute( "DELETE FROM charaglobalitem " \
|
g_database.execute( "DELETE FROM charaglobalitem WHERE itemId = " +
|
||||||
"WHERE itemId = %i ",
|
std::to_string( it->second->getUId() ) );
|
||||||
it->second->getUId() );
|
|
||||||
|
|
||||||
m_itemMap.erase( it );
|
m_itemMap.erase( it );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue