Click here to Skip to main content
15,895,709 members
Articles / Mobile Apps

CEDB .NET

Rate me:
Please Sign up or sign in to vote.
4.38/5 (6 votes)
24 Apr 2005CPOL13 min read 87.6K   564   29  
Implementing a managed wrapper to the CEDB database engine with some C++ help.
using System;

namespace Primeworks.CeDb
{
	/// <summary>
	/// A CE property database table (a database in API terminology)
	/// </summary>
	public class CeDbTable
	{
		private CeDbVolume	m_volume;
		private string		m_strName;
		private int			m_nFlags;
		private int			m_oid		= 0;

		public CeDbTable(CeDbVolume volume, string strName, int nFlags)
		{
			m_volume	= volume;
			m_strName	= strName;
			m_nFlags	= nFlags;
		}

		public CeDbTable(CeDbVolume volume, string strName)
		{
			m_volume	= volume;
			m_strName	= strName;
			m_nFlags	= 0;
		}

		public CeDbRecordSet Open(CeDbOpenFlags flags, uint propid)
		{
			IntPtr	hTable	= IntPtr.Zero;
			CEGUID	ceguid	= m_volume.CeGuid;

			hTable = CeDbApi.CeOpenDatabaseEx(ref ceguid, ref m_oid, m_strName, propid, (uint)flags, IntPtr.Zero);
			if((int)hTable != -1)
				return new CeDbRecordSet(hTable);
			throw new CeDbException("Failed to open table");
		}

		public string Name
		{
			get { return m_strName; }
		}

		public int Flags
		{
			get { return m_nFlags; }
		}

		public int Id
		{
			get
			{
				return m_oid;
			}
		}
	}

	/// <summary>
	/// Database open flags
	/// </summary>
	public enum CeDbOpenFlags : uint
	{
		None			= 0,
		AutoIncrement	= 1
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

Comments and Discussions