示例#1
0
 def __init__(self) :
     self.config_bible = {
       'user': '******',
       'password': '******',
       'host': 'mthx.cafe24.com',
       'database': 'bible',
       'raise_on_warnings': True,
     }
     self.config_bot = {
       'user': '******',
       'password': '******',
       'host': 'mthx.cafe24.com',
       'database': 'chatbot',
       'raise_on_warnings': True,
     }
     self.dbBible = dbConMysql( self.config_bible )
     self.dbBot   = dbConMysql( self.config_bot )
 def initDBMgs(self):
     config_db = {
         'user': '******',
         'password': '******',
         'host': 'mthx.cafe24.com',
         'database': 'bible',
         'raise_on_warnings': True
     }
     self.db = dbConMysql(config_db)
 def initDBMgs(self):
     config_db = {
         'user': '******',
         'password': '******',
         'host': 'mthx.cafe24.com',
         'database': 'bible',
         'raise_on_warnings': True
     }
     self.db = dbConMysql(config_db)
     if (self.db != None): self.addLog("I", "DB", "Init OK")
     else: self.addLog("E", "DB", "Init Fail")
 def initDB(
     self,
     config_db={
         'user': '******',
         'password': '******',
         'host': 'mthx.cafe24.com',
         'database': 'bible',
         'raise_on_warnings': True
     }):
     print("initDB : {}".format(config_db))
     self.config_db = config_db
     self.db = dbConMysql(self.config_db)
     print(self.db)
示例#5
0
def func_query_dict_except(api_name, isDebug, query, requestarg, list_args=[]):
    if (len(list_args) > 0):
        dictArgs = requestarg.to_dict(flat=True)
        cntNotContain = 0
        for elem in list_args:
            if (elem not in dictArgs.keys()): cntNotContain = cntNotContain + 1
        if (cntNotContain > 0):
            return {
                "ret": False,
                "code": 1,
                "msg": "invalid args",
                "cnt": 0,
                "data": []
            }  # code 0 -- arg invali
        print(dictArgs)
        tquery = query.format(**dictArgs)
    else:
        tquery = query
    db = dbConMysql(config_db)
    try:
        print("api_command:{} query:{}".format(api_name, tquery))
        Ret = db.selectQueryWithRet(tquery)
        if (Ret["ret"] == False):
            if (isDebug):
                print("api_command:{} query:{} is FAIL".format(
                    api_name, query))
            return {
                "ret": False,
                "code": 2,
                "msg": "query fail",
                "cnt": 0,
                "data": []
            }
        else:
            if (isDebug):
                print("api_command:{} query:{} is OK".format(api_name, query))
            return {
                "ret": True,
                "code": 0,
                "msg": "ok",
                "cnt": len(Ret),
                "data": Ret['data']
            }
    except Exception as e:
        return {
            "ret": False,
            "code": 3,
            "msg": "query fail",
            "cnt": 0,
            "data": []
        }
示例#6
0
def swinfo():
    db_local = dbConMysql(config_db)
    query_appver = "select attrname , attrvalue from tSetting where attrname = 'appver'"
    ret_appdbver = db_local.selectQueryWithRet(query_appver)

    query_biblever = "select attrname , attrvalue from tSetting where attrname = 'bibledbver'"
    ret_bibledbver = db_local.selectQueryWithRet(query_biblever)

    query_contentver = "select attrname , attrvalue from tSetting where attrname = 'contentdbver'"
    ret_contentver = db_local.selectQueryWithRet(query_contentver)

    print(ret_appdbver['data'][0]['attrvalue'])
    print(ret_bibledbver['data'][0]['attrvalue'])
    print(ret_contentver['data'][0]['attrvalue'])

    dicSwinfo = {
        "appver": ret_appdbver['data'][0]['attrvalue'],
        "bibledbver": ret_bibledbver['data'][0]['attrvalue'],
        "contentdbver": ret_contentver['data'][0]['attrvalue']
    }

    return dicSwinfo
import sys

