Exemplo n.º 1
0
IMPLEMENT_FUNCTION(database, getField)
{
	database_object* dbo = toDatabase(interpr_, this_);
	long n = ARG_LONG(0);

	if( n == -2 )
	{
		RETURN_LONG( dbo->sql->GetChangedRows() );
	}
	else if( n == -1 )
	{
		RETURN_LONG( dbo->sql->GetInsertId() );
	}
	else if( n < 0 || n >= dbo->sql->GetFieldCount() )
	{
		SEE_error_throw(interpr_, interpr_->RangeError, "bad index");
	}
	else
	{
		if( dbo->sql->IsSet( n ) )
			RETURN_STRING( dbo->sql->GetString( n ) );
		else
			RETURN_UNDEFINED;
	}
}
JSValue JSInjectedScriptHost::selectDatabase(ExecState*, const ArgList& args)
{
    if (args.size() < 1)
        return jsUndefined();

    Database* database = toDatabase(args.at(0));
    if (database)
        impl()->selectDatabase(database);
    return jsUndefined();
}
JSValue JSInjectedScriptHost::selectDatabase(ExecState* exec)
{
    if (exec->argumentCount() < 1)
        return jsUndefined();

    Database* database = toDatabase(exec->argument(0));
    if (database)
        impl()->selectDatabase(database);
    return jsUndefined();
}
Exemplo n.º 4
0
IMPLEMENT_FUNCTION(database, getFile)
{
	database_object* dbo = toDatabase(interpr_, this_);

	wxSqltDb* db = dbo->db? dbo->db : wxSqltDb::GetDefault();
	if( db )
		RETURN_STRING( db->GetFile() );
	else
		RETURN_UNDEFINED;
}
Exemplo n.º 5
0
JSValue JSInjectedScriptHost::databaseId(ExecState* exec)
{
    if (exec->argumentCount() < 1)
        return jsUndefined();
#if ENABLE(SQL_DATABASE)
    Database* database = toDatabase(exec->argument(0));
    if (database)
        return jsString(exec, impl()->databaseIdImpl(database));
#endif
    return jsUndefined();
}
JSValue JSCommandLineAPIHost::databaseId(ExecState* exec)
{
    if (exec->argumentCount() < 1)
        return jsUndefined();

#if ENABLE(SQL_DATABASE)
    Database* database = toDatabase(exec->uncheckedArgument(0));
    if (database)
        return jsStringWithCache(exec, impl().databaseIdImpl(database));
#endif

    return jsUndefined();
}
Exemplo n.º 7
0
IMPLEMENT_FUNCTION(database, getFieldCount)
{
	database_object* dbo = toDatabase(interpr_, this_);
	RETURN_LONG( dbo->sql->GetFieldCount() );
}
Exemplo n.º 8
0
IMPLEMENT_FUNCTION(database, nextRecord)
{
	database_object* dbo = toDatabase(interpr_, this_);
	RETURN_BOOL( dbo->sql->Next() );
}
Exemplo n.º 9
0
IMPLEMENT_FUNCTION(database, openQuery)
{
	database_object* dbo = toDatabase(interpr_, this_);
	RETURN_BOOL( dbo->sql->Query(ARG_STRING(0)) );
}
Exemplo n.º 10
0
IMPLEMENT_FUNCTION(database, closeQuery)
{
	database_object* dbo = toDatabase(interpr_, this_);
	dbo->sql->CloseQuery();
	RETURN_UNDEFINED;
}