Exemple #1
0
def runupdatedb():
	db = dbconnect.dbworker()
	dbversion = getdbversion()

	#q = ""
	for i in range(dbversion, len(sqltables.updatequeryes)):
		for q in sqltables.updatequeryes[i]:
			db.cursor.execute(q)
			db.db.commit()
	return "complate!!!"
Exemple #2
0
def getdbversion():
	db = dbconnect.dbworker()
	sql = "show tables from c9 like 'sysinfo'"
	db.cursor.execute(sql)
	userrow =  db.cursor.fetchone()
	if userrow is None:
		ver = 0
	else:
		sql = "select value from sysinfo where key_name = 'versiondb'"
		db.cursor.execute(sql)
		userrow =  db.cursor.fetchone()
		if userrow is None:
			ver = 0
		else:
			ver = int(userrow[0])
	return ver
Exemple #3
0
def index(request):
    #loadmysqlcredential()
    authorities = ez.checkauthorize(request)

    context = {"authorities": authorities,
                "location": "myadmin"}

    if (authorities.have):
        d = dbconnect.dbworker()
        d.doinitdb()
        t = hg.htmlgn(request)
        t.setjsrootname(request.path)
        t.append(hg.htmltext("Initialization complete!!!"))

        httptext = t.gen()
        return HttpResponse(httptext)
    else:
        return render(request, 'necessaryauth.html', context)
Exemple #4
0
	def __init__(self):
		self.db = dbconnect.dbworker()
		self.sql = u"""INSERT INTO goods (id, shop, caption, unit) VALUES ('{0}', '{1}', '{2}', '{3}')