sys.path.append("../../Common")
from Mysql.libmysql import dbConMysql


config_db = {'user': '******', 'password': '******', 'host': 'mthx.cafe24.com', 'database': 'mthx_app',
             'raise_on_warnings': True}

db = dbConMysql(config_db)

#1. fill `tBibleIWordAdv`
if True : # Done
    query = "select * from tBibleIWord"
    ins_query = "insert into tBibleIWordAdv( iw_cateid , iw_catenm , iw_catedesc_desc ) values ( {bibleiword_seq} , '{bibleiword_nm}' , '{bibleiword_desc}' )"
    ret = db.selectQueryWithRet( query )
    for row in ret['data'] :
        print( row )
        act_query = ins_query.format(**row)
        print( act_query )
        ret = db.commitQuery(act_query)

if True :


dicData = {}

if False :
    query = "select * from tBibleBook"
    ret = db.selectQueryWithRet(query)
    if( ret['ret'] == False ) : print("False")
示例#8
0
from time import sleep
from selenium import webdriver
import json
import re

from time import sleep
import json

config_db = {
    'user': '******',
    'password': '******',
    'host': 'mthx.cafe24.com',
    'database': 'bible',
    'raise_on_warnings': True
}
db = dbConMysql(config_db)
db2 = dbConMysql(config_db)
db3 = dbConMysql(config_db)

path_chrome_driver_win = "\\..\\Common\\lib\\chromedriver.exe"
path_chrome_driver_win_abs = "D:/workspace/PyCharm/PyTorch/couragesuper-ds/Common/Crawler/lib/chromedriver.exe"

url_biblebook = [
    'Gen', 'Exo', 'Lev', 'num', 'deu', 'jos', 'jdg', 'rth', '1sa', '2sa',
    '1ki', '2ki', '1ch', '2ch', 'ezr', 'neh', 'est', 'job', 'psa', 'pro',
    'ecc', 'son', 'isa', 'jer', 'lam', 'eze', 'dan', 'hos', 'joe', 'amo',
    'oba', 'jon', 'mic', 'nah', 'hab', 'zep', 'hag', 'zec', 'mal', 'mat',
    'mar', 'luk', 'joh', 'act', 'rom', '1co', '2co', 'gal', 'eph', 'phi',
    'col', '1th', '2th', '1ti', '2ti', 'tit', 'phm', 'heb', 'jam', '1pe',
    '2pe', '1jo', '2jo', '3jo', 'jud', 'rev'
]
示例#9
0
def openDB() :
    config_db = {'user': '******', 'password': '******', 'host': 'mthx.cafe24.com', 'database': 'bible',
                 'raise_on_warnings': True}
    return dbConMysql(config_db)
示例#10
0
import sys
import json
sys.path.append("../Common")
from Mysql.libmysql import dbConMysql

config_bot = {
          'user': '******',
          'password': '******',
          'host': 'mthx.cafe24.com',
          'database': 'chatbot',
          'raise_on_warnings': True }

db      = dbConMysql(config_bot)
qry     = "select * from tUserChatStatJson where userkey='U9A9agpChomm'; "
listRet = db.selectQuery( qry )
jsonStr = listRet[0]['jsondata']
ret     = json.loads(jsonStr)

print( ret )











示例#11
0
import sys

sys.path.append("../Common")
from Mysql.libmysql import dbConMysql
import sqlite3

config_db = {
    'user': '******',
    'password': '******',
    'host': 'mthx.cafe24.com',
    'database': 'mthx_app',
    'raise_on_warnings': True
}

db = dbConMysql(config_db)
dbinput = dbConMysql(config_db)

ret_category = db.selectQueryWithRet("select * from tBibleIWordAdv;")
print(ret_category)

#ret = db.selectQueryWithRet("select * from tBibleIWordContAdv")
#print( ret )

iw_cateid = 0
iw_seq = 0
iw_subseq = 0
iw_subsubseq = 0

for category in ret_category['data']:
    print(category)
    ret = db.selectQueryWithRet(