#include <sqldb.h>
class TSqlScalarFullSelectQuery |
Public Member Functions | |
---|---|
TSqlScalarFullSelectQuery() | |
TSqlScalarFullSelectQuery(RSqlDatabase &) | |
IMPORT_C TInt | SelectBinaryL(const TDesC &, TDes8 &) |
IMPORT_C TInt | SelectBinaryL(const TDesC8 &, TDes8 &) |
IMPORT_C TInt64 | SelectInt64L(const TDesC &) |
IMPORT_C TInt64 | SelectInt64L(const TDesC8 &) |
IMPORT_C TInt | SelectIntL(const TDesC &) |
IMPORT_C TInt | SelectIntL(const TDesC8 &) |
IMPORT_C TReal | SelectRealL(const TDesC &) |
IMPORT_C TReal | SelectRealL(const TDesC8 &) |
IMPORT_C TInt | SelectTextL(const TDesC &, TDes &) |
IMPORT_C TInt | SelectTextL(const TDesC8 &, TDes &) |
IMPORT_C void | SetDatabase(RSqlDatabase &) |
TSqlScalarFullSelectQuery interface is used for executing SELECT sql queries, which return a single row consisting of a single column value.
Examples.
RSqlDatabase db; //initialize db object.... ....... TSqlScalarFullSelectQuery fullSelectQuery(db); TInt recCnt = fullSelectQuery.SelectIntL(_L("SELECT COUNT(*) FROM PersonTbl"));
RSqlDatabase db; //initialize db object.... ....... TSqlScalarFullSelectQuery fullSelectQuery(db); TInt personId = fullSelectQuery.SelectIntL(_L("SELECT ID FROM PersonTbl WHERE Name = 'John'"));
RSqlDatabase db; //initialize db object.... ....... TSqlScalarFullSelectQuery fullSelectQuery(db); HBufC* buf = HBufC::NewLC(20); TPtr name = buf->Des(); TInt rc = fullSelectQuery.SelectTextL(_L("SELECT Name FROM PersonTbl WHERE Id = 1"), name); TEST(rc >= 0); //the function may return only non-negative values if(rc > 0) { buf = buf->ReAllocL(rc); CleanupStack::Pop(); CleanupStack::PushL(buf); name.Set(buf->Des()); rc = fullSelectQuery.SelectTextL(_L("SELECT Name FROM PersonTbl WHERE Id = 1"), name); TEST(rc == 0); } CleanupStack::PopAndDestroy();//buf
See also: RSqlDatabase
IMPORT_C | TSqlScalarFullSelectQuery | ( | ) |
Initializes TSqlScalarFullSelectQuery data members with default values.
IMPORT_C | TSqlScalarFullSelectQuery | ( | RSqlDatabase & | aDatabase | ) |
Initializes TSqlScalarFullSelectQuery object.
Parameter | Description |
---|---|
aDatabase | A reference to the RSqlDatabase object that represents the database on which scalar fullselect queries will be executed. |
Executes a SELECT query which is expected to return a single row consisting of a single binary value and copies that value to the place refered by aDest parameter.
If the destination buffer is not big enough, the function will copy as much data as possible and will return positive value - the byte length of the binary column.
Parameter | Description |
---|---|
aSqlStmt | 16-bit SELECT sql query |
aDest | Refers to the place where the column data will be copied |
Returns: KErrNone, if the function completes successfully, Positive value, The binary column value length in bytes, in case if the receiving buffer is not big enough.
Executes a SELECT query which is expected to return a single row consisting of a single binary value and copies that value to the place refered by aDest parameter.
If the destination buffer is not big enough, the function will copy as much data as possible and will return positive value - the character length of the text column.
Parameter | Description |
---|---|
aSqlStmt | 8-bit SELECT sql query |
aDest | Refers to the place where the column data will be copied |
Returns: KErrNone, if the function completes successfully, Positive value, The binary column value length in bytes, in case if the receiving buffer is not big enough.
Executes a SELECT query which is expected to return a single row consisting of a single 64-bit integer value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 16-bit SELECT sql query |
Returns: 64-bit integer column value.
Executes a SELECT query which is expected to return a single row consisting of a single 64-bit integer value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 8-bit SELECT sql query |
Returns: 64-bit integer column value.
Executes a SELECT query which is expected to return a single row consisting of a single 32-bit integer value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 16-bit SELECT sql query |
Returns: 32-bit integer column value.
Executes a SELECT query which is expected to return a single row consisting of a single 32-bit integer value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 8-bit SELECT sql query |
Returns: 32-bit integer column value.
Executes a SELECT query which is expected to return a single row consisting of a single real value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 16-bit SELECT sql query |
Returns: Real column value.
Executes a SELECT query which is expected to return a single row consisting of a single real value and returns that value.
Parameter | Description |
---|---|
aSqlStmt | 8-bit SELECT sql query |
Returns: Real column value.
Executes a SELECT query which is expected to return a single row consisting of a single text value and copies that value to the place refered by aDest parameter.
If the destination buffer is not big enough, the function will copy as much data as possible and will return positive value - the character length of the text column.
Parameter | Description |
---|---|
aSqlStmt | 16-bit SELECT sql query |
aDest | Refers to the place where the column data will be copied |
Returns: KErrNone, if the function completes successfully, Positive value, The text column value length in characters, in case if the receiving buffer is not big enough.
Executes a SELECT query which is expected to return a single row consisting of a single text value and copies that value to the place refered by aDest parameter.
If the destination buffer is not big enough, the function will copy as much data as possible and will return positive value - the character length of the text column.
Parameter | Description |
---|---|
aSqlStmt | 8-bit SELECT sql query |
aDest | Refers to the place where the column data will be copied |
Returns: KErrNone, if the function completes successfully, Positive value, The text column value length in characters, in case if the receiving buffer is not big enough.
IMPORT_C void | SetDatabase | ( | RSqlDatabase & | aDatabase | ) |
Initializes/reinitializes TSqlScalarFullSelectQuery object.
Parameter | Description |
---|---|
aDatabase | A reference to the RSqlDatabase object that represents the database on which scalar fullselect queries will be executed. |