/// <summary> /// Create an extract object with an absolute or relative file system path. This object must be closed. /// </summary> /// <param name="path"></param> public Extract(String path) { Int32 result = API.TabExtractCreate(out m_Handle, path); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Sets a column in this row to the specified integer value. /// </summary> /// <param name="columnNumber"></param> /// <param name="value"></param> public void SetInteger(Int32 columnNumber, Int32 value) { Int32 result = API.TabRowSetInteger(m_Handle, columnNumber, value); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Queue a row for insertion; may perform insert of buffered rows. /// </summary> /// <param name="row"></param> public void Insert(Row row) { Int32 result = API.TabTableInsert(m_Handle, row.Handle); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Sets a column in this row to the specified duration value. /// </summary> /// <param name="columnNumber"></param> /// <param name="day"></param> /// <param name="hour"></param> /// <param name="min"></param> /// <param name="sec"></param> /// <param name="frac"></param> public void SetDuration(Int32 columnNumber, Int32 day, Int32 hour, Int32 min, Int32 sec, Int32 frac) { Int32 result = API.TabRowSetDuration(m_Handle, columnNumber, day, hour, min, sec, frac); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Create an empty row with the specified schema. /// </summary> /// <param name="tableDefinition"></param> public Row(TableDefinition tableDefinition) { Int32 result = API.TabRowCreate(out m_Handle, tableDefinition.Handle); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Sets a column in this row to the specified date value. /// </summary> /// <param name="columnNumber"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="day"></param> public void SetDate(Int32 columnNumber, Int32 year, Int32 month, Int32 day) { Int32 result = API.TabRowSetDate(m_Handle, columnNumber, year, month, day); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Sets the default collation for added string columns. /// </summary> /// <param name="collation"></param> public void SetDefaultCollation(Collation collation) { Int32 result = API.TabTableDefinitionSetDefaultCollation(m_Handle, ConvertEnum.ToCollation(collation)); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Adds a column with a specific collation. /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="collation"></param> public void AddColumnWithCollation(String name, Type type, Collation collation) { Int32 result = API.TabTableDefinitionAddColumnWithCollation(m_Handle, name, ConvertEnum.ToType(type), ConvertEnum.ToCollation(collation)); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } }
/// <summary> /// Creates and adds table to the extract /// </summary> /// <param name="name"></param> /// <param name="tableDefinition"></param> /// <returns></returns> public Table AddTable(String name, TableDefinition tableDefinition) { IntPtr retval; Int32 result = API.TabExtractAddTable(m_Handle, name, tableDefinition.Handle, out retval); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } return(new Table(retval)); }
/// <summary> /// Gets the current default collation; if unspecified, default is binary. /// </summary> /// <returns></returns> public Collation GetDefaultCollation() { Int32 retval; Int32 result = API.TabTableDefinitionGetDefaultCollation(m_Handle, out retval); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } return(ConvertEnum.FromCollation(retval)); }
/// <summary> /// Gives the type of the column. /// </summary> /// <param name="columnNumber"></param> /// <returns></returns> public Type GetColumnType(Int32 columnNumber) { Int32 retval; Int32 result = API.TabTableDefinitionGetColumnType(m_Handle, columnNumber, out retval); if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } return(ConvertEnum.FromType(retval)); }
/// <summary> /// Closes the extract and any open tables. /// </summary> public void Close() { if (m_Handle != IntPtr.Zero) { int result = API.TabExtractClose(m_Handle); m_Handle = IntPtr.Zero; if (result != API.TAB_RESULT_Success) { throw new TableauException(ConvertEnum.FromResult(result), API.TabGetLastErrorMessage()); } } }