persistentstorage/sql/SRC/Server/SqlSrvStatement.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
child 11 211563e4b919
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    26 //////////////////////////////////////////////////////////////////////////////////////////////////////
    26 //////////////////////////////////////////////////////////////////////////////////////////////////////
    27 
    27 
    28 //This is the name prefix which will be given to the nameless parameters.
    28 //This is the name prefix which will be given to the nameless parameters.
    29 //For example, if the SQL string is:
    29 //For example, if the SQL string is:
    30 //   SELECT * FROM A WHERE ColA1 = ? AND ColA2 = ?
    30 //   SELECT * FROM A WHERE ColA1 = ? AND ColA2 = ?
    31 //then the names which will be give to the parameters will be:
    31 //then the names which will be given to the parameters will be:
    32 //"?0" and "?1"
    32 //"?0" and "?1"
    33 _LIT(KNamelessParameter, "?");
    33 _LIT(KNamelessParameter, "?");
    34 
    34 
    35 
    35 
    36 /////////////////////////////////////////////////////////////////////////////////////////////////////////
    36 /////////////////////////////////////////////////////////////////////////////////////////////////////////
    88 /**
    88 /**
    89 This function is called by the bound statement object to notify the current HSqlSrvStmtParamBuf object that the
    89 This function is called by the bound statement object to notify the current HSqlSrvStmtParamBuf object that the
    90 bound statement is about to be finalized. That means, when the "stream close" operation on the client side 
    90 bound statement is about to be finalized. That means, when the "stream close" operation on the client side 
    91 makes an attempt to synch the HSqlSrvStmtParamBuf object, no attempt should be made to bound the parameter data,
    91 makes an attempt to synch the HSqlSrvStmtParamBuf object, no attempt should be made to bound the parameter data,
    92 because the statement object is gone.
    92 because the statement object is gone.
    93 After this call the bound statement objects seases to exist.
    93 After this call the bound statement objects ceases to exist.
    94 
    94 
    95 Actions, performed by this method:
    95 Actions, performed by this method:
    96  - if the buffer type is "simple bind", the buffer will be destroyed. No reason to keep it alive, there is no bound IPC
    96  - if the buffer type is "simple bind", the buffer will be destroyed. No reason to keep it alive, there is no bound IPC
    97    stream object on the client side;
    97    stream object on the client side;
    98  - if the buffer type is an IPC stream buffer and the buffer is alive, that means: the bound statement object is about to be
    98  - if the buffer type is an IPC stream buffer and the buffer is alive, that means: the bound statement object is about to be
   198 	}
   198 	}
   199 
   199 
   200 /**
   200 /**
   201 Sets SQL statement parameter values.
   201 Sets SQL statement parameter values.
   202 
   202 
   203 Only parameters, which values are set by the client, will be processed.
   203 Only parameters, whose values are set by the client, will be processed.
   204 
   204 
   205 @param aParamBuf Flat buffer with parameter values.
   205 @param aParamBuf Flat buffer with parameter values.
   206 
   206 
   207 @leave KErrArgument, unknown parameter type;
   207 @leave KErrArgument, unknown parameter type;
   208 	   KSqlErrStmtExpired, statement handle expired.
   208 	   KSqlErrStmtExpired, statement handle expired.
   275 	}
   275 	}
   276 
   276 
   277 /**
   277 /**
   278 Collects column names in a flat buffer and returns a reference to the buffer. 
   278 Collects column names in a flat buffer and returns a reference to the buffer. 
   279 
   279 
   280 @return A const reference to a flat buffer containing the column values.
   280 @return A const reference to a flat buffer containing the column names.
   281 
   281 
   282 @leave KErrNoMemory, an out of memory condition has occurred.
   282 @leave KErrNoMemory, an out of memory condition has occurred.
   283 
   283 
   284 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object.
   284 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object.
   285 */	
   285 */	
   304 	}
   304 	}
   305 
   305 
   306 /**
   306 /**
   307 Collects parameter names in a flat buffer and returns a reference to the buffer. 
   307 Collects parameter names in a flat buffer and returns a reference to the buffer. 
   308 
   308 
   309 @return A const reference to a flat buffer containing the column values.
   309 @return A const reference to a flat buffer containing the parameter names.
   310 
   310 
   311 @leave KErrNoMemory, an out of memory condition has occurred.
   311 @leave KErrNoMemory, an out of memory condition has occurred.
   312 
   312 
   313 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object.
   313 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object.
   314 */	
   314 */	
   690 /**
   690 /**
   691 This function is used by the DBMS emulation library only.
   691 This function is used by the DBMS emulation library only.
   692 The function retrieves the declared column types from the SQLITE library, compiles them in a single string
   692 The function retrieves the declared column types from the SQLITE library, compiles them in a single string
   693 and then returns the string to the caller.
   693 and then returns the string to the caller.
   694 
   694 
   695 The function also initializes iColumnText8 array, where particular array element with index "idx" will 
       
   696 be set to 1, if the column with index "idx" is a 8-bit text column.
       
   697 
       
   698 @return A pointer to a heap allocated HBufC object with the delcared column types. The caller is responsible
   695 @return A pointer to a heap allocated HBufC object with the delcared column types. The caller is responsible
   699 		for the HBufC object destruction.
   696 		for the HBufC object destruction.
   700 */
   697 */
   701 HBufC* CSqlSrvStatement::GetDeclColumnTypesL()
   698 HBufC* CSqlSrvStatement::GetDeclColumnTypesL()
   702 	{
   699 	{
   714 		}
   711 		}
   715 	return buf;
   712 	return buf;
   716 	}
   713 	}
   717 
   714 
   718 /**
   715 /**
   719 Creates a new HSqlSrvStmtParamBuf object.
   716 Creates a new HSqlSrvStmtParamBuf object for the parameter with index "aParamIndex" or
   720 
   717 reuses the existing one.
   721 @param aParameterIndex Parameter index, zero based.
   718 
       
   719 @param aParamIndex Parameter index, zero based.
   722 @param aDataType Parameter value type - binary, text8 or text16.
   720 @param aDataType Parameter value type - binary, text8 or text16.
   723 @param aIsStreamBuf True if the param data will be retrieved from an IPC stream
   721 @param aIsStreamBuf True if the param data will be retrieved from an IPC stream
   724 
   722 
   725 @return A pointer to the created HSqlSrvStmtParamBuf instance.
   723 @return A pointer to the created HSqlSrvStmtParamBuf instance.
   726 
   724 
   744 	return paramBuf;
   742 	return paramBuf;
   745 	}
   743 	}
   746 
   744 
   747 /**
   745 /**
   748 This function will extend the iParamBufArray array (filling the new array items with NULL), if it is needed - 
   746 This function will extend the iParamBufArray array (filling the new array items with NULL), if it is needed - 
   749 to ensure that there is enough place for the buffer for the parameter identified by aParamIndex.
   747 to ensure that there is enough place in the buffer for the parameter identified by aParamIndex.
   750 
   748 
   751 @param aParamIndex The parameter index
   749 @param aParamIndex The parameter index
   752 
   750 
   753 @leave KErrNoMemory, an out of memory condition has occurred;
   751 @leave KErrNoMemory, an out of memory condition has occurred;
   754 
   752