(self, data)
New data from psycopg
New data from psycopg
New data from psycopg
def write(self, data):
        "New data from psycopg"
        if self.write_hook:
            data = self.write_hook(self, data)

        self.total_bytes += len(data)
        self.total_rows += data.count("\n")

        if self.buf.tell() >= self.limit:
            pos = data.find('\n')
            if pos >= 0:
                # split at newline
                p1 = data[:pos + 1]
                p2 = data[pos + 1:]
                self.buf.write(p1)
                self.flush()

                data = p2

        self.buf.write(data)
def write ( self , data ) : if self . write_hook : data = self . write_hook ( self , data ) self . total_bytes += len ( data ) self . total_rows += data . count ( "\n" ) if self . buf . tell ( ) >= self . limit : pos = data . find ( '\n' ) if pos >= 0 : # split at newline p1 = data [ : pos + 1 ] p2 = data [ pos + 1 : ] self . buf . write ( p1 ) self . flush ( ) data = p2 self . buf . write ( data )