Re: Python and 8.0 beta

Поиск
Список
Период
Сортировка
От Clodoaldo Pinto Neto
Тема Re: Python and 8.0 beta
Дата
Msg-id 20040822203320.29464.qmail@web40912.mail.yahoo.com
обсуждение исходный текст
Ответ на Python and 8.0 beta  (Tim Penhey <tim@penhey.net>)
Ответы Re: Python and 8.0 beta  (Gaetano Mendola <mendola@bigfoot.com>)
Список pgsql-general
> Are there any python drivers that work with the version 8 beta?
>
> The version seven ones didn't.

This script is working with version 7.4.2, FC2, python 2.3.3

#! /usr/bin/env python
import pgdb
db = pgdb.connect(dsn="localhost:ksDesenv")
cursor = db.cursor()
cursor.execute("select * from times()")
rsTimes = cursor.fetchall()
for lTime in rsTimes:
    i = 0
#    print str(lTime[0])
    cursor.execute("select * from usuarios_do_time(" + str(lTime[0]) +
")")
    rsMembros = cursor.fetchall()
    for lMembro in rsMembros:
        f = open('/var/www/html/kakaostats/u' + str(lMembro[0]) + '.txt',
'w')
        f.write(repr(lMembro[1]) + ';' + str(lMembro[2]) + ';' + lMembro[5] +
'\n')
        i += 1
#        print i, lTime[0], lMembro
        rank = lMembro[4]
        cursor.execute("select * from concorrentes_de_um_usuario(" +
str(lTime[0]) + "," + str(lMembro[2]) + "," + str(lMembro[3]) + "," +
str(rank) + ")")
        rsConcorrentes = cursor.fetchall()
        for lConcorrente in rsConcorrentes:
            if lMembro[2] - lMembro[3] > lConcorrente[6] - lConcorrente[7] and
lMembro[4] > lConcorrente[4]:
                rank -= 1
                rg = 'g'
            else:
                rank += 1
                rg = 'r'
            f.write(str(rank) + ";")
            for campo in lConcorrente:
                f.write(repr(campo) + ';')
            f.write(rg + '\n')
#            print rank, lConcorrente, rg
        f.close()
#        print raw_input(":")
cursor.close()
db.close()


Regards,
Clodoaldo Pinto





_______________________________________________________
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade!
http://br.acesso.yahoo.com/

В списке pgsql-general по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions on