!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.3.29 

uname -a: Linux tardis23.nocplanet.net 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024
x86_64
 

 

Safe-mode: OFF (not secure)

/opt/alt/python37/share/doc/alt-python37-psycopg2/doc/src/tools/   drwxr-xr-x
Free 979.31 GB of 1859.98 GB (52.65%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     make_sqlstate_docs.py (1.53 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/env python
"""Create the docs table of the sqlstate errors.
"""

from __future__ import print_function

import re
import sys
from collections import namedtuple

from psycopg2._psycopg import sqlstate_errors


def main():
    sqlclasses = {}
    clsfile = sys.argv[1]
    with open(clsfile) as f:
        for l in f:
            m = re.match(r'/\* Class (..) - (.+) \*/', l)
            if m is not None:
                sqlclasses[m.group(1)] = m.group(2)

    Line = namedtuple('Line', 'colstate colexc colbase sqlstate')

    lines = [Line('SQLSTATE', 'Exception', 'Base exception', None)]
    for k in sorted(sqlstate_errors):
        exc = sqlstate_errors[k]
        lines.append(Line(
            "``%s``" % k, "`!%s`" % exc.__name__,
            "`!%s`" % get_base_exception(exc).__name__, k))

    widths = [max(len(l[c]) for l in lines) for c in range(3)]
    h = Line(*(['=' * w for w in widths] + [None]))
    lines.insert(0, h)
    lines.insert(2, h)
    lines.append(h)

    h1 = '-' * (sum(widths) + len(widths) - 1)
    sqlclass = None
    for l in lines:
        cls = l.sqlstate[:2] if l.sqlstate else None
        if cls and cls != sqlclass:
            print("**Class %s**: %s" % (cls, sqlclasses[cls]))
            print(h1)
            sqlclass = cls

        print("%-*s %-*s %-*s" % (
            widths[0], l.colstate, widths[1], l.colexc, widths[2], l.colbase))


def get_base_exception(exc):
    for cls in exc.__mro__:
        if cls.__module__ == 'psycopg2':
            return cls


if __name__ == '__main__':
    sys.exit(main())

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0226 ]--