471,337 Members | 1,000 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

DB Query Parse Hangup

Hi There,

I have been working on this script, and the part that this issue that
I have occurs in is when iterating through some results from the db,
asking the admin input to delete the entry or not - everything works
fine up until the last entry, then it bombs out. I know why - but I am
not quite sure how to fix it:

The Code:

select_statement = "SELECT source, destination FROM mail.forwardings
WHERE destination = '%s'" % e_mail

result = db_cursor.execute(select_statement)
if result >= 1:
aliasLine = 0
number = result - 1
while aliasLine <= number:
db_cursor.execute(select_statement)
answer = db_cursor.fetchall()
answer_1 = answer[aliasLine]
aliasLine = aliasLine + 1
print '%s is still linked to %s.' % (answer_1[0], answer_1[1])
#to_edit = raw_input("Please provide one of the above mentioned E-
Mail Aliases to edit: ")
to_do = str.lower(raw_input("Would you like to Delete(D) or
Modify(M) the alias? [D/M] "))
delete = 'd'
modify = 'm'
if to_do == delete:
del_statement = "DELETE FROM forwardings WHERE source = '%s'" %
answer_1[0]
db_cursor.execute(del_statement)
print "Alias '%s', has been successfully deleted." % answer_1[0]
elif to_do == modify:
print "WILL BE MODIFIED"

any help will be much appreciated.

Thank you!
-- Merrigan
Dec 14 '07 #1
1 970
En Fri, 14 Dec 2007 13:17:32 -0300, Merrigan <ch***********@gmail.com>
escribi�:
I have been working on this script, and the part that this issue that
I have occurs in is when iterating through some results from the db,
asking the admin input to delete the entry or not - everything works
fine up until the last entry, then it bombs out. I know why - but I am
not quite sure how to fix it:
You could get some help if you explain what you mean by "it bombs out"
(the program stops with an exception? post the full traceback), and since
you know "why", telling it would be a good thing too.

--
Gabriel Genellina

Dec 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Polar | last post: by
4 posts views Thread by Obi Wan | last post: by
9 posts views Thread by JT | last post: by
1 post views Thread by Jimmy V | last post: by
1 post views Thread by shapper | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.