I'm using isql command in python for sybase databases, isql command by default returns zero as return code if the database query has failed, I want it to return some non zero value if the query has failed so that i could i know that my query is invalid.
I looked it over on the internet, i have found that using --retserverror option with isql would solve the purpose but i'm getting some errors while using it
I'm using following python code:-
ps = subprocess.Popen("""./isql -S %s -U %s -P %s -D %s --retserverror -s "|" -w 10000 <<EOF
%s
go
EOF""" % (server,userid,password,database,Query),stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
error = ps.stderr.read()
out, err = ps.communicate()
if ps.returncode == 0:
final = out
else:
print "Error"
final = error
print final
Output:-
Syntax Error in '--retserverror'.
usage: ./isql [-b] [-e] [-F] [-p] [-n] [-v] [-X] [-Y] [-Q]
[-a display_charset] [-A packet_size] [-c cmdend] [-D database]
[-E editor [-h header [-H hostname [-i inputfile]
[-I interfaces_file] [-J client_charset] [-K keytab_file]
[-l login_timeout] [-m errorlevel] [-M labelname labelvalue]
[-o outputfile] [-P password] [-R remote_server_principal]
[-s col_separator] [-S server_name] [-t timeout] [-U username]
[-V [security_options]] [-w column_width] [-z localename]
[-Z security_mechanism]
Can anyone guide me here?