⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapiclient.py.in

📁 这个是内存数据库的客户端
💻 IN
字号:
#!@PYTHON@# The contents of this file are subject to the MonetDB Public License# Version 1.1 (the "License"); you may not use this file except in# compliance with the License. You may obtain a copy of the License at# http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html## Software distributed under the License is distributed on an "AS IS"# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the# License for the specific language governing rights and limitations# under the License.## The Original Code is the MonetDB Database System.## The Initial Developer of the Original Code is CWI.# Portions created by CWI are Copyright (C) 1997-2007 CWI.# All Rights Reserved.import sysimport ossys.path.append(os.path.join(os.environ.get('CLIENTS_PREFIX','@QXprefix@'),                             'share',                             'MonetDB',                             'python'))sys.path.append(os.path.join(os.environ.get('MONETDB_PREFIX','@QXprefix@'),                             'share',                             'MonetDB',                             'python'))import monet_optionsfrom Mapi import serverimport fileinputdef main(argv) :    cmd_options = [        ('host',None,'host','hostname','host to connect to (default: localhost)'),        ('port',None,'mapi_port','port','port to connect to (default: 50000)'),        ('user',None,'user','user','login as user (default: monetdb)'),        ('passwd',None,'passwd','passwd','password (default: monetdb)'),        ('language',None,'language','language','language (default: sql)'),        ('database',None,'database','database','database (default: "")'),        ('mapi_trace',None,'mapi_trace', None, 'mapi_trace'),        ]    try:        opt, args = monet_options.parse_options(argv[1:], cmd_options)    except monet_options.Error:        # error parsing options        sys.exit(1)    s = server(opt.get("host", "localhost"),               int(opt.get("mapi_port", 50000)),                opt.get("user", "monetdb"),                opt.get("passwd", "monetdb"),                opt.get("language", "sql"),                opt.get("database", ""),                opt.get("mapi_trace", None)!=None);     print "#MapiClient (python) connected to %s:%d as %s" % \          (opt.get("host", "localhost"),           int(opt.get("mapi_port", 50000)),           opt.get("user", "monetdb"))    #fi = fileinput.FileInput()    fi = sys.stdin    sys.stdout.write(s.prompt.encode('utf-8'))    line = fi.readline()    while line and line != "\q\n":        res = s.cmd(line)        print res        sys.stdout.write(s.prompt.encode('utf-8'))        line = fi.readline()    s.disconnect()### main(argv) #if __name__ == "__main__":    if '--trace' in sys.argv:        sys.argv.remove('--trace')        import trace        t = trace.Trace(trace=1, count=0)        t.runfunc(main, sys.argv)    else:        main(sys.argv)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -