Commit graph

8 commits

Author SHA1 Message Date
Dan Stillman
b88b767b0b Renamed DB to scholar.sqlite, since that seems to be the current fashion
Added some new core functions:

- Scholar.varDump(), after PHP's var_dump()

- Scholar.flattenArguments(), to flatten mixed array/literal argument lists into a single array

- Scholar.join() -- a version of join() that operates externally, for use on, for example, the arguments object (safer than extending Object)

- Scholar.Hash, a slightly smarter associative array -- not perfect, but brings a proper length property and a few convenience methods (and allows for other additions) -- should probably be limited to places where the length property or other additional additions are needed, since its use is a little non-standard (e.g. you have to remember to do _for (i in arr.items)_ rather than just _for (i in arr)_, to use set(), etc.)
2006-03-14 11:45:19 +00:00
Dan Stillman
50eddb05ee Lots of DB-related updates:
Moved schema file out of chrome and removed XML tags, since it will no longer be accessed by XMLHTTP

Changed schema updater to use XPCOM components rather than XMLHTTP

Converted DB class to a singleton named Scholar_DB

Scholar_DB.query() now returns associative array similar to mysql_fetch_assoc() for SELECT statements rather than a mozIStorageStatementWrapper -- the mozStorage executeDataSet() function doesn't work yet, so we do it this way

Added DB functions:

   - beginTransaction(), commitTransaction(), rollbackTransaction()
   - columnQuery() -- one column, multiple rows, returned as array indexed by row
   - getColumns() and getColumnHash

DB query functions can now handle bind parameters passed as an array of object literals: e.g. [{'int':2},{'string':'foobar'}]

valueQuery() now returns an int for COUNT(*) queries, so the result can be tested without a "0" being true

Changed _initializeSchema to drop existing tables before creating new ones, hacked with try/catch until DROP TABLE IF EXISTS works with the mozStorage extension (it's already in the latest SQLite release)

Added DB_REBUILD config flag to manually trigger schema regeneration

Added debug logging at level 5 for all SQL queries

Updated sample data
2006-03-14 11:34:17 +00:00
Dan Stillman
2a866fe3cd Added some sample data to the schema file and other assorted additions and tweaks 2006-03-14 10:57:01 +00:00
David Norton
89949042c3 Forgot to add the sidebar.js file before. :-) 2006-02-24 17:51:16 +00:00
David Norton
b0e5715c17 updated sidebar with treeView interface. 2006-02-24 17:50:24 +00:00
David Norton
686389ced5 Basic sidebar added. 2006-02-24 14:41:15 +00:00
David Norton
000378b5af 2006-02-24 14:28:04 +00:00
Dan Stillman
9f38337ec7 Initial import of repository structure, basic extension layout, and functions for DB abstraction and schema maintenance 2006-02-21 17:01:06 +00:00