The Pyrrho Database Management System

Malcolm Crowe, University of the West of Scotland


Application Programming

The following notes apply to C# programming. Visual Basic is similar, and applications can also be developed in Java and Prolog. The database connection is provided using the standard IDbConnection interface

var db = new PyrrhoConnect(connectionstring);

The connection string can be as simple as "Files=dbname". In runtimes not based on ADO.NET, such as Silverlight or WindowsPhone, the IDbConnection interface is not defined, but The PyrrhoConnect class provides a similar API, so that the following notes still apply. The function Pyrrho.PyrrhoConnect is provided in PyrrhoLink.dll or OSPLink.dll. The other runtimes are in EmbeddedPyrrho.dll, OSP.dll, SilverlightOSP.dll or PhoneOSP.dll.

The connection must be opened before it can be used:


Connections should be closed when no longer required:


An application may use this cycle many times during its operation, as connections may be opened using different roles. Uncommitted transactions are silently rolled back when the connection is closed. For other details of the IDbConnection interface, see the ADO.NET documentation. Two functions in this interface described below are CreateCommand and BeginTransaction .

As usual with ADO.NET, at most one IDataReader or PyrrhoReader can be open for any connection. Remember to close the IDataReader before calling another ExecuteReader.

For example, the following console program connects to a database Movies on the local server, and lists the TITLEs found in table MOVIE:

using System.Data;

using Pyrrho;

class Test


   public static void Main(string[] args)


IDbConnection db =

new PyrrhoConnect("Files=Movies");


IDbCommand cmd = db.CreateCommand();

cmd.CommandText = "select title from Movie";

DataReader rdr = cmd.ExecuteReader();

while (rdr.Read())






Note that SQL is not normally case sensitive. If you want SQL identifiers to be case sensitive, you will need to double-quote them, and in C# strings, the double-quote will need to be escaped.