dugasz1 Posted September 21, 2013 Share Posted September 21, 2013 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? Link to comment
Sora Posted September 21, 2013 Share Posted September 21, 2013 * 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. Link to comment
dugasz1 Posted September 21, 2013 Author Share Posted September 21, 2013 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) Link to comment
ixjf Posted September 21, 2013 Share Posted September 21, 2013 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. Link to comment
dugasz1 Posted September 21, 2013 Author Share Posted September 21, 2013 ohhh thanks then if i connect in another res like this: dbConnect( "mysql", "dbname=mta;host=localhost", "root", "******") It just use the shared connection? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now