|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tmatesoft.sqljet.core.internal.SqlJetCloneable
org.tmatesoft.sqljet.core.internal.vdbe.SqlJetVdbeMem
public class SqlJetVdbeMem
Internally, the vdbe manipulates nearly all SQL values as Mem structures. Each Mem struct may cache multiple representations (string, integer etc.) of the same value. A value (and therefore Mem structure) has the following properties: Each value has a manifest type. The manifest type of the value stored in a Mem struct is returned by the MemType(Mem*) macro. The type is one of SQLITE_NULL, SQLITE_INTEGER, SQLITE_REAL, SQLITE_TEXT or SQLITE_BLOB.
Constructor Summary | |
---|---|
SqlJetVdbeMem()
|
|
SqlJetVdbeMem(ISqlJetDbHandle db)
|
Method Summary | |
---|---|
void |
applyAffinity(SqlJetTypeAffinity affinity,
SqlJetEncoding enc)
Processing is determine by the affinity parameter: AFF_INTEGER: AFF_REAL: AFF_NUMERIC: Try to convert value to an integer representation or a floating-point representation if an integer representation is not possible. |
void |
applyNumericAffinity()
Try to convert a value into a numeric representation if we can do so without loss of information. |
void |
changeEncoding(SqlJetEncoding desiredEnc)
If pMem is an object with a valid string representation, this routine ensures the internal encoding for the string representation is 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE. |
static int |
compare(SqlJetVdbeMem pMem1,
SqlJetVdbeMem pMem2,
ISqlJetCollSeq pColl)
Compare the values contained by the two memory cells, returning negative, zero or positive if pMem1 is less than, equal to, or greater than pMem2. |
ISqlJetVdbeMem |
copy()
Make a full copy of pFrom into pTo. |
void |
expandBlob()
If the given Mem* has a zero-filled tail, turn it into an ordinary blob stored in dynamically allocated space. |
void |
fromBtree(ISqlJetBtreeCursor pCur,
int offset,
int amt,
boolean key)
Move data out of a btree key or data field and into a Mem structure. |
java.util.Set<SqlJetVdbeMemFlags> |
getFlags()
|
SqlJetValueType |
getType()
|
void |
grow(int n,
boolean preserve)
Make sure pMem->z points to a writable allocation of at least n bytes. |
void |
handleBom()
This routine checks for a byte-order mark at the beginning of the UTF-16 string stored in *pMem. |
void |
integerAffinity()
The MEM structure is already a MEM_Real. |
void |
integerify()
Convert pMem to type integer. |
long |
intValue()
Return some kind of integer value which is the best we can do at representing the value that *pMem describes as an integer. |
boolean |
isNull()
|
boolean |
isTooBig()
Return true if the Mem object contains a TEXT or BLOB that is too large - whose size exceeds SQLITE_MAX_LENGTH. |
void |
makeWriteable()
Make the given Mem object MEM_Dyn. |
ISqlJetVdbeMem |
move()
Transfer the contents of pFrom to pTo. |
void |
nulTerminate()
Make sure the given Mem is nul terminated. |
void |
numerify()
Convert pMem so that it has types MEM_Real or MEM_Int or both. |
void |
realify()
Convert pMem so that it is of type MEM_Real. |
double |
realValue()
Return the best representation of pMem that we can get into a double. |
void |
release()
Release any memory held by the Mem. |
void |
sanity()
Perform various checks on the memory cell pMem. |
void |
setDouble(double val)
Delete any previous value and set the value stored in *pMem to val, manifest type REAL. |
void |
setInt64(long val)
Delete any previous value and set the value stored in *pMem to val, manifest type INTEGER. |
void |
setNull()
Delete any previous value and set the value stored in *pMem to NULL. |
void |
setRowSet()
Delete any previous value and set the value of pMem to be an empty boolean index. |
void |
setStr(ISqlJetMemoryPointer z,
SqlJetEncoding enc)
Change the value of a Mem to be a string or a BLOB. |
void |
setTypeFlag(SqlJetVdbeMemFlags f)
Clear any existing type flags from a Mem and replace them with f |
void |
setZeroBlob(int n)
Delete any previous value and set the value to be a BLOB of length n containing all zeros. |
ISqlJetVdbeMem |
shallowCopy(SqlJetVdbeMemFlags srcType)
Make an shallow copy. |
void |
stringify(SqlJetEncoding enc)
Add MEM_Str to the set of representations for the given Mem. |
void |
translate(SqlJetEncoding desiredEnc)
This routine transforms the internal text encoding used by pMem to desiredEnc. |
ISqlJetMemoryPointer |
valueBlob()
Converts the object V into a BLOB and then returns a pointer to the converted value. |
int |
valueBytes(SqlJetEncoding enc)
Return the number of bytes in the sqlite3_value object assuming that it uses the encoding "enc" |
ISqlJetMemoryPointer |
valueText(SqlJetEncoding enc)
This function is only available internally, it is not part of the external API. |
Methods inherited from class org.tmatesoft.sqljet.core.internal.SqlJetCloneable |
---|
clone |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SqlJetVdbeMem()
public SqlJetVdbeMem(ISqlJetDbHandle db)
Method Detail |
---|
public void release()
ISqlJetVdbeMem
release
in interface ISqlJetVdbeMem
public static int compare(SqlJetVdbeMem pMem1, SqlJetVdbeMem pMem2, ISqlJetCollSeq pColl) throws SqlJetException
SqlJetException
public ISqlJetVdbeMem shallowCopy(SqlJetVdbeMemFlags srcType) throws SqlJetException
ISqlJetVdbeMem
shallowCopy
in interface ISqlJetVdbeMem
SqlJetException
public ISqlJetVdbeMem copy() throws SqlJetException
ISqlJetVdbeMem
copy
in interface ISqlJetVdbeMem
SqlJetException
public ISqlJetVdbeMem move() throws SqlJetException
ISqlJetVdbeMem
move
in interface ISqlJetVdbeMem
SqlJetException
public ISqlJetMemoryPointer valueText(SqlJetEncoding enc) throws SqlJetException
ISqlJetVdbeMem
valueText
in interface ISqlJetVdbeMem
SqlJetException
public void stringify(SqlJetEncoding enc) throws SqlJetException
ISqlJetVdbeMem
stringify
in interface ISqlJetVdbeMem
SqlJetException
public void grow(int n, boolean preserve)
ISqlJetVdbeMem
grow
in interface ISqlJetVdbeMem
public void nulTerminate()
ISqlJetVdbeMem
nulTerminate
in interface ISqlJetVdbeMem
public void changeEncoding(SqlJetEncoding desiredEnc) throws SqlJetException
ISqlJetVdbeMem
changeEncoding
in interface ISqlJetVdbeMem
SqlJetException
public void translate(SqlJetEncoding desiredEnc) throws SqlJetException
ISqlJetVdbeMem
translate
in interface ISqlJetVdbeMem
SqlJetException
public void expandBlob()
ISqlJetVdbeMem
expandBlob
in interface ISqlJetVdbeMem
public void fromBtree(ISqlJetBtreeCursor pCur, int offset, int amt, boolean key) throws SqlJetException
ISqlJetVdbeMem
fromBtree
in interface ISqlJetVdbeMem
offset
- Offset from the start of data to return bytes from.amt
- Number of bytes to return.key
- If true, retrieve from the btree key, not data.
SqlJetException
public void makeWriteable()
ISqlJetVdbeMem
makeWriteable
in interface ISqlJetVdbeMem
public long intValue()
ISqlJetVdbeMem
intValue
in interface ISqlJetVdbeMem
public void setNull()
ISqlJetVdbeMem
setNull
in interface ISqlJetVdbeMem
public void setStr(ISqlJetMemoryPointer z, SqlJetEncoding enc) throws SqlJetException
ISqlJetVdbeMem
setStr
in interface ISqlJetVdbeMem
SqlJetException
public void setInt64(long val)
ISqlJetVdbeMem
setInt64
in interface ISqlJetVdbeMem
public double realValue()
ISqlJetVdbeMem
realValue
in interface ISqlJetVdbeMem
public void integerAffinity()
ISqlJetVdbeMem
integerAffinity
in interface ISqlJetVdbeMem
public void integerify()
ISqlJetVdbeMem
integerify
in interface ISqlJetVdbeMem
public void realify()
ISqlJetVdbeMem
realify
in interface ISqlJetVdbeMem
public void numerify()
ISqlJetVdbeMem
numerify
in interface ISqlJetVdbeMem
public void setTypeFlag(SqlJetVdbeMemFlags f)
ISqlJetVdbeMem
setTypeFlag
in interface ISqlJetVdbeMem
public void setZeroBlob(int n)
ISqlJetVdbeMem
setZeroBlob
in interface ISqlJetVdbeMem
public void setDouble(double val)
ISqlJetVdbeMem
setDouble
in interface ISqlJetVdbeMem
public void setRowSet()
ISqlJetVdbeMem
setRowSet
in interface ISqlJetVdbeMem
public boolean isTooBig()
ISqlJetVdbeMem
isTooBig
in interface ISqlJetVdbeMem
public void sanity()
ISqlJetVdbeMem
sanity
in interface ISqlJetVdbeMem
public int valueBytes(SqlJetEncoding enc) throws SqlJetException
ISqlJetVdbeMem
valueBytes
in interface ISqlJetVdbeMem
SqlJetException
public void handleBom()
ISqlJetVdbeMem
handleBom
in interface ISqlJetVdbeMem
public java.util.Set<SqlJetVdbeMemFlags> getFlags()
getFlags
in interface ISqlJetVdbeMem
public boolean isNull()
isNull
in interface ISqlJetVdbeMem
public SqlJetValueType getType()
getType
in interface ISqlJetVdbeMem
public ISqlJetMemoryPointer valueBlob() throws SqlJetException
ISqlJetVdbeMem
valueBlob
in interface ISqlJetVdbeMem
SqlJetException
public void applyAffinity(SqlJetTypeAffinity affinity, SqlJetEncoding enc) throws SqlJetException
|
|
Try to convert value to an integer representation or a floating-point representation if an integer representation is not possible. Note that the integer representation is always preferred, even if the affinity is REAL, because an integer representation is more space efficient on disk. | |
|
|
Convert value to a text representation. | |
|
|
No-op. value is unchanged. |
applyAffinity
in interface ISqlJetVdbeMem
affinity
- The affinity to be appliedenc
- Use this text encoding
SqlJetException
public void applyNumericAffinity() throws SqlJetException
SqlJetException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |