473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1013
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom...
9
by: Mike Bridge | last post by:
I am using MS Access 2003, and I typed in a query in SQL view which was working fine. Now when I open it, it gives me the error "Join expression not supported". Apparently, Access "fixed" it for...
18
by: NickName | last post by:
The following example may further clarify the question, Select fieldA, filedB, fieldC >From tblX Where fieldD = Forms!formName!controlName What I'd like to know is how to determine or get...
4
by: Obi Wan | last post by:
I am running Visual C++ 6 SR5 on a HyperThreaded machine. From time to time the debugger will hangup, forcing a power switch reboot. It does not appear to be related to my application. I...
3
by: serge | last post by:
How do I determine which method I should use if I want to optimize the performance of a database. I took Northwind's database to run my example. My query is I want to retrieve the Employees'...
1
by: kevin | last post by:
I thought that the parse query feature in Query Analyzer simply wrapped your statement in a TRAN and then issued a ROLLBACK statement to prevent making real changes... but i just had a query parse...
9
by: JT | last post by:
I am working on a basic webpage in PHP connecting to a mySQL database, here is my query... //query 1 $query_rs_staff = "SELECT * FROM jtStaff WHERE locationID=".$_GET; $rs_staff =...
1
by: Jimmy V | last post by:
Hey all, I am writing a query builder in C# 2005 and I want to parse the query before I send it to the database. I remember being able to call a Parse or TryParse method on a DMO object or...
1
by: Vinod Sadanandan | last post by:
A Roadmap To Query Tuning ============================ For each SQL statement, there are different approaches that could be used to retrieve the required data. Optimization is the process of...
1
by: shapper | last post by:
Hi, On a form I have an input where tags are inserted in a CSV format. Then on my code I convert the CSV string to a List<Tag>. Tag is an object with two properties: TagID and Name So when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.