Update of /cvsroot/monetdb/clients/src/examples/python
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14987/src/examples/python
Added Files:
Makefile.ag sqlsample.py.in
Log Message:
propagated changes of Wednesday Oct 17 2007 - Monday Oct 22 2007
from the Clients_1-20 branch to the development trunk
--- NEW FILE: Makefile.ag ---
# 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.
MTSAFE
scripts_py = {
DIR = libdir/MonetDB/Tests
SOURCES = sqlsample.py.in
}
--- NEW FILE: sqlsample.py.in ---
[EMAIL PROTECTED]@
# 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 MonetSQLdb
import sys
if len(sys.argv) > 3:
dbh =
MonetSQLdb.Connection(dbfarm=sys.argv[1],dbname=sys.argv[2],version=int(sys.argv[3]))
else:
dbh = MonetSQLdb.Connection(port=sys.argv[1],dbname=sys.argv[2])
cursor = dbh.cursor();
cursor.execute('select 1;')
print cursor.fetchall()
cursor = dbh.cursor();
cursor.execute('select 2;')
print cursor.fetchone()
# deliberately executing a wrong SQL statement:
try:
cursor.execute('( xyz 1);')
except (RuntimeError), e:
print e
cursor.execute('create table python_table (i smallint,s string);');
cursor.execute('insert into python_table values ( 3, \'three\');');
cursor.execute('insert into python_table values ( 7, \'seven\');');
cursor.execute('select * from python_table;');
print cursor.fetchall()
cursor.execute('drop table python_table;');
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins