On 5/25/2011 6:08 PM, Philip Semanchuk wrote:
On May 25, 2011, at 2:17 PM, Jayme Proni Filho wrote:

Helo guys,

I'm building a local application for twitter for my brother's store. I'm in
the beginning and I have some newbie problems, so:

I create a table called tb_messages with int auto increment and varchar(140)
fields;
I did three SQL funcionts, insert_tweet, delete_tweet, select_tweet

select_tweet is use for getting messages for sending them to twitter;

My problem is: How can i make my select_tweet works at the same time that
insert or delete funcions. I just got to work when I stop select function.

I would like to do my app works all the time.
Hi Jayme,
You need to provide a lot more information for us to be able to help you.
   I suspect that the original poster's problem is that he's trying to
delete items from a table while reading the results from a SELECT on
the same table.  SQL systems don't allow that.  It has the same problem
as, in Python, deleting from a dict while iterating over it.

   One way to do this properly is something like

        loop
                START TRANSACTION
                SELECT itemid, item FROM tablename WITH ...  LIMIT 1
                get one item
                if no item, break
                do whatever needs to be done with item
                DELETE FROM tablename WHERE itemid = %s
                END TRANSACTION


   Also, it sounds like he's writing a spam program for Twitter.

                                        John Nagle
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to