dugasz1 Posted September 21, 2013 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? Sorry for lot of questions and thanks for the answers!
Sora Posted September 21, 2013 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. [REL] Resource Starter System v1.3 [REL] Give Permissions Panel v1.4 [REL] Meta Creator 1.1 ( In-game MetaCreator ) [REL] ACL Permission Manager 1.0 [REL] Accounts Security Manager 1.1 Name(s) in-game : old |S.s|SoRa, current : *Sora
dugasz1 Posted September 21, 2013 Author 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) Sorry for lot of questions and thanks for the answers!
ixjf Posted September 21, 2013 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. I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
dugasz1 Posted September 21, 2013 Author 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? Sorry for lot of questions and thanks for the answers!
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