From ef96fb881c096ef9f80ab087c5fb08026ede3c4a Mon Sep 17 00:00:00 2001 From: dsandersoremutah Date: Thu, 21 Sep 2006 23:20:01 +0000 Subject: [PATCH] Added DataVector class to C# code, along with some unit tests. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@898 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- xflaim/csharp/cstest/cstest.cs | 98 ++++ xflaim/csharp/xflaim/DOMNode.cs | 17 + xflaim/csharp/xflaim/DataVector.cpp | 425 ++++++++++++++ xflaim/csharp/xflaim/DataVector.cs | 863 ++++++++++++++++++++++++++++ xflaim/csharp/xflaim/DbSystem.cpp | 34 ++ xflaim/csharp/xflaim/DbSystem.cs | 174 +++--- 6 files changed, 1544 insertions(+), 67 deletions(-) create mode 100644 xflaim/csharp/xflaim/DataVector.cpp create mode 100644 xflaim/csharp/xflaim/DataVector.cs diff --git a/xflaim/csharp/cstest/cstest.cs b/xflaim/csharp/cstest/cstest.cs index 72713c7..16bdbb4 100644 --- a/xflaim/csharp/cstest/cstest.cs +++ b/xflaim/csharp/cstest/cstest.cs @@ -541,6 +541,97 @@ namespace cstest return( true); } + //-------------------------------------------------------------------------- + // Vector tests + //-------------------------------------------------------------------------- + static bool vectorTests( + DbSystem dbSystem) + { + DataVector v; + byte [] b = new byte [] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + byte [] b2; + bool bDataSame; + + beginTest( "Creating DataVector"); + try + { + v = dbSystem.createDataVector(); + } + catch (XFlaimException ex) + { + endTest( false, ex, "calling createDataVector"); + return( false); + } + endTest( false, true); + + + + beginTest( "Setting binary data"); + try + { + v.setBinary( 0, b); + } + catch (XFlaimException ex) + { + endTest( false, ex, "calling setBinary"); + return( false); + } + endTest( false, true); + + beginTest( "Getting binary data"); + try + { + b2 = v.getBinary( 0); + } + catch (XFlaimException ex) + { + endTest( false, ex, "calling getBinary"); + return( false); + } + endTest( false, true); + + + beginTest( "Comparing set data to get data"); + + bDataSame = true; + if (b.Length != b2.Length) + { + bDataSame = false; + } + else + { + for( uint uiLoop = 0; uiLoop < b.Length; uiLoop++) + { + if (b [uiLoop] != b2 [uiLoop]) + { + bDataSame = false; + break; + } + } + } + if (!bDataSame) + { + endTest( false, false); + System.Console.WriteLine( "Set data does not match get data"); + System.Console.Write( "Set Data Length: {0}\n[", b.Length); + for( uint uiLoop = 0; uiLoop < b.Length; uiLoop++) + { + System.Console.Write( "{0} ", b[uiLoop]); + } + System.Console.WriteLine( "]"); + System.Console.Write( "Get Data Length: {0}\n[", b2.Length); + for( uint uiLoop = 0; uiLoop < b2.Length; uiLoop++) + { + System.Console.Write( "{0} ", b2[uiLoop]); + } + System.Console.WriteLine( "]"); + return( false); + } + + endTest( false, true); + return( true); + } + //-------------------------------------------------------------------------- // Main for tester program //-------------------------------------------------------------------------- @@ -653,6 +744,13 @@ namespace cstest { return; } + + // Data vector tests + + if (!vectorTests( dbSystem)) + { + return; + } } } diff --git a/xflaim/csharp/xflaim/DOMNode.cs b/xflaim/csharp/xflaim/DOMNode.cs index 80666c0..0fa834e 100644 --- a/xflaim/csharp/xflaim/DOMNode.cs +++ b/xflaim/csharp/xflaim/DOMNode.cs @@ -29,6 +29,23 @@ using System.Runtime.InteropServices; namespace xflaim { + /// + /// Data types supported in an XFLAIM database. + /// IMPORTANT NOTE: These should be kept in sync with data types defined + /// in xflaim.h + /// + public enum FlmDataType : int + { + /// No data may be stored with a node of this type + XFLM_NODATA_TYPE = 0, + /// String data - UTF8 - unicode 16 supported + XFLM_TEXT_TYPE = 1, + /// Integer numbers - 64 bit signed and unsigned supported + XFLM_NUMBER_TYPE = 2, + /// Binary data + XFLM_BINARY_TYPE = 3 + } + /// /// DOM Node types /// diff --git a/xflaim/csharp/xflaim/DataVector.cpp b/xflaim/csharp/xflaim/DataVector.cpp new file mode 100644 index 0000000..011dae5 --- /dev/null +++ b/xflaim/csharp/xflaim/DataVector.cpp @@ -0,0 +1,425 @@ +//------------------------------------------------------------------------------ +// Desc: Native C routines to support C# DataVector class +// +// Tabs: 3 +// +// Copyright (c) 2006 Novell, Inc. All Rights Reserved. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the GNU General Public +// License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, contact Novell, Inc. +// +// To contact Novell about this file by physical or electronic mail, +// you may find current contact information at www.novell.com +// +// $Id$ +//------------------------------------------------------------------------------ + +#include "xflaim.h" + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_Release( + FLMUINT64 ui64This) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + if (pDataVector) + { + pDataVector->Release(); + } +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_setDocumentID( + FLMUINT64 ui64This, + FLMUINT64 ui64DocumentID) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + pDataVector->setDocumentID( ui64DocumentID); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setID( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT64 ui64ID) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setID( (FLMUINT)ui32ElementNumber, ui64ID)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setNameId( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT32 ui32NameId, + FLMBOOL bIsAttr, + FLMBOOL bIsData) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setNameId( (FLMUINT)ui32ElementNumber, + (FLMUINT)ui32NameId, bIsAttr, bIsData)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setULong( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT64 ui64Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setUINT64( (FLMUINT)ui32ElementNumber, ui64Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setLong( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMINT64 i64Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setINT64( (FLMUINT)ui32ElementNumber, i64Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setUInt( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT32 ui32Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setUINT( (FLMUINT)ui32ElementNumber, (FLMUINT)ui32Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setInt( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMINT32 i32Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setINT( (FLMUINT)ui32ElementNumber, (FLMINT)i32Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setString( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + const FLMUNICODE * puzValue) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setUnicode( (FLMUINT)ui32ElementNumber, puzValue)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_setBinary( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + const void * pvValue, + FLMUINT32 ui32Len) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->setBinary( (FLMUINT)ui32ElementNumber, pvValue, (FLMUINT)ui32Len)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_setRightTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + pDataVector->setRightTruncated( (FLMUINT)ui32ElementNumber); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_setLeftTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + pDataVector->setLeftTruncated( (FLMUINT)ui32ElementNumber); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_clearRightTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + pDataVector->clearRightTruncated( (FLMUINT)ui32ElementNumber); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DataVector_clearLeftTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + pDataVector->clearLeftTruncated( (FLMUINT)ui32ElementNumber); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMBOOL FLMAPI xflaim_DataVector_isRightTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->isRightTruncated( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMBOOL FLMAPI xflaim_DataVector_isLeftTruncated( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->isLeftTruncated( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMUINT64 FLMAPI xflaim_DataVector_getDocumentID( + FLMUINT64 ui64This) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->getDocumentID()); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMUINT64 FLMAPI xflaim_DataVector_getID( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->getID( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMUINT32 FLMAPI xflaim_DataVector_getNameId( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( (FLMUINT32)pDataVector->getNameId( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMBOOL FLMAPI xflaim_DataVector_isAttr( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->isAttr( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMBOOL FLMAPI xflaim_DataVector_isDataComponent( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->isDataComponent( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMBOOL FLMAPI xflaim_DataVector_isKeyComponent( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->isKeyComponent( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMUINT32 FLMAPI xflaim_DataVector_getDataLength( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( (FLMUINT32)pDataVector->getDataLength( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP FLMINT32 FLMAPI xflaim_DataVector_getDataType( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( (FLMINT32)pDataVector->getDataType( (FLMUINT)ui32ElementNumber)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getULong( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT64 * pui64Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->getUINT64( (FLMUINT)ui32ElementNumber, pui64Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getLong( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMINT64 * pi64Value) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->getINT64( (FLMUINT)ui32ElementNumber, pi64Value)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getUInt( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT32 * pui32Value) +{ + RCODE rc; + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + FLMUINT uiValue; + + rc = pDataVector->getUINT( (FLMUINT)ui32ElementNumber, &uiValue); + *pui32Value = (FLMUINT32)uiValue; + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getInt( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMINT32 * pi32Value) +{ + RCODE rc; + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + FLMINT iValue; + + rc = pDataVector->getINT( (FLMUINT)ui32ElementNumber, &iValue); + *pi32Value = (FLMINT32)iValue; + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getString( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUNICODE ** ppuzValue) +{ + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + + return( pDataVector->getUnicode( (FLMUINT)ui32ElementNumber, ppuzValue)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DataVector_getBinary( + FLMUINT64 ui64This, + FLMUINT32 ui32ElementNumber, + FLMUINT32 ui32Len, + void * pvValue) +{ + RCODE rc = NE_XFLM_OK; + IF_DataVector * pDataVector = ((IF_DataVector *)(FLMUINT)ui64This); + FLMUINT uiLength = (FLMUINT)ui32Len; + + if (RC_BAD( rc = pDataVector->getBinary( (FLMUINT)ui32ElementNumber, + pvValue, &uiLength))) + { + goto Exit; + } + flmAssert( uiLength == (FLMUINT)ui32Len); + +Exit: + + return( rc); +} diff --git a/xflaim/csharp/xflaim/DataVector.cs b/xflaim/csharp/xflaim/DataVector.cs new file mode 100644 index 0000000..f665b1a --- /dev/null +++ b/xflaim/csharp/xflaim/DataVector.cs @@ -0,0 +1,863 @@ +//------------------------------------------------------------------------------ +// Desc: Data Vector Class +// +// Tabs: 3 +// +// Copyright (c) 2006 Novell, Inc. All Rights Reserved. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the GNU General Public +// License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, contact Novell, Inc. +// +// To contact Novell about this file by physical or electronic mail, +// you may find current contact information at www.novell.com +// +// $Id$ +//------------------------------------------------------------------------------ +using System; +using System.Runtime.InteropServices; + +namespace xflaim +{ + + /// + /// The DataVector class provides a number of methods that allow C# + /// applications to access data vector object in unmanaged space. A + /// DataVector object is obtained by calling . + /// + public class DataVector + { + private ulong m_pDataVector; // Pointer to IF_DataVector object in unmanaged space + private DbSystem m_dbSystem; + + /// + /// Db constructor. + /// + /// + /// Reference to an IF_Db object. + /// + /// + /// DbSystem object that this Db object is associated with. + /// + internal DataVector( + ulong pDataVector, + DbSystem dbSystem) + { + if (pDataVector == 0) + { + throw new XFlaimException( "Invalid IF_DataVector reference"); + } + + m_pDataVector = pDataVector; + + if (dbSystem == null) + { + throw new XFlaimException( "Invalid DbSystem reference"); + } + + m_dbSystem = dbSystem; + + // Must call something inside of DbSystem. Otherwise, the + // m_dbSystem object gets a compiler warning on linux because + // it is not used anywhere. Other than that, there is really + // no need to make the following call. + if (m_dbSystem.getDbSystem() == 0) + { + throw new XFlaimException( "Invalid DbSystem.IF_DbSystem object"); + } + } + + /// + /// Destructor. + /// + ~DataVector() + { + close(); + } + + /// + /// Return the pointer to the IF_DataVector object. + /// + /// Returns a pointer to the IF_DataVector object. + internal ulong getDataVector() + { + return( m_pDataVector); + } + + /// + /// Close this data vector object. + /// + public void close() + { + // Release the native pDataVector! + + if (m_pDataVector != 0) + { + xflaim_DataVector_Release( m_pDataVector); + m_pDataVector = 0; + } + + // Remove our reference to the dbSystem so it can be released. + + m_dbSystem = null; + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_Release( + ulong pDataVector); + +//----------------------------------------------------------------------------- +// setDocumentID +//----------------------------------------------------------------------------- + + /// + /// Set the document ID a data vector is associated with. + /// + /// + /// Docment ID. + /// + public void setDocumentID( + ulong ulDocId) + { + xflaim_DataVector_setDocumentID( m_pDataVector, ulDocId); + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_setDocumentID( + ulong pDataVector, + ulong ulDocId); + +//----------------------------------------------------------------------------- +// setID +//----------------------------------------------------------------------------- + + /// + /// Set the ID for a particular element in a data vector. + /// + /// + /// Element number whose ID is to be set. + /// + /// + /// ID to be set for the element. This is generally a node ID. + /// + public void setID( + uint uiElementNumber, + ulong ulID) + { + RCODE rc; + if ((rc = xflaim_DataVector_setID( m_pDataVector, uiElementNumber, ulID)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setID( + ulong pDataVector, + uint uiElementNumber, + ulong ulID); + +//----------------------------------------------------------------------------- +// setNameId +//----------------------------------------------------------------------------- + + /// + /// Set the name ID for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Name Id to be set + /// Flag that specifies whether the value is an attribute + /// Flag that specifies whether the value is a data component + public void setNameId( + uint uiElementNumber, + uint uiNameId, + bool bIsAttr, + bool bIsData) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setNameId( m_pDataVector, + uiElementNumber, uiNameId, (int)(bIsAttr ? 1 : 0), + (int)(bIsData ? 1 : 0))) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setNameId( + ulong pDataVector, + uint uiElementNumber, + uint uiNameId, + int bIsAttr, + int bIsData); + +//----------------------------------------------------------------------------- +// setULong +//----------------------------------------------------------------------------- + + /// + /// Set an unsigned long value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setULong( + uint uiElementNumber, + ulong ulValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setULong( m_pDataVector, + uiElementNumber, ulValue)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setULong( + ulong pDataVector, + uint uiElementNumber, + ulong ulValue); + +//----------------------------------------------------------------------------- +// setLong +//----------------------------------------------------------------------------- + + /// + /// Set a long value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setLong( + uint uiElementNumber, + long lValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setLong( m_pDataVector, + uiElementNumber, lValue)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setLong( + ulong pDataVector, + uint uiElementNumber, + long lValue); + +//----------------------------------------------------------------------------- +// setUInt +//----------------------------------------------------------------------------- + + /// + /// Set an unsigned int value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setUInt( + uint uiElementNumber, + uint uiValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setUInt( m_pDataVector, + uiElementNumber, uiValue)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setUInt( + ulong pDataVector, + uint uiElementNumber, + uint uiValue); + +//----------------------------------------------------------------------------- +// setInt +//----------------------------------------------------------------------------- + + /// + /// Set an int value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setInt( + uint uiElementNumber, + int iValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setInt( m_pDataVector, + uiElementNumber, iValue)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setInt( + ulong pDataVector, + uint uiElementNumber, + int iValue); + +//----------------------------------------------------------------------------- +// setString +//----------------------------------------------------------------------------- + + /// + /// Set a string value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setString( + uint uiElementNumber, + string sValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setString( m_pDataVector, + uiElementNumber, sValue)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setString( + ulong pDataVector, + uint uiElementNumber, + [MarshalAs(UnmanagedType.LPWStr)] + string sValue); + +//----------------------------------------------------------------------------- +// setBinary +//----------------------------------------------------------------------------- + + /// + /// Set a binary value for the specified element in the data vector. + /// + /// Element number whose value is to be set + /// Value to be set + public void setBinary( + uint uiElementNumber, + byte [] pvValue) + { + RCODE rc; + + if ((rc = xflaim_DataVector_setBinary( m_pDataVector, + uiElementNumber, pvValue, (uint)pvValue.Length)) != 0) + { + throw new XFlaimException( rc); + } + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_setBinary( + ulong pDataVector, + uint uiElementNumber, + [MarshalAs(UnmanagedType.LPArray), In] + byte [] pvValue, + uint uiLen); + +//----------------------------------------------------------------------------- +// setRightTruncated +//----------------------------------------------------------------------------- + + /// + /// Set the right truncated flag for the specified element in the vector. + /// + /// Element whose right truncation flag is to be set + public void setRightTruncated( + uint uiElementNumber) + { + xflaim_DataVector_setRightTruncated( m_pDataVector, uiElementNumber); + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_setRightTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// setLeftTruncated +//----------------------------------------------------------------------------- + + /// + /// Set the left truncated flag for the specified element in the vector. + /// + /// Element whose left truncation flag is to be set + public void setLeftTruncated( + uint uiElementNumber) + { + xflaim_DataVector_setLeftTruncated( m_pDataVector, uiElementNumber); + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_setLeftTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// clearRightTruncated +//----------------------------------------------------------------------------- + + /// + /// Clear the right truncated flag for the specified element in the vector. + /// + /// Element whose right truncation flag is to be cleared + public void clearRightTruncated( + uint uiElementNumber) + { + xflaim_DataVector_clearRightTruncated( m_pDataVector, uiElementNumber); + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_clearRightTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// clearLeftTruncated +//----------------------------------------------------------------------------- + + /// + /// Clear the left truncated flag for the specified element in the vector. + /// + /// Element whose left truncation flag is to be cleared + public void clearLeftTruncated( + uint uiElementNumber) + { + xflaim_DataVector_clearLeftTruncated( m_pDataVector, uiElementNumber); + } + + [DllImport("xflaim")] + private static extern void xflaim_DataVector_clearLeftTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// isRightTruncated +//----------------------------------------------------------------------------- + + /// + /// Determine if the right truncated flag for the specified element in the vector is set. + /// + /// Element to be tested + /// + /// Returns a flag indicating whether the specified element's right truncation flag is set. + /// + public bool isRightTruncated( + uint uiElementNumber) + { + return( xflaim_DataVector_isRightTruncated( m_pDataVector, uiElementNumber) != 0 ? true : false); + } + + [DllImport("xflaim")] + private static extern int xflaim_DataVector_isRightTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// isLeftTruncated +//----------------------------------------------------------------------------- + + /// + /// Determine if the left truncated flag for the specified element in the vector is set. + /// + /// Element to be tested + /// + /// Returns a flag indicating whether the specified element's left truncation flag is set. + /// + public bool isLeftTruncated( + uint uiElementNumber) + { + return( xflaim_DataVector_isLeftTruncated( m_pDataVector, uiElementNumber) != 0 ? true : false); + } + + [DllImport("xflaim")] + private static extern int xflaim_DataVector_isLeftTruncated( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// getDocumentID +//----------------------------------------------------------------------------- + + /// + /// Get the document ID associated with the data vector. + /// + /// + /// Document ID for the data vector. + /// + public ulong getDocumentID() + { + return( xflaim_DataVector_getDocumentID( m_pDataVector)); + } + + [DllImport("xflaim")] + private static extern ulong xflaim_DataVector_getDocumentID( + ulong pDataVector); + +//----------------------------------------------------------------------------- +// getID +//----------------------------------------------------------------------------- + + /// + /// Get the ID associated with the specified element in the data vector. + /// + /// Element number whose ID is to be returned. + /// + /// ID for the specified element in the data vector. + /// + public ulong getID( + uint uiElementNumber) + { + return( xflaim_DataVector_getID( m_pDataVector, uiElementNumber)); + } + + [DllImport("xflaim")] + private static extern ulong xflaim_DataVector_getID( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// getNameId +//----------------------------------------------------------------------------- + + /// + /// Get the name ID associated with the specified element in the data vector. + /// + /// Element number whose name ID is to be returned. + /// + /// Name ID for the specified element in the data vector. + /// + public uint getNameId( + uint uiElementNumber) + { + return( xflaim_DataVector_getNameId( m_pDataVector, uiElementNumber)); + } + + [DllImport("xflaim")] + private static extern uint xflaim_DataVector_getNameId( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// isAttr +//----------------------------------------------------------------------------- + + /// + /// Determine if the specified element in the data vector is an attribute. + /// + /// Element number to be tested. + /// + /// Flag indicating whether the specified element in the data vector is an attribute. + /// + public bool isAttr( + uint uiElementNumber) + { + return( xflaim_DataVector_isAttr( m_pDataVector, uiElementNumber) != 0 ? true : false); + } + + [DllImport("xflaim")] + private static extern int xflaim_DataVector_isAttr( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// isDataComponent +//----------------------------------------------------------------------------- + + /// + /// Determine if the specified element in the data vector is a data component. + /// + /// Element number to be tested. + /// + /// Flag indicating whether the specified element in the data vector is a data component. + /// + public bool isDataComponent( + uint uiElementNumber) + { + return( xflaim_DataVector_isDataComponent( m_pDataVector, uiElementNumber) != 0 ? true : false); + } + + [DllImport("xflaim")] + private static extern int xflaim_DataVector_isDataComponent( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// isKeyComponent +//----------------------------------------------------------------------------- + + /// + /// Determine if the specified element in the data vector is a key component. + /// + /// Element number to be tested. + /// + /// Flag indicating whether the specified element in the data vector is a key component. + /// + public bool isKeyComponent( + uint uiElementNumber) + { + return( xflaim_DataVector_isKeyComponent( m_pDataVector, uiElementNumber) != 0 ? true : false); + } + + [DllImport("xflaim")] + private static extern int xflaim_DataVector_isKeyComponent( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// getDataLength +//----------------------------------------------------------------------------- + + /// + /// Get the length of the data that is stored in the specified element in the data vector. + /// + /// Element number whose data length is to be returned. + /// + /// Length of data in the specified element. + /// + public uint getDataLength( + uint uiElementNumber) + { + return( xflaim_DataVector_getDataLength( m_pDataVector, uiElementNumber)); + } + + [DllImport("xflaim")] + private static extern uint xflaim_DataVector_getDataLength( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// getDataType +//----------------------------------------------------------------------------- + + /// + /// Get the type of the data that is stored in the specified element in the data vector. + /// + /// Element number whose data type is to be returned. + /// + /// Type of data in the specified element. + /// + public FlmDataType getDataType( + uint uiElementNumber) + { + return( xflaim_DataVector_getDataType( m_pDataVector, uiElementNumber)); + } + + [DllImport("xflaim")] + private static extern FlmDataType xflaim_DataVector_getDataType( + ulong pDataVector, + uint uiElementNumber); + +//----------------------------------------------------------------------------- +// getULong +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as an unsigned + /// long value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as an unsigned long. + /// + public ulong getULong( + uint uiElementNumber) + { + RCODE rc; + ulong ulValue; + + if ((rc = xflaim_DataVector_getULong( m_pDataVector, uiElementNumber, out ulValue)) != 0) + { + throw new XFlaimException( rc); + } + return( ulValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getULong( + ulong pDataVector, + uint uiElementNumber, + out ulong pulValue); + +//----------------------------------------------------------------------------- +// getLong +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as a + /// long value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as a long. + /// + public long getLong( + uint uiElementNumber) + { + RCODE rc; + long lValue; + + if ((rc = xflaim_DataVector_getLong( m_pDataVector, uiElementNumber, out lValue)) != 0) + { + throw new XFlaimException( rc); + } + return( lValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getLong( + ulong pDataVector, + uint uiElementNumber, + out long plValue); + +//----------------------------------------------------------------------------- +// getUInt +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as an unsigned + /// int value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as an unsigned int. + /// + public uint getUInt( + uint uiElementNumber) + { + RCODE rc; + uint uiValue; + + if ((rc = xflaim_DataVector_getUInt( m_pDataVector, uiElementNumber, out uiValue)) != 0) + { + throw new XFlaimException( rc); + } + return( uiValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getUInt( + ulong pDataVector, + uint uiElementNumber, + out uint puiValue); + +//----------------------------------------------------------------------------- +// getInt +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as a signed + /// int value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as a signed int. + /// + public int getInt( + uint uiElementNumber) + { + RCODE rc; + int iValue; + + if ((rc = xflaim_DataVector_getInt( m_pDataVector, uiElementNumber, out iValue)) != 0) + { + throw new XFlaimException( rc); + } + return( iValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getInt( + ulong pDataVector, + uint uiElementNumber, + out int piValue); + +//----------------------------------------------------------------------------- +// getString +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as a string + /// value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as a string. + /// + public string getString( + uint uiElementNumber) + { + RCODE rc; + IntPtr pValue; + string sValue; + + if ((rc = xflaim_DataVector_getString( m_pDataVector, uiElementNumber, out pValue)) != 0) + { + throw new XFlaimException( rc); + } + sValue = Marshal.PtrToStringUni( pValue); + m_dbSystem.freeUnmanagedMem( pValue); + return( sValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getString( + ulong pDataVector, + uint uiElementNumber, + out IntPtr pValue); + +//----------------------------------------------------------------------------- +// getBinary +//----------------------------------------------------------------------------- + + /// + /// Get the data in the specified element in the data vector as a byte array + /// value. + /// + /// Element number whose value is to be returned. + /// + /// Element's value is returned as a byte array. + /// + public byte [] getBinary( + uint uiElementNumber) + { + RCODE rc; + byte [] pvValue = null; + uint uiLen = xflaim_DataVector_getDataLength( m_pDataVector, uiElementNumber); + + pvValue = new byte [uiLen]; + + if ((rc = xflaim_DataVector_getBinary( m_pDataVector, uiElementNumber, + uiLen, pvValue)) != 0) + { + throw new XFlaimException( rc); + } + return( pvValue); + } + + [DllImport("xflaim")] + private static extern RCODE xflaim_DataVector_getBinary( + ulong pDataVector, + uint uiElementNumber, + uint uiLen, + [MarshalAs(UnmanagedType.LPArray), Out] + byte [] pvValue); + + } +} diff --git a/xflaim/csharp/xflaim/DbSystem.cpp b/xflaim/csharp/xflaim/DbSystem.cpp index 3dc5e9c..d46e3f3 100644 --- a/xflaim/csharp/xflaim/DbSystem.cpp +++ b/xflaim/csharp/xflaim/DbSystem.cpp @@ -1433,3 +1433,37 @@ FLMEXTC FLMEXP RCODE FLMAPI xflaim_DbSystem_writeToOStream( return( pDbSystem->writeToOStream( pIStream, pOStream)); } + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP RCODE FLMAPI xflaim_DbSystem_createDataVector( + FLMUINT64 ui64This, + FLMUINT64 * pui64DataVector) +{ + RCODE rc = NE_XFLM_OK; + IF_DataVector * pDataVector = NULL; + IF_DbSystem * pDbSystem = (IF_DbSystem *)((FLMUINT)ui64This); + + if (RC_BAD( rc = pDbSystem->createIFDataVector( &pDataVector))) + { + goto Exit; + } + +Exit: + + *pui64DataVector = (FLMUINT64)((FLMUINT)pDataVector); + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +FLMEXTC FLMEXP void FLMAPI xflaim_DbSystem_freeUnmanagedMem( + FLMUINT64 ui64This, + void * pvMem) +{ + IF_DbSystem * pDbSystem = ((IF_DbSystem *)(FLMUINT)ui64This); + + pDbSystem->freeMem( &pvMem); +} diff --git a/xflaim/csharp/xflaim/DbSystem.cs b/xflaim/csharp/xflaim/DbSystem.cs index ee67bfa..b013db4 100644 --- a/xflaim/csharp/xflaim/DbSystem.cs +++ b/xflaim/csharp/xflaim/DbSystem.cs @@ -293,9 +293,9 @@ namespace xflaim return m_pDbSystem; } -//----------------------------------------------------------------------------- -// dbCreate -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbCreate + //----------------------------------------------------------------------------- /// /// Creates a new XFlaim database. @@ -375,9 +375,9 @@ namespace xflaim XFLM_CREATE_OPTS pCreateOpts, out ulong ppDb); -//----------------------------------------------------------------------------- -// dbOpen -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbOpen + //----------------------------------------------------------------------------- /// /// Opens an existing XFlaim database. @@ -434,9 +434,9 @@ namespace xflaim int bAllowLimited, out ulong ppDb); -//----------------------------------------------------------------------------- -// dbRemove -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbRemove + //----------------------------------------------------------------------------- /// /// Removes (deletes) an XFlaim database. @@ -480,9 +480,9 @@ namespace xflaim string pszRflDir, int bRemoveRflFiles); -//----------------------------------------------------------------------------- -// dbRestore -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbRestore + //----------------------------------------------------------------------------- /// /// Restores a previously backed up database. The parameter @@ -793,9 +793,9 @@ namespace xflaim private RestoreStatus m_restoreStatus; } -//----------------------------------------------------------------------------- -// dbCheck -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbCheck + //----------------------------------------------------------------------------- /// /// Check for physical and logical corruptions on the specified database. @@ -896,13 +896,13 @@ namespace xflaim { rc = m_dbCheckStatus.reportProgress( (XFLM_PROGRESS_CHECK_INFO)Marshal.PtrToStructure( pProgressInfo, - typeof( XFLM_PROGRESS_CHECK_INFO))); + typeof( XFLM_PROGRESS_CHECK_INFO))); } else { rc = m_dbCheckStatus.reportCheckErr( (XFLM_CORRUPT_INFO)Marshal.PtrToStructure( pCorruptInfo, - typeof( XFLM_CORRUPT_INFO))); + typeof( XFLM_CORRUPT_INFO))); } return( rc); } @@ -910,9 +910,9 @@ namespace xflaim private DbCheckStatus m_dbCheckStatus; } -//----------------------------------------------------------------------------- -// dbCopy -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbCopy + //----------------------------------------------------------------------------- /// /// Makes a copy of an existing database. @@ -1028,9 +1028,9 @@ namespace xflaim private DbCopyStatus m_dbCopyStatus; } -//----------------------------------------------------------------------------- -// dbRename -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbRename + //----------------------------------------------------------------------------- /// /// Rename a database. @@ -1121,9 +1121,9 @@ namespace xflaim private DbRenameStatus m_dbRenameStatus; } -//----------------------------------------------------------------------------- -// dbRebuild -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // dbRebuild + //----------------------------------------------------------------------------- /// /// Rebuild a database. @@ -1255,9 +1255,9 @@ namespace xflaim private DbRebuildStatus m_dbRebuildStatus; } -//----------------------------------------------------------------------------- -// openBufferIStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openBufferIStream + //----------------------------------------------------------------------------- /// /// Open an input stream that reads from a string buffer. @@ -1288,9 +1288,9 @@ namespace xflaim string pszBuffer, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openFileIStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openFileIStream + //----------------------------------------------------------------------------- /// /// Open an input stream that reads from a file. @@ -1322,9 +1322,9 @@ namespace xflaim string pszFileName, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openMultiFileIStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openMultiFileIStream + //----------------------------------------------------------------------------- /// /// Open an input stream that reads from multiple files. @@ -1349,7 +1349,7 @@ namespace xflaim ulong pIStream = 0; if ((rc = xflaim_DbSystem_openMultiFileIStream( m_pDbSystem, sDirectory, - sBaseName, out pIStream)) != 0) + sBaseName, out pIStream)) != 0) { throw new XFlaimException( rc); } @@ -1365,9 +1365,9 @@ namespace xflaim string pszBaseName, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openBufferedIStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openBufferedIStream + //----------------------------------------------------------------------------- /// /// Open an input stream that buffers an existing input stream. @@ -1393,7 +1393,7 @@ namespace xflaim ulong pIStream = 0; if ((rc = xflaim_DbSystem_openBufferedIStream( m_pDbSystem, - inputIStream.getIStream(), uiBufferSize, out pIStream)) != 0) + inputIStream.getIStream(), uiBufferSize, out pIStream)) != 0) { throw new XFlaimException( rc); } @@ -1407,9 +1407,9 @@ namespace xflaim uint uiBufferSize, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openUncompressingIStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openUncompressingIStream + //----------------------------------------------------------------------------- /// /// Open an input stream that decompresses data from another input stream. It @@ -1442,9 +1442,9 @@ namespace xflaim ulong pInputIStream, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openBase64Encoder -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openBase64Encoder + //----------------------------------------------------------------------------- /// /// Open an input stream that encodes data from another input stream into @@ -1485,9 +1485,9 @@ namespace xflaim int bInsertLineBreaks, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openBase64Decoder -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openBase64Decoder + //----------------------------------------------------------------------------- /// /// Open an input stream that decodes data from another input stream. It is @@ -1522,9 +1522,9 @@ namespace xflaim ulong pInputIStream, out ulong ppIStream); -//----------------------------------------------------------------------------- -// openFileOStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openFileOStream + //----------------------------------------------------------------------------- /// /// Open an output stream that writes data to a file. @@ -1564,9 +1564,9 @@ namespace xflaim int bTruncateIfExists, out ulong ppOStream); -//----------------------------------------------------------------------------- -// openMultiFileOStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openMultiFileOStream + //----------------------------------------------------------------------------- /// /// Open a multi-file output stream. Data is written to one or more files. @@ -1619,9 +1619,9 @@ namespace xflaim int bOkToOverwrite, out ulong ppOStream); -//----------------------------------------------------------------------------- -// removeMultiFileStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // removeMultiFileStream + //----------------------------------------------------------------------------- /// /// Remove a multi-file output stream from disk. @@ -1655,9 +1655,9 @@ namespace xflaim [MarshalAs(UnmanagedType.LPStr)] string sBaseName); -//----------------------------------------------------------------------------- -// openBufferedOStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openBufferedOStream + //----------------------------------------------------------------------------- /// /// Open a buffered output stream. A buffer is allocated for writing data to @@ -1700,9 +1700,9 @@ namespace xflaim uint uiBufferSize, out ulong ppOStream); -//----------------------------------------------------------------------------- -// openCompressingOStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // openCompressingOStream + //----------------------------------------------------------------------------- /// /// Open a compressing output stream. Data is compressed before writing it @@ -1736,9 +1736,9 @@ namespace xflaim ulong pInputOStream, out ulong ppOStream); -//----------------------------------------------------------------------------- -// writeToOStream -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // writeToOStream + //----------------------------------------------------------------------------- /// /// Read data from an input stream and write it out to an output stream. This @@ -1768,5 +1768,45 @@ namespace xflaim ulong pDbSystem, ulong pIStream, ulong pOStream); + +//----------------------------------------------------------------------------- +// createDataVector +//----------------------------------------------------------------------------- + + /// + /// Create a object. + /// + /// Returns a objecdt + public DataVector createDataVector() + { + RCODE rc; + ulong pDataVector; + + if ((rc = xflaim_DbSystem_createDataVector( m_pDbSystem, out pDataVector)) != 0) + { + throw new XFlaimException( rc); + } + return( new DataVector( pDataVector, this)); + } + + [DllImport("xflaim",CharSet=CharSet.Ansi)] + private static extern RCODE xflaim_DbSystem_createDataVector( + ulong pDbSystem, + out ulong ppDataVector); + +//----------------------------------------------------------------------------- +// freeUnmanagedMem +//----------------------------------------------------------------------------- + + internal void freeUnmanagedMem( + IntPtr pMem) + { + xflaim_DbSystem_freeUnmanagedMem( m_pDbSystem, pMem); + } + + [DllImport("xflaim")] + private static extern void xflaim_DbSystem_freeUnmanagedMem( + ulong pDbSystem, + IntPtr pMem); } }