Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Using National Character Set

By default when character arguments are passed to a prepared statement they are encoded using database character set. Which is a non-issue, even if they need to be converted later to/from the national character set, if the database character set is Unicode. However, when the database character is is not Unicode, then character data conversion to the database character set might lose data. For these environments Sibyl provides an NChar type indicates during parameter binding that the value should be encoded using the national character set.

Example

    let stmt = session.prepare("
        INSERT INTO nchar_test_data (txt) VALUES (:TXT)
        RETURNING id INTO :ID
    ")?;
    
    let old_pond = "古池や 蛙飛び込む 水の音";
    stmt.execute((
        ("TXT", NChar(old_pond)),
        ("ID", &mut ids[0])
    ))?;