def SchemaOption(name="schema"): """Option for specifying the schema to connect to.""" return cx_OptionParser.Option( "--%s" % name, required=1, default=os.environ.get("ORA_USERID"), metavar="SCHEMA", help="use this connect string to connect to the database")
"""Define options and methods used for handling logging.""" import cx_Exceptions import cx_Logging import cx_OptionParser import locale import os import sys LOG_ENCODING = cx_OptionParser.Option( "--log-encoding", default=locale.getpreferredencoding(), metavar="ENCODING", help="the encoding to use for logging instead") LOG_FILE = cx_OptionParser.Option( "--log-file", metavar="FILE", default=os.environ.get(cx_Logging.ENV_NAME_FILE_NAME, "stderr"), help="the name of the file to log messages to or the words stdout " "or stderr") LOG_LEVEL = cx_OptionParser.Option( "--log-level", metavar="LEVEL", default=os.environ.get(cx_Logging.ENV_NAME_LEVEL, "error"), help="the level at which to log messages; one of debug (10), " "info (20), warning (30), error (40) or critical (50)") LOG_PREFIX = cx_OptionParser.Option( "--log-prefix",
""" Define common options used in describing objects. """ import cx_OptionParser import os ARRAY_SIZE = cx_OptionParser.Option("--array-size", type="int", metavar="N", help="array size is <n> rows") AS_OF_SCN = cx_OptionParser.Option( "--as-of-scn", type="int", metavar="SCN", help="system change number to use for performing a flashback query") AS_OF_TIMESTAMP = cx_OptionParser.Option( "--as-of-timestamp", metavar="TS", help="timestamp expression to use for performing a flashback query") BINARY = cx_OptionParser.Option( "--binary", action="store_true", help="the column is a BLOB (or long raw), not a CLOB (or long)") COMMIT_POINT = cx_OptionParser.Option( "--commit-point", metavar="N",
Common options. """ import cx_OptionParser import os import sys if sys.platform == "win32": defaultForPlatform = r"C:\Oracle\OracleControl.ini" else: defaultForPlatform = "/etc/oracle/OracleControl.ini" defaultConfigFileName = os.environ.get("CX_ORACLE_ADMIN", defaultForPlatform) CONFIG_FILE_NAME = cx_OptionParser.Option( "--config-file-name", metavar="FILE", default=defaultConfigFileName, help="the name of the file to read for configuration information") NO_PROMPTS = cx_OptionParser.Option( "--no-prompts", dest="prompts", default=True, action="store_false", help="do not issue any prompts and accept all defaults") NO_START = cx_OptionParser.Option( "--no-start", action="store_true", help="do not start the database if it is not already started")