comparison sqlpython.py @ 92:fa8c9eb8908f

accepting command-line args
author catherine@cordelia
date Sun, 25 May 2008 01:35:08 -0400
parents 83de0cb04f12
children c5f601abc993
comparison
equal deleted inserted replaced
91:51e1fe3adf0e 92:fa8c9eb8908f
44 except Exception, e: 44 except Exception, e:
45 print e 45 print e
46 46
47 def emptyline(self): 47 def emptyline(self):
48 pass 48 pass
49
50 def do_quit(self, arg):
51 return 1
52 49
53 def fail(self, arg, do_everywhere=False): 50 def fail(self, arg, do_everywhere=False):
54 if self.failover: 51 if self.failover:
55 success, result = False, '' 52 success, result = False, ''
56 for fbs in self.failoverSessions: 53 for fbs in self.failoverSessions:
116 self.default('commit %s;' % (arg), do_everywhere=True) 113 self.default('commit %s;' % (arg), do_everywhere=True)
117 def do_rollback(self, arg): 114 def do_rollback(self, arg):
118 self.default('rollback %s;' % (arg), do_everywhere=True) 115 self.default('rollback %s;' % (arg), do_everywhere=True)
119 116
120 # shortcuts 117 # shortcuts
121 do_q = do_quit 118 do_exit = cmd2.Cmd.do_quit
122 do_exit = do_quit
123 119
124 stmtEndSearchString = r'(.*)(%s)\s*(\d+)?\s*$' % terminatorSearchString 120 stmtEndSearchString = r'(.*)(%s)\s*(\d+)?\s*$' % terminatorSearchString
125 statementEndPattern = re.compile(stmtEndSearchString, re.MULTILINE | re.DOTALL) 121 statementEndPattern = re.compile(stmtEndSearchString, re.MULTILINE | re.DOTALL)
126 122
127 def pmatrix(rows,desc,maxlen=30): 123 def pmatrix(rows,desc,maxlen=30):