

Database openDatabase(in DOMString name, 
                      in DOMString version, 
                      in DOMString displayName, 
                      in unsigned long estimatedSize) raises(DOMException);
-------------------------------------------------------------------------------

interface SQLResultSet {
    readonly attribute SQLResultSetRowList rows;
    readonly attribute int insertId
    getter raises(DOMException);
    readonly attribute int rowsAffected;
};

interface SQLResultSetRowList {
	readonly attribute unsigned long length;
	[Custom] DOMObject item(in unsigned long index);
};


class SQLResultSet : public ThreadSafeShared<SQLResultSet> {
public:
    SQLResultSet();
    SQLResultSetRowList* rows() const;
    int64_t insertId(ExceptionCode&) const;
    int rowsAffected() const;
};

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

interface Database {
    readonly attribute DOMString version;
    [Custom] void changeVersion(in DOMString oldVersion, 
                                in DOMString newVersion, 
                                in SQLTransactionCallback callback, 
                                in SQLTransactionErrorCallback errorCallback, 
                                in VoidCallback successCallback);
    [Custom] void transaction(in SQLTransactionCallback callback, 
                              in SQLTransactionErrorCallback errorCallback, 
                              in VoidCallback successCallback);
};

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

interface SQLTransaction {
    [Custom] void executeSql(in DOMString sqlStatement, 
                             in ObjectArray arguments, 
                             in SQLStatementCallback callback, 
                             in SQLStatementErrorCallback errorCallback);
};

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


interface SQLTransactionCallback {
	void handleEvent(in SQLTransaction transaction);
};

class SQLTransactionCallback : public ThreadSafeShared<SQLTransactionCallback> {
public:
    virtual ~SQLTransactionCallback() { }
    virtual void handleEvent(SQLTransaction*, bool& raisedException) = 0;
};

interface SQLTransactionErrorCallback {
    void handleEvent(in SQLError error);
};

class SQLStatementCallback : public ThreadSafeShared<SQLStatementCallback> {
public:
    virtual ~SQLStatementCallback() { }
    virtual void handleEvent(SQLTransaction*, SQLResultSet*, bool& raisedException) = 0;
};


class SQLStatementErrorCallback : public ThreadSafeShared<SQLStatementErrorCallback> {
public:
    virtual ~SQLStatementErrorCallback() { }
    virtual bool handleEvent(SQLTransaction*, SQLError*) = 0;
};

interface [CustomNativeConverter] VoidCallback {
    void handleEvent();
};

class VoidCallback : public RefCounted<VoidCallback> {
public:
    VoidCallback() { }
    virtual ~VoidCallback() { }
    virtual void handleEvent() = 0;
};
-------------------------------------------------------------------------------

interface SQLError {
	readonly attribute unsigned int code;
	readonly attribute DOMString message;
};
-------------------------------------------------------------------------------



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

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





