# -*- coding: utf-8 -*-
# $Id$
"""
Copyright (C) 2012-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
The contents of this file may alternatively be used under the terms
of the Common Development and Distribution License Version 1.0
(CDDL) only, as it comes in the "COPYING.CDDL" file of the
VirtualBox OSE distribution, in which case the provisions of the
CDDL are applicable instead of those of the GPL.
You may elect to license modified versions of this file under the
terms and conditions of either the GPL or the CDDL or both.
"""
"""
Converts doxygen style comments in SQL script to COMMENT ON statements.
"""
import sys;
import re;
return 1;
"""
Class for parsing relevant comments out of a pgsql file
and emit COMMENT ON statements from it.
"""
return True;
self.sCommentSqlObj = None;
self.resetComment();
return True;
#
# New comment.
# The first list may have a @table, @type or similar that we're interested in.
#
# Ignore.
pass;
else:
#
# Append line to comment.
#
if sLine == '--':
sLine = '';
else:
else:
#
# Comment that starts on the same line as the object it describes.
#
else:
#
# Not a comment that interests us. So, complete any open
# comment and commit it if we know which SQL object it
# applies to.
#
if self.sCommentSqlObj is not None:
else:
#
# Not a comment. As above, we complete and optionally commit
# any open comment.
#
if self.sCommentSqlObj is not None:
#
# Check for SQL (very fuzzy and bad).
#
# CREATE statement.
and self.sOuterSqlObj is not None \
# Possibly a column name.
#
# Check for semicolon.
#
self.sOuterSqlObj = None;
return 0;
def usage():
'\n'
'The output goes to stdout.\n');
return 0;
# Parse the argument. :-)
sInput = None;
usage();
return 2;
# Do the job, outputting to standard output.
try:
except: