JSDB 1.8.0.7
New stuff
- system.stderr available for writing only
Changes
- new Stream(newfilename,"rw") creates or opens on unix
- new Stream(filename,"cw") always creates a new (truncated) file on all OSs
- I/O treats strings as ANSI. UTF-8 conversion must be made with explicit calls to encodeUTF8()/deocdeUTF8()
JSDB 1.8.0.6
New stuff
- system.wait([stream, stream, stream, server, server], timeout)
- Stream.wait(timeout) for internet streams
- Server.accept(timeout) allows an optional timeout. Returns null on timeout.
- Efficient httpd.js can run standalone or as a module
- runs "startup.js" in an attached zip file
- system.executeWait(program,args,dir) returns exit code
Bugs fixed
- Stream("com19://") works past com9. Probably. Try it.
- Internet streams set linger to 10s
- Internet streams detect disconnection with Stream.eof
- Stream.canRead and Stream.eof can detect closed connections.
- stream("com19://") works past com9 for real on Windows. Probably.
- system.exitCode and system.cwd are not read-only
- system.execute(program, args, dir) for Linux
- system.browse() runs detached (with system("foobar &")) on unix
- Server.accept() always calls JS_MaybeGC()
- Stream accepts long file names allowed in Windows (windows \\?\ escape sequence)
- system.script works
- system.exitCode works
JSDB 1.8.0.5
Bugs fixed
- Update SQLite to 3.7.7.1
- Stream("com19://") works past com9
- system.exitCode
- system.platform is Windows, OSX, Sun, LINUX, or UNIX
- eliminated loadResource, jsGC, jsTestCompile. Use system.gc() and system.resource() instead.
- system.compile acts on the current execution context
- InternetStream.canWrite() on Linux, fixed select(). I think.
- Table.get(integer) returns a JS Object for the table row.
JSDB 1.8.0.2
Bugs fixed
- encodeURL() could crash. Fixed. Debugger works again on Windows. Haven't tested Mac or Linux yet.
- Server tries harder to get a valid host name on OSX
New features
- New Stream functions: readFloat32(), writeFloat32(), readFloat64(), writeFloat64(), readDouble(), writeDouble()
- New system.remove() function to delete files or directories.
Version 1.8.0.1 - now 50x faster
New features
- JSDB now uses the TraceMonkey just-in-time (JIT) compiler, with the SpiderMonkey engine from FireFox 3.5.
- If you don't want the JIT, use the command-line option -nojit.
- The build script has been simplified, and make.js updated accordingly, for those of you who use JSDB to build JSDB from sources.
Thanks to Michael Iola for helping decipher Mozilla's configure script!
JSDB 1.8
New features
- Uses SpiderMonkey version 1.8. This is significantly faster, though the Just-in-time compiler doesn't work yet.
Bug fixed
- Record.clear() no longer crashes
Version 1.7.3.6
Bugs fixed
- Fixed a bug in SQLite.exec()
- Added "i" option for "immediate" in TCP streams. This makes it more consistent with the other Stream constructors. Backward compatible to existing code.
- system.attributes(file) returns local time, not UTC
JSDB 1.7.3.5
Bugs fixed
- crc32, encodeB64, decodeB64 now accept strings with embedded nulls
- Fixed a truncation bug in utf-8 to UCS-2 conversion, fixing some windows system call bugs like system.attributes()
- ODBC.setAutoCommit(), ODBC.commit(), ODBC.rollback()
- Improve sqlite lock contention
- JSDB detects whether it's in a CGI environment. If so, errors that stop execution will print Content-type: text/plain\n\n before the error message.
- Record.toObject(), new Record(object)
- Removed Stream::read(wchar_t*,int) for type rule changes in Visual Studio 2008. Use Stream::read(char*, int) instead.utf-8 to UCS-2 conversion can detect invalid characters and convert them as if they were ANSI characters. Many web browsers will send you ANSI quotation marks, even if you specifically request utf-8 encoding. Bah!
Special thanks to yak van KrakLog, Michael Iola, and Árgylán Nándor
Version 1.7.3.4
New * system.name is the computer name * system.script is the main script, but empty for -load * system.arguments is defined (as an empty array) for -load script.js * Matrix.inverse() in matrix.js Bug fixes * Changed how file size > 4Gb is reported by system.attributes() * Fixed a buffer overrun (non-hazardous, but annoying) in WStr() constructor. * Fixed some typos in error reporting.
JSDB 1.7.3.3
Bugs fixed * DecodeANSI was truncating * Process accessed a bad pointer on Windows. * Record(false) never worked. * SQLite updated to 3.6.16. Download from http://www.jsdb.org/download.html
JSDB 1.7.3.2
Bugs fixed - SQlite updated to 3.6.15 (fixed 64-bit alignment bug on SunOS)
- Run from Zip fixed (also accepts JAR)
Version 1.7.3.1
Bugs fixed - SQLite.escape() lost a '. Fixed.
- Source is automatically converted from UTF-8
- system.files() and system.folders() fixed on Windows
- Error message generated if you run "jsdb file.js" and file.js doesn't exist. Errorlevel 1 = file doesn't exist, 2 = can't open file.
If JSDB is being run in a server environment (checks for GATEWAY_INTERFACE=CGI/*), it prints Content-type: text/plain\nWarn: 500\n\n before the error messages.
JSDB 1.7.3.0
Big changes! Download JSDB 1.7.3.0 if you're feeling adventurous. Otherwise, stick with 1.7.2.6. JSDB is completely overhauled to fix your character set difficulties. Report your bugs to shanti@shantirao.com. Functions are either UCS-2 (Unicode) or 8-bit. Most functions accept 16-bit strings, assume they are UCS-2, and convert them to utf-8 when interacting with the operating system, and convert them back to UCS-2 for the return value. See http://www.joelonsoftware.com/articles/Unicode.html. Functions called out below (like Stream I/O) are 8-bit, and will only use the lowest 8 bits of a unicode string. There are also new Stream.read16() and Stream.write16() functions. If you get tired of writing decodeUTF8(stream.readln()), recompile JSDB by running jsdb make.js jsdb.project win32|osx|linux|sun /define JS_C_STRINGS_ARE_UTF8or make a wrapper object function UTF8Stream(stream) { this.stream = stream; this.read = function(length) {return decodeUTF8(this.stream.read(length));} this.write = function() {return this.stream.write.apply( this.stream,arguments.map(encodeUTF8));} }
Note that JavaScript's 16-bit character set is not necessarily UCS-2 or UTF-16, because it faithfully stores binary values that may not be part of the Unicode character set. The functions that convert between JavaScript strings and UTF-8 do not know about the character set, so round-trip conversions will not lose data as long as there are no null-value characters. If you're working with binary data, consider Array, Stream, or Numbers instead. - SQLite.createFunction() (Thanks, Yak!)
- Archive.compress() and Archive.uncompress() (Thanks, Argyelan!)
Bug fixes - You can change the directory with system.cwd="/home"
- SQLite updated to 3.6.14
- Fix problems to compile on 64bit
- system.files() and system.folders() understands wildcards on Unix
- Table.save(filename) works for spreadsheet tables
- Table.index(field1,field2,...) works
- ODBC.escape() leaves _ and % alone.
Character set notes - SQLite functions all accept and return unicode, but save utf-8 in the database.
- ODBC functions all accept and return unicode, but save utf-8 in the database.
- This means that SQLite.escape() and ODBC.escape() appear to operate in unicode. Conversion is done before the SQL_Exec() call.
- ODBC connection strings are 8-bit (only the lowest 8 bits of the JS string are used)
- File i/o Windows file and directory names are unicode
- UNIX file and directory names are converted to and from utf-8.
- I/O functions like read(), write(), Stream.read(), and Stream.write() are 8-bit
- The debugger converts strings to utf-8
- Numbers.toString(delimiter) is 8-bit (only the lowest 8 bits of the JS string are used)
- Mail logins are 8-bit (only the lowest 8 bits of the JS string are used), but Mail.send() automatically converts strings to utf-8.
- The Record object stores strings internally as utf-8, and converts them automatically to and from UCS-2.
- Windows registry functions are 8-bit. Sorry. That's a bug.
- system.execute() will pass parameters as Unicode, unless your program is http://xxx, which should be already utf-8 and URL-encoded
- Network addresses are 8-bit, so as to preserve utf-8 encoding without translation.
- encodeURL() converts strings to utf-8 before %-escaping.
- decodeURL() undoes whatever encodeURL did.
- encodeB64() and decodeB64() are 8-bit. If you want to encode a unicode string, use encodeB64(encodeUTF8('foobar'))
- encodeHTML() accepts Unicode and returns a 7-bit string with appropriate &-escapes.
- decodeHTML() returns a 7-bit or utf-8 input to unicode.
Upcoming Several people have asked about switching to V8 or TraceMonkey. The former lacks a working toSource() function, and the latter has too many bugs. We'll get there eventually.
Version 1.7.2.5
Bug fixes - SQLite: added lastid property
- SQLite: wait for locks for longer before giving up
- Linux: compiled without ODBC fixed
- All load() and run() functions know about and skip the shebang #! line
Version 1.7.2.4: Improvements and fixes
Warning - Changes may break existing code! If you need to read a web page in a backward-compatible way, use var s = new Stream('http://www.jsdb.org/') if (!s.header) s.header = s.readMIME() var data = s.read(s.header['Content-Length']) Bug fixes:- Safe Mode: system.status() and system.exists() are allowed in Safe Mode.
- SQLite: Fix dropped columns in sparse result sets.
- ActiveX: Replace lost CoCreateInstance() call. Sorry! This fix is also made for the 1.7.2.3 binary and sources on the Downloads page.
- Process: Works on UNIX, uses /bin/sh to run commands.
- Stream: exec:// streams work on UNIX. Use Stream.canRead to detect program termination -- the stream detects empty read() calls and flags itself as closed if waitpid() fails.
Improvements:- JS objects may be used anywhere in place of Record objects (though with a substantial efficiency hit for database transactions). I hope to phase out the Record class eventually.
- Stream: You can pass HTTP header parameters to the server (see below).
- New read-only properties system.pid and system.cwd.
- New system.getcwd() function, behaves the same as system.setcwd().
Changes:The Stream class is changed to make it easier to download web data. In this version, the code to read the contents of a web page is var s = new Stream('http://www.jsdb.org/')The response HTTP header, status code, and status text are stored in the header, status, and statusText properties of the stream, respectively. The server response is automatically de-chunked, and the header modified accordingly. If you want to use the old Stream interface, whereby you had to parse the header yourself, use var s = new Stream('http://www.jsdb.org/',1)There are occasions when you may want to send custom headers to the server. In that case, use var s = new Stream('http://www.jsdb.org/', {header-field: "header-value", ...})
If you want to send custom headers, and parse the entire HTTP response yourself, including the status reply, use var s = new Stream('http://www.jsdb.org/',0, {header-field: "header-value", ...})
Version 1.7.2.3: Bug fixes
Bug fixes: - Allow newlines in quoted strings in CSV, TSV files
- ActiveX works more reliably
- Stream.eof works for exec:// streams on Windows
For ActiveX: The handling of number data types was changed, so that integers returned from ActiveX calls that fit within 31 bits are represented as INTs, while larger integers are automatically promoted to DOUBLEs. Note that the ECMA specification says that all numbers are double-precision floating-point, but INTs may be used for storage convenience. There's still a problem that 64-bit integers can not be represented in JavaScript, but the language standards folks are working on that. Also, a few instances of redundant AddRef() and Release() calls were removed.
Version 1.7.2.2: Minor upgrade + bug fixes
Bug fixes - Changed uint64 definition in compiler.h to auto-detect 64-bit OSs
- ODBC.table() doesn't crash when returning a null set.
New functions - stream.readInt32() and stream.writeInt32()
- SQLite.tables(), odbc.keys(), odbc.columns(), odbc.escape()
- ODBC.tables(), odbc.keys(), odbc.escape()
- Updated ODBC.exec(query, callback, ...) to match SQLite.exec()
New features - In-memory FIFO streams. new Stream("fifo://")
- Cross-platform Web GUI
- Linux image is relocateable; reads argv[0] from /proc/self/exe
Version 1.7.2.1
Bug fixes - Fixed a byte order error in Stream.readTag() that affected Sparc/PPC
- Fixed a byte order error in Stream.readInt() and Stream.writeInt().
SunOS, Bug Fixes
JSDB now compiles on SunOS. Run makejsdb.sun. Bug Fixes - Table.add({field:'value', field:'value'}) works without crashing.
- Table.create() now works when field types are specified.
- On UNIX, ls *.foo no longer crashes when *.foo is not found
- Added _atoi64() to libraries for systems that don't provide it.
SQLite! Version 1.7.2
Version 1.7.2 integrates the SQLite3 engine. Here's a test: db = new SQLite("myfile.db") if (!db.exec("create table people (name varchar(32), email varchar(32));")) writeln(db.error)
db.exec("insert into people (name, email) values ('shanti','shanti@shantirao.com')")
db.exec("select * from people",writeln)
function callback(record, tableName) { writeln(tableName,' ',record.get('name')) }
db.exec("select * from people",callback,"people")
New: ODBC.table()
New function, ODBC.table('tablename') for opening read/write tables directly from an ODBC connection. SQLite coming soon.
Version 1.7
JSDB 1.7 is now available, based on the latest version of the language. - You can do cool things like multiple return values, and use the new keywords like "let". More on JS 1.7
- ActiveX handling is improved. You should be able to use VARIANT types that JavaScript doesn't understand as opaque variables without crashing.
- OSX is pre-compiled with the iODBC library
- Linux is pre-compiled without ODBC (working on that), but build scripts for unixODBC and for iODBC are included in the source
A few more fixes are in the pipeline, like making the image relocatable under Linux. Thanks for all the feedback.
Mac OS X version
I bought a Mac, and now JSDB 1.6 is available in an OS X binary! To build it yourself, use the makejsdb.osx script. There are a few gotchas in XCode 2.4.1, which this script will do for you. - Link with g++ instead of gcc
- The -s linker option doesn't work. Run strip after linking.
- XCode can't use template classes if the .h file containing the template and the .cpp file including it are in different directories. Strange, eh?
- SpiderMonkey 1.6 doesn't recognize __APPLE__ as having a built-in int64 type, so define JS_HAVE_LONG_LONG on the command line.
The web server (httpd.js) works just great! There's obviously some work yet to do. The system.openBrowser() function doesn't point to Safari. An installer package would be nifty, too.
Version 1.6.1
Bug fixes - load() fixed on Linux
- load() and run() run different functions. Run() can take a stream as a parameter
- Linux binary and build script are for ODBC. Read readme.txt for instructions on building JSDB for Linux without ODBC, say for an embedded device.
New features - Record(object) constructor
- Record.toObject() function
- Linux -- load() and resource() search path set to /etc/jsdb/
Version 1.6
New! JavaScript language version 1.6! Download and unzip JSDB for Windows or JSDB for Linux (x86).Read the Mozilla notes on the language update. Just to make life interesting, the standard download is the open-source version, compiled with gcc. This means that native Lotus Notes mail doesn't work anymore (not that anyone uses it anymore). If you need Notes, send me a message and I'll hook you up.
Version 1.51
Bugs fixed - Stream.writeInt16() and Stream.writeInt32() would sometimes reverse the byte order. Oops! Found and fixed that.
New features - Spiffy new Numbers class for implementing an array of double-precision floating-point numbers. The Numbers.exec() function is a simple RPN calculator for vector math operations.
- A new Matrix class that fits data to polynomials and solves systems of equations. Check it out! It uses Array by default, but it can also use Numbers for efficiency.
- Added Stream.readUInt16() and Stream.readUInt32().
The JavaScript language version 1.7 is coming soon. Real soon.
Version 1.5
Did you ever spend a day writing a routine, only to discover that you'd already done it a few weeks ago? Anyhow, I now understand the ANSI and Unicode character sets much better -- at least for the next few weeks. JSDB is updated with a few bug fixes. The version is changed to 1.5 - Mail.send() is more tolerant of funny recipient addresses
- decodeANSI is updated (but gives the same results)
- load() works better at finding source files and keeping track of whether it needs to re-load a modified file.
- xml.js is updated. Instead of using readXML(), use XML.read()
- make.js is updated. I think it's a pretty nifty build system.
JSDB's next release will have the JavaScript 1.7 language interpreter. Let me know if you would like: - An installer
- A web-based IDE
- A better debugger
- Large arrays of numbers
- A graphical mail client
- An AJAX toolkit
- Microsoft speech-recognition examples
Comm port
- Fixed Stream.canRead for comm ports.
- Added decodeANSI() for no particular reason.
- Fixed Stream.writeMIME() to escape embedded linefeeds.
ActiveX error reporting
Fixed a bug in ActiveX error reporting. ActiveX exceptions will now throw a string of the form ActiveX: (module.dll) Error message
Bug fixes
- readUntilBytes() added
- readUntil() now does UTF-8 conversion. If you don't want that, use readUntilBytes()
- readUntil() sometimes returned false for short searches (fixed)
- ActiveX exception strings weren't converted to UTF-8 before display.
- readline() included trailing '\r' (fixed)
Debugger updated
Bug fixes: - The command-line debugger wasn't stripping \r. Oops!
- Use AJAX with a watchdog timer to detect whether the web browser is still open. We're no longer confined to Internet Explorer for debugging.
Version 1.31
Improved file handling with system.move(). Fixed a rare variable rooting error in ActiveX.
Version 1.3 - Linux port and bug fixes
New: - JSDB compiles and runs on Linux! Download the source package and run "./makejsdb.csh".
- Not all the objects (like ActiveX and Process) are ported.
- Thanks, Marcin, for helping get this started.
Bugs fixed: - "jsdb library.zip" failed to run "main.js" in the zip file. This is fixed, and now you can also do "copy /b jsdb.exe+library.zip program.exe" to make self-running JavaScript programs. (Thanks, paradorn)
- Added js.ico to the source distribution.
Bugfix
Oops, fixed a bug in Stream.readInt16 and friends.
Version 1.2
Thanks for all the feedback, folks! Here's a new version with many improvements. - New command-line flags (read the tutorial)
- Self-executing, compressed code
- HTTP streams de-chunk by default
- Better online tutorial
- You can run zip files containing "main.js" as well as .js files on the command line.
- Stream.readInt*() can swap byte order
- Source code tidies up a bit
Outstanding bugs - Sometimes crases when accessing remote MySQL databases.
- Stream doesn't always detect closed sockets quickly.
- Image still has a brain-dead line-drawing algorithm. Any suggestions for a better graphics library?
- Raosoft has a patent-free GIF compression code, but we haven't hooked it up yet.
Minor changes
- The XML option is on by default.
- Use "jsdb -load library.js" to enter the console after running "library.js". The library can tell that it's being loaded as a library, because system.arguments will be undefined.
- "Transfer-Encoding: Chunked" getting you down? Use new Stream('http://xyz.com/',1) to have JSDB de-chunk it for you.
Version 1.1
New: "system" object. Note lower case: you can't make new ones of these. "system" is for interacting with the operating system and the interpreter. Most of these functions were globally scoped under a different name. For instance, "jsOptions()" becomes "system.options()". Note that the old functions are still available -- no changes are needed to existing code. Examples - system.debug("127.0.0.1:3345") instead of jsDebug("127.0.0.1:3345")
- system.folders() instead of listFolders()
- system.files() instead of listFiles()
Marked printReport() as deprecated. This is a holdover from EZSurvey, and better formatting functions are available now. Added system.attributes(filename)
Returns an object describing the file. { attributes: "archive,compressed,directory,hgidden,offline,readonly,sytstem,temporary", size: Number, date: Date, //last write date creation: Date //creation date } Automatic fetching of HTTP chunked.
Stream('http:/xxx/') will prefetch the HTTP headers. If "Transfer-encoding: chunked" is encountered, the entire web site will be downloaded into a memory buffer, and the headers recreated. If other Transfer-encodings were applied before "chunked", they will be preserved. Otherwise, the headers will be written into a memory buffer that is placed ahead of the network data. No changes to existing code are required.
Console features
In console mode, you have "dir", "ls", and "cd" commands. Fixed a bug where the search was for /^dir/ instead of /^dir$/. This bypasses JS and is handled by jsdb.cpp. The tests for executing a file system command (instead of passing code to the JS interpreter) are: /^dir$/ /^dir\s/ /^ls$/ /^ls\s/ /^cd\s/ /^quit$/ /^exit$/
Proposed changes
- Stream.setEndOfFile() is redundant -- Stream.truncate() does the same thing. Does anyone use the former?
- new Stream("http://jsdb.org/") doesn't help you if the server uses "Transfer-encoding: chunked". Should JSDB de-chunk the download data and modify the MIME header to make it look like a binary transfer was used instead?
- Should Stream('http://') return headers (as it does now) or skip straight to the file data? Making this change could break existing code.
- For that matter, should the Stream('http://') automatically un-B64 data, too?
Comments to shanti@shantirao.com
Fixes to Stream.read() and sleep()
Improved Stream.read() and Stream.readFile() to work with binary transfers with streams. - Stream.read() acts like Stream.readFile()
- Stream.read(length) is unchanged
- Stream.read(stream,length) acts like Stream.append()
Fixed sleep(double) All Stream functions do integer conversions (from Number/String) instead of requiring an integer parameter.
Stream.readUntil() bug
Fixed a bug in which the bypassed stream data would be truncated in Stream.readUntil() reached the end of file before encountering the target work.
Fixed a Unicode error
Was incorrectly converting some UCS-2 characters to UTF-8.
Fixed a mail bug
Fixed a bug in Mail.send(recip,subject,text,html) where it would lose the subject if the HTML note were not included. Parameters were passed in the wrong order to MailLibrary::SendDocuments(). Source code and binaries are updated today.
Improved memory management
Run JS_MaybeGC before every 1024-th RSLIB call and before any RSLIB object is created. This should keep the memory usage down. Also, the threshold for automatic garbage collection is lowered to 256*1024 objects.
Update
Fixed an error in UTF-8 to UCS-2 conversion routines.
Update for 2005
E4X is added (and turned on by default). Some Windows NT networking bugs are fixed. The version number is updated to 5.1 (2005, January).
|