コード例 #1
0
    def add_concept(self, concept):
        q = Query\
            .into(self.table_reference)\
            .columns(
                self.table_reference.relation,
                self.table_reference.first,
                self.table_reference.second,
                self.table_reference.userid,
                self.table_reference.score,
                self.table_reference.valid)\
            .insert(
                concept.relation,
                concept.first,
                concept.second,
                concept.user_id,
                concept.score,
                concept.valid)

        query = q.get_sql()
        query = query.replace("\"", "")
        print(query)

        sql_response = SQLExecuter.execute_write_query(query)

        return sql_response
コード例 #2
0
    def delete_concept(self, first, relation, second):
        q = Query\
            .from_(self.table_reference)\
            .delete()\
            .where(
            (self.table_reference.first == first) & (self.table_reference.relation == relation) & (
                    self.table_reference.second == second)
        )

        query = q.get_sql()
        query = query.replace("\"", "")
        print(query)

        sql_response = SQLExecuter.execute_write_query(query)

        return sql_response
コード例 #3
0
    def update_valid(self, first, relation, second, valid):
        q = Query\
            .update(self.table_reference)\
            .set(self.table_reference.valid, valid)\
            .where(
            (self.table_reference.first == first) & (self.table_reference.relation == relation) & (
                    self.table_reference.second == second)
        )

        query = q.get_sql()
        query = query.replace("\"", "")
        print(query)

        sql_response = SQLExecuter.execute_write_query(query)

        return sql_response
コード例 #4
0
ファイル: DBOUser.py プロジェクト: Kylitaaaaaa/Mod_ORSEN_v2
    def add_user(self, user):
        q = Query\
            .into(self.table_reference)\
            .columns(
                self.table_reference.name,
                self.table_reference.code)\
            .insert(
                user.name,
                user.code )

        query = q.get_sql()
        query = query.replace("\"", "")
        print(query)

        sql_response = SQLExecuter.execute_write_query(query)

        if sql_response is not None:
            user.id = sql_response

        return user