void init_xhrHelper_object() { HandleScope scope; JSOBJT o = ObjectTemplate::New(); o->Set(String::New("request"), FunctionTemplate::New(request)); builtinObject->Set(String::New("xhrHelper"), o); }
void init_popen_object () { HandleScope scope; JSOBJT popenObject = ObjectTemplate::New(); popenObject->Set(String::New("open"), FunctionTemplate::New(popen_open)); popenObject->Set(String::New("gets"), FunctionTemplate::New(popen_gets)); popenObject->Set(String::New("puts"), FunctionTemplate::New(popen_puts)); popenObject->Set(String::New("close"), FunctionTemplate::New(popen_close)); builtinObject->Set(String::New("popen"), popenObject); }
void init_sqlite3_object() { HandleScope scope; JSOBJT o = ObjectTemplate::New(); // open flags o->Set(String::New("OPEN_READONLY"), Integer::New(SQLITE_OPEN_READONLY)); o->Set(String::New("OPEN_READWRITENLY"), Integer::New(SQLITE_OPEN_READWRITE)); o->Set(String::New("OPEN_CREATE"), Integer::New(SQLITE_OPEN_CREATE)); o->Set(String::New("SQLITE_OPEN_DELETEONCLOSE"), Integer::New(SQLITE_OPEN_DELETEONCLOSE)); o->Set(String::New("SQLITE_OPEN_EXCLUSIVE"), Integer::New(SQLITE_OPEN_EXCLUSIVE)); #ifdef SQLITE_OPEN_AUTOPROXY o->Set(String::New("SQLITE_OPEN_AUTOPROXY"), Integer::New(SQLITE_OPEN_AUTOPROXY)); #endif #ifdef SQLITE_OPEN_URI o->Set(String::New("SQLITE_OPEN_URI"), Integer::New(SQLITE_OPEN_URI)); #endif o->Set(String::New("SQLITE_OPEN_MAIN_DB"), Integer::New(SQLITE_OPEN_MAIN_DB)); o->Set(String::New("SQLITE_OPEN_TEMP_DB"), Integer::New(SQLITE_OPEN_TEMP_DB)); o->Set(String::New("SQLITE_OPEN_TRANSIENT_DB"), Integer::New(SQLITE_OPEN_TRANSIENT_DB)); o->Set(String::New("SQLITE_OPEN_MAIN_JOURNAL"), Integer::New(SQLITE_OPEN_MAIN_JOURNAL)); o->Set(String::New("SQLITE_OPEN_TEMP_JOURNAL"), Integer::New(SQLITE_OPEN_TEMP_JOURNAL)); o->Set(String::New("SQLITE_OPEN_SUBJOURNAL"), Integer::New(SQLITE_OPEN_SUBJOURNAL)); o->Set(String::New("SQLITE_OPEN_MASTER_JOURNAL"), Integer::New(SQLITE_OPEN_MASTER_JOURNAL)); o->Set(String::New("OPEN_NOMUTEX"), Integer::New(SQLITE_OPEN_NOMUTEX)); o->Set(String::New("OPEN_FULLMUTEX"), Integer::New(SQLITE_OPEN_FULLMUTEX)); #ifdef SQLITE_OPEN_SHAREDCACHE o->Set(String::New("OPEN_SHAREDCACHE"), Integer::New(SQLITE_OPEN_SHAREDCACHE)); #endif #ifdef SQLITE_OPEN_PRIVATECACHE o->Set(String::New("OPEN_PRIVATECACHE"), Integer::New(SQLITE_OPEN_PRIVATECACHE)); #endif #ifdef SQLITE_OPEN_WAL o->Set(String::New("OPEN_WAL"), Integer::New(SQLITE_OPEN_WAL)); #endif // Result Codes o->Set(String::New("OK"), Integer::New(SQLITE_OK)); o->Set(String::New("ERROR"), Integer::New(SQLITE_ERROR)); o->Set(String::New("IGNORE"), Integer::New(SQLITE_ERROR)); o->Set(String::New("INTERNAL"), Integer::New(SQLITE_INTERNAL)); o->Set(String::New("PERM"), Integer::New(SQLITE_PERM)); o->Set(String::New("ABORT"), Integer::New(SQLITE_ABORT)); o->Set(String::New("BUSY"), Integer::New(SQLITE_BUSY)); o->Set(String::New("LOCKED"), Integer::New(SQLITE_LOCKED)); o->Set(String::New("NOMEM"), Integer::New(SQLITE_NOMEM)); o->Set(String::New("READONLY"), Integer::New(SQLITE_READONLY)); o->Set(String::New("INTERRUPT"), Integer::New(SQLITE_INTERRUPT)); o->Set(String::New("IOERR"), Integer::New(SQLITE_IOERR)); o->Set(String::New("CORRUPT"), Integer::New(SQLITE_CORRUPT)); o->Set(String::New("NOTFOUND"), Integer::New(SQLITE_NOTFOUND)); o->Set(String::New("FULL"), Integer::New(SQLITE_FULL)); o->Set(String::New("CANTOPEN"), Integer::New(SQLITE_CANTOPEN)); o->Set(String::New("PROTOCOL"), Integer::New(SQLITE_PROTOCOL)); o->Set(String::New("EMPTY"), Integer::New(SQLITE_EMPTY)); o->Set(String::New("SCHEMA"), Integer::New(SQLITE_SCHEMA)); o->Set(String::New("TOOBIG"), Integer::New(SQLITE_TOOBIG)); o->Set(String::New("CONSTRAINT"), Integer::New(SQLITE_CONSTRAINT)); o->Set(String::New("MISMATCH"), Integer::New(SQLITE_MISMATCH)); o->Set(String::New("MISUSE"), Integer::New(SQLITE_MISUSE)); o->Set(String::New("NOLFS"), Integer::New(SQLITE_NOLFS)); o->Set(String::New("AUTH"), Integer::New(SQLITE_AUTH)); o->Set(String::New("FORMAT"), Integer::New(SQLITE_FORMAT)); o->Set(String::New("RANGE"), Integer::New(SQLITE_RANGE)); o->Set(String::New("NOTADB"), Integer::New(SQLITE_NOTADB)); o->Set(String::New("ROW"), Integer::New(SQLITE_ROW)); o->Set(String::New("DONE"), Integer::New(SQLITE_DONE)); // Extended Result Codes o->Set(String::New("IOERR_READ"), Integer::New(SQLITE_IOERR_READ)); o->Set(String::New("IOERR_SHORT_READ"), Integer::New(SQLITE_IOERR_SHORT_READ)); o->Set(String::New("IOERR_WRITE"), Integer::New(SQLITE_IOERR_WRITE)); o->Set(String::New("IOERR_FSYNC"), Integer::New(SQLITE_IOERR_FSYNC)); o->Set(String::New("IOERR_DIR_FSYNC"), Integer::New(SQLITE_IOERR_DIR_FSYNC)); o->Set(String::New("IOERR_TRUNCATE"), Integer::New(SQLITE_IOERR_TRUNCATE)); o->Set(String::New("IOERR_FSTAT"), Integer::New(SQLITE_IOERR_FSTAT)); o->Set(String::New("IOERR_UNLOCK"), Integer::New(SQLITE_IOERR_UNLOCK)); o->Set(String::New("IOERR_RDLOCK"), Integer::New(SQLITE_IOERR_RDLOCK)); o->Set(String::New("IOERR_DELETE"), Integer::New(SQLITE_IOERR_DELETE)); o->Set(String::New("IOERR_BLOCKED"), Integer::New(SQLITE_IOERR_BLOCKED)); o->Set(String::New("IOERR_NOMEM"), Integer::New(SQLITE_IOERR_NOMEM)); o->Set(String::New("IOERR_ACCESS"), Integer::New(SQLITE_IOERR_ACCESS)); o->Set(String::New("IOERR_CHECKRESERVEDLOCK"), Integer::New(SQLITE_IOERR_CHECKRESERVEDLOCK)); o->Set(String::New("IOERR_LOCK"), Integer::New(SQLITE_IOERR_LOCK)); o->Set(String::New("IOERR_CLOSE"), Integer::New(SQLITE_IOERR_CLOSE)); o->Set(String::New("IOERR_DIR_CLOSE"), Integer::New(SQLITE_IOERR_DIR_CLOSE)); #ifdef SQLITE_IOERR_SHMOPEN o->Set(String::New("IOERR_SHMOPEN"), Integer::New(SQLITE_IOERR_SHMOPEN)); #endif #ifdef SQLITE_IOERR_SHMSIZE o->Set(String::New("IOERR_SHMSIZE"), Integer::New(SQLITE_IOERR_SHMSIZE)); #endif #ifdef SQLITE_IOERR_SHMLOCK o->Set(String::New("IOERR_SHMLOCK"), Integer::New(SQLITE_IOERR_SHMLOCK)); #endif #ifdef SQLITE_IOERR_SHMMAP o->Set(String::New("IOERR_SHMMAP"), Integer::New(SQLITE_IOERR_SHMMAP)); #endif #ifdef SQLITE_IOERR_SEEK o->Set(String::New("IOERR_SEEK"), Integer::New(SQLITE_IOERR_SEEK)); #endif o->Set(String::New("LOCKED_SHAREDCACHE"), Integer::New(SQLITE_LOCKED_SHAREDCACHE)); #ifdef SQLITE_BUSY_RECOVERY o->Set(String::New("BUSY_RECOVERY"), Integer::New(SQLITE_BUSY_RECOVERY)); #endif #ifdef SQLITE_CANTOPEN_NOTEMPDIR o->Set(String::New("CANTOPEN_NOTEMPDIR"), Integer::New(SQLITE_CANTOPEN_NOTEMPDIR)); #endif #ifdef SQLITE_CORRUPT_VTAB o->Set(String::New("CORRUPT_VTAB"), Integer::New(SQLITE_CORRUPT_VTAB)); #endif #ifdef SQLITE_READONLY_RECOVERY o->Set(String::New("READONLY_RECOVERY"), Integer::New(SQLITE_READONLY_RECOVERY)); #endif #ifdef SQLITE_READONLY_CANTLOCK o->Set(String::New("READONLY_CANTLOCK"), Integer::New(SQLITE_READONLY_CANTLOCK)); #endif // fundamental data types o->Set(String::New("INTEGER"), Integer::New(SQLITE_INTEGER)); o->Set(String::New("FLOAT"), Integer::New(SQLITE_FLOAT)); o->Set(String::New("BLOB"), Integer::New(SQLITE_BLOB)); o->Set(String::New("NULL"), Integer::New(SQLITE_NULL)); o->Set(String::New("TEXT"), Integer::New(SQLITE_TEXT)); // functions o->Set(String::New("open"), FunctionTemplate::New(sqlite_open)); o->Set(String::New("open16"), FunctionTemplate::New(sqlite_open16)); o->Set(String::New("open_v2"), FunctionTemplate::New(sqlite_open_v2)); o->Set(String::New("extended_result_codes"), FunctionTemplate::New(sqlite_extended_result_codes)); o->Set(String::New("errcode"), FunctionTemplate::New(sqlite_errcode)); o->Set(String::New("extended_errcode"), FunctionTemplate::New(sqlite_extended_errcode)); o->Set(String::New("errmsg"), FunctionTemplate::New(sqlite_errmsg)); o->Set(String::New("errmsg16"), FunctionTemplate::New(sqlite_errmsg16)); o->Set(String::New("prepare"), FunctionTemplate::New(sqlite_prepare)); o->Set(String::New("prepare_v2"), FunctionTemplate::New(sqlite_prepare_v2)); o->Set(String::New("prepare16"), FunctionTemplate::New(sqlite_prepare16)); o->Set(String::New("prepare16_v2"), FunctionTemplate::New(sqlite_prepare16_v2)); o->Set(String::New("close"), FunctionTemplate::New(sqlite_close)); o->Set(String::New("finalize"), FunctionTemplate::New(sqlite_finalize)); o->Set(String::New("reset"), FunctionTemplate::New(sqlite_reset)); o->Set(String::New("step"), FunctionTemplate::New(sqlite_step)); o->Set(String::New("column_count"), FunctionTemplate::New(sqlite_column_count)); o->Set(String::New("data_count"), FunctionTemplate::New(sqlite_data_count)); o->Set(String::New("column_type"), FunctionTemplate::New(sqlite_column_type)); o->Set(String::New("column_bytes"), FunctionTemplate::New(sqlite_column_bytes)); o->Set(String::New("column_bytes16"), FunctionTemplate::New(sqlite_column_bytes16)); o->Set(String::New("column_blob"), FunctionTemplate::New(sqlite_column_blob)); o->Set(String::New("column_blob64"), FunctionTemplate::New(sqlite_column_blob64)); o->Set(String::New("column_double"), FunctionTemplate::New(sqlite_column_double)); o->Set(String::New("column_int"), FunctionTemplate::New(sqlite_column_int)); o->Set(String::New("column_int64"), FunctionTemplate::New(sqlite_column_int64)); o->Set(String::New("column_text"), FunctionTemplate::New(sqlite_column_text)); o->Set(String::New("column_text16"), FunctionTemplate::New(sqlite_column_text16)); o->Set(String::New("column_value"), FunctionTemplate::New(sqlite_column_value)); builtinObject->Set(String::New("sqlite3"), o); }
extern "C" JSOBJ getExports() { JSOBJT o = ObjectTemplate::New(); o->Set(String::New("REPLY_STRING"), Integer::New(REDIS_REPLY_STRING)); o->Set(String::New("REPLY_ARRAY"), Integer::New(REDIS_REPLY_ARRAY)); o->Set(String::New("REPLY_INTEGER"), Integer::New(REDIS_REPLY_INTEGER)); o->Set(String::New("REPLY_NIL"), Integer::New(REDIS_REPLY_NIL)); o->Set(String::New("REPLY_STATUS"), Integer::New(REDIS_REPLY_STATUS)); o->Set(String::New("REPLY_ERROR"), Integer::New(REDIS_REPLY_ERROR)); o->Set(String::New("connect"), FunctionTemplate::New(connect)); o->Set(String::New("close"), FunctionTemplate::New(close)); o->Set(String::New("query"), FunctionTemplate::New(query)); o->Set(String::New("command"), FunctionTemplate::New(command)); o->Set(String::New("freeReply"), FunctionTemplate::New(freeReply)); o->Set(String::New("getType"), FunctionTemplate::New(getType)); o->Set(String::New("getInteger"), FunctionTemplate::New(getInteger)); o->Set(String::New("getString"), FunctionTemplate::New(getString)); o->Set(String::New("getElements"), FunctionTemplate::New(getElements)); o->Set(String::New("getElement"), FunctionTemplate::New(getElement)); return o->NewInstance(); }
void init_mysql_object() { HandleScope scope; // const char *server_options[] = { "mysql_test", "--defaults-file=my.cnf", NULL }; // int num_elements = (sizeof(server_options) / sizeof(char *)) - 1; // const char *server_groups[] = { "libmysqld_server", "libmysqld_client", NULL }; // mysql_library_init(num_elements, (char **)server_options, (char **)server_groups); // handle = mysql_init(NULL); // my_bool reconnect = 1; // mysql_options(handle, MYSQL_OPT_RECONNECT, &reconnect); // unsigned long timeout = 15; // mysql_options(handle, MYSQL_OPT_READ_TIMEOUT, &timeout); // mysql_options(handle, MYSQL_OPT_WRITE_TIMEOUT, &timeout); // mysql_options(handle, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); // handle = mysql_real_connect(handle, "localhost", "mschwartz", "", "sim", 3306, NULL, 0); JSOBJT o = ObjectTemplate::New(); o->Set(String::New("connect"), FunctionTemplate::New(connect)); o->Set(String::New("selectDb"), FunctionTemplate::New(select_db)); o->Set(String::New("getDataRows"), FunctionTemplate::New(getDataRows)); o->Set(String::New("getDataRowsJson"), FunctionTemplate::New(getDataRowsJson)); o->Set(String::New("getDataRow"), FunctionTemplate::New(getDataRow)); o->Set(String::New("getScalar"), FunctionTemplate::New(getScalar)); o->Set(String::New("update"), FunctionTemplate::New(update)); o->Set(String::New("affected_rows"), FunctionTemplate::New(affected_rows)); o->Set(String::New("autocommit"), FunctionTemplate::New(autocommit)); o->Set(String::New("change_user"), FunctionTemplate::New(change_user)); o->Set(String::New("character_set_name"), FunctionTemplate::New(character_set_name)); o->Set(String::New("close"), FunctionTemplate::New(close)); o->Set(String::New("commit"), FunctionTemplate::New(commit)); o->Set(String::New("data_seek"), FunctionTemplate::New(data_seek)); o->Set(String::New("errno"), FunctionTemplate::New(errno)); o->Set(String::New("error"), FunctionTemplate::New(error)); o->Set(String::New("fetch_field"), FunctionTemplate::New(fetch_field)); o->Set(String::New("fetch_field_direct"), FunctionTemplate::New(fetch_field_direct)); o->Set(String::New("fetch_fields"), FunctionTemplate::New(fetch_fields)); o->Set(String::New("fetch_lengths"), FunctionTemplate::New(fetch_lengths)); o->Set(String::New("fetch_row"), FunctionTemplate::New(fetch_row)); o->Set(String::New("field_count"), FunctionTemplate::New(field_count)); o->Set(String::New("field_seek"), FunctionTemplate::New(field_seek)); o->Set(String::New("field_tell"), FunctionTemplate::New(field_tell)); o->Set(String::New("free_result"), FunctionTemplate::New(free_result)); o->Set(String::New("get_character_set_info"), FunctionTemplate::New(get_character_set_info)); o->Set(String::New("get_client_info"), FunctionTemplate::New(get_client_info)); o->Set(String::New("get_client_version"), FunctionTemplate::New(get_client_version)); o->Set(String::New("get_host_info"), FunctionTemplate::New(get_host_info)); o->Set(String::New("get_proto_info"), FunctionTemplate::New(get_proto_info)); o->Set(String::New("get_server_info"), FunctionTemplate::New(get_server_info)); o->Set(String::New("get_server_version"), FunctionTemplate::New(get_server_version)); o->Set(String::New("info"), FunctionTemplate::New(info)); o->Set(String::New("init"), FunctionTemplate::New(init)); o->Set(String::New("insert_id"), FunctionTemplate::New(insert_id)); o->Set(String::New("kill"), FunctionTemplate::New(kill)); o->Set(String::New("list_dbs"), FunctionTemplate::New(list_dbs)); o->Set(String::New("list_fields"), FunctionTemplate::New(list_fields)); o->Set(String::New("list_processes"), FunctionTemplate::New(list_processes)); o->Set(String::New("list_tables"), FunctionTemplate::New(list_tables)); o->Set(String::New("store_result"), FunctionTemplate::New(store_result)); o->Set(String::New("real_connect"), FunctionTemplate::New(real_connect)); o->Set(String::New("query"), FunctionTemplate::New(query)); globalObject->Set(String::New("mysql"), o); }