How do I correctly use applescript 2.3 script library "use" rather than "tell" When I use my library this way applescript will not parse the display dialog line, treating dialog as an identifier!

Can anyone explain why this is not being understood in the way I want it to be? Many thanks!
** UPDATE ** Both the scripts below will now compile and work properly

use myLib : script "IHDatabase" -- the name of the library
-- UPDATE -- See also my answer below 
use scripting additions
-- UPDATE -- without the above statement this script will not compile
set db to IHDatabase of myLib at "~/Desktop/TestDB.db" 
-- IHDatabase handler returns an IHDB script object
tell db
    add_sql("drop table if exists testtable;")
    add_sql("create table testtable (firstname, lastname, country);")
    add_sql("insert into testtable values('Ray', 'Barber', 'USA');")
    add_sql("insert into testtable values('jj', 'Sancho', 'Spain');")
    add_sql("insert into testtable values('Adam', 'Bell', 'Canada');")
    add_sql("insert into testtable values('Bruce', 'Phillips', 'USA');")
    add_sql("insert into testtable values('Kim', 'Hunter', 'USA');")
    add_sql("insert into testtable values('Kevin', 'Bradley', 'USA');")
    add_sql("select * from testtable;") -- columns are separated by pipes ("|") in the result.
    set testtable_result to run_sql()
    log testtable_result &amp; return &amp; return
    set title to "So far, the table contents are: " &amp; return &amp; return
    display dialog title &amp; testtable_result buttons {"Done"} default button 1 with icon 1
end tell


But if I write it like this, with an extra level of tell nesting, it works OK:

tell script "IHDatabase" -- the name of the library
    set db to IHDatabase at "~/Desktop/TestDB.db" 
    -- IHDatabase handler returns an IHDB script object
    tell db
        add_sql("drop table if exists testtable;")
        add_sql("create table testtable (firstname, lastname, country);")
        add_sql("insert into testtable values('Ray', 'Barber', 'USA');")
        add_sql("insert into testtable values('jj', 'Sancho', 'Spain');")
        add_sql("insert into testtable values('Adam', 'Bell', 'Canada');")
        add_sql("insert into testtable values('Bruce', 'Phillips', 'USA');")
        add_sql("insert into testtable values('Kim', 'Hunter', 'USA');")
        add_sql("insert into testtable values('Kevin', 'Bradley', 'USA');")
        add_sql("select * from testtable;") -- columns are separated by pipes ("|") in the result.
        set testtable_result to run_sql()
        log testtable_result &amp; return &amp; return
        set title to "So far, the table contents are: " &amp; return &amp; return
        display dialog title &amp; testtable_result buttons {"Done"} default button 1 with icon 1
    end tell
end tell


FYI the library is:

property name : "IHDatabase"
property version : "1.0"

--IHDatabase class
on IHDatabase at dbname
    script IHDB
        property loc : missing value -- tells SQLite where to put our db if it doesn't exist, identifies it if it does.
        property head : missing value -- the opening statement of every future command to our db.
        property tail : missing value --ends every query started with "head".
        property sql_stmt_list : missing value -- we build up a SQL program here

        on init(dbname)
            set loc to space &amp; dbname &amp; space
            set head to "sqlite3" &amp; loc &amp; quote
            set tail to quote
            set sql_stmt_list to {}
            return me
        end init

        on add_sql(stmt)
            set stmt_space to stmt &amp; space
            set sql_stmt_list to sql_stmt_list &amp; stmt_space
        end add_sql

        on run_sql()
            set rows to do shell script head &amp; sql_stmt_list &amp; tail
            set sql_stmt_list to {}
            return rows
        end run_sql

    end script
    return IHDB's init(dbname)
end IHDatabase
I have just discovered that you need to add explicitly use scripting additions to have the display dialog command recognised properly.
Once you start using use then apparently other libraries, otherwise normally available by default, have to be explicitly included by their own use statements.

So add 

use scripting additions


to the client of the library (my first file above) and it will compile and run as intended.