Coder Social home page Coder Social logo

node_adt's Introduction

Node-ADT

New in v1.1.4: Support for Date, DateTime and NChar field types

Node ADT is a small fast library for reading Advantage Database Server database files (.ADT). It is a quick node port from the awesome rubygem by Chase Gray.

Installation

npm install node_adt

Basic Usage

    var Adt = require('node_adt');
    var adt = new Adt();

    adt.open('table.adt', 'ISO-8859-1', function(err, table) {

      console.log(table.header.recordCount);
      console.log(table.columns);

      table.eachRecord(function(err, record) {
        console.log(record.Name);
        console.log(record.Email);
      });

      table.findRecord(0, function(err, record) {
        console.log(record.Name);
      });

      table.close(); // Optional
    });

Changes in v1.0: Please note: forEach has been renamed to eachRecord

Supported ADT field types

ADT Field JavaScript
Character String
CiCharater String
NChar String
Logical Boolean
Double Number
Integer Number
ShortInteger Number
Date Date
Timestamp Date
Time String (hh:mm:ss.ss)

Not implemented

Memo, Numeric, Image, Binary, Raw, Money, ModTime, RowVersion

Limitations and known bugs

  • The rubygem has many more features than this node package, such as CSV export and an ActiveRecord-like find method.
  • ADT is read-only
  • External index files are not used

Acknowledgements

Thank you, Chase Gray, for all the hard work of figuring out how the ADT format works.

Thank you, @yortus for contributing bug fixes and support for Date, Timestamp and NChar fields types. 🎉

License

(The MIT Licence)

Copyright (c) 2010-2010 Chase Gray mailto:[email protected] Copyright (c) 2015 Albert Zak mailto:[email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node_adt's People

Contributors

albertzak avatar yortus avatar barelyknown avatar

node_adt's Issues

doc: ADT Field Types and Specifications

https://web.archive.org/web/20211205205221/http://devzone.advantagedatabase.com:80/dz/webhelp/Advantage9.0/server1/adt_field_types_and_specifications.htm

ADT Field Types and Specifications

Advantage Concepts

The following are the field data types available in ADT tables. Note that the length and format of some fields are different than their DBF table equivalents. The following data types that are available in DBF tables are not available in ADT tables: Numeric, ShortDate, General, and Picture.

Type Length Available in DBF Table Description
Character 1 to 65530 Yes Fixed-length character field that is stored entirely in the table.
CICharacter 1 to 65530 No Case insensitive fixed-length character field that is stored entirely in the table.
Date 4 Yes 4-byte integer containing a Julian date.
Logical 1 Yes 1-byte logical (boolean) field. Recognized values for True are ‘1’, ‘T’, ‘t’, ‘Y’, and ‘y’.
Memo 9 Yes Variable-length memo field containing character data. The size of each field is limited to 4 GB. The memo data is actually stored in a separate file, called a memo file, to reduce table bloat.
Double 8 VFP, Extended 8-byte IEEE floating point value in the range 1.7E +/-308 (15 digits of precision). The decimal value affects the use of the field in expressions. It does not affect the precision of the stored data. If the length is given, it will be ignored. For example, "salary, double, 10, 2" and "salary, double, 2" produce the same field.
Integer 4 VFP, Extended 4-byte long integer values from --2,147,483,647 to 2,147,483,647.
Numeric 2 to 32 (Decimal: 0 to Length-2) Yes Fixed-length (exact ASCII representation) numeric. One byte is reserved for the sign of the numeric value. If the decimal value is not zero, one additional byte is used for the decimal point.
Image 9 Extended Variable-length memo field containing binary image data. The size of each field is limited to 4 GB. The binary image data is actually stored in a separate file, called a memo file, to reduce table bloat.If using the Advantage CA-Visual Objects RDDs, Advantage Client Engine APIs must be used to set and retrieve the image data.
Binary 9 VFP, Extended Variable-length memo field containing binary data. The size of each field is limited to 4 GB. The binary data is actually stored in a separate file, called a memo file, to reduce table bloat.If using the Advantage CA-Visual Objects RDDs, Advantage Client Engine APIs must be used to set and retrieve the binary data.
ShortInteger 2 No 2-byte short integer value from -32,767 to 32,767.
Time 4 No 4-byte integer internally stored as the number of milliseconds since midnight.
TimeStamp 8 VFP 8-byte value where the high order 4 bytes are an integer containing a Julian date, and the low order 4 bytes are internally stored as the number of milliseconds since midnight. If using the Advantage CA-Visual Objects RDDs, this is a string type.
AutoIncrement 4 VFP 4-byte read-only positive integer value from 0 to 4,294,967,296 that is unique for each record in the table.
Raw 1 to 65530 No Fixed-length, data-typeless raw data field. If using the Advantage CA-Visual Objects RDDs, Advantage Client Engine APIs must be used to set and retrieve the raw data.
CurDouble 8 No Currency data stored internally as an 8-byte IEEE floating-point value in the range 1.7E +/-308 (15 digits of precision). The decimal value affects the use of the field in expressions. It does not affect the precision of the stored data. If the length is given, it will be ignored. For example, "salary, CurDouble, 10, 2" and "salary, CurDouble, 2" produce the same field.
Money 8 VFP Currency data stored internally as a 64-bit integer, with 4 implied decimal digits from -922,337,203,685,477.5807 to +922,337,203,685,477.5807. The Money data type will not lose precision.
ModTime 8 No 8-byte value where the high order 4 bytes are an integer containing a Julian date, and the low order 4 bytes are internally stored as the number of milliseconds since midnight. If using the Advantage CA-Visual Objects RDDs, this is a string type. The value of this field is automatically updated with the current date and time each time a record is updated.
RowVersion 8 No An 8-byte unsigned integer unique for each record in the table that is automatically incremented each time a record is updated.
VarChar 1 to 65000 VFP This field type allows variable length character data to be stored up to the maximum field length, which is specified when the table is created. It is similar to a character field except that the exact same data will be returned when it is read without extra blank padding on the end. If you are creating this field using the Advantage Client Engine API directly (e.g., AdsCreateTable), you must specify the type as "VarCharFox" to avoid legacy compatibility issues with an older obsolete varchar field type.
VarBinary 1 to 65000 VFP Variable length binary data. The maximum length of data that can be stored in the field is specified when the table is created. This is similar to the Raw field type except that the true length of the data is stored internally in the record.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.