Jump to content

mySQL share


dugasz1

Recommended Posts

Posted

Hello comminity!

I have a few question about mySQL (not the modul).

1. When i share a dbConnect whit "share=1",what is mean? I can use the connection in another scripts, and how?

2. If i cant use it whit share, what is the best way to make a connection in resources?

Posted
* share which can be set to 0 or 1. (Default value for SQLite is "share=1", for MySQL is "share=0"). When set to 1, the connection is shared and will be used by other calls to dbConnect with the same host string. This is usually a good thing for SQLite connections, but not so good for MySQL unless care is taken.

Posted

Yeah i tried it.

theConn = dbConnect( "mysql", "dbname=mta;host=localhost", "root", "******", "share=1" ) 

Another resources :

local qh = dbQuery( theConn , "SELECT * FROM accs" ) 

But it can't find theConn variable.

What is the best way to make the connection in resources? (i try to make a gamemode i don't want to type everywhere the host, user ... etc)

Posted

The share option doesn't magically share variables across Lua virtual machines, the only thing it does is re-use the active connection instead of connecting to the server again.

Posted

ohhh thanks :)

then if i connect in another res like this:

dbConnect( "mysql", "dbname=mta;host=localhost", "root", "******") 

It just use the shared connection?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...