August 20, 2018, 06:52:43 am

Author Topic: [Module] MySQL  (Read 2668 times)

0 Members and 1 Guest are viewing this topic.

stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1753
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
    • Awards
[Module] MySQL
« on: November 19, 2011, 06:22:31 am »
MySQL ( lu_mysql )

This is a re-release of Juppi's lu_mysql module, which was never formally released. The module would allow you to connect to any MySQL database on any server, unlike SQLite, which restricts you to databases in the server folder. This module can allow you to update stats on a website, while maintaining another database on your server.

The only difference between this and Juppi's original code is a courtesy loading message, two more exceptions for connection failures, and it's been recompiled to work properly. The original module seemed to not compile correctly, and trying to use it would always result in a "Failed to retrieve UserData"

All the credit should go to Juppi for coding the vast majority of this great module. The list of functions provided are:
  • mysql_connect( szHost, szUsername, szPassword, szDatabase, iPort )
  • mysql_close( pConnection )
  • mysql_query( pConnection, szQuery )
  • mysql_num_rows( pResult )
  • mysql_num_fields( pResult )
  • mysql_fetch_row( pResult )
  • mysql_fetch_assoc( pResult )
  • mysql_fetch_lengths( pResult )
  • mysql_free_result( pResult )
  • mysql_errno( pConnection )
  • mysql_error( pConnection )
  • mysql_ping( pConnection )
  • mysql_escape_string( pConnection, szString )
  • mysql_select_db( pConnection, szDatabase )
  • mysql_change_user( pConnection, szUser, szPassword )
  • mysql_warning_count( pConnection )
  • mysql_affected_rows( pConnection )
  • mysql_insert_id( pConnection )
  • mysql_info( pConnection )

And will be available on the (LU) wiki ASAP.

Installation
Extract lu_mysql.dll/so to your Modules folder, and libmysql.dll to the same folder as the server (if you're using Windows). Load the module and you should be good to go.

Download
Windows Binary
Linux Binary
Source Code
« Last Edit: November 19, 2011, 07:48:24 pm by stormeus »
Winner Winner x 1 (list)
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

Thijn

  • Forum Administrator
  • Crazy Man
  • *
  • *
  • *
  • Posts: 2831
  • Country: nl
    • View Profile
    • Awards
Re: [Module] MySQL
« Reply #1 on: November 19, 2011, 12:33:11 pm »
Juppi's module worked fine on both windows and linux for me :P
Would be nice if you fix the query function.
If you query from the database and need multiple rows you get the first result normally (in a array),
but then if you want to loop trough the next result you get another array (thats good, I guess?) but with all null values.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

I'm not totally useless,
I can be used as an bad example ;)

"Never do Today, What you can do Tomorrow"



stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1753
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
    • Awards
Re: [Module] MySQL
« Reply #2 on: November 19, 2011, 04:44:50 pm »
Linux was giving me grief while compiling on Arch. I'll come back to that after I fix the row bug.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1753
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
    • Awards
Re: [Module] MySQL
« Reply #3 on: November 19, 2011, 07:47:34 pm »

Good news, everyone!

Updated to fix multi-row bug.
An issue where mysql_fetch_field didn't re-seek for each row was fixed. If you don't understand that, just be glad that it's fixed.

Linux version compiled.
Not much else to say here.

Links updated in the first post.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • *
  • Posts: 4182
  • Country: 00
    • View Profile
    • Awards
Re: [Module] MySQL
« Reply #4 on: December 17, 2011, 03:53:07 pm »
Stickied
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts