05.11.2010, 14:53
Update
New functions available:
There is no need for db_free_result after using BUD::RunQuery! BUD will take care of that when the function that sent the query is done running.
To protect your query from SQL injections, simply run BUD::EscapeSqlString with the string you will insert as an argument; if you're doing this for something enclosed in ` quotes, do:
Example usage of BUD::GetSortedData to list the top killers:
Please help me test these new functions, I haven'd had much time to do testing.
Download
The links are in the main post.
New functions available:
Код:
DBResult BUD::RunQuery( query[], bool:store_results )
BUD::EscapeSqlString( string[ ] )
BUD::GetSortedData( &results[][], column )
bool BUD::GetNamesForSortedData( results[][], num_results, &names[][] )
To protect your query from SQL injections, simply run BUD::EscapeSqlString with the string you will insert as an argument; if you're doing this for something enclosed in ` quotes, do:
pawn Код:
BUD::EscapeSqlString( string, '`' );
pawn Код:
new BUD::Results:brTest<10>;
new iResults = BUD::GetSortedData( brTest, "kills" );
new szaNames[ 10 ][ MAX_PLAYER_NAME ];
BUD::GetNamesForSortedData( brTest, iResults, szaNames );
if ( iResults == BUD::INVALID_RESULTS )
printf( "BUD::GetSortedData failed." );
else
{
for ( new i = 0; i < iResults; i++ )
{
printf( "User: %s (%d)\t%d", szaNames[ i ], brTest[ i ][ 0 ], brTest[ i ][ 1 ] );
}
}
Download
The links are in the main post.

