You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2016/05/13 19:20:37 UTC
[05/50] [abbrv] ignite git commit: IGNITE-2777: CPP: Added queries
example. This closes #648.
IGNITE-2777: CPP: Added queries example. This closes #648.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/80979dfc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/80979dfc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/80979dfc
Branch: refs/heads/ignite-2949
Commit: 80979dfcd8b5f2e6931b1035f4ae0cf77763374e
Parents: 28196d0
Author: isapego <is...@gridgain.com>
Authored: Wed May 11 18:18:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed May 11 18:18:31 2016 +0300
----------------------------------------------------------------------
.../cpp/core/include/ignite/cache/cache_entry.h | 2 +-
modules/platforms/cpp/examples/Makefile.am | 1 +
modules/platforms/cpp/examples/configure.ac | 2 +
.../examples/include/ignite/examples/address.h | 9 +-
.../include/ignite/examples/organization.h | 20 +-
.../cpp/examples/project/vs/ignite-examples.sln | 6 +
.../cpp/examples/query-example/Makefile.am | 56 +++
.../query-example/config/query-example.xml | 121 ++++++
.../project/vs/query-example.vcxproj | 108 +++++
.../project/vs/query-example.vcxproj.filters | 27 ++
.../query-example/src/query_example.cpp | 405 +++++++++++++++++++
.../cpp/odbc/src/config/configuration.cpp | 2 +-
12 files changed, 747 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h b/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
index adace5d..f709650 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
@@ -36,7 +36,7 @@ namespace ignite
* copy-constructable and assignable.
*/
template<typename K, typename V>
- class IGNITE_IMPORT_EXPORT CacheEntry
+ class CacheEntry
{
public:
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/Makefile.am b/modules/platforms/cpp/examples/Makefile.am
index 4d49233..cda5132 100644
--- a/modules/platforms/cpp/examples/Makefile.am
+++ b/modules/platforms/cpp/examples/Makefile.am
@@ -20,5 +20,6 @@ ACLOCAL_AMFLAGS =-I m4
SUBDIRS = \
putget-example \
odbc-example \
+ query-example \
include
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/configure.ac b/modules/platforms/cpp/examples/configure.ac
index 1143e6c..94519af 100644
--- a/modules/platforms/cpp/examples/configure.ac
+++ b/modules/platforms/cpp/examples/configure.ac
@@ -52,8 +52,10 @@ fi
AC_CONFIG_FILES([ \
Makefile \
+ include/Makefile \
putget-example/Makefile \
odbc-example/Makefile \
+ query-example/Makefile \
])
AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/include/ignite/examples/address.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/ignite/examples/address.h b/modules/platforms/cpp/examples/include/ignite/examples/address.h
index 149a98a..b19fb4d 100644
--- a/modules/platforms/cpp/examples/include/ignite/examples/address.h
+++ b/modules/platforms/cpp/examples/include/ignite/examples/address.h
@@ -22,16 +22,17 @@
namespace ignite
{
- namespace examples
+ namespace examples
{
- struct Address
+ struct Address
{
Address() : street(), zip(0)
{
// No-op.
}
-
- Address(std::string street, int zip) : street(street), zip(zip)
+
+ Address(const std::string& street, int zip) :
+ street(street), zip(zip)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/include/ignite/examples/organization.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/ignite/examples/organization.h b/modules/platforms/cpp/examples/include/ignite/examples/organization.h
index 736e600..e819d69 100644
--- a/modules/platforms/cpp/examples/include/ignite/examples/organization.h
+++ b/modules/platforms/cpp/examples/include/ignite/examples/organization.h
@@ -24,20 +24,28 @@
namespace ignite
{
- namespace examples
+ namespace examples
{
- struct Organization
+ struct Organization
{
- Organization() : name(), addr()
+ Organization() :
+ name(), addr()
{
// No-op.
}
-
- Organization(std::string name, Address addr) : name(name), addr(addr)
+
+ Organization(const std::string& name) :
+ name(name), addr()
+ {
+ // No-op.
+ }
+
+ Organization(const std::string& name, Address addr) :
+ name(name), addr(addr)
{
// No-op.
}
-
+
std::string ToString()
{
std::ostringstream oss;
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/project/vs/ignite-examples.sln
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/project/vs/ignite-examples.sln b/modules/platforms/cpp/examples/project/vs/ignite-examples.sln
index 5fdaaef..89f609f 100644
--- a/modules/platforms/cpp/examples/project/vs/ignite-examples.sln
+++ b/modules/platforms/cpp/examples/project/vs/ignite-examples.sln
@@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "putget-example", "..\..\put
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odbc-example", "..\..\odbc-example\project\vs\odbc-example.vcxproj", "{56839DFF-6C03-416B-BC5F-DDC6EBF8512D}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "query-example", "..\..\query-example\project\vs\query-example.vcxproj", "{9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|x64 = Release|x64
@@ -19,6 +21,10 @@ Global
{56839DFF-6C03-416B-BC5F-DDC6EBF8512D}.Release|x64.Build.0 = Release|x64
{56839DFF-6C03-416B-BC5F-DDC6EBF8512D}.Release|x86.ActiveCfg = Release|Win32
{56839DFF-6C03-416B-BC5F-DDC6EBF8512D}.Release|x86.Build.0 = Release|Win32
+ {9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}.Release|x64.ActiveCfg = Release|x64
+ {9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}.Release|x64.Build.0 = Release|x64
+ {9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}.Release|x86.ActiveCfg = Release|Win32
+ {9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/query-example/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/Makefile.am b/modules/platforms/cpp/examples/query-example/Makefile.am
new file mode 100644
index 0000000..1437303
--- /dev/null
+++ b/modules/platforms/cpp/examples/query-example/Makefile.am
@@ -0,0 +1,56 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+
+ACLOCAL_AMFLAGS =-I m4
+
+noinst_PROGRAMS = ignite-queryexample
+
+AM_CPPFLAGS = \
+ -I@top_srcdir@/include \
+ -I@top_srcdir@/../core/include \
+ -I@top_srcdir@/../core/os/linux/include \
+ -I@top_srcdir@/../common/include \
+ -I@top_srcdir@/../common/os/linux/include \
+ -I@top_srcdir@/../binary/include \
+ -I@top_srcdir@/../jni/include \
+ -I@top_srcdir@/../jni/os/linux/include \
+ -I$(JAVA_HOME)/include \
+ -I$(JAVA_HOME)/include/linux \
+ -DIGNITE_IMPL
+
+AM_CXXFLAGS = \
+ -Wall \
+ -std=c++0x
+
+ignite_queryexample_LDADD = \
+ @top_srcdir@/../core/libignite.la \
+ -lpthread
+
+ignite_queryexample_LDFLAGS = \
+ -static-libtool-libs
+
+ignite_queryexample_SOURCES = \
+ src/query_example.cpp
+
+run-check: check
+ ./ignite-queryexample -p
+
+clean-local: clean-check
+ $(RM) *.gcno *.gcda
+
+clean-check:
+ $(RM) $(ignite_queryexample_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/query-example/config/query-example.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/config/query-example.xml b/modules/platforms/cpp/examples/query-example/config/query-example.xml
new file mode 100644
index 0000000..a7b63c2
--- /dev/null
+++ b/modules/platforms/cpp/examples/query-example/config/query-example.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <!-- Set to true to enable distributed class loading for examples, default is false. -->
+ <property name="peerClassLoadingEnabled" value="true"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="Person"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="queryEntities">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryEntity">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="Person"/>
+
+ <property name="fields">
+ <map>
+ <entry key="orgId" value="java.lang.Long"/>
+ <entry key="firstName" value="java.lang.String"/>
+ <entry key="lastName" value="java.lang.String"/>
+ <entry key="resume" value="java.lang.String"/>
+ <entry key="salary" value="java.lang.Double"/>
+ </map>
+ </property>
+
+ <property name="indexes">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryIndex">
+ <property name="fields">
+ <map>
+ <entry key="resume" value="true"/>
+ </map>
+ </property>
+ <property name="indexType" value="FULLTEXT"/>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="Organization"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="queryEntities">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryEntity">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="Organization"/>
+
+ <property name="fields">
+ <map>
+ <entry key="name" value="java.lang.String"/>
+ </map>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery.
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47550..47551</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
new file mode 100644
index 0000000..ff8e5be
--- /dev/null
+++ b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
@@ -0,0 +1,108 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{9FB34AB4-01DD-4C6F-99BF-681019D0E4DD}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>igniteexamples</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\..\include;..\..\..\..\jni\os\win\include;..\..\..\..\jni\include;..\..\..\..\common\os\win\include;..\..\..\..\common\include;..\..\..\..\binary\include;..\..\..\..\core\os\win\include;..\..\..\..\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>jvm.lib;ignite.jni.lib;ignite.binary.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\..\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\..\include;..\..\..\..\jni\os\win\include;..\..\..\..\jni\include;..\..\..\..\common\os\win\include;..\..\..\..\common\include;..\..\..\..\binary\include;..\..\..\..\core\os\win\include;..\..\..\..\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>jvm.lib;ignite.jni.lib;ignite.binary.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\..\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\query_example.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\ignite\examples\address.h" />
+ <ClInclude Include="..\..\..\include\ignite\examples\organization.h" />
+ <ClInclude Include="..\..\..\include\ignite\examples\person.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
new file mode 100644
index 0000000..219d3f4
--- /dev/null
+++ b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
@@ -0,0 +1,27 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\ignite\examples\address.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\ignite\examples\organization.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\ignite\examples\person.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{35cb32b7-bf2e-440f-9b32-80d392d81847}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{b355095f-b4e2-4324-9516-854828c876ff}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\query_example.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/examples/query-example/src/query_example.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/src/query_example.cpp b/modules/platforms/cpp/examples/query-example/src/query_example.cpp
new file mode 100644
index 0000000..1bbf21b
--- /dev/null
+++ b/modules/platforms/cpp/examples/query-example/src/query_example.cpp
@@ -0,0 +1,405 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <iostream>
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+#include "ignite/examples/organization.h"
+#include "ignite/examples/person.h"
+
+using namespace ignite;
+using namespace cache;
+using namespace query;
+
+using namespace examples;
+
+/** Organizations cache name. */
+const char* ORG_CACHE = "Organization";
+
+/** Organizations type name. */
+const char* ORG_TYPE = "Organization";
+
+/** Persons cache name. */
+const char* PERSON_CACHE = "Person";
+
+/** Persons type name. */
+const char* PERSON_TYPE = "Person";
+
+/**
+ * Example for SQL-based fields queries that return only required
+ * fields instead of whole key-value pairs.
+ *
+ * Note that SQL Fields Query can only be performed using fields that have been
+ * listed in "QueryEntity" been of the config.
+ */
+void DoSqlFieldsQueryWithJoin()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // Execute query to get names of all employees.
+ std::string sql(
+ "select concat(firstName, ' ', lastName), org.name "
+ "from Person, \"Organization\".Organization as org "
+ "where Person.orgId = org._key");
+
+ QueryFieldsCursor cursor = cache.Query(SqlFieldsQuery(sql));
+
+ // Print persons' names and organizations' names.
+ std::cout << "Names of all employees and organizations they belong to: " << std::endl;
+
+ // In this particular case each row will have two elements with full name
+ // of an employees and their organization.
+ while (cursor.HasNext())
+ {
+ QueryFieldsRow row = cursor.GetNext();
+
+ std::cout << row.GetNext<std::string>() << ", ";
+ std::cout << row.GetNext<std::string>() << std::endl;
+ }
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for SQL-based fields queries that return only required fields instead
+ * of whole key-value pairs.
+ *
+ * Note that SQL Fields Query can only be performed using fields that have been
+ * listed in "QueryEntity" been of the config.
+ */
+void DoSqlFieldsQuery()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // Execute query to get names of all employees.
+ QueryFieldsCursor cursor = cache.Query(SqlFieldsQuery(
+ "select concat(firstName, ' ', lastName) from Person"));
+
+ // Print names.
+ std::cout << "Names of all employees: " << std::endl;
+
+ // In this particular case each row will have one element with full name of an employees.
+ while (cursor.HasNext())
+ std::cout << cursor.GetNext().GetNext<std::string>() << std::endl;
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for SQL queries to calculate average salary for a specific organization.
+ *
+ * Note that SQL Fields Query can only be performed using fields that have been
+ * listed in "QueryEntity" been of the config.
+ */
+void DoSqlQueryWithAggregation()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // Calculate average of salary of all persons in ApacheIgnite.
+ // Note that we also join on Organization cache as well.
+ std::string sql(
+ "select avg(salary) "
+ "from Person, \"Organization\".Organization as org "
+ "where Person.orgId = org._key "
+ "and lower(org.name) = lower(?)");
+
+ SqlFieldsQuery qry(sql);
+
+ qry.AddArgument<std::string>("ApacheIgnite");
+
+ QueryFieldsCursor cursor = cache.Query(qry);
+
+ // Calculate average salary for a specific organization.
+ std::cout << "Average salary for 'ApacheIgnite' employees: " << std::endl;
+
+ while (cursor.HasNext())
+ std::cout << cursor.GetNext().GetNext<double>() << std::endl;
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for TEXT queries using LUCENE-based indexing of people's resumes.
+ *
+ * Note that to be able to do so you have to add FULLTEXT index for the 'resume'
+ * field of the Person type. See config for details.
+ */
+void DoTextQuery()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ typedef std::vector< CacheEntry<int64_t, Person> > ResVector;
+
+ // Query for all people with "Master" in their resumes.
+ ResVector masters;
+ cache.Query(TextQuery(PERSON_TYPE, "Master")).GetAll(masters);
+
+ // Query for all people with "Bachelor" in their resumes.
+ ResVector bachelors;
+ cache.Query(TextQuery(PERSON_TYPE, "Bachelor")).GetAll(bachelors);
+
+ std::cout << "Following people have 'Master' in their resumes: " << std::endl;
+
+ // Printing first result set.
+ for (ResVector::const_iterator i = masters.begin(); i != masters.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+
+ std::cout << "Following people have 'Bachelor' in their resumes: " << std::endl;
+
+ // Printing second result set.
+ for (ResVector::const_iterator i = bachelors.begin(); i != bachelors.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for SQL queries based on all employees working for a specific organization.
+ *
+ * Note that SQL Query can only be performed using fields that have been
+ * listed in "QueryEntity" been of the config.
+ */
+void DoSqlQueryWithJoin()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ typedef std::vector< CacheEntry<int64_t, Person> > ResVector;
+
+ // SQL clause query which joins on 2 types to select people for a specific organization.
+ std::string sql(
+ "from Person, \"Organization\".Organization as org "
+ "where Person.orgId = org._key "
+ "and lower(org.name) = lower(?)");
+
+ SqlQuery qry(PERSON_TYPE, sql);
+
+ // Execute queries for find employees for different organizations.
+ std::cout << "Following people are 'ApacheIgnite' employees: " << std::endl;
+
+ qry.AddArgument<std::string>("ApacheIgnite");
+
+ ResVector res;
+ cache.Query(qry).GetAll(res);
+
+ for (ResVector::const_iterator i = res.begin(); i != res.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+
+ std::cout << "Following people are 'Other' employees: " << std::endl;
+
+ qry = SqlQuery(PERSON_TYPE, sql);
+
+ qry.AddArgument<std::string>("Other");
+
+ res.clear();
+ cache.Query(qry).GetAll(res);
+
+ for (ResVector::const_iterator i = res.begin(); i != res.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for SQL queries based on salary ranges.
+ *
+ * Note that SQL Query can only be performed using fields that have been
+ * listed in "QueryEntity" been of the config.
+ */
+void DoSqlQuery()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // SQL clause which selects salaries based on range.
+ std::string sql("salary > ? and salary <= ?");
+
+ SqlQuery qry(PERSON_TYPE, sql);
+
+ typedef std::vector< CacheEntry<int64_t, Person> > ResVector;
+
+ // Execute queries for salary range 0 - 1000.
+ std::cout << "People with salaries between 0 and 1000 (queried with SQL query): " << std::endl;
+
+ qry.AddArgument(0);
+ qry.AddArgument(1000);
+
+ ResVector res;
+ cache.Query(qry).GetAll(res);
+
+ for (ResVector::const_iterator i = res.begin(); i != res.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+
+ qry = SqlQuery(PERSON_TYPE, sql);
+
+ // Execute queries for salary range 1000 - 2000.
+ std::cout << "People with salaries between 1000 and 2000 (queried with SQL query): " << std::endl;
+
+ qry.AddArgument(1000);
+ qry.AddArgument(2000);
+
+ res.clear();
+
+ cache.Query(qry).GetAll(res);
+
+ for (ResVector::const_iterator i = res.begin(); i != res.end(); ++i)
+ std::cout << i->GetKey() << " : " << i->GetValue().ToString() << std::endl;
+
+ std::cout << std::endl;
+}
+
+/**
+ * Example for scan query based on a predicate.
+ */
+void DoScanQuery()
+{
+ Cache<int64_t, Person> cache = Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ ScanQuery scan;
+
+ typedef std::vector< CacheEntry<int64_t, Person> > ResVector;
+
+ ResVector res;
+ cache.Query(scan).GetAll(res);
+
+ // Execute queries for salary ranges.
+ std::cout << "People with salaries between 0 and 1000 (queried with SCAN query): " << std::endl;
+
+ for (ResVector::const_iterator i = res.begin(); i != res.end(); ++i)
+ {
+ Person person(i->GetValue());
+
+ if (person.salary <= 1000)
+ std::cout << i->GetKey() << " : " << person.ToString() << std::endl;
+ }
+
+ std::cout << std::endl;
+}
+
+/**
+ * Populate cache with test data.
+ */
+void Initialize()
+{
+ Cache<int64_t, Organization> orgCache =
+ Ignition::Get().GetCache<int64_t, Organization>(ORG_CACHE);
+
+ // Clear cache before running the example.
+ orgCache.Clear();
+
+ // Organizations.
+ Organization org1("ApacheIgnite");
+ Organization org2("Other");
+
+ const int64_t org1Id = 1;
+ const int64_t org2Id = 2;
+
+ orgCache.Put(org1Id, org1);
+ orgCache.Put(org2Id, org2);
+
+ Cache<int64_t, Person> personCache =
+ Ignition::Get().GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // Clear cache before running the example.
+ personCache.Clear();
+
+ // People.
+ Person p1(org1Id, "John", "Doe", "John Doe has Master Degree.", 2000);
+ Person p2(org1Id, "Jane", "Doe", "Jane Doe has Bachelor Degree.", 1000);
+ Person p3(org2Id, "John", "Smith", "John Smith has Bachelor Degree.", 1000);
+ Person p4(org2Id, "Jane", "Smith", "Jane Smith has Master Degree.", 2000);
+
+ // Note that in this example we use custom affinity key for Person objects
+ // to ensure that all persons are collocated with their organizations.
+ personCache.Put(1, p1);
+ personCache.Put(2, p2);
+ personCache.Put(3, p3);
+ personCache.Put(4, p4);
+}
+
+int main()
+{
+ IgniteConfiguration cfg;
+
+ cfg.jvmInitMem = 512;
+ cfg.jvmMaxMem = 512;
+
+ cfg.springCfgPath = "platforms/cpp/examples/query-example/config/query-example.xml";
+
+ try
+ {
+ // Start a node.
+ Ignite ignite = Ignition::Start(cfg);
+
+ std::cout << std::endl;
+ std::cout << ">>> Cache query example started." << std::endl;
+ std::cout << std::endl;
+
+ // Get organization cache instance.
+ Cache<int64_t, Organization> orgCache = ignite.GetCache<int64_t, Organization>(ORG_CACHE);
+
+ // Get person cache instance.
+ Cache<int64_t, Person> personCache = ignite.GetCache<int64_t, Person>(PERSON_CACHE);
+
+ // Populate cache.
+ Initialize();
+
+ // Example for SCAN-based query based on a predicate.
+ DoScanQuery();
+
+ // Example for SQL-based querying employees based on salary ranges.
+ DoSqlQuery();
+
+ // Example for SQL-based querying employees for a given organization (includes SQL join).
+ DoSqlQueryWithJoin();
+
+ // Example for TEXT-based querying for a given string in peoples resumes.
+ DoTextQuery();
+
+ // Example for SQL-based querying to calculate average salary among all employees within a company.
+ DoSqlQueryWithAggregation();
+
+ // Example for SQL-based fields queries that return only required
+ // fields instead of whole key-value pairs.
+ DoSqlFieldsQuery();
+
+ // Example for SQL-based fields queries that uses joins.
+ DoSqlFieldsQueryWithJoin();
+
+ // Stop node.
+ Ignition::StopAll(false);
+ }
+ catch (IgniteError& err)
+ {
+ std::cout << "An error occurred: " << err.GetText() << std::endl;
+ }
+
+ std::cout << std::endl;
+ std::cout << ">>> Example finished, press any key to exit ..." << std::endl;
+ std::cout << std::endl;
+
+ std::cin.get();
+
+ return 0;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80979dfc/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp
index 260ea9d..8d57dee 100644
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@ -41,7 +41,7 @@ namespace ignite
const std::string driver = "Apache Ignite";
/** Default value for host attribute. */
- const std::string host = "";
+ const std::string host = "localhost";
/** Default value for port attribute. */
const uint16_t port = 10800;