GithubHelp home page GithubHelp logo

gamestock / mysql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from callofduty4x/mysql

0.0 1.0 0.0 9.13 MB

CoD4X MySQL support for GSC.

License: GNU Affero General Public License v3.0

C++ 34.61% C 47.84% Pascal 0.29% Makefile 0.17% Objective-C 17.09%

mysql's Introduction

mysql

CoD4X MySQL support for GSC. Continious connection up to 4 databases supported.

Contributors

Script Docs

MySQL Related Functions

mysql_real_connect(<str host>, <str user>, <str passwd>, <str db>, [int port=3306])

Connects to a database, returns handle to database connection. If you want to connect to multiple databases, you can call this function up to 4 times. Do not forget to close connection with mysql_close(). TODO: link here!

If "localhost" passed as host, for *NIX OS will be changed to "127.0.0.1".

Usage example 1: handle = mysql_real_connect("localhost", "cod4server", "12345678", "players");

Usage example 2: handle = mysql_real_connect("255.125.255.125", "usr1337", "87654321", "stats", 1337);

mysql_close(<handle>)

Close a MySQL connection. Handle must be valid.

Usage example: mysql_close(handle);

mysql_query(<handle>, <str query>)

Send a query to a database and saves the result for use in following functions. Must be called after mysql_real_connect().

Usage example: mysql_query(handle, "SELECT * from users");

mysql_num_rows(<handle>)

Returns the amount of rows received after latest query. Must be called after mysql_real_connect() and mysql_query().

Usage example: rowsCount = mysql_num_rows(handle);

mysql_affected_rows(<handle>)

Returns the amount of affected rows after latest query. Must be called after mysql_real_connect() and mysql_query().

Usage example: rowsCount = mysql_affected_rows(handle);

mysql_num_fields(<handle>)

Returns number of fields in latest query result. Must be called after mysql_real_connect() and mysql_query().

Usage example: fieldsCount = mysql_num_field(handle);

mysql_fetch_row(<handle>)

Returns next row from latest query result as array. Array's keys are equal to column names and can be found with getArrayKeys(<array>). An empty array returned if there's no more rows left. Must be called after mysql_real_connect() and mysql_query().

Usage example:

arr = mysql_fetch_row(handle);
keys = getArrayKeys(arr);
for(j = 0; j < keys.size; j++)
{
  iprintln("Key=" + keys[j] + ", value=" + arr[keys[j]]);
}

Non-MySQL Related Functions

mysql_fetch_rows(<handle>)

Returns rest rows from latest query result as 2-dimensional array. Array's keys are equal to column names and can be found with getArrayKeys(<array>). An empty array returned if there's no more rows left. Must be called after mysql_real_connect() and mysql_query().

Usage example:

query = mysql_fetch_rows(handle);
for(i = 0; i < query.size; i++)
{
  keys = getArrayKeys(query[i]);
  for(j = 0; j < keys.size; j++)
  {
    iprintln("Row #" + i + ", Key=" + keys[j] + ", value=" + query[i][keys[j]] + "\n");
  }
}

mysql's People

Contributors

t-maxxx avatar thamidu avatar d1st4r avatar sharpienero avatar michaelhillcox avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.