Пример #1
0
int SQLiteStatement::bindNull(int index) {
  ASSERT(m_isPrepared);
  ASSERT(index > 0);
  ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

  return restrictError(sqlite3_bind_null(m_statement, index));
}
Пример #2
0
int SQLiteStatement::bindDouble(int index, double number) {
  ASSERT(m_isPrepared);
  ASSERT(index > 0);
  ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

  return restrictError(sqlite3_bind_double(m_statement, index, number));
}
Пример #3
0
int SQLiteStatement::bindInt64(int index, int64_t integer)
{
    ASSERT(m_isPrepared);
    ASSERT(index > 0);
    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

    return sqlite3_bind_int64(m_statement, index, integer);
}
Пример #4
0
int SQLiteStatement::bindText(int index, const String& text)
{
    ASSERT(m_isPrepared);
    ASSERT(index > 0);
    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

    // SQLite treats uses zero pointers to represent null strings, which means we need to make sure to map null WTFStrings to zero pointers.
    ASSERT(!String().charactersWithNullTermination().data());
    return sqlite3_bind_text16(m_statement, index, text.charactersWithNullTermination().data(), sizeof(UChar) * text.length(), SQLITE_TRANSIENT);
}
Пример #5
0
int SQLiteStatement::bindText(int index, const String& text) {
  ASSERT(m_isPrepared);
  ASSERT(index > 0);
  ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

  String text16(text);
  text16.ensure16Bit();
  return restrictError(
      sqlite3_bind_text16(m_statement, index, text16.characters16(),
                          sizeof(UChar) * text16.length(), SQLITE_TRANSIENT));
}
Пример #6
0
int SQLiteStatement::bindBlob(int index, const void* blob, int size)
{
    ASSERT(m_isPrepared);
    ASSERT(index > 0);
    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
    ASSERT(blob);
    ASSERT(size >= 0);

    if (!m_statement)
        return SQLITE_ERROR;

    return sqlite3_bind_blob(m_statement, index, blob, size, SQLITE_TRANSIENT);
}
Пример #7
0
int SQLiteStatement::bindText(int index, const String& text)
{
    ASSERT(m_isPrepared);
    ASSERT(index > 0);
    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());

    // String::characters() returns 0 for the empty string, which SQLite
    // treats as a null, so we supply a non-null pointer for that case.
    UChar anyCharacter = 0;
    const UChar* characters;
    if (text.isEmpty() && !text.isNull())
        characters = &anyCharacter;
    else
        characters = text.characters();

    return sqlite3_bind_text16(m_statement, index, characters, sizeof(UChar) * text.length(), SQLITE_TRANSIENT);
}