|
typedef struct Mem sqlite3_value;
SQLite使用sqlite3_value对象表示所有可以存入数据库表的值。SQLite对存储的值使用了动态类型。存储在sqlite3_value对象中的值可以是整数、浮点数、字符串、BLOB或NULL。
SQLite uses the sqlite3_value object to represent all values
that can be stored in a database table. SQLite uses dynamic typing
for the values it stores. Values stored in sqlite3_value objects
can be integers, floating point values, strings, BLOBs, or NULL.
sqlite3_value对象可以是“保护(protected)”或“无保护(unprotected)”的。一些接口需要需要保护的sqlite3_value。另一些接口保护的和无保护的sqlite3_value都能接受。每个需要sqlite3_value参数的接口都会指定是否需要一个保护的sqlite3_value。
An sqlite3_value object may be either "protected" or "unprotected".
Some interfaces require a protected sqlite3_value. Other interfaces
will accept either a protected or an unprotected sqlite3_value.
Every interface that accepts sqlite3_value arguments specifies
whether or not it requires a protected sqlite3_value.
术语“保护”和“无保护”指的是是否持有一个互斥锁。保护的sqlite3_value内部会持有一个互斥锁,而无保护的sqlite3_value对象没有互斥锁。如果SQLite编译为单线程模式(加入SQLITE_THREADSAFE=0并且sqlite3_threadsafe()返回0)或者如果SQLite运行在SQLITE_CONFIG_SINGLETHREAD或SQLITE_CONFIG_MULTITHREAD之一的简化互斥锁模式,那么保护和无保护的sqlite3_value对象之间就没有区别了,并且可以交换使用。但是为了提高代码的可移植性,建议应用程序即使在没有严格区分需求的情况下还是继续区分保护和无保护的sqlite3_value对象。
The terms "protected" and "unprotected" refer to whether or not
a mutex is held. An internal mutex is held for a protected
sqlite3_value object but no mutex is held for an unprotected
sqlite3_value object. If SQLite is compiled to be single-threaded
(with SQLITE_THREADSAFE=0 and with sqlite3_threadsafe() returning 0)
or if SQLite is run in one of reduced mutex modes
SQLITE_CONFIG_SINGLETHREAD or SQLITE_CONFIG_MULTITHREAD
then there is no distinction between protected and unprotected
sqlite3_value objects and they can be used interchangeably. However,
for maximum code portability it is recommended that applications
still make the distinction between protected and unprotected
sqlite3_value objects even when not strictly required.
作为参数传入到应用程序自定义SQL函数中的sqlite3_value对象都是保护的。sqlite3_column_value()返回的sqlite3_value对象是无保护的。无保护的sqlite3_value对象只能用在sqlite3_result_value()和sqlite3_bind_value()中。sqlite3_value_type()系列的接口都需要保护的sqlite3_value对象。
The sqlite3_value objects that are passed as parameters into the
implementation of application-defined SQL functions are protected.
The sqlite3_value object returned by
sqlite3_column_value() is unprotected.
Unprotected sqlite3_value objects may only be used with
sqlite3_result_value() and sqlite3_bind_value().
The sqlite3_value_type() family of
interfaces require protected sqlite3_value objects.
另行参见Objects、Constants和Functions的列表。
See also lists of
Objects,
Constants, and
Functions.