Turley, thank you for your answer.
Of course, my request wasn't full and informative.
After some days, I guessed that POL can't display full array of MySQL result, and its a pity!
But I found some bugs with this functions and want to share them!
This is how my code works:
1st step
I connect to DB
Code: Select all
var connection := mysql_connect( DB_HOST, DB_USERNAME, DB_PASSWORD );
if( connection.errortext )
SysLog("\n [MySQL GameCards] Connection Failed: " + connection.errortext );
else
syslog("\n [MySQL GameCards] Connection Successful!");
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Connection Successful!
Code: Select all
print( " MySQL_CreateNewCard() | connection : " + connection ); // DEBUG
MySQL_CreateNewCard() | connection : SQLConnection
2nd step
I select DB name
Code: Select all
var selectdb := mysql_select_db( connection, DB_NAME );
if( selectdb.errortext )
SysLog("\n [MySQL GameCards] Database Selection Failed: " + selectdb.errortext );
else
SysLog("\n [MySQL GameCards] Database Selected!");
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Database Selected!
Code: Select all
print( " MySQL_CreateNewCard() | selectdb : " + selectdb ); // DEBUG
MySQL_CreateNewCard() | selectdb : 1
3rd step
I INSERT INTO 'gcards' table some info
Code: Select all
query := "INSERT INTO gcards (
card, card_days, card_time
)
VALUES ('"+ card +"', '"+ card_days +"', '"+ card_time +"'
)";
result := mysql_query( connection, query );
if( result.errortext )
SysLog("\n [MySQL GameCards] Query Result 1 Failed: " + result.errortext );
else
SysLog("\n [MySQL GameCards] Query Result 1 Sent!");
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Query Result 1 Sent!
Code: Select all
print( " MySQL_CreateNewCard() | result : " + result ); // DEBUG
MySQL_CreateNewCard() | result 1 : SQLResultSet
4th step
I SELECT last added card with ORDER BY id DESC colomn (id is AUTO_INCREMENT)
Code: Select all
query := "SELECT * FROM gcards ORDER BY id DESC";
result := mysql_query( connection, query );
var getArray := mysql_fetch_row( result );
if( getArray.errortext )
SysLog("\n [MySQL GameCards] mysql_fetch_row() Failed: " + getArray.errortext );
else
SysLog("\n [MySQL GameCards] Array Selected! : " + getArray[1] );
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Array Selected! : 3
Code: Select all
print( " MySQL_CreateNewCard() | getArray : " + getArray[1] ); // DEBUG
MySQL_CreateNewCard() | getArray : 3
5th step
I INSERT INTO 'gcards_created_by' table some else info with Third Normal Form (3NF) order
Code: Select all
query:="INSERT INTO gcards_created_by (
id_card,
created_by_account, created_by_name, created_by_ip,
created_by_serial, created_by_serial_hex
)
VALUES ('"+ getArray[1] +"',
'"+ card_created_by_acc +"', '"+ card_created_by_name +"',
'"+ card_created_by_ip +"', '"+ card_created_by_serial +"', '"+ card_created_by_serial_hex +"'
)";
result := mysql_query( connection, query );
if( result.errortext )
SysLog("\n [MySQL GameCards] Query Result 2 Failed: " + result.errortext );
else
SysLog("\n [MySQL GameCards] Query Result 2 Sent!");
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Query Result 2 Sent!
Code: Select all
print( " MySQL_CreateNewCard() | result 2 : " + result ); // DEBUG
MySQL_CreateNewCard() | result 2 : SQLResultSet
6th step
I INSERT INTO 'gcards_created_time' table some else info with Third Normal Form (3NF) order
Code: Select all
query:="INSERT INTO gcards_created_time (
id_card,
created_time, created_time_data
)
VALUES ('"+ getArray[1] +"',
'"+ card_created_time +"', '"+ card_created_time_data +"'
)";
result := mysql_query( connection, query );
if( result.errortext )
SysLog("\n [MySQL GameCards] Query Result 3 Failed: " + result.errortext );
else
SysLog("\n [MySQL GameCards] Query Result 3 Sent!");
endif
syslog [pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl]:
[MySQL GameCards] Query Result 3 Sent!
Code: Select all
print( " MySQL_CreateNewCard() | result 3 : " + result ); // DEBUG
MySQL_CreateNewCard() | result 3 : SQLResultSet
7th step
And the final step!
If I find some nonexistent card in my DB, pol make MINIDUMP!
Code: Select all
query := "SELECT * FROM gcards WHERE card IN('xxxxxxxxxxx') ";
result := mysql_query( connection, query );
getArray := mysql_fetch_row( result );
if( getArray.errortext )
SysLog("\n [MySQL GameCards] mysql_fetch_row() Failed: " + getArray.errortext );
else
SysLog("\n [MySQL GameCards] Array Selected! : " + getArray[1] );
endif
Unhandled Exception! Minidump started...
##########################################################
Current StackBackTrace
(function-name not available) - 0x140261b47
(filename not available)
(function-name not available) - 0x14025694f
(filename not available)
(function-name not available) - 0x140256530
(filename not available)
UnhandledExceptionFilter - 0x7ffba610bdd0
(filename not available)
memset - 0x7ffba8ed3167
(filename not available)
_C_specific_handler - 0x7ffba8ebb5e6
(filename not available)
_chkstk - 0x7ffba8ecf7dd
(filename not available)
RtlWalkFrameChain - 0x7ffba8e3d856
(filename not available)
KiUserExceptionDispatcher - 0x7ffba8ece70e
(filename not available)
(function-name not available) - 0x1400dbddf
(filename not available)
(function-name not available) - 0x140219801
(filename not available)
(function-name not available) - 0x1402141c6
(filename not available)
(function-name not available) - 0x1400caecd
(filename not available)
(function-name not available) - 0x1400cd025
(filename not available)
(function-name not available) - 0x1400900bb
(filename not available)
(function-name not available) - 0x140255452
(filename not available)
(function-name not available) - 0x140255688
(filename not available)
(function-name not available) - 0x1402a2f99
(filename not available)
BaseThreadInitThunk - 0x7ffba6463dc4
(filename not available)
RtlUserThreadStart - 0x7ffba8ea3691
(filename not available)
##########################################################
##########################################################
Unhandled Exception! Writing Minidump file.
Post this file with explanation and last lines from log files on
http://forums.polserver.com/tracker.php for the development team.
Saved dump file to '20190311011640-0.dmp'
Last Script: pkg/player/login/gameCards/mysql/MySQL_CreateNewCard.ecl PC: 512
##########################################################
Code: Select all
print( " MySQL_CreateNewCard() | getArray : " + getArray[1] ); // DEBUG
...
I have a several questions!
Is it real to make that from DB we will get a full array of result SELECT * FROM ....?
Can we change so that in case of failure, will shown an error is instead a minidump?
Can we make that POL displays full array of result?
And what do you think about implementing associative arrays in mysql functions?)
p.s. I still use 99.0.1 Break Everything Even Rudder
With best regards!