Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102316

Re: Cannot step through asynchronous iterator manually

From Michael Torrie <torriem@gmail.com>
Newsgroups comp.lang.python
Subject Re: Cannot step through asynchronous iterator manually
Date 2016-01-30 15:05 -0700
Message-ID <mailman.142.1454191515.2338.python-list@python.org> (permalink)
References (1 earlier) <CALwzid=sSDSm8hdAN+ORJ54A_jEu9Wc8103iqGKAah8mrj-TXw@mail.gmail.com> <n8hrs1$orn$1@ger.gmane.org> <56AD122F.2030904@gmail.com> <CAPTjJmpGFbnOJGTQcYcFQK83HGCoH5td57J7+RpM_tsR=O3ZOA@mail.gmail.com> <56AD31E7.50407@gmail.com>

Show all headers | View raw


On 01/30/2016 02:57 PM, Michael Torrie wrote:
> SELECT count(some_id_field),field1,field2,field3 FROM wherever WHERE
> conditions
> 
> If the first column (or whatever you decide to alias it as) contains a
> count, and the rest of the information is still there.  If count is 1,
> then the row is what you want and you can do whatever you wish with it.
>  If not, throw your exception.

I'm not sure how SQLite handles it, or even what the SQL spec says, but
I know in MySQL you could do something like this:

SELECT count(id) as row_count,`tablename`.* FROM `tablename` WHERE condition

and get the same thing as SELECT * would have, with the addition of a
"row_count" field.  Note that because of the count() part, the query
will always only return 1 row. The fields will be NULL if the count was
zero or they will contain the fields from the last row the query found.
 In other words if there is more than one row that matches the query, it
will only give you data from the last match.

Now if Frank is hoping to do work on the first row and then throw an
exception if there's an additional row, then this of course won't work
for him.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Cannot step through asynchronous iterator manually Michael Torrie <torriem@gmail.com> - 2016-01-30 15:05 -0700
  Re: Cannot step through asynchronous iterator manually Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-01-31 11:50 +1300

csiph-web