Exemplo n.º 1
0
def main():
    tool = MySQL()
##    tool._loadConfigMySQL()
    sql_opt = "-X -udocid finister -e \" SELECT * FROM actions LIMIT 0,1\" "
    output = tool.mysql_query(sql_opt,"MySQL test")
    print "MySQL test",output
##    sql_opt = " -u root root"
##    output = tool.mysql_query(sql_opt,"MySQL test")
##    print "MySQL test",output
##    sql_opt = "help"
##    output = tool.mysql_query(sql_opt,"MySQL help")
##    print "MySQL help",output
    #sql_opt = "-u docid finister"
    #output = tool.mysql_query(sql_opt,"MySQL test")
    #print "MySQL test",output
##    sql_opt = "-udocid"
##    output = tool.mysql_query(sql_opt,"MySQL init")
##    print "MySQL init",output
##    sql_opt = "use finister;"
##    output = tool.mysql_query(sql_opt,"Select database")
##    print "Select database",output
##    sql_query = "SELECT * FROM actions LIMIT 1,30;"
##    output = tool.mysql_query(sql_query,"Get QA actions")
##    print "Actions",output
    if 0==1:
        db=pdo.connect("Module=MySQLdb;User=root;Passwd=root;DB=finister")
        if db.active:
            strSelect="SELECT * FROM actions"
            rs=db.openRS(strSelect)
            while rs.next():
                print rs.fields['Description'].value
Exemplo n.º 2
0
	def __init__(self, password, user, db):
		global this, this2, this3
		if password is None:
			password = ''
		this = PDO.connect('Module=MySQLdb;User=%s;Passwd=%s;DB=%s'%(str(user), str(password), str(db)))
		this3 = MySQLdb.connect(host="localhost", user=user, passwd=password, db=db)
		this2 = this3.cursor()
		this3.autocommit(True)
Exemplo n.º 3
0
 def link_db(self, db_kind, host, user, passwd, db):
     import pdo
     _db_type = ""
     db_kind = self.strtoupper(db_kind)
     if db_kind == "MYSQL":
         db_type = "MySQLdb"
     _link_str = 'Module=' + db_type + ';Host=' + host + ';User='******';Passwd=' + passwd + ';DB=' + db
     PDO = pdo.connect(_link_str)
     self.execSQL(PDO, "SET NAMES UTF8")
     return PDO
Exemplo n.º 4
0
 def sql_on(self, varChat, varEvent):
     global conn
     details["status"]=1
     db=pdo.connect("Module=MySQLdb;User=pyboter;Passwd=pyboter1.0;DB=pyboter;host=localhost")
     varChat.privmsg( self.channel, "La conexión con SQL esta apagada.")