/** Set the query field to a SQL string that inserts the specified object field values in the database.
	* @param $anObject Object whose field values need to be saved
	* @param $tableName String
	* @param $fieldMap Associative Array mapping fieldName to columnName
	*/
	function setQueryToInsertObject_table_fieldMap($anObject, $tableName, $fieldMap) {
		$sep = '';
		$columns = '';
		$values = '';
		reset($fieldMap);
		forEach($fieldMap as $field => $column) {
			//insert of a not-new object is assumed to be insert in secondary table
			if ($field != 'id' || (!$anObject->isNew()) ) {
				$columns .= $sep;
				$columns .= $column;
				$values .= $sep;
				$values .= $this->param(isSet($anObject->$field) ? $anObject->$field : null);
				$sep = ', ';
			}
		}
		$this->query = "insert into $tableName ($columns) VALUES ($values)";
	}