Sindbad~EG File Manager
from sqlalchemy import create_engine, MetaData, Table, insert, null, select,update,delete,text
from sqlalchemy.sql import and_, or_
from sqlalchemy import asc, desc
from core import app
import json
#engine = create_engine(app.config['DATABASE_URI'])
engine = create_engine(app.config['DATABASE_URI'],pool_recycle=3600,future =True)
class NeuroUsers():
def __init__(self):
try:
self.meta = MetaData()
self.users = Table("users", self.meta, autoload_with=engine)
self.payments = Table("payments", self.meta, autoload_with=engine)
except Exception as e:
print(e)
def check_email_password(self,email):
with engine.connect() as conn:
stmt = text("select * from users where email='"+email+"';")
result = conn.execute(stmt).one_or_none()
return dict(result._mapping) if result else None
def usp_get_all_registered_users(self):
sets = []
try:
connection = engine.raw_connection()
cursor = connection.cursor()
cursor.callproc("usp_get_all_registered_users")
while 1:
#(column_name, type_, ignore_, ignore_, ignore_, null_ok, column_flags)
names = [c[0] for c in cursor.description]
set_ = []
while 1:
row_raw = cursor.fetchone()
if row_raw is None:
break
row = dict(zip(names, row_raw))
set_.append(row)
sets.append(list(set_))
if cursor.nextset() is None:
break
# nextset() doesn't seem to be sufficiant to tell the end.
if cursor.description is None:
break
finally:
# Return the connection to the pool (won't actually close).
connection.close()
return sets
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists