def _format_output(self, output):
     if output.endswith('\n'):
         output = output[:-1]
     return decode_from_system(output)
Beispiel #2
0
from robot.utils import decode_from_system

CREATION_SCRIPT = """\
CREATE TABLE libraries (id INTEGER PRIMARY KEY,
                        name TEXT,
                        arguments TEXT,
                        last_updated REAL);
CREATE TABLE keywords (name TEXT,
                       doc TEXT,
                       arguments TEXT,
                       library_name TEXT,
                       library INTEGER,
                       FOREIGN KEY(library) REFERENCES libraries(id));
"""#创建脚本

DATABASE_FILE = os.path.join(decode_from_system(SETTINGS_DIRECTORY),
                             'librarykeywords.db')  #数据库文件


def _create_database():  #创建数据库
    print 'Creating librarykeywords database to "%s"' % DATABASE_FILE

    connection = sqlite3.connect(DATABASE_FILE)
    connection.executescript(CREATION_SCRIPT)
    connection.commit()
    connection.close()


def _validate_database():  #数据库验证
    connection = sqlite3.connect(DATABASE_FILE)
    connection.execute(
Beispiel #3
0
from robot.utils import decode_from_system

CREATION_SCRIPT = """\
CREATE TABLE libraries (id INTEGER PRIMARY KEY,
                        name TEXT,
                        arguments TEXT,
                        last_updated REAL);
CREATE TABLE keywords (name TEXT,
                       doc TEXT,
                       arguments TEXT,
                       library_name TEXT,
                       library INTEGER,
                       FOREIGN KEY(library) REFERENCES libraries(id));
"""

DATABASE_FILE = os.path.join(decode_from_system(SETTINGS_DIRECTORY), 'librarykeywords.db')

def _create_database():
    print 'Creating librarykeywords database to "%s"' % DATABASE_FILE

    connection = sqlite3.connect(DATABASE_FILE)
    connection.executescript(CREATION_SCRIPT)
    connection.commit()
    connection.close()

def _validate_database():
    connection = sqlite3.connect(DATABASE_FILE)
    connection.execute('select id, name, arguments, last_updated from libraries')
    connection.execute('select name, doc, arguments, library_name, library from keywords')
    connection.close()