Конференция "Базы" » SQLLITE и длина поля STRING [SQLLITE]
 
  • Raisa © (20.07.17 13:00) [0]
    Сколько символов можно записать в поле таблицы с типом STRING(100)?

    А если поле имеет тип STRING, то сколько можно записать символов?
  • Гугле (20.07.17 13:59) [1]
    Maximum length of a string or BLOB

    The maximum number of bytes in a string or BLOB in SQLite is defined by the preprocessor macro SQLITE_MAX_LENGTH. The default value of this macro is 1 billion (1 thousand million or 1,000,000,000). You can raise or lower this value at compile-time using a command-line option like this:

       -DSQLITE_MAX_LENGTH=123456789

    The current implementation will only support a string or BLOB length up to 231-1 or 2147483647. And some built-in functions such as hex() might fail well before that point. In security-sensitive applications it is best not to try to increase the maximum string and blob length. In fact, you might do well to lower the maximum string and blob length to something more in the range of a few million if that is possible.

    During part of SQLite's INSERT and SELECT processing, the complete content of each row in the database is encoded as a single BLOB. So the SQLITE_MAX_LENGTH parameter also determines the maximum number of bytes in a row.

    The maximum string or BLOB length can be lowered at run-time using the sqlite3_limit(db,SQLITE_LIMIT_LENGTH,size) interface.

    https://www.sqlite.org/limits.html

    Datatypes In SQLite Version 3

    https://www.sqlite.org/datatype3.html
  • Raisa © (20.07.17 14:12) [2]
    Спасибо за ответ. Про тип String не увидела по ссылкам.

    Я просто была удивлена,  что в поле String(100) можно записать более 1000 символов.

    Интересно, какие могут быть последствия такой записи?
  • Гугле (20.07.17 14:23) [3]
    В поле String(100) можно записать 1 000 000 000 символов (по умолчанию согласно https://www.sqlite.org/limits.html).
  • Гугле (20.07.17 14:27) [4]
    И да, это относится не только к полям типа String(100).
    1 000 000 000 символов можно записать в любое поле любого типа.
    "In SQLite, the datatype of a value is associated with the value itself, not with its container" https://www.sqlite.org/datatype3.html
  • tod (20.07.17 16:19) [5]
    Доброго времени суток. В жизни человека, перенесшего ампутацию, происходят большие изменения. Те виды деятельности, которые раньше казались совершенно естественными, требуют новых усилий и навыков. Независимо от возраста и активности, движение остается важнейшей частью в жизни каждого человека. Более 90 лет концерн ОТТО БОКК помогает людям сохранять или восстанавливать свободу передвижения.
    http://www.ottobock.ru/prosthetics/
  • Raisa © (21.07.17 12:44) [6]

    > Гугле   (20.07.17 13:59) [1]


    > Гугле   (20.07.17 14:23) [3]

    Спасибо за ответ.
 
Конференция "Базы" » SQLLITE и длина поля STRING [SQLLITE]
Есть новые Нет новых   [118230   +21][b:0][p:0]