Ejemplo n.º 1
0
    def select(self,
               table,
               columns=['*'],
               condition='',
               orderby='',
               limit=0,
               isFetchAll=True):
        """
        Select rows from the table
        :param table: Table name
        :param columns: Selected columns
        :param condition: Where condition
        :param orderby: Order by condition
        :param limit: Rows limit
        :param isFetchAll: Indicator of fetching all
        :return Result rows
        """
        select = SqlClient.select(self, table, columns, condition, orderby,
                                  limit, isFetchAll)
        if len(select) > 0:
            if columns[0] != '*':
                ret = []
                for ele in select:
                    row = []
                    for column in columns:
                        row.append(ele[column])

                    ret.append(row)
            else:
                ret = [list(e.values()) for e in select]

            return ret
        else:
            return select
Ejemplo n.º 2
0
 def select(self,
            table,
            columns=['*'],
            condition='',
            orderby='',
            limit=0,
            isFetchAll=True):
     """
     Select rows from the table
     :param table: Table name
     :param columns: Selected columns
     :param condition: Where condition
     :param orderby: Order by condition
     :param limit: Rows limit
     :param isFetchAll: Indicator of fetching all
     :return Result rows
     """
     ret = SqlClient.select(self, table, columns, condition, orderby, limit,
                            isFetchAll)
     if isinstance(ret, list):
         return [list(e.values()) for e in ret]
     else:
         return ret