merge the formfield patch from ooo-build
[ooovba.git] / pyuno / demo / biblioaccess.py
blobac9cf64044ad1e7ef855768b60c5f0b89e838699
1 import uno
3 from com.sun.star.sdb.CommandType import COMMAND
5 def main():
7 connectionString = "socket,host=localhost,port=2002"
9 url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext"
11 localCtx = uno.getComponentContext()
12 localSmgr = localCtx.ServiceManager
13 resolver = localSmgr.createInstanceWithContext(
14 "com.sun.star.bridge.UnoUrlResolver", localCtx)
15 ctx = resolver.resolve( url )
16 smgr = ctx.ServiceManager
18 rowset =smgr.createInstanceWithContext( "com.sun.star.sdb.RowSet", ctx )
19 rowset.DataSourceName = "Bibliography"
20 rowset.CommandType = COMMAND
21 rowset.Command = "SELECT IDENTIFIER, AUTHOR FROM biblio"
23 rowset.execute();
25 print "Identifier\tAuthor"
27 id = rowset.findColumn( "IDENTIFIER" )
28 author = rowset.findColumn( "AUTHOR" )
29 while rowset.next():
30 print rowset.getString( id ) + "\t" + repr( rowset.getString( author ) )
33 rowset.dispose();
35 main()