s-a/scream-js — Issue #1: missing scream mysql db connection
Author: s-a
Created: 2011-12-19 20:25:11+00:00
State: open

scream.db.get(sql /* string */, parms /* array */, includeMeta /* bool */ );
returns object

meta : {
cols: [{
name:'', dataType: , ...

COL_ID	TAB_NAME	COL_NAME	PKEY	NOTNULL	READONLY	DOMAIN_ID	DOMAIN_NAME	WIDTH	SCALE	MIN_VALUE	MAX_VALUE	DEFAULT	VALUE	base_table_id	base_column_id	FKEY_ID	PRIMARY_TABLE_ID	PRIMARY_COLUMN_ID	FOREIGN_TABLE_ID	FOREIGN_COLUMN_ID	FKEY_NAME	PRIMARY_TABLE_NAME	PRIMARY_COLNAME	FOREIGN_TABLE_NAME	FOREIGN_COLNAME

--> full http://saquery.com/describe-a-sql-select/ ... in mysql/mongo?
}]
},
handle: 0, /* int */
rows:[[...],[...]]

if (rows.length==1 && cols.length==1) return rows[0][0];

----

sample:

if (scream.db.get('select count() from dummy where ?=?', [1,new date()]) == 0){alert('done')}

---------------------------

scream.db.set(handle /* int */, parms /* array */) returns int (affected rows)
set uses informationation of handle to create an update on existing insert statement.