-
Notifications
You must be signed in to change notification settings - Fork 11
Fixed up mysql_fetch_rows and added some docs along with other things #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added a mini script doc for people using the plugin
|
Are not header files for Unix and Windows the same? |
|
Leave mysql_fetch_row in peace. :D If you want, you can add mysql_fetch_rows, but keep it here as documented mysql function. |
|
And you can not create arrays with non constant size ( variable ) specificator. For that you must allocate memory. BUT we should not allocate RAM in any parts of cod4x server. Instead of that we should reserve ehough space in stack. |
|
Thank you. Moved your pull request to pr1 branch because a lot of things must be fixed. |
|
@T-Maxxx thats so not how branches work nor is it how pull requests work. If this needed fixing then it should of stayed open so I could fix the issues. Not so I can go and work on a different branch. Thats literally more work for me for no reason. Please reopen this and remove the new branch because its unneeded. I'm not offering alternative code here, I'm offering fixes and improvements to the original code. I how no idea what you mean about a few things so could you reopen this and review my code so I can fix said things. Also no Unix and Windows headers are different not sure why. But they seem to be . for the array structure I am only every allocating the amount of columns to the stringIndex or what ever its called. Before I was doing it for every rows column of which is stupid of course. So thats been fixed. I replaced your mysql_fetch_row because I have no idea how that would actually work out in game. Could you show me an example. "About cvars. Im thinking about 4 database connections at same time. This must be enough for most cases. As I read, if you didnt pass pointer to MYSQL structure, it allocates a new one. We should avoid that."? all I did was move it back to using arguments and fail if it does not get them. I don't think I changed anything with now you are doing the pointers. Your way of mysql_init and the assigning it to an &mysql was much better than our original way so I left it :) "And you can not create arrays with non constant size ( variable ) specificator. For that you must allocate memory. BUT we should not allocate RAM in any parts of cod4x server. Instead of that we should reserve ehough space in stack." to which bit of code are you referring to? |
|
@MichaelHillcox Seems you didn't tried to compile this after changes you made so I decided to close PR and fix errors by myself. |
|
@T-Maxxx I would like to give it ago but fair enough. Also update the readme if you change any functions around :P also "Moved your pull request to pr1 branch because a lot of things must be fixed." does not say that you want to do it yourself :P Maybe more clear next time? also please leave arguments in the mysql_real_connect. Its really something that should an override system at the least. If the cvar isn't defined then default to arguments or vice verser. |
|
@T-Maxxx I did compile this. I have the .so to prove it. I also did test it a lot. Look at me fixes in the code. So yeah. I also made a linux build file? how are you not seeing that I didn't compile this? |
|
@MichaelHillcox 'mysql_fetch_rows' will return one- or two-dimensional array. Prove me why this is better than unified 2-dimensional array? You have to handle 2 cases instead of one. |
|
@T-Maxxx I continue to not understand. So you would create a 2D array when you only need a 1D array if there is only one row? remembering that the first dimension is purely for the rows. |
|
@MichaelHillcox Why not? You expecting to get unknown numbers of lines by parsing WHOLE MYSQL_RES. In your way, your GSC must handle both cases: when |
|
in gsc check for mysql_row_count or what ever it is. Its just a nicer way of doing it. You can either always use a for loop or use an if. |
|
@MichaelHillcox Oh, nice! As I said, you have to handle 2 cases in GSC. |
|
@T-Maxxx You have to handle two cases either way. It doesn't really matter. If you are only expecting one result "SELECT pdsjsapodjs limit 0,1" then its nice to have that ability. |
|
Currently having an issue to where this happens on start up
I know for sure that
mysql_get_client_versionis fine in the code/ From what I understand its something todo with how the mysql lib is not being loaded because its plugin.someone much better at this than I will need to take a look at it and see if they can figure out whats going wrong. I've also including a unix build file aswell as adding a readme.md and docs on how to use the functions. I've modified
mysql_real_connect's prams to allow for mulitiple different connections to different databases. I've left the port CVAR but removed the rest. They need to be dynamic.