Skip to content

Commit 1a04d04

Browse files
authored
Merge pull request #2 from callofduty4x/pr1
Merge with PR1
2 parents 59730bd + 6e0a3f5 commit 1a04d04

File tree

132 files changed

+19204
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+19204
-112
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mysql.config
2-
mysql.creator
2+
mysql.creator*
33
mysql.files
44
mysql.includes

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# mysql
2+
CoD4X MySQL support for GSC.
3+
4+
# Contributors
5+
- [Sharpienero](https://github.com/Sharpienero/)
6+
- [Michael Hillcox](https://github.com/MichaelHillcox/)
7+
- [T-Maxxx](https://github.com/T-Max/)
8+
9+
# Script Docs
10+
### MySQL Related Functions
11+
12+
#### CVARS
13+
##### `mysql_port`
14+
You can use `mysql_port` to define a default port to connect to. `mysql_real_connect` will still prioritise its own argument
15+
over the CVAR so leaving `mysql_real_connect`'s port empty will cause it to fall back to `mysql_port`. If `mysql_port` and
16+
`mysql_real_connect`'s ports are both empty then by default fall back onto mysqls default port `3306`
17+
18+
Usage example: `set mysql_port 3306`
19+
20+
#### `mysql_real_connect()`
21+
22+
Connects to a database
23+
24+
Usage example `db = mysql_real_connect(host, user, pass, db, *port)`
25+
26+
####### Note: *the port pram is optional
27+
28+
###### Use 127.0.0.1 on unix, and the default port for mysql is 3306.
29+
30+
#### `mysql_close()`
31+
32+
Close a MySQL Connection
33+
34+
Usage example `mysql_close()`
35+
36+
#### `mysql_errno()`
37+
38+
Returns the MySQL Error number.
39+
Usage example: `error = mysql_errno()`
40+
41+
#### `mysql_error()`
42+
43+
Returns the MySQL Error number.
44+
Usage example: `error = mysql_error()`
45+
46+
#### `mysql_query()`
47+
48+
Send a query to a database and returns the result for use in the following functions:
49+
50+
Usage example:
51+
```cs
52+
query = mysql_query(<string query>)
53+
```
54+
55+
#### `mysql_rowcount()`
56+
Returns the amount of rows
57+
58+
Usage example: `count = mysql_rowcount()`
59+
60+
#### `mysql_affected_rows()`
61+
Returns the amount of affected rows
62+
63+
Usage example: `count = mysql_affected_rows()`
64+
65+
#### `mysql_num_field()`
66+
67+
Returns number of fields
68+
69+
Usage example = `count = mysql_num_field()`
70+
71+
72+
#### `mysql_fetch_rows()`
73+
74+
Fetches and handles all rows from the `mysql_query()`
75+
76+
Usage example = `data = mysql_fetch_rows()`
77+
78+
Returns: This function will return two different data types depending on the field count. If the field count is one, `if( mysql_num_field(mysql) == 1 )`, then the function will return a key based array `data['field_name']`. If the `mysql_num_field()` is larger than one then it will return a 2D array. The first array being a numeric array and the second being a key based array `data[0]['field_name']`.

bin/unix/cod4x_mysql.so

3.92 MB
Binary file not shown.
File renamed without changes.

bin/win32/cod4x_mysql.dll

52.9 KB
Binary file not shown.

bin/win32/dummy

Whitespace-only changes.

build_unix.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
cd bin/unix
3+
LIBNAME='cod4x_mysql.so'
4+
5+
echo Compiling...
6+
gcc -m32 -O3 -Wall -Wattributes -fPIC -s -fvisibility=hidden -I../../mysql/unix/include -c ../../*.c
7+
8+
echo Linking...
9+
gcc -m32 -O3 -s -shared -fvisibility=hidden -o $LIBNAME *.o ../../mysql/unix/lib/libmysqlclient.a
10+
11+
echo Cleaning up...
12+
rm *.o
13+
14+
echo Done.
15+
16+
cd ../..

build_win32.bat

100644100755
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
@echo off
2-
cd bin
2+
cd bin/win32
3+
set LIBNAME="cod4x_mysql.dll"
34

4-
echo Compile...
5-
gcc -O3 -I../mysql/include -c ../*.c
5+
echo Compiling...
6+
gcc -O3 -Wall -s -fvisibility=hidden -I../../mysql/windows/include -c ../../*.c
67

7-
echo Link...
8-
gcc -O3 -shared -o cod4x_mysql.dll *.o ../mysql/lib/libmysql.lib ../../libcom_plugin.a
8+
echo Linking...
9+
gcc -O3 -s -shared -fvisibility=hidden -o %LIBNAME% *.o ../../mysql/windows/lib/libmysql.lib ../../../libcom_plugin.a
910

10-
echo Cleanup...
11+
echo Cleaning up...
1112
del *.o
1213

1314
echo Done.
1415

15-
cd ..
16+
cd ../..
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)