On Tue, 2007-10-30 at 17:35 +, [EMAIL PROTECTED] wrote:
> it returns a number type LONG but it schould not.
Why not? You haven't explained why this is an error. If you think the
type is a problem, you're mistaken: a long is just a number. If you
think the fact that it's returning a number is
> If you want to write code that will work for all backends, you must limit
> your code to behavior that is defined in the spec. In this specific case it
> means you should call fetchall on the cursor object, not the return value of
> execute.
thanks, that did the job :)
--~--~-~--~--
On 10/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> So I have a function in views:
> #
> def getEntries(user):
> """Returns unique entries and page views for each of last 30 day
> """
> cursor = connection.cursor()
> query = cursor.execute('SELECT
it returns a number type LONG but it schould not. 1. fetchall() and
fetchrow() should do that 2. the query returns (in phpmyadmin) correct
data which is few rows not a simgle number.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
tion.cursor()
> query = cursor.execute('SELECT COUNT(DISTINCT(ip)) AS uniqs,
> COUNT(ip) AS views, date FROM pw_logs GROUP BY date LIMIT 30')
> return query.fetchall()
> #
> The query in phpMyAdmin returns the correct data. In Django-S
> What's "connection"? Is it django.db.connection?
from django.db import connection
Yes
> What're your settings? DATABASE_* and DEBUG are relevant here.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql',
'mysql', 'sqlite3' or 'ado_mssql'
= connection.cursor()
> query = cursor.execute('SELECT COUNT(DISTINCT(ip)) AS uniqs,
> COUNT(ip) AS views, date FROM pw_logs GROUP BY date LIMIT 30')
> return query.fetchall()
> #####
> The query in phpMyAdmin returns the correct data. In
) AS views, date FROM pw_logs GROUP BY date LIMIT 30')
return query.fetchall()
#
The query in phpMyAdmin returns the correct data. In Django-SVN
cursor.execute returns LONG - a number. I used SQLite yesterday with
simillar query (and others) and it worked. Now
8 matches
Mail list logo