Jorg
Our developer page has a few bits of sample code. Whilst the literature
database can be user-defined it has to be given the DataSource name
"Bibliography" for the bibliographic functions to work with it.
I have quoted a small python routine below that reads entries from the
bibliographic database.
I know very little about OOo programming but the crucial bit seems to be
setting the DataSourceName = "Bibliography" in
rowset.DataSourceName = "Bibliography"
I hope this helps. The real experts on this question are on database list so
try there if you need more technical assistance. The bibliographic project
does not have much programming skill yet.
regards
David
==
import uno
from com.sun.star.sdb.CommandType import COMMAND
def main():
connectionString = "socket,host=localhost,port=2002"
url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext"
localCtx = uno.getComponentContext()
localSmgr = localCtx.ServiceManager
resolver = localSmgr.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localCtx)
ctx = resolver.resolve( url )
smgr = ctx.ServiceManager
rowset =smgr.createInstanceWithContext( "com.sun.star.sdb.RowSet", ctx )
rowset.DataSourceName = "Bibliography"
rowset.CommandType = COMMAND
rowset.Command = "SELECT IDENTIFIER, AUTHOR FROM biblio"
rowset.execute();
print "Identifier\tAuthor"
id = rowset.findColumn( "IDENTIFIER" )
author = rowset.findColumn( "AUTHOR" )
while rowset.next():
print rowset.getString( id ) + "\t" +
repr( rowset.getString( author ) )
rowset.dispose();
main()
=
On Wednesday 13 April 2005 2:56 am, Jörg Schmidt wrote:
> Hello,
>
> I can get the names of all databases in my OOo-Application by this code:
>
> Sub datenquellenAnzeigen
> oDatenbankKontext = createUnoService _
> ( "com.sun.star.sdb.DatabaseContext" )
> aDatenquellenNamen = oDatenbankKontext.getElementNames()
> For nCounter = LBound( aDatenquellenNamen ) _
> To UBound( aDatenquellenNamen )
> oDatenquelle = oDatenbankKontext.getByName _
> ( aDatenquellenNamen(nCounter) )
> sAusgabe = sAusgabe & _
> oDatenquelle.Name & chr(13)
> Next nCounter
> msgbox sAusgabe
> End Sub
>
> works correctly, but my question is:
> How can i get the name of the specific database which is the current
> database for literature (by StarBasic-code)?
>
> What i mean is:
> On my own system the name of the literature database is "Bibliography",
> but on a unknown system the name of the literature database can be
> user-defined.
>
>
>
> greetings
>
> Jörg
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
---
David N. Wilson
Co-Project Lead for the Bibliographic
OpenOffice Project
http://bibliographic.openoffice.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]