mysql_format is returning empty string
#1

My code is returning an empty string when being called.

Код:
[20:09:37] Saving business 0
[20:09:37] (null)
PHP код:
stock SaveBusiness(i)
{
    new 
string[512];
    
printf("Saving business %d"i);
    
mysql_format(connstringsizeof(string), "UPDATE `business` SET \
        `EntranceX` = %f, \
        `EntranceY` = %f, \
        `EntranceZ` = %f, \
        `EntranceR` = %f, \
        `EntranceInt` = %d, \
        `EntranceVW` = %d, \
        `ExitX` = %f, \
        `ExitY` = %f, \
        `ExitZ` = %f, \
        `ExitR` = %f, \
        `ExitInt` = %d, \
        `ExitVW` = %d, \
        `Enterable` = %d, \
        `Value` = %d, \
        `EntranceCost` = %d, \
        `Till` = %d, \
        `Type` = %d, \
        `Stock` = %d \
        WHERE `BusinessID` = %d"
, \
        
BusinessData[i][bEntranceX],
        
BusinessData[i][bEntranceY],
        
BusinessData[i][bEntranceZ],
        
BusinessData[i][bEntranceR],
        
BusinessData[i][bEntranceInt],
        
BusinessData[i][bEntranceVW],
        
BusinessData[i][bExitX],
        
BusinessData[i][bExitY],
        
BusinessData[i][bExitZ],
        
BusinessData[i][bExitR],
        
BusinessData[i][bExitInt],
        
BusinessData[i][bEnterable],
        
BusinessData[i][bValue],
        
BusinessData[i][bEntranceCost],
        
BusinessData[i][bTill],
        
BusinessData[i][bType],
        
BusinessData[i][bStock],
        
i+1);
    
mysql_tquery(connstring);
    print(string); 
// [20:09:37] (null)

It isn't doing this anywhere else, just when this piece of code is being called.
Reply
#2

Where / how are you using SaveBusiness?
Reply
#3

I'm using this every time a business has been modified and on every server restart / exit

- Sent from iPhone.
Reply
#4

Which plugin version? <= R39 or >= R40?
Reply
#5

R40+. The latest release. I updated today to see if that would fix the problem but to no avail.

- Sent from iPhone.
Reply
#6

Ok, now what's in your mysql_log? If nothing, please enable logging all levels and then share contents of the log.
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Ok, now what's in your mysql_log? If nothing, please enable logging all levels and then share contents of the log.
Heres the logs:

errors.log
Код:
[13:52:10] [plugins/mysql] mysql_format: no value for specifier '%d' passed
[13:52:10] [plugins/mysql] error #1065 while executing query "": Query was empty
warnings.log
Код:
[13:48:51] [plugins/mysql] mysql_connect: no password specified
plugin/mysql.log
Код:
[13:48:51] [INFO] changed log level from 'warning, error' to 'debug, info, warning, error'
[13:48:51] [DEBUG] mysql_connect("localhost", "root", "*****", "sa-mp", 1)
[13:48:51] [DEBUG] CHandleManager::Create(this=0x563c88, host='localhost', user='root', pass='****', db='sa-mp', options=0x564438)
[13:48:51] [INFO] Creating new connection handle...
[13:48:51] [WARNING] mysql_connect: no password specified
[13:48:51] [DEBUG] CConnection::CConnection(this=0x56a6c8, host='localhost', user='root', passw='****', db='sa-mp', options=0x564438)
[13:48:51] [DEBUG] CConnection::CConnection - new connection = 0x57e4b8
[13:48:51] [DEBUG] CConnection::CConnection(this=0x5bee020, host='localhost', user='root', passw='****', db='sa-mp', options=0x564438)
[13:48:51] [DEBUG] CConnection::CConnection - new connection = 0x578f50
[13:48:51] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5bee020, connection=0x5bee020)
[13:48:51] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x5bee020, connection=0x5bee020)
[13:48:51] [DEBUG] CConnectionPool::CConnectionPool(size=2, this=0x56a988)
[13:48:51] [DEBUG] CConnection::CConnection(this=0x5db5020, host='localhost', user='root', passw='****', db='sa-mp', options=0x564438)
[13:48:51] [DEBUG] CConnection::CConnection - new connection = 0x58f658
[13:48:51] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5db5020, connection=0x5db5020)
[13:48:51] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x5db5020, connection=0x5db5020)
[13:48:51] [DEBUG] CConnection::CConnection(this=0x5f8c020, host='localhost', user='root', passw='****', db='sa-mp', options=0x564438)
[13:48:51] [DEBUG] CConnection::CConnection - new connection = 0x59aa08
[13:48:51] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5f8c020, connection=0x5f8c020)
[13:48:51] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x5f8c020, connection=0x5f8c020)
[13:48:51] [INFO] Connection handle with id '1' successfully created.
[13:48:51] [DEBUG] CHandleManager::Create - new handle = 0x541530
[13:48:51] [DEBUG] mysql_connect: return value: '1'
[13:48:51] [DEBUG] mysql_errno(1)
[13:48:51] [DEBUG] CHandle::GetErrorId(this=0x541530)
[13:48:51] [DEBUG] CConnection::GetError(this=0x56a6c8, connection=0x57e4b8)
[13:48:51] [DEBUG] CHandle::GetErrorId - return value: true, error id: '0', error msg: ''
[13:48:51] [DEBUG] mysql_errno: return value: '0'
[13:48:51] [DEBUG] mysql_tquery(1, "SELECT * FROM `settings` LIMIT 1", "OnSettingsLoad", "")
[13:48:51] [DEBUG] CCallback::Create(amx=0x29c7b50, name='OnSettingsLoad', format='', params=0x59998ec, param_offset=5)
[13:48:51] [DEBUG] CCallback::Create - callback index for 'OnSettingsLoad': 107
[13:48:51] [INFO] Callback 'OnSettingsLoad' set up for delayed execution.
[13:48:51] [DEBUG] created delayed callback with 0 parameter
[13:48:51] [DEBUG] CHandle::Execute(this=0x541530, type=1, query=0x5996c0)
[13:48:51] [DEBUG] CHandle::Execute - return value: true
[13:48:51] [DEBUG] mysql_tquery: return value: '1'
[13:48:51] [DEBUG] CConnection::Execute(query=0x5996c0, this=0x5bee020, connection=0x578f50)
[13:48:51] [DEBUG] CQuery::Execute(this=0x5996c0, connection=0x578f50)
[13:48:51] [INFO] query "SELECT * FROM `settings` LIMIT 1" successfully executed within 0.377 milliseconds
[13:48:51] [DEBUG] mysql_tquery(1, "SELECT * FROM `business`", "OnLoadBusiness", "")
[13:48:51] [DEBUG] CResultSet::Create(connection=0x578f50, query_str='SELECT * FROM `settings` LIMIT 1')
[13:48:51] [DEBUG] CCallback::Create(amx=0x29c7b50, name='OnLoadBusiness', format='', params=0x5999868, param_offset=5)
[13:48:51] [DEBUG] created new resultset '0x57e3a8'
[13:48:51] [DEBUG] CCallback::Create - callback index for 'OnLoadBusiness': 57
[13:48:51] [INFO] Callback 'OnLoadBusiness' set up for delayed execution.
[13:48:51] [DEBUG] created delayed callback with 0 parameter
[13:48:51] [DEBUG] fetched MySQL result '0x576e40'
[13:48:51] [DEBUG] CHandle::Execute(this=0x541530, type=1, query=0x5998f8)
[13:48:51] [DEBUG] CHandle::Execute - return value: true
[13:48:51] [DEBUG] allocated 148 bytes for PAWN result
[13:48:51] [DEBUG] mysql_tquery: return value: '1'
[13:48:51] [DEBUG] CConnection::Execute(query=0x5998f8, this=0x5bee020, connection=0x578f50)
[13:48:51] [DEBUG] CQuery::Execute(this=0x5998f8, connection=0x578f50)
[13:48:51] [INFO] query "SELECT * FROM `business`" successfully executed within 0.253 milliseconds
[13:48:51] [DEBUG] CResultSet::Create(connection=0x578f50, query_str='SELECT * FROM `business`')
[13:48:51] [DEBUG] created new resultset '0x57e258'
[13:48:51] [DEBUG] fetched MySQL result '0x561998'
[13:48:51] [DEBUG] allocated 172 bytes for PAWN result
[13:48:51] [DEBUG] CCallback::Execute(amx=0x29c7b50, index=107, num_params=0)
[13:48:52] [INFO] Executing callback 'OnSettingsLoad' with 0 parameter...
[13:48:52] [DEBUG] executing AMX callback with index '107'
[13:48:52] [DEBUG] cache_get_row_count(0x05999914)
[13:48:52] [DEBUG] cache_get_row_count: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "PlayerMOTD", 0x03E595A8, 128)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: 'Hello World - Player'
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "AdminMOTD", 0x03E597A8, 128)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: 'Hello World - Admin'
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "HelperMOTD", 0x03E599A8, 128)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: 'Hello World - Helper'
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "VIPMOTD", 0x03E59BA8, 128)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: 'Hello World - VIP'
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "AdPosX", 0x03E59DA8)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "AdPosY", 0x03E59DAC)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "TotalWarrants", 0x0449FA98)
[13:48:52] [ERROR] cache_get_value_name_int: field 'TotalWarrants' not found
[13:48:52] [DEBUG] cache_get_value_name_int(0, "GovernmentBalance", 0x03E59DB4)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "TaxRate", 0x03E59DB8)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '15'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "TotalRegistrations", 0x03E59DBC)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "TotalLogins", 0x03E59DC0)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_unset_active()
[13:48:52] [DEBUG] cache_unset_active: return value: '1'
[13:48:52] [DEBUG] AMX callback executed with error '0'
[13:48:52] [INFO] Callback successfully executed.
[13:48:52] [DEBUG] CCallback::Execute(amx=0x29c7b50, index=57, num_params=0)
[13:48:52] [INFO] Executing callback 'OnLoadBusiness' with 0 parameter...
[13:48:52] [DEBUG] executing AMX callback with index '57'
[13:48:52] [DEBUG] cache_get_row_count(0x05999910)
[13:48:52] [DEBUG] cache_get_row_count: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "BusinessID", 0x04434CA8)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Owner", 0x04434EAC)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "OwnerName", 0x04434EB0, 25)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: ''
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name(0, "BusinessName", 0x04434F14, 128)
[13:48:52] [DEBUG] cache_get_value_name: assigned value: ''
[13:48:52] [DEBUG] cache_get_value_name: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Locked", 0x04435114)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "EntranceX", 0x04435118)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '-154.366'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "EntranceY", 0x0443511C)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '1108.74'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "EntranceZ", 0x04435120)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '19.7422'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "EntranceR", 0x04435124)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '180.999'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "EntranceInt", 0x04435128)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "EntranceVW", 0x0443512C)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "ExitX", 0x04435130)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "ExitY", 0x04435134)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "ExitZ", 0x04435138)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_float(0, "ExitR", 0x0443513C)
[13:48:52] [DEBUG] cache_get_value_name_float: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_float: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "ExitInt", 0x04435140)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Enterable", 0x04435144)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Value", 0x04435148)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "EntranceCost", 0x0443514C)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Till", 0x04435150)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Type", 0x04435154)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '11'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] cache_get_value_name_int(0, "Stock", 0x04435158)
[13:48:52] [DEBUG] cache_get_value_name_int: assigned value: '0'
[13:48:52] [DEBUG] cache_get_value_name_int: return value: '1'
[13:48:52] [DEBUG] AMX callback executed with error '0'
[13:48:52] [INFO] Callback successfully executed.
[13:52:10] [DEBUG] mysql_format(1, 0x059990F8, 512, "UPDATE `business` SET `EntranceX` = %f, `EntranceY` = %f, `EntranceZ` = %f, `EntranceR` = %f, `EntranceInt` = %d, `EntranceVW` = %d, `ExitX` = %f, `ExitY` = %f, `ExitZ` = %f, `ExitR` = %f, `ExitInt` = %d, `ExitVW` = %d, `Enterable` = %d, `Value` = %d, `EntranceCost` = %d, `Till` = %d, `Type` = %d, `Stock` = %d WHERE `BusinessID` = %d")
[13:52:10] [ERROR] mysql_format: no value for specifier '%d' passed
[13:52:10] [DEBUG] mysql_format: return value: '0'
[13:52:10] [DEBUG] mysql_tquery(1, "", "", "")
[13:52:10] [DEBUG] CCallback::Create(amx=0x29c7b50, name='', format='', params=0x59990e4, param_offset=5)
[13:52:10] [DEBUG] CHandle::Execute(this=0x541530, type=1, query=0x5996c0)
[13:52:10] [DEBUG] CHandle::Execute - return value: true
[13:52:10] [DEBUG] mysql_tquery: return value: '1'
[13:52:10] [DEBUG] CConnection::Execute(query=0x5996c0, this=0x5bee020, connection=0x578f50)
[13:52:10] [DEBUG] CQuery::Execute(this=0x5996c0, connection=0x578f50)
[13:52:10] [ERROR] error #1065 while executing query "": Query was empty
[13:52:10] [DEBUG] CConnection::GetError(this=0x5bee020, connection=0x578f50)
[13:52:10] [DEBUG] mysql_close(1)
[13:52:10] [DEBUG] CHandleManager::Destroy(this=0x563c88, handle=0x541530)
[13:52:10] [DEBUG] CHandle::~CHandle(this=0x541530)
[13:52:10] [DEBUG] CConnection::~CConnection(this=0x56a6c8, connection=0x57e4b8)
[13:52:10] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0x5bee020, connection=0x5bee020)
[13:52:10] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5bee020, connection=0x5bee020) - shutting down
[13:52:10] [DEBUG] CConnection::~CConnection(this=0x5bee020, connection=0x578f50)
[13:52:10] [DEBUG] CConnectionPool::~CConnectionPool(this=0x56a988)
[13:52:10] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0x5db5020, connection=0x5db5020)
[13:52:10] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5db5020, connection=0x5db5020) - shutting down
[13:52:10] [DEBUG] CConnection::~CConnection(this=0x5db5020, connection=0x58f658)
[13:52:10] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0x5f8c020, connection=0x5f8c020)
[13:52:10] [DEBUG] CThreadedConnection::WorkerFunc(this=0x5f8c020, connection=0x5f8c020) - shutting down
[13:52:10] [DEBUG] CConnection::~CConnection(this=0x5f8c020, connection=0x59aa08)
[13:52:10] [DEBUG] mysql_close: return value: '1'
Reply
#8

You're missing var of ExitVW

you have wrote:
Код:
        `ExitInt` = %d, \ 
        `ExitVW` = %d, \ 
        `Enterable` = %d, \ 
        `Value` = %d,
but passed those only:
Код:
        BusinessData[i][bExitInt], 
        BusinessData[i][bEnterable], 
        BusinessData[i][bValue],
Reply
#9

Quote:
Originally Posted by jlalt
Посмотреть сообщение
You're missing var of ExitVW

you have wrote:
Код:
        `ExitInt` = %d, \ 
        `ExitVW` = %d, \ 
        `Enterable` = %d, \ 
        `Value` = %d,
but passed those only:
Код:
        BusinessData[i][bExitInt], 
        BusinessData[i][bEnterable], 
        BusinessData[i][bValue],
How did I miss that? I've added the fix you mentioned and it worked. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)