Trees | Indices | Help |
---|
|
1 # 2 # Copyright (c) 2008--2015 Red Hat, Inc. 3 # 4 # This software is licensed to you under the GNU General Public License, 5 # version 2 (GPLv2). There is NO WARRANTY for this software, express or 6 # implied, including the implied warranties of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 8 # along with this software; if not, see 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 10 # 11 # Red Hat trademarks are not licensed under GPLv2. No permission is 12 # granted to use or replicate Red Hat trademarks that are incorporated 13 # in this software or its documentation. 14 # 15 # This file implements teh Sequence class 16 # 17 18 from spacewalk.common.rhnException import rhnException 19 20 import sql_base 21 22 23 # A class to handle sequences 24 # XXX: this is still Oracle specific, but it shouldn't be264928 if not seq or not isinstance(seq, str): 29 raise rhnException("First argument needs to be a sequence name", seq) 30 self.__seq = seq 31 if not isinstance(db, sql_base.Database): 32 raise rhnException("Argument db is not a database instance", db) 33 self.__db = db3436 sql = "select sequence_nextval('%s') as ID from dual" % self.__seq 37 cursor = self.__db.prepare(sql) 38 cursor.execute() 39 ret = cursor.fetchone_dict() 40 if ret is None: # how the hell can this happen? 41 return ret 42 return int(ret['id'])4345 return self.next()46
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:49 2020 | http://epydoc.sourceforge.net |