summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-25 20:35:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-25 20:35:31 +0300
commit3fe9378674c484750e36f01a353ec17977a6f1a3 (patch)
treef83e61172c9b0877295284f6fd9e67cddb954ee6
parent451173da3c76fcb9b3aea5c6d97f48b492558392 (diff)
parent0d49ea1fe08cf1eab41a00149393a291c65a59d7 (diff)
Merge branch 'odb-tests' into multi-package
-rw-r--r--odb-tests/.gitignore41
-rw-r--r--odb-tests/GPLv2340
-rw-r--r--odb-tests/LICENSE20
-rw-r--r--odb-tests/README.md4
-rw-r--r--odb-tests/boost/common/multi-index/driver.cxx189
-rw-r--r--odb-tests/boost/common/multi-index/test.hxx113
-rw-r--r--odb-tests/boost/common/optional/driver.cxx74
-rw-r--r--odb-tests/boost/common/optional/test.hxx31
-rw-r--r--odb-tests/boost/common/smart-ptr/driver.cxx202
-rw-r--r--odb-tests/boost/common/smart-ptr/test.hxx82
-rw-r--r--odb-tests/boost/common/template/driver.cxx39
-rw-r--r--odb-tests/boost/common/template/template-vc10.vcxproj177
-rw-r--r--odb-tests/boost/common/template/template-vc10.vcxproj.filters24
-rw-r--r--odb-tests/boost/common/template/template-vc11.vcxproj181
-rw-r--r--odb-tests/boost/common/template/template-vc11.vcxproj.filters24
-rw-r--r--odb-tests/boost/common/template/template-vc12.vcxproj185
-rw-r--r--odb-tests/boost/common/template/template-vc12.vcxproj.filters24
-rw-r--r--odb-tests/boost/common/template/template-vc8.vcproj353
-rw-r--r--odb-tests/boost/common/template/template-vc9.vcproj360
-rw-r--r--odb-tests/boost/common/template/test.hxx25
-rw-r--r--odb-tests/boost/common/unordered/driver.cxx212
-rw-r--r--odb-tests/boost/common/unordered/test.hxx113
-rw-r--r--odb-tests/boost/common/uuid/driver.cxx69
-rw-r--r--odb-tests/boost/common/uuid/test.hxx37
-rw-r--r--odb-tests/boost/mssql/date-time/driver.cxx158
-rw-r--r--odb-tests/boost/mssql/date-time/test.hxx58
-rw-r--r--odb-tests/boost/mssql/template/driver.cxx39
-rw-r--r--odb-tests/boost/mssql/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/boost/mssql/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/boost/mssql/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/boost/mssql/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/boost/mssql/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/boost/mssql/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/boost/mssql/template/template-vc8.vcproj354
-rw-r--r--odb-tests/boost/mssql/template/template-vc9.vcproj361
-rw-r--r--odb-tests/boost/mssql/template/test.hxx25
-rw-r--r--odb-tests/boost/mysql/date-time/driver.cxx218
-rw-r--r--odb-tests/boost/mysql/date-time/test.hxx65
-rw-r--r--odb-tests/boost/mysql/template/driver.cxx39
-rw-r--r--odb-tests/boost/mysql/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/boost/mysql/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/boost/mysql/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/boost/mysql/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/boost/mysql/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/boost/mysql/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/boost/mysql/template/template-vc8.vcproj354
-rw-r--r--odb-tests/boost/mysql/template/template-vc9.vcproj361
-rw-r--r--odb-tests/boost/mysql/template/test.hxx25
-rw-r--r--odb-tests/boost/oracle/date-time/driver.cxx136
-rw-r--r--odb-tests/boost/oracle/date-time/test.hxx42
-rw-r--r--odb-tests/boost/oracle/template/driver.cxx39
-rw-r--r--odb-tests/boost/oracle/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/boost/oracle/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/boost/oracle/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/boost/oracle/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/boost/oracle/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/boost/oracle/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/boost/oracle/template/template-vc8.vcproj354
-rw-r--r--odb-tests/boost/oracle/template/template-vc9.vcproj361
-rw-r--r--odb-tests/boost/oracle/template/test.hxx25
-rw-r--r--odb-tests/boost/pgsql/date-time/driver.cxx157
-rw-r--r--odb-tests/boost/pgsql/date-time/test.hxx39
-rw-r--r--odb-tests/boost/pgsql/template/driver.cxx39
-rw-r--r--odb-tests/boost/pgsql/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/boost/pgsql/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/boost/pgsql/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/boost/pgsql/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/boost/pgsql/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/boost/pgsql/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/boost/pgsql/template/template-vc8.vcproj354
-rw-r--r--odb-tests/boost/pgsql/template/template-vc9.vcproj361
-rw-r--r--odb-tests/boost/pgsql/template/test.hxx25
-rw-r--r--odb-tests/boost/sqlite/date-time/driver.cxx208
-rw-r--r--odb-tests/boost/sqlite/date-time/test.hxx57
-rw-r--r--odb-tests/boost/sqlite/template/driver.cxx39
-rw-r--r--odb-tests/boost/sqlite/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/boost/sqlite/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/boost/sqlite/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/boost/sqlite/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/boost/sqlite/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/boost/sqlite/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/boost/sqlite/template/template-vc8.vcproj354
-rw-r--r--odb-tests/boost/sqlite/template/template-vc9.vcproj361
-rw-r--r--odb-tests/boost/sqlite/template/test.hxx25
-rw-r--r--odb-tests/build/.gitignore3
-rw-r--r--odb-tests/build/bootstrap.build9
-rw-r--r--odb-tests/build/export.build9
-rw-r--r--odb-tests/build/root.build270
-rw-r--r--odb-tests/buildfile10
-rw-r--r--odb-tests/common/access/buildfile45
-rw-r--r--odb-tests/common/access/driver.cxx262
-rw-r--r--odb-tests/common/access/test.hxx592
-rw-r--r--odb-tests/common/access/testscript33
-rw-r--r--odb-tests/common/as/buildfile49
-rw-r--r--odb-tests/common/as/driver.cxx348
-rw-r--r--odb-tests/common/as/test.hxx270
-rw-r--r--odb-tests/common/as/testscript33
-rw-r--r--odb-tests/common/blob/buildfile40
-rw-r--r--odb-tests/common/blob/driver.cxx76
-rw-r--r--odb-tests/common/blob/test.hxx71
-rw-r--r--odb-tests/common/blob/testscript33
-rw-r--r--odb-tests/common/buildfile6
-rw-r--r--odb-tests/common/bulk/buildfile49
-rw-r--r--odb-tests/common/bulk/driver.cxx1203
-rw-r--r--odb-tests/common/bulk/test.hxx211
-rw-r--r--odb-tests/common/bulk/testscript503
-rw-r--r--odb-tests/common/callback/buildfile41
-rw-r--r--odb-tests/common/callback/driver.cxx184
-rw-r--r--odb-tests/common/callback/test.hxx43
-rw-r--r--odb-tests/common/callback/testscript100
-rw-r--r--odb-tests/common/changelog/.gitignore3
-rw-r--r--odb-tests/common/changelog/add-column-mssql-diff.xml16
-rw-r--r--odb-tests/common/changelog/add-column-mssql-patch.xml13
-rw-r--r--odb-tests/common/changelog/add-column-mysql-diff.xml16
-rw-r--r--odb-tests/common/changelog/add-column-mysql-patch.xml13
-rw-r--r--odb-tests/common/changelog/add-column-oracle-diff.xml16
-rw-r--r--odb-tests/common/changelog/add-column-oracle-patch.xml13
-rw-r--r--odb-tests/common/changelog/add-column-pgsql-diff.xml16
-rw-r--r--odb-tests/common/changelog/add-column-pgsql-patch.xml13
-rw-r--r--odb-tests/common/changelog/add-column-sqlite-diff.xml16
-rw-r--r--odb-tests/common/changelog/add-column-sqlite-patch.xml13
-rw-r--r--odb-tests/common/changelog/add-column.hxx20
-rw-r--r--odb-tests/common/changelog/add-foreign-key-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-mssql-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-mssql-patch.xml25
-rw-r--r--odb-tests/common/changelog/add-foreign-key-mysql-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-mysql-patch.xml25
-rw-r--r--odb-tests/common/changelog/add-foreign-key-oracle-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-oracle-patch.xml25
-rw-r--r--odb-tests/common/changelog/add-foreign-key-pgsql-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-pgsql-patch.xml25
-rw-r--r--odb-tests/common/changelog/add-foreign-key-sqlite-diff.xml28
-rw-r--r--odb-tests/common/changelog/add-foreign-key-sqlite-patch.xml25
-rw-r--r--odb-tests/common/changelog/add-foreign-key.hxx29
-rw-r--r--odb-tests/common/changelog/add-index-mssql-diff.xml21
-rw-r--r--odb-tests/common/changelog/add-index-mssql-patch.xml18
-rw-r--r--odb-tests/common/changelog/add-index-mysql-diff.xml21
-rw-r--r--odb-tests/common/changelog/add-index-mysql-patch.xml18
-rw-r--r--odb-tests/common/changelog/add-index-oracle-diff.xml21
-rw-r--r--odb-tests/common/changelog/add-index-oracle-patch.xml18
-rw-r--r--odb-tests/common/changelog/add-index-pgsql-diff.xml21
-rw-r--r--odb-tests/common/changelog/add-index-pgsql-patch.xml18
-rw-r--r--odb-tests/common/changelog/add-index-sqlite-diff.xml21
-rw-r--r--odb-tests/common/changelog/add-index-sqlite-patch.xml18
-rw-r--r--odb-tests/common/changelog/add-index.hxx24
-rw-r--r--odb-tests/common/changelog/add-table-mssql-diff.xml45
-rw-r--r--odb-tests/common/changelog/add-table-mssql-patch.xml44
-rw-r--r--odb-tests/common/changelog/add-table-mysql-diff.xml45
-rw-r--r--odb-tests/common/changelog/add-table-mysql-patch.xml44
-rw-r--r--odb-tests/common/changelog/add-table-oracle-diff.xml45
-rw-r--r--odb-tests/common/changelog/add-table-oracle-patch.xml44
-rw-r--r--odb-tests/common/changelog/add-table-pgsql-diff.xml45
-rw-r--r--odb-tests/common/changelog/add-table-pgsql-patch.xml44
-rw-r--r--odb-tests/common/changelog/add-table-sqlite-diff.xml45
-rw-r--r--odb-tests/common/changelog/add-table-sqlite-patch.xml44
-rw-r--r--odb-tests/common/changelog/add-table.hxx34
-rw-r--r--odb-tests/common/changelog/alter-column-mssql-diff.xml17
-rw-r--r--odb-tests/common/changelog/alter-column-mssql-patch.xml13
-rw-r--r--odb-tests/common/changelog/alter-column-mysql-diff.xml17
-rw-r--r--odb-tests/common/changelog/alter-column-mysql-patch.xml13
-rw-r--r--odb-tests/common/changelog/alter-column-oracle-diff.xml17
-rw-r--r--odb-tests/common/changelog/alter-column-oracle-patch.xml13
-rw-r--r--odb-tests/common/changelog/alter-column-pgsql-diff.xml17
-rw-r--r--odb-tests/common/changelog/alter-column-pgsql-patch.xml13
-rw-r--r--odb-tests/common/changelog/alter-column-sqlite-diff.xml17
-rw-r--r--odb-tests/common/changelog/alter-column-sqlite-patch.xml13
-rw-r--r--odb-tests/common/changelog/alter-column.hxx21
-rw-r--r--odb-tests/common/changelog/buildfile30
-rw-r--r--odb-tests/common/changelog/drop-column-mssql-diff.xml17
-rw-r--r--odb-tests/common/changelog/drop-column-mssql-patch.xml12
-rw-r--r--odb-tests/common/changelog/drop-column-mysql-diff.xml17
-rw-r--r--odb-tests/common/changelog/drop-column-mysql-patch.xml12
-rw-r--r--odb-tests/common/changelog/drop-column-oracle-diff.xml17
-rw-r--r--odb-tests/common/changelog/drop-column-oracle-patch.xml12
-rw-r--r--odb-tests/common/changelog/drop-column-pgsql-diff.xml17
-rw-r--r--odb-tests/common/changelog/drop-column-pgsql-patch.xml12
-rw-r--r--odb-tests/common/changelog/drop-column-sqlite-diff.xml17
-rw-r--r--odb-tests/common/changelog/drop-column-sqlite-patch.xml12
-rw-r--r--odb-tests/common/changelog/drop-column.hxx20
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-mssql-diff.xml30
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-mssql-patch.xml18
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-mysql-diff.xml30
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-mysql-patch.xml18
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-oracle-diff.xml30
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-oracle-patch.xml18
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-pgsql-diff.xml30
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-pgsql-patch.xml18
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-sqlite-diff.xml30
-rw-r--r--odb-tests/common/changelog/drop-foreign-key-sqlite-patch.xml18
-rw-r--r--odb-tests/common/changelog/drop-foreign-key.hxx29
-rw-r--r--odb-tests/common/changelog/drop-index-mssql-diff.xml20
-rw-r--r--odb-tests/common/changelog/drop-index-mssql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-index-mysql-diff.xml20
-rw-r--r--odb-tests/common/changelog/drop-index-mysql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-index-oracle-diff.xml20
-rw-r--r--odb-tests/common/changelog/drop-index-oracle-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-index-pgsql-diff.xml20
-rw-r--r--odb-tests/common/changelog/drop-index-pgsql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-index-sqlite-diff.xml20
-rw-r--r--odb-tests/common/changelog/drop-index-sqlite-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-index.hxx21
-rw-r--r--odb-tests/common/changelog/drop-table-mssql-diff.xml47
-rw-r--r--odb-tests/common/changelog/drop-table-mssql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-table-mysql-diff.xml47
-rw-r--r--odb-tests/common/changelog/drop-table-mysql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-table-oracle-diff.xml47
-rw-r--r--odb-tests/common/changelog/drop-table-oracle-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-table-pgsql-diff.xml47
-rw-r--r--odb-tests/common/changelog/drop-table-pgsql-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-table-sqlite-diff.xml47
-rw-r--r--odb-tests/common/changelog/drop-table-sqlite-patch.xml13
-rw-r--r--odb-tests/common/changelog/drop-table.hxx34
l---------odb-tests/common/changelog/model-mssql-diff.xml1
l---------odb-tests/common/changelog/model-mssql-patch.xml1
-rw-r--r--odb-tests/common/changelog/model-mssql.xml56
l---------odb-tests/common/changelog/model-mysql-diff.xml1
l---------odb-tests/common/changelog/model-mysql-patch.xml1
-rw-r--r--odb-tests/common/changelog/model-mysql.xml56
l---------odb-tests/common/changelog/model-oracle-diff.xml1
l---------odb-tests/common/changelog/model-oracle-patch.xml1
-rw-r--r--odb-tests/common/changelog/model-oracle.xml56
l---------odb-tests/common/changelog/model-pgsql-diff.xml1
l---------odb-tests/common/changelog/model-pgsql-patch.xml1
-rw-r--r--odb-tests/common/changelog/model-pgsql.xml56
l---------odb-tests/common/changelog/model-sqlite-diff.xml1
l---------odb-tests/common/changelog/model-sqlite-patch.xml1
-rw-r--r--odb-tests/common/changelog/model-sqlite.xml56
-rw-r--r--odb-tests/common/changelog/model.hxx46
-rw-r--r--odb-tests/common/changelog/testscript66
-rw-r--r--odb-tests/common/circular/multiple/.gitignore6
-rw-r--r--odb-tests/common/circular/multiple/buildfile49
-rw-r--r--odb-tests/common/circular/multiple/driver.cxx69
-rw-r--r--odb-tests/common/circular/multiple/test1.hxx27
-rw-r--r--odb-tests/common/circular/multiple/test2.hxx17
-rw-r--r--odb-tests/common/circular/multiple/testscript31
-rw-r--r--odb-tests/common/circular/single/buildfile41
-rw-r--r--odb-tests/common/circular/single/driver.cxx40
-rw-r--r--odb-tests/common/circular/single/test.hxx28
-rw-r--r--odb-tests/common/circular/single/testscript33
-rw-r--r--odb-tests/common/composite/buildfile41
-rw-r--r--odb-tests/common/composite/driver.cxx229
-rw-r--r--odb-tests/common/composite/test.hxx250
-rw-r--r--odb-tests/common/composite/testscript33
-rw-r--r--odb-tests/common/const-member/buildfile40
-rw-r--r--odb-tests/common/const-member/driver.cxx119
-rw-r--r--odb-tests/common/const-member/test.hxx109
-rw-r--r--odb-tests/common/const-member/testscript33
-rw-r--r--odb-tests/common/const-object/buildfile41
-rw-r--r--odb-tests/common/const-object/driver.cxx216
-rw-r--r--odb-tests/common/const-object/test.hxx51
-rw-r--r--odb-tests/common/const-object/testscript33
-rw-r--r--odb-tests/common/container/basics/buildfile40
-rw-r--r--odb-tests/common/container/basics/driver.cxx523
-rw-r--r--odb-tests/common/container/basics/test.hxx245
-rw-r--r--odb-tests/common/container/basics/testscript33
-rw-r--r--odb-tests/common/container/change-tracking/buildfile40
-rw-r--r--odb-tests/common/container/change-tracking/driver.cxx729
-rw-r--r--odb-tests/common/container/change-tracking/test.hxx106
-rw-r--r--odb-tests/common/container/change-tracking/testscript33
-rw-r--r--odb-tests/common/ctor/buildfile41
-rw-r--r--odb-tests/common/ctor/driver.cxx79
-rw-r--r--odb-tests/common/ctor/test.hxx29
-rw-r--r--odb-tests/common/ctor/testscript33
-rw-r--r--odb-tests/common/default/buildfile41
-rw-r--r--odb-tests/common/default/driver.cxx81
-rw-r--r--odb-tests/common/default/test.hxx67
-rw-r--r--odb-tests/common/default/testscript33
-rw-r--r--odb-tests/common/definition/.gitignore6
-rw-r--r--odb-tests/common/definition/buildfile52
-rw-r--r--odb-tests/common/definition/driver.cxx56
-rw-r--r--odb-tests/common/definition/test.hxx26
-rw-r--r--odb-tests/common/definition/testscript33
-rw-r--r--odb-tests/common/definition/time-mapping.hxx17
-rw-r--r--odb-tests/common/enum/buildfile41
-rw-r--r--odb-tests/common/enum/driver.cxx84
-rw-r--r--odb-tests/common/enum/test.hxx47
-rw-r--r--odb-tests/common/enum/testscript33
-rw-r--r--odb-tests/common/erase-query/buildfile41
-rw-r--r--odb-tests/common/erase-query/driver.cxx181
-rw-r--r--odb-tests/common/erase-query/test.hxx46
-rw-r--r--odb-tests/common/erase-query/testscript33
-rw-r--r--odb-tests/common/id/auto/buildfile40
-rw-r--r--odb-tests/common/id/auto/driver.cxx96
-rw-r--r--odb-tests/common/id/auto/test.hxx40
-rw-r--r--odb-tests/common/id/auto/testscript33
-rw-r--r--odb-tests/common/id/composite/buildfile42
-rw-r--r--odb-tests/common/id/composite/driver.cxx731
-rw-r--r--odb-tests/common/id/composite/test.hxx519
-rw-r--r--odb-tests/common/id/composite/testscript33
-rw-r--r--odb-tests/common/id/nested/buildfile41
-rw-r--r--odb-tests/common/id/nested/driver.cxx266
-rw-r--r--odb-tests/common/id/nested/test.hxx217
-rw-r--r--odb-tests/common/id/nested/testscript33
-rw-r--r--odb-tests/common/include/.gitignore17
-rw-r--r--odb-tests/common/include/buildfile51
-rw-r--r--odb-tests/common/include/driver.cxx42
-rw-r--r--odb-tests/common/include/obj1.hxx25
-rw-r--r--odb-tests/common/include/obj2.hxx25
-rw-r--r--odb-tests/common/include/obj3.hxx25
-rw-r--r--odb-tests/common/include/objs1.hxx13
-rw-r--r--odb-tests/common/include/objs2.hxx13
-rw-r--r--odb-tests/common/include/objs3.hxx11
-rw-r--r--odb-tests/common/include/objs4.hxx11
-rw-r--r--odb-tests/common/include/test1.hxx16
-rw-r--r--odb-tests/common/include/test2.hxx15
-rw-r--r--odb-tests/common/include/test3.hxx12
-rw-r--r--odb-tests/common/include/test4.hxx12
-rw-r--r--odb-tests/common/include/testscript31
-rw-r--r--odb-tests/common/index/buildfile40
-rw-r--r--odb-tests/common/index/driver.cxx44
-rw-r--r--odb-tests/common/index/test.hxx142
-rw-r--r--odb-tests/common/index/testscript33
-rw-r--r--odb-tests/common/inheritance/polymorphism/.gitignore76
-rw-r--r--odb-tests/common/inheritance/polymorphism/buildfile52
-rw-r--r--odb-tests/common/inheritance/polymorphism/driver.cxx2093
-rw-r--r--odb-tests/common/inheritance/polymorphism/test1.hxx115
-rw-r--r--odb-tests/common/inheritance/polymorphism/test10.hxx78
-rw-r--r--odb-tests/common/inheritance/polymorphism/test11.hxx78
-rw-r--r--odb-tests/common/inheritance/polymorphism/test12.hxx79
-rw-r--r--odb-tests/common/inheritance/polymorphism/test13.hxx46
-rw-r--r--odb-tests/common/inheritance/polymorphism/test14.hxx99
-rw-r--r--odb-tests/common/inheritance/polymorphism/test15.hxx44
-rw-r--r--odb-tests/common/inheritance/polymorphism/test2.hxx105
-rw-r--r--odb-tests/common/inheritance/polymorphism/test3.hxx146
-rw-r--r--odb-tests/common/inheritance/polymorphism/test4.hxx84
-rw-r--r--odb-tests/common/inheritance/polymorphism/test5.hxx92
-rw-r--r--odb-tests/common/inheritance/polymorphism/test6.hxx64
-rw-r--r--odb-tests/common/inheritance/polymorphism/test7.hxx54
-rw-r--r--odb-tests/common/inheritance/polymorphism/test8.hxx129
-rw-r--r--odb-tests/common/inheritance/polymorphism/test9.hxx161
-rw-r--r--odb-tests/common/inheritance/polymorphism/testscript80
-rw-r--r--odb-tests/common/inheritance/reuse/buildfile41
-rw-r--r--odb-tests/common/inheritance/reuse/driver.cxx237
-rw-r--r--odb-tests/common/inheritance/reuse/test.hxx163
-rw-r--r--odb-tests/common/inheritance/reuse/testscript33
-rw-r--r--odb-tests/common/inheritance/transient/buildfile41
-rw-r--r--odb-tests/common/inheritance/transient/driver.cxx80
-rw-r--r--odb-tests/common/inheritance/transient/test.hxx60
-rw-r--r--odb-tests/common/inheritance/transient/testscript33
-rw-r--r--odb-tests/common/inverse/buildfile42
-rw-r--r--odb-tests/common/inverse/driver.cxx502
-rw-r--r--odb-tests/common/inverse/test.hxx391
-rw-r--r--odb-tests/common/inverse/testscript33
-rw-r--r--odb-tests/common/lazy-ptr/buildfile41
-rw-r--r--odb-tests/common/lazy-ptr/driver.cxx360
-rw-r--r--odb-tests/common/lazy-ptr/test.hxx147
-rw-r--r--odb-tests/common/lazy-ptr/testscript33
-rw-r--r--odb-tests/common/lifecycle/buildfile40
-rw-r--r--odb-tests/common/lifecycle/driver.cxx248
-rw-r--r--odb-tests/common/lifecycle/test.hxx27
-rw-r--r--odb-tests/common/lifecycle/testscript33
-rw-r--r--odb-tests/common/no-id/buildfile41
-rw-r--r--odb-tests/common/no-id/driver.cxx102
-rw-r--r--odb-tests/common/no-id/test.hxx21
-rw-r--r--odb-tests/common/no-id/testscript33
-rw-r--r--odb-tests/common/object/buildfile41
-rw-r--r--odb-tests/common/object/driver.cxx84
-rw-r--r--odb-tests/common/object/test.hxx49
-rw-r--r--odb-tests/common/object/testscript33
-rw-r--r--odb-tests/common/optimistic/buildfile41
-rw-r--r--odb-tests/common/optimistic/driver.cxx300
-rw-r--r--odb-tests/common/optimistic/test.hxx76
-rw-r--r--odb-tests/common/optimistic/testscript33
-rw-r--r--odb-tests/common/pragma/buildfile39
-rw-r--r--odb-tests/common/pragma/driver.cxx27
-rw-r--r--odb-tests/common/pragma/test.hxx40
-rw-r--r--odb-tests/common/pragma/testscript31
-rw-r--r--odb-tests/common/prepared/buildfile43
-rw-r--r--odb-tests/common/prepared/driver.cxx444
-rw-r--r--odb-tests/common/prepared/test.hxx32
-rw-r--r--odb-tests/common/prepared/testscript33
-rw-r--r--odb-tests/common/query/array/buildfile43
-rw-r--r--odb-tests/common/query/array/driver.cxx220
-rw-r--r--odb-tests/common/query/array/test.hxx70
-rw-r--r--odb-tests/common/query/array/testscript33
-rw-r--r--odb-tests/common/query/basics/buildfile42
-rw-r--r--odb-tests/common/query/basics/driver.cxx668
-rw-r--r--odb-tests/common/query/basics/test.hxx117
-rw-r--r--odb-tests/common/query/basics/testscript150
-rw-r--r--odb-tests/common/query/one/buildfile42
-rw-r--r--odb-tests/common/query/one/driver.cxx205
-rw-r--r--odb-tests/common/query/one/test.hxx26
-rw-r--r--odb-tests/common/query/one/testscript33
-rw-r--r--odb-tests/common/readonly/buildfile40
-rw-r--r--odb-tests/common/readonly/driver.cxx324
-rw-r--r--odb-tests/common/readonly/test.hxx225
-rw-r--r--odb-tests/common/readonly/testscript33
-rw-r--r--odb-tests/common/relationship/basics/buildfile41
-rw-r--r--odb-tests/common/relationship/basics/driver.cxx150
-rw-r--r--odb-tests/common/relationship/basics/test.hxx260
-rw-r--r--odb-tests/common/relationship/basics/testscript33
-rw-r--r--odb-tests/common/relationship/on-delete/buildfile43
-rw-r--r--odb-tests/common/relationship/on-delete/driver.cxx82
-rw-r--r--odb-tests/common/relationship/on-delete/test.hxx58
-rw-r--r--odb-tests/common/relationship/on-delete/testscript33
-rw-r--r--odb-tests/common/relationship/query/buildfile42
-rw-r--r--odb-tests/common/relationship/query/driver.cxx168
-rw-r--r--odb-tests/common/relationship/query/test.hxx140
-rw-r--r--odb-tests/common/relationship/query/testscript33
-rw-r--r--odb-tests/common/schema/embedded/basics/buildfile42
-rw-r--r--odb-tests/common/schema/embedded/basics/driver.cxx59
-rw-r--r--odb-tests/common/schema/embedded/basics/test.hxx23
-rw-r--r--odb-tests/common/schema/embedded/basics/testscript31
-rw-r--r--odb-tests/common/schema/embedded/order/.gitignore6
-rw-r--r--odb-tests/common/schema/embedded/order/buildfile48
-rw-r--r--odb-tests/common/schema/embedded/order/driver.cxx65
-rw-r--r--odb-tests/common/schema/embedded/order/test1.hxx23
-rw-r--r--odb-tests/common/schema/embedded/order/test2.hxx17
-rw-r--r--odb-tests/common/schema/embedded/order/testscript31
-rw-r--r--odb-tests/common/schema/namespace/buildfile41
-rw-r--r--odb-tests/common/schema/namespace/driver.cxx113
-rw-r--r--odb-tests/common/schema/namespace/test.hxx158
-rw-r--r--odb-tests/common/schema/namespace/testscript33
-rw-r--r--odb-tests/common/section/basics/buildfile41
-rw-r--r--odb-tests/common/section/basics/driver.cxx1735
-rw-r--r--odb-tests/common/section/basics/test.hxx628
-rw-r--r--odb-tests/common/section/basics/testscript33
-rw-r--r--odb-tests/common/section/polymorphism/buildfile41
-rw-r--r--odb-tests/common/section/polymorphism/driver.cxx1807
-rw-r--r--odb-tests/common/section/polymorphism/test.hxx542
-rw-r--r--odb-tests/common/section/polymorphism/testscript33
-rw-r--r--odb-tests/common/session/cache/buildfile41
-rw-r--r--odb-tests/common/session/cache/driver.cxx83
-rw-r--r--odb-tests/common/session/cache/test.hxx50
-rw-r--r--odb-tests/common/session/cache/testscript33
-rw-r--r--odb-tests/common/session/custom/buildfile43
-rw-r--r--odb-tests/common/session/custom/driver.cxx231
-rw-r--r--odb-tests/common/session/custom/session.cxx57
-rw-r--r--odb-tests/common/session/custom/session.hxx191
-rw-r--r--odb-tests/common/session/custom/session.txx159
-rw-r--r--odb-tests/common/session/custom/test.hxx118
-rw-r--r--odb-tests/common/session/custom/testscript33
-rw-r--r--odb-tests/common/statement/processing/buildfile8
-rw-r--r--odb-tests/common/statement/processing/driver.cxx619
-rw-r--r--odb-tests/common/statement/processing/testscript6
-rw-r--r--odb-tests/common/threads/buildfile49
-rw-r--r--odb-tests/common/threads/driver.cxx236
-rw-r--r--odb-tests/common/threads/test.hxx29
-rw-r--r--odb-tests/common/threads/testscript50
-rw-r--r--odb-tests/common/transaction/basics/buildfile13
-rw-r--r--odb-tests/common/transaction/basics/driver.cxx151
-rw-r--r--odb-tests/common/transaction/basics/testscript62
-rw-r--r--odb-tests/common/transaction/callback/buildfile13
-rw-r--r--odb-tests/common/transaction/callback/driver.cxx231
-rw-r--r--odb-tests/common/transaction/callback/testscript72
-rw-r--r--odb-tests/common/types/buildfile39
-rw-r--r--odb-tests/common/types/driver.cxx37
-rw-r--r--odb-tests/common/types/test.hxx55
-rw-r--r--odb-tests/common/types/testscript6
-rw-r--r--odb-tests/common/view/basics/buildfile42
-rw-r--r--odb-tests/common/view/basics/driver.cxx846
-rw-r--r--odb-tests/common/view/basics/test.hxx640
-rw-r--r--odb-tests/common/view/basics/testscript33
-rw-r--r--odb-tests/common/view/olv/.gitignore46
-rw-r--r--odb-tests/common/view/olv/buildfile50
-rw-r--r--odb-tests/common/view/olv/driver.cxx654
-rw-r--r--odb-tests/common/view/olv/test1.hxx116
-rw-r--r--odb-tests/common/view/olv/test2.hxx122
-rw-r--r--odb-tests/common/view/olv/test3.hxx106
-rw-r--r--odb-tests/common/view/olv/test4.hxx151
-rw-r--r--odb-tests/common/view/olv/test5.hxx86
-rw-r--r--odb-tests/common/view/olv/test6.hxx57
-rw-r--r--odb-tests/common/view/olv/test7.hxx57
-rw-r--r--odb-tests/common/view/olv/test8.hxx54
-rw-r--r--odb-tests/common/view/olv/test9.hxx78
-rw-r--r--odb-tests/common/view/olv/testscript39
-rw-r--r--odb-tests/common/virtual/buildfile42
-rw-r--r--odb-tests/common/virtual/driver.cxx154
-rw-r--r--odb-tests/common/virtual/test.hxx171
-rw-r--r--odb-tests/common/virtual/testscript33
-rw-r--r--odb-tests/common/wrapper/buildfile40
-rw-r--r--odb-tests/common/wrapper/driver.cxx216
-rw-r--r--odb-tests/common/wrapper/test.hxx214
-rw-r--r--odb-tests/common/wrapper/testscript33
-rw-r--r--odb-tests/database-options.testscript75
-rw-r--r--odb-tests/evolution/add-column/driver.cxx125
-rw-r--r--odb-tests/evolution/add-column/model.hxx38
-rw-r--r--odb-tests/evolution/add-column/test1.hxx9
-rw-r--r--odb-tests/evolution/add-column/test2.hxx11
-rw-r--r--odb-tests/evolution/add-column/test3.hxx11
-rw-r--r--odb-tests/evolution/add-foreign-key/driver.cxx173
-rw-r--r--odb-tests/evolution/add-foreign-key/model.hxx66
-rw-r--r--odb-tests/evolution/add-foreign-key/test1.hxx9
-rw-r--r--odb-tests/evolution/add-foreign-key/test2.hxx11
-rw-r--r--odb-tests/evolution/add-foreign-key/test3.hxx11
-rw-r--r--odb-tests/evolution/add-index/driver.cxx165
-rw-r--r--odb-tests/evolution/add-index/model.hxx33
-rw-r--r--odb-tests/evolution/add-index/test1.hxx9
-rw-r--r--odb-tests/evolution/add-index/test2.hxx11
-rw-r--r--odb-tests/evolution/add-index/test3.hxx11
-rw-r--r--odb-tests/evolution/add-table/driver.cxx140
-rw-r--r--odb-tests/evolution/add-table/model.hxx48
-rw-r--r--odb-tests/evolution/add-table/test1.hxx9
-rw-r--r--odb-tests/evolution/add-table/test2.hxx11
-rw-r--r--odb-tests/evolution/add-table/test3.hxx11
-rw-r--r--odb-tests/evolution/alter-column/driver.cxx160
-rw-r--r--odb-tests/evolution/alter-column/model.hxx56
-rw-r--r--odb-tests/evolution/alter-column/test1.hxx9
-rw-r--r--odb-tests/evolution/alter-column/test2.hxx11
-rw-r--r--odb-tests/evolution/alter-column/test3.hxx11
-rw-r--r--odb-tests/evolution/combined/driver.cxx157
-rw-r--r--odb-tests/evolution/combined/model.hxx174
-rw-r--r--odb-tests/evolution/combined/test1.hxx9
-rw-r--r--odb-tests/evolution/combined/test2.hxx11
-rw-r--r--odb-tests/evolution/combined/test3.hxx11
-rw-r--r--odb-tests/evolution/data/driver.cxx178
-rw-r--r--odb-tests/evolution/data/model.hxx45
-rw-r--r--odb-tests/evolution/data/test1.hxx9
-rw-r--r--odb-tests/evolution/data/test2.hxx11
-rw-r--r--odb-tests/evolution/data/test3.hxx11
-rw-r--r--odb-tests/evolution/drop-column/driver.cxx126
-rw-r--r--odb-tests/evolution/drop-column/model.hxx59
-rw-r--r--odb-tests/evolution/drop-column/test1.hxx9
-rw-r--r--odb-tests/evolution/drop-column/test2.hxx11
-rw-r--r--odb-tests/evolution/drop-column/test3.hxx11
-rw-r--r--odb-tests/evolution/drop-foreign-key/driver.cxx145
-rw-r--r--odb-tests/evolution/drop-foreign-key/model.hxx50
-rw-r--r--odb-tests/evolution/drop-foreign-key/test1.hxx9
-rw-r--r--odb-tests/evolution/drop-foreign-key/test2.hxx11
-rw-r--r--odb-tests/evolution/drop-foreign-key/test3.hxx11
-rw-r--r--odb-tests/evolution/drop-index/driver.cxx154
-rw-r--r--odb-tests/evolution/drop-index/model.hxx33
-rw-r--r--odb-tests/evolution/drop-index/test1.hxx9
-rw-r--r--odb-tests/evolution/drop-index/test2.hxx11
-rw-r--r--odb-tests/evolution/drop-index/test3.hxx11
-rw-r--r--odb-tests/evolution/drop-table/driver.cxx168
-rw-r--r--odb-tests/evolution/drop-table/model.hxx94
-rw-r--r--odb-tests/evolution/drop-table/test1.hxx9
-rw-r--r--odb-tests/evolution/drop-table/test2.hxx11
-rw-r--r--odb-tests/evolution/drop-table/test3.hxx11
-rw-r--r--odb-tests/evolution/embedded/driver.cxx181
-rw-r--r--odb-tests/evolution/embedded/model.hxx45
-rw-r--r--odb-tests/evolution/embedded/test1.hxx9
-rw-r--r--odb-tests/evolution/embedded/test2.hxx11
-rw-r--r--odb-tests/evolution/embedded/test3.hxx11
-rw-r--r--odb-tests/evolution/soft-add/driver.cxx2219
-rw-r--r--odb-tests/evolution/soft-add/model.hxx504
-rw-r--r--odb-tests/evolution/soft-add/test1.hxx9
-rw-r--r--odb-tests/evolution/soft-add/test2.hxx11
-rw-r--r--odb-tests/evolution/soft-add/test3.hxx11
-rw-r--r--odb-tests/evolution/soft-delete/driver.cxx2202
-rw-r--r--odb-tests/evolution/soft-delete/model.hxx518
-rw-r--r--odb-tests/evolution/soft-delete/test1.hxx9
-rw-r--r--odb-tests/evolution/soft-delete/test2.hxx11
-rw-r--r--odb-tests/evolution/soft-delete/test3.hxx11
-rw-r--r--odb-tests/evolution/template/driver.cxx124
-rw-r--r--odb-tests/evolution/template/model.hxx40
-rw-r--r--odb-tests/evolution/template/template-vc10.vcxproj196
-rw-r--r--odb-tests/evolution/template/template-vc10.vcxproj.filters32
-rw-r--r--odb-tests/evolution/template/template-vc11.vcxproj200
-rw-r--r--odb-tests/evolution/template/template-vc11.vcxproj.filters32
-rw-r--r--odb-tests/evolution/template/template-vc12.vcxproj204
-rw-r--r--odb-tests/evolution/template/template-vc12.vcxproj.filters32
-rw-r--r--odb-tests/evolution/template/template-vc8.vcproj372
-rw-r--r--odb-tests/evolution/template/template-vc9.vcproj379
-rw-r--r--odb-tests/evolution/template/test1.hxx9
-rw-r--r--odb-tests/evolution/template/test2.hxx11
-rw-r--r--odb-tests/evolution/template/test3.hxx11
-rw-r--r--odb-tests/evolution/version/driver.cxx156
-rw-r--r--odb-tests/evolution/version/model.hxx45
-rw-r--r--odb-tests/evolution/version/test1.hxx9
-rw-r--r--odb-tests/evolution/version/test2.hxx11
-rw-r--r--odb-tests/evolution/version/test3.hxx11
-rw-r--r--odb-tests/libcommon/.gitignore3
-rw-r--r--odb-tests/libcommon/buffer.hxx104
-rw-r--r--odb-tests/libcommon/buildfile50
-rw-r--r--odb-tests/libcommon/common.cxx355
-rw-r--r--odb-tests/libcommon/common.hxx47
-rw-r--r--odb-tests/libcommon/common.txx24
-rw-r--r--odb-tests/libcommon/concrete.hxx57
-rw-r--r--odb-tests/libcommon/config.hxx.in14
-rw-r--r--odb-tests/libcommon/export.hxx39
-rw-r--r--odb-tests/manifest48
-rw-r--r--odb-tests/mssql/custom/custom.sql42
-rw-r--r--odb-tests/mssql/custom/driver.cxx135
-rw-r--r--odb-tests/mssql/custom/query.hxx183
-rw-r--r--odb-tests/mssql/custom/test.hxx121
-rw-r--r--odb-tests/mssql/custom/traits.cxx128
-rw-r--r--odb-tests/mssql/custom/traits.hxx148
-rw-r--r--odb-tests/mssql/database/driver.cxx105
-rw-r--r--odb-tests/mssql/native/driver.cxx73
-rw-r--r--odb-tests/mssql/query/driver.cxx188
-rw-r--r--odb-tests/mssql/query/test.hxx38
-rw-r--r--odb-tests/mssql/stored-proc/driver.cxx231
-rw-r--r--odb-tests/mssql/stored-proc/test.hxx63
-rw-r--r--odb-tests/mssql/template/driver.cxx40
-rw-r--r--odb-tests/mssql/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/mssql/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/mssql/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/mssql/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/mssql/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/mssql/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/mssql/template/template-vc8.vcproj354
-rw-r--r--odb-tests/mssql/template/template-vc9.vcproj361
-rw-r--r--odb-tests/mssql/template/test.hxx25
-rw-r--r--odb-tests/mssql/types/driver.cxx381
-rw-r--r--odb-tests/mssql/types/test.hxx517
-rw-r--r--odb-tests/mssql/types/traits.hxx223
-rw-r--r--odb-tests/mysql-schema.testscript9
-rw-r--r--odb-tests/mysql.testscript12
-rw-r--r--odb-tests/mysql/custom/buildfile37
-rw-r--r--odb-tests/mysql/custom/driver.cxx117
-rw-r--r--odb-tests/mysql/custom/query.hxx160
-rw-r--r--odb-tests/mysql/custom/test.hxx54
-rw-r--r--odb-tests/mysql/custom/testscript11
-rw-r--r--odb-tests/mysql/custom/traits.hxx88
-rw-r--r--odb-tests/mysql/database/buildfile11
-rw-r--r--odb-tests/mysql/database/driver.cxx72
-rw-r--r--odb-tests/mysql/database/testscript6
-rw-r--r--odb-tests/mysql/index/buildfile34
-rw-r--r--odb-tests/mysql/index/driver.cxx44
-rw-r--r--odb-tests/mysql/index/test.hxx20
-rw-r--r--odb-tests/mysql/index/testscript11
-rw-r--r--odb-tests/mysql/native/buildfile16
-rw-r--r--odb-tests/mysql/native/driver.cxx75
-rw-r--r--odb-tests/mysql/native/testscript9
-rw-r--r--odb-tests/mysql/truncation/buildfile35
-rw-r--r--odb-tests/mysql/truncation/driver.cxx192
-rw-r--r--odb-tests/mysql/truncation/test.hxx48
-rw-r--r--odb-tests/mysql/truncation/testscript11
-rw-r--r--odb-tests/mysql/types/buildfile36
-rw-r--r--odb-tests/mysql/types/driver.cxx168
-rw-r--r--odb-tests/mysql/types/test.hxx328
-rw-r--r--odb-tests/mysql/types/testscript11
-rw-r--r--odb-tests/mysql/types/traits.hxx198
-rw-r--r--odb-tests/oracle/custom/custom.sql53
-rw-r--r--odb-tests/oracle/custom/driver.cxx77
-rw-r--r--odb-tests/oracle/custom/test.hxx40
-rw-r--r--odb-tests/oracle/custom/traits.hxx76
-rw-r--r--odb-tests/oracle/database/driver.cxx33
-rw-r--r--odb-tests/oracle/native/driver.cxx77
-rw-r--r--odb-tests/oracle/template/driver.cxx40
-rw-r--r--odb-tests/oracle/template/template-vc10.vcxproj180
-rw-r--r--odb-tests/oracle/template/template-vc10.vcxproj.filters25
-rw-r--r--odb-tests/oracle/template/template-vc11.vcxproj184
-rw-r--r--odb-tests/oracle/template/template-vc11.vcxproj.filters25
-rw-r--r--odb-tests/oracle/template/template-vc12.vcxproj188
-rw-r--r--odb-tests/oracle/template/template-vc12.vcxproj.filters25
-rw-r--r--odb-tests/oracle/template/template-vc8.vcproj354
-rw-r--r--odb-tests/oracle/template/template-vc9.vcproj361
-rw-r--r--odb-tests/oracle/template/test.hxx25
-rw-r--r--odb-tests/oracle/types/driver.cxx366
-rw-r--r--odb-tests/oracle/types/test.hxx353
-rw-r--r--odb-tests/oracle/types/traits.hxx192
-rw-r--r--odb-tests/pgsql-schema.testscript6
-rw-r--r--odb-tests/pgsql.testscript12
-rw-r--r--odb-tests/pgsql/buildfile6
-rw-r--r--odb-tests/pgsql/bulk/buildfile40
-rw-r--r--odb-tests/pgsql/bulk/driver.cxx361
-rw-r--r--odb-tests/pgsql/bulk/test.hxx34
-rw-r--r--odb-tests/pgsql/bulk/testscript18
-rw-r--r--odb-tests/pgsql/custom/buildfile37
-rw-r--r--odb-tests/pgsql/custom/driver.cxx125
-rw-r--r--odb-tests/pgsql/custom/query.hxx158
-rw-r--r--odb-tests/pgsql/custom/test.hxx86
-rw-r--r--odb-tests/pgsql/custom/testscript11
-rw-r--r--odb-tests/pgsql/custom/traits.hxx166
-rw-r--r--odb-tests/pgsql/database/buildfile11
-rw-r--r--odb-tests/pgsql/database/driver.cxx44
-rw-r--r--odb-tests/pgsql/database/testscript6
-rw-r--r--odb-tests/pgsql/index/buildfile34
-rw-r--r--odb-tests/pgsql/index/driver.cxx44
-rw-r--r--odb-tests/pgsql/index/test.hxx19
-rw-r--r--odb-tests/pgsql/index/testscript11
-rw-r--r--odb-tests/pgsql/native/buildfile16
-rw-r--r--odb-tests/pgsql/native/driver.cxx75
-rw-r--r--odb-tests/pgsql/native/testscript9
-rw-r--r--odb-tests/pgsql/truncation/buildfile35
-rw-r--r--odb-tests/pgsql/truncation/driver.cxx163
-rw-r--r--odb-tests/pgsql/truncation/test.hxx46
-rw-r--r--odb-tests/pgsql/truncation/testscript11
-rw-r--r--odb-tests/pgsql/types/buildfile36
-rw-r--r--odb-tests/pgsql/types/driver.cxx165
-rw-r--r--odb-tests/pgsql/types/test.hxx220
-rw-r--r--odb-tests/pgsql/types/testscript11
-rw-r--r--odb-tests/pgsql/types/traits.hxx171
-rw-r--r--odb-tests/qt/common/basic/driver.cxx66
-rw-r--r--odb-tests/qt/common/basic/test.hxx35
-rw-r--r--odb-tests/qt/common/containers/basics/driver.cxx569
-rw-r--r--odb-tests/qt/common/containers/basics/test.hxx224
-rw-r--r--odb-tests/qt/common/containers/change-tracking/driver.cxx643
-rw-r--r--odb-tests/qt/common/containers/change-tracking/test.hxx46
-rw-r--r--odb-tests/qt/common/smart-ptr/driver.cxx248
-rw-r--r--odb-tests/qt/common/smart-ptr/test.hxx77
-rw-r--r--odb-tests/qt/common/template/driver.cxx43
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc10.vcxproj177
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc10.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc11.vcxproj181
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc11.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc12.vcxproj185
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc12.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc8.vcproj353
-rw-r--r--odb-tests/qt/common/template/template-qt4-vc9.vcproj360
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc10.vcxproj177
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc10.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc11.vcxproj181
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc11.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc12.vcxproj185
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc12.vcxproj.filters24
-rw-r--r--odb-tests/qt/common/template/template-qt5-vc9.vcproj360
-rw-r--r--odb-tests/qt/common/template/test.hxx25
-rw-r--r--odb-tests/qt/mssql/basic/driver.cxx65
-rw-r--r--odb-tests/qt/mssql/basic/test.hxx46
-rw-r--r--odb-tests/qt/mssql/date-time/driver.cxx94
-rw-r--r--odb-tests/qt/mssql/date-time/test.hxx68
-rw-r--r--odb-tests/qt/mssql/template/driver.cxx43
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj180
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj184
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj188
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc8.vcproj354
-rw-r--r--odb-tests/qt/mssql/template/template-qt4-vc9.vcproj361
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj180
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj184
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj188
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/mssql/template/template-qt5-vc9.vcproj361
-rw-r--r--odb-tests/qt/mssql/template/test.hxx25
-rw-r--r--odb-tests/qt/mysql/basic/driver.cxx60
-rw-r--r--odb-tests/qt/mysql/basic/test.hxx27
-rw-r--r--odb-tests/qt/mysql/date-time/driver.cxx178
-rw-r--r--odb-tests/qt/mysql/date-time/test.hxx70
-rw-r--r--odb-tests/qt/mysql/template/driver.cxx43
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj180
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj184
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj188
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc8.vcproj354
-rw-r--r--odb-tests/qt/mysql/template/template-qt4-vc9.vcproj361
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj180
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj184
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj188
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/mysql/template/template-qt5-vc9.vcproj361
-rw-r--r--odb-tests/qt/mysql/template/test.hxx25
-rw-r--r--odb-tests/qt/oracle/basic/driver.cxx81
-rw-r--r--odb-tests/qt/oracle/basic/test.hxx51
-rw-r--r--odb-tests/qt/oracle/date-time/driver.cxx80
-rw-r--r--odb-tests/qt/oracle/date-time/test.hxx45
-rw-r--r--odb-tests/qt/oracle/template/driver.cxx43
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj180
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj184
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj188
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc8.vcproj354
-rw-r--r--odb-tests/qt/oracle/template/template-qt4-vc9.vcproj361
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj180
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj184
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj188
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/oracle/template/template-qt5-vc9.vcproj361
-rw-r--r--odb-tests/qt/oracle/template/test.hxx25
-rw-r--r--odb-tests/qt/pgsql/basic/driver.cxx60
-rw-r--r--odb-tests/qt/pgsql/basic/test.hxx27
-rw-r--r--odb-tests/qt/pgsql/date-time/driver.cxx108
-rw-r--r--odb-tests/qt/pgsql/date-time/test.hxx43
-rw-r--r--odb-tests/qt/pgsql/template/driver.cxx43
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj180
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj184
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj188
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc8.vcproj354
-rw-r--r--odb-tests/qt/pgsql/template/template-qt4-vc9.vcproj361
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj180
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj184
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj188
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/pgsql/template/template-qt5-vc9.vcproj361
-rw-r--r--odb-tests/qt/pgsql/template/test.hxx25
-rw-r--r--odb-tests/qt/sqlite/basic/driver.cxx60
-rw-r--r--odb-tests/qt/sqlite/basic/test.hxx27
-rw-r--r--odb-tests/qt/sqlite/date-time/driver.cxx140
-rw-r--r--odb-tests/qt/sqlite/date-time/test.hxx60
-rw-r--r--odb-tests/qt/sqlite/template/driver.cxx43
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj180
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj184
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj188
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc8.vcproj354
-rw-r--r--odb-tests/qt/sqlite/template/template-qt4-vc9.vcproj361
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj180
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj184
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj188
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj.filters25
-rw-r--r--odb-tests/qt/sqlite/template/template-qt5-vc9.vcproj361
-rw-r--r--odb-tests/qt/sqlite/template/test.hxx25
-rw-r--r--odb-tests/sqlite.testscript10
-rw-r--r--odb-tests/sqlite/attach/buildfile32
-rw-r--r--odb-tests/sqlite/attach/driver.cxx109
-rw-r--r--odb-tests/sqlite/attach/test.hxx32
-rw-r--r--odb-tests/sqlite/attach/testscript9
-rw-r--r--odb-tests/sqlite/auto/buildfile32
-rw-r--r--odb-tests/sqlite/auto/driver.cxx76
-rw-r--r--odb-tests/sqlite/auto/test.hxx32
-rw-r--r--odb-tests/sqlite/auto/testscript9
-rw-r--r--odb-tests/sqlite/custom/buildfile31
-rw-r--r--odb-tests/sqlite/custom/driver.cxx78
-rw-r--r--odb-tests/sqlite/custom/test.hxx39
-rw-r--r--odb-tests/sqlite/custom/testscript9
-rw-r--r--odb-tests/sqlite/database/buildfile11
-rw-r--r--odb-tests/sqlite/database/driver.cxx40
-rw-r--r--odb-tests/sqlite/database/testscript6
-rw-r--r--odb-tests/sqlite/native/buildfile12
-rw-r--r--odb-tests/sqlite/native/driver.cxx74
-rw-r--r--odb-tests/sqlite/native/testscript9
-rw-r--r--odb-tests/sqlite/stream/buildfile31
-rw-r--r--odb-tests/sqlite/stream/driver.cxx281
-rw-r--r--odb-tests/sqlite/stream/test.hxx37
-rw-r--r--odb-tests/sqlite/stream/testscript9
-rw-r--r--odb-tests/sqlite/transaction/buildfile30
-rw-r--r--odb-tests/sqlite/transaction/driver.cxx61
-rw-r--r--odb-tests/sqlite/transaction/test.hxx26
-rw-r--r--odb-tests/sqlite/transaction/testscript9
-rw-r--r--odb-tests/sqlite/truncation/buildfile31
-rw-r--r--odb-tests/sqlite/truncation/driver.cxx163
-rw-r--r--odb-tests/sqlite/truncation/test.hxx46
-rw-r--r--odb-tests/sqlite/truncation/testscript9
-rw-r--r--odb-tests/sqlite/types/buildfile32
-rw-r--r--odb-tests/sqlite/types/driver.cxx113
-rw-r--r--odb-tests/sqlite/types/test.hxx125
-rw-r--r--odb-tests/sqlite/types/testscript9
-rw-r--r--odb-tests/sqlite/types/traits.hxx57
842 files changed, 90096 insertions, 0 deletions
diff --git a/odb-tests/.gitignore b/odb-tests/.gitignore
new file mode 100644
index 0000000..e3bbf5b
--- /dev/null
+++ b/odb-tests/.gitignore
@@ -0,0 +1,41 @@
+# Compiler/linker output.
+#
+*.d
+*.t
+*.i
+*.i.*
+*.ii
+*.ii.*
+*.o
+*.obj
+*.gcm
+*.pcm
+*.ifc
+*.so
+*.dylib
+*.dll
+*.a
+*.lib
+*.exp
+*.pdb
+*.ilk
+*.exe
+*.exe.dlls/
+*.exe.manifest
+*.pc
+
+# Test executables.
+#
+driver
+
+# ODB-generated files.
+#
+test-odb.?xx
+test-odb-*.?xx
+test.sql
+test-*.sql
+
+# Testscript output directories (can be symlinks).
+#
+test
+test-driver
diff --git a/odb-tests/GPLv2 b/odb-tests/GPLv2
new file mode 100644
index 0000000..3912109
--- /dev/null
+++ b/odb-tests/GPLv2
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/odb-tests/LICENSE b/odb-tests/LICENSE
new file mode 100644
index 0000000..9d92da1
--- /dev/null
+++ b/odb-tests/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009-2024 Code Synthesis Tools CC.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 as
+published by the Free Software Foundation.
+
+For more information on ODB licensing as well as for answers to
+some of the common licensing questions, visit the ODB License
+page:
+
+http://www.codesynthesis.com/products/odb/license.xhtml
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/odb-tests/README.md b/odb-tests/README.md
new file mode 100644
index 0000000..24d3bf7
--- /dev/null
+++ b/odb-tests/README.md
@@ -0,0 +1,4 @@
+# odb-tests - tests for ODB compiler
+
+This package contains tests for `odb`, object-relational mapping (ORM)
+compiler for C++.
diff --git a/odb-tests/boost/common/multi-index/driver.cxx b/odb-tests/boost/common/multi-index/driver.cxx
new file mode 100644
index 0000000..a077008
--- /dev/null
+++ b/odb-tests/boost/common/multi-index/driver.cxx
@@ -0,0 +1,189 @@
+// file : boost/common/multi-index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Boost multi-index container persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ {
+ using namespace odb;
+
+ assert (odb::access::container_traits<int_lst>::kind == ck_ordered);
+ assert (odb::access::container_traits<int_vec>::kind == ck_ordered);
+ assert (odb::access::container_traits<int_set>::kind == ck_set);
+
+ assert (odb::access::container_traits<int_lst_set>::kind == ck_ordered);
+ assert (odb::access::container_traits<comp_set_vec>::kind == ck_ordered);
+ assert (odb::access::container_traits<comp_set_set>::kind == ck_set);
+ }
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ object empty ("empty"), med ("medium"), full ("full");
+
+ //
+ // empty
+ //
+
+ //
+ // med
+ //
+ med.il.push_back (234);
+ med.il.push_back (123);
+
+ med.iv.push_back (234);
+ med.iv.push_back (123);
+
+ med.is.insert (234);
+ med.is.insert (123);
+
+ med.ils.push_back (234);
+ med.ils.push_back (123);
+
+ med.csv.insert (comp (234, "bcd"));
+ med.csv.insert (comp (123, "abc"));
+
+ med.css.insert (comp (234, "bcd"));
+ med.css.insert (comp (123, "abc"));
+
+ //
+ // full
+ //
+ full.il.push_back (2345);
+ full.il.push_back (1234);
+ full.il.push_back (3456);
+
+ full.iv.push_back (2345);
+ full.iv.push_back (1234);
+ full.iv.push_back (3456);
+
+ full.is.insert (2345);
+ full.is.insert (1234);
+ full.is.insert (3456);
+
+ full.ils.push_back (2345);
+ full.ils.push_back (1234);
+ full.ils.push_back (3456);
+
+ full.csv.insert (comp (234, "bcde"));
+ full.csv.insert (comp (123, "abcd"));
+ full.csv.insert (comp (234, "cdef"));
+
+ full.css.insert (comp (234, "bcde"));
+ full.css.insert (comp (123, "abcd"));
+ full.css.insert (comp (234, "cdef"));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (empty);
+ db->persist (med);
+ db->persist (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // empty
+ //
+ empty.il.push_back (12);
+ empty.iv.push_back (12);
+ empty.is.insert (12);
+ empty.ils.push_back (12);
+ empty.csv.insert (comp (12, "ab"));
+ empty.css.insert (comp (12, "ab"));
+
+ // med
+ //
+ med.il.clear ();
+ med.iv.clear ();
+ med.is.clear ();
+ med.ils.clear ();
+ med.csv.clear ();
+ med.css.clear ();
+
+ // full
+ //
+ full.il.push_back (4567);
+ full.iv.push_back (4567);
+ full.is.insert (4567);
+ full.ils.push_back (4567);
+ full.csv.insert (comp (4567, "defg"));
+ full.css.insert (comp (4567, "defg"));
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (empty);
+ db->update (med);
+ db->update (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<object> ("empty");
+ db->erase<object> ("medium");
+ db->erase<object> ("full");
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/multi-index/test.hxx b/odb-tests/boost/common/multi-index/test.hxx
new file mode 100644
index 0000000..22b9ea4
--- /dev/null
+++ b/odb-tests/boost/common/multi-index/test.hxx
@@ -0,0 +1,113 @@
+// file : boost/common/multi-index/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/random_access_index.hpp>
+
+#include <odb/core.hxx>
+
+namespace mi = boost::multi_index;
+
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, const std::string& s) : num (n), str (s) {}
+
+ #pragma db column("number")
+ int num;
+ std::string str;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num && x.str == y.str;
+}
+
+typedef
+mi::multi_index_container<
+ int,
+ mi::indexed_by<mi::sequenced<> >
+> int_lst;
+
+typedef
+mi::multi_index_container<
+ int,
+ mi::indexed_by<mi::random_access<> >
+> int_vec;
+
+typedef
+mi::multi_index_container<
+ int,
+ mi::indexed_by<mi::ordered_unique<mi::identity<int> > >
+> int_set;
+
+typedef
+mi::multi_index_container<
+ int,
+ mi::indexed_by<
+ mi::sequenced<>,
+ mi::ordered_unique<mi::identity<int> >
+ >
+> int_lst_set;
+
+typedef
+mi::multi_index_container<
+ comp,
+ mi::indexed_by<
+ mi::ordered_unique<mi::member<comp, std::string, &comp::str> >,
+ mi::random_access<>
+ >
+> comp_set_vec;
+
+typedef
+mi::multi_index_container<
+ comp,
+ mi::indexed_by<
+ mi::ordered_unique<mi::member<comp, int, &comp::num> >,
+ mi::ordered_unique<mi::member<comp, std::string, &comp::str> >
+ >
+> comp_set_set;
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (const std::string& id): id (id) {}
+
+ #pragma db id
+ std::string id;
+
+ int_lst il;
+ int_lst iv;
+ int_set is;
+
+ int_lst_set ils;
+ comp_set_vec csv;
+ comp_set_set css;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ return
+ x.id == y.id &&
+
+ x.il == y.il &&
+ x.iv == y.iv &&
+ x.is == y.is &&
+
+ x.ils == y.ils &&
+ x.csv == y.csv &&
+ x.css == y.css;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/common/optional/driver.cxx b/odb-tests/boost/common/optional/driver.cxx
new file mode 100644
index 0000000..c2e3079
--- /dev/null
+++ b/odb-tests/boost/common/optional/driver.cxx
@@ -0,0 +1,74 @@
+// file : boost/common/optional/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost::optional persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ object o1 (1);
+ object o2 (2);
+ o2.str = "abc";
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ auto_ptr<object> o2 (db->load<object> (2));
+ t.commit ();
+
+ assert (!o1->str);
+ assert (o2->str && *o2->str == "abc");
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> (query::str.is_null ()));
+ assert (!r.empty ());
+ }
+
+ {
+ result r (db->query<object> (query::str == "abc"));
+ assert (!r.empty ());
+ }
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/optional/test.hxx b/odb-tests/boost/common/optional/test.hxx
new file mode 100644
index 0000000..65d951e
--- /dev/null
+++ b/odb-tests/boost/common/optional/test.hxx
@@ -0,0 +1,31 @@
+// file : boost/common/optional/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <boost/optional.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ boost::optional<std::string> str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/common/smart-ptr/driver.cxx b/odb-tests/boost/common/smart-ptr/driver.cxx
new file mode 100644
index 0000000..4bc6366
--- /dev/null
+++ b/odb-tests/boost/common/smart-ptr/driver.cxx
@@ -0,0 +1,202 @@
+// file : boost/common/smart-ptr/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost smart pointers.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace odb::boost;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ using boost::shared_ptr;
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ shared_ptr<cont> c1 (new cont (1));
+ {
+ transaction t (db->begin ());
+ db->persist (c1);
+ t.commit ();
+ }
+
+ // Test comparison operators.
+ //
+ {
+ assert (lazy_shared_ptr<cont> () == lazy_shared_ptr<cont> ());
+ assert (lazy_shared_ptr<cont> () != lazy_shared_ptr<cont> (c1));
+ assert (lazy_shared_ptr<cont> (c1) == lazy_shared_ptr<cont> (c1));
+
+ lazy_shared_ptr<cont> lc1 (*db, 1);
+ assert (lc1 != lazy_shared_ptr<cont> ());
+ assert (lc1 == lazy_shared_ptr<cont> (*db, c1));
+
+ shared_ptr<cont> c2 (new cont (2));
+ assert (lc1 != lazy_shared_ptr<cont> (*db, c2));
+ }
+
+ // Test swap.
+ //
+ {
+ lazy_shared_ptr<cont> lx (*db, 1), ly;
+ assert (lx == lazy_shared_ptr<cont> (*db, c1));
+
+ swap (lx, ly);
+ assert (lx == lazy_shared_ptr<cont> ());
+ assert (ly == lazy_shared_ptr<cont> (*db, c1));
+ }
+
+ // Test assignment from auto_ptr.
+ //
+ {
+ cont* p = new cont (3);
+ auto_ptr<cont> a (p);
+ lazy_shared_ptr<cont> l;
+ l = a;
+
+ assert (l.get() == p);
+ assert (!a.get ());
+ }
+
+ shared_ptr<obj> o1 (new obj (1));
+ shared_ptr<obj> o2 (new obj (2));
+ shared_ptr<obj> o3 (new obj (3));
+ shared_ptr<obj> o4 (new obj (4));
+ shared_ptr<cont> c2 (new cont (2));
+
+ o1->c = c1;
+ o2->c = c1;
+ o3->c = c2;
+ o4->c = c2;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+ db->persist (c2);
+
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ shared_ptr<cont> c (db->load<cont> (1));
+ shared_ptr<obj> o (db->load<obj> (1));
+
+ // Ensure that lazy pointers are present but not loaded.
+ //
+ assert (c->o.size () == 2);
+ assert (!c->o[0].loaded ());
+ assert (!c->o[1].loaded ());
+ assert (!o->c.loaded ());
+
+ // Ensure that the correct object IDs were loaded.
+ //
+ assert (c->o[0].object_id<obj> () == 1);
+ assert (c->o[1].object_id<obj> () == 2);
+ assert (o->c.object_id<obj> () == 1);
+
+ // Load the lazy pointer targets ensuring that the loaded
+ // targets correspond to the cached session objects.
+ //
+ shared_ptr<cont> cl (o->c.load ());
+ shared_ptr<obj> ol (c->o[0].load ());
+
+ assert (c->o[0].loaded ());
+ assert (o->c.loaded ());
+
+ assert (cl == c);
+ assert (ol == o);
+
+ t.commit ();
+ }
+
+ // Test lazy weak locking and reloading.
+ //
+ {
+ // No session.
+ //
+ transaction t (db->begin ());
+ shared_ptr<cont> c (db->load<cont> (1));
+
+ // Lock.
+ //
+ assert (!c->o[1].loaded ());
+ lazy_shared_ptr<obj> l (c->o[1].lock ());
+ assert (!l.loaded ());
+ assert (l.object_id<obj> () == c->o[1].object_id<obj> ());
+
+ // Reload.
+ //
+ assert (!c->o[1].loaded ());
+
+ shared_ptr<obj> ol (c->o[1].load ());
+ assert (c->o[1].loaded ());
+
+ ol.reset ();
+ assert (!c->o[1].loaded ());
+
+ ol = c->o[1].load ();
+ assert (c->o[1].loaded ());
+
+ t.commit ();
+ }
+
+ //
+ // Test shared_ptr as a value wrapper.
+ //
+
+ {
+ obj2 o1 (1);
+ obj2 o2 (2);
+ o2.str.reset (new string ("abc"));
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ shared_ptr<obj2> o1 (db->load<obj2> (1));
+ shared_ptr<obj2> o2 (db->load<obj2> (2));
+ t.commit ();
+
+ assert (!o1->str);
+ assert (o2->str && *o2->str == "abc");
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/smart-ptr/test.hxx b/odb-tests/boost/common/smart-ptr/test.hxx
new file mode 100644
index 0000000..26d7109
--- /dev/null
+++ b/odb-tests/boost/common/smart-ptr/test.hxx
@@ -0,0 +1,82 @@
+// file : boost/common/smart-ptr/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+
+#include <odb/core.hxx>
+#include <odb/boost/smart-ptr/lazy-ptr.hxx>
+
+struct obj;
+
+using boost::shared_ptr;
+using odb::boost::lazy_shared_ptr;
+using odb::boost::lazy_weak_ptr;
+
+#pragma db object
+struct cont
+{
+ cont ()
+ {
+ }
+
+ cont (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ typedef std::vector<lazy_weak_ptr<obj> > obj_list;
+
+ #pragma db inverse(c) value_not_null
+ obj_list o;
+};
+
+#pragma db object
+struct obj
+{
+ obj ()
+ {
+ }
+
+ obj (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db not_null
+ lazy_shared_ptr<cont> c;
+};
+
+// Test shared_ptr as a value wrapper.
+//
+#pragma db object
+struct obj2
+{
+ obj2 ()
+ {
+ }
+
+ obj2 (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db null
+ shared_ptr<std::string> str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/common/template/driver.cxx b/odb-tests/boost/common/template/driver.cxx
new file mode 100644
index 0000000..43e28c0
--- /dev/null
+++ b/odb-tests/boost/common/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/common/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/template/template-vc10.vcxproj b/odb-tests/boost/common/template/template-vc10.vcxproj
new file mode 100644
index 0000000..3c606f9
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc10.vcxproj
@@ -0,0 +1,177 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/common/template/template-vc10.vcxproj.filters b/odb-tests/boost/common/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc10.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/common/template/template-vc11.vcxproj b/odb-tests/boost/common/template/template-vc11.vcxproj
new file mode 100644
index 0000000..83d20c5
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc11.vcxproj
@@ -0,0 +1,181 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/common/template/template-vc11.vcxproj.filters b/odb-tests/boost/common/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc11.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/common/template/template-vc12.vcxproj b/odb-tests/boost/common/template/template-vc12.vcxproj
new file mode 100644
index 0000000..fd147f7
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc12.vcxproj
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/common/template/template-vc12.vcxproj.filters b/odb-tests/boost/common/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc12.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/common/template/template-vc8.vcproj b/odb-tests/boost/common/template/template-vc8.vcproj
new file mode 100644
index 0000000..e0ac609
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc8.vcproj
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-__value__(database).lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-__value__(database).lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/common/template/template-vc9.vcproj b/odb-tests/boost/common/template/template-vc9.vcproj
new file mode 100644
index 0000000..b8bf4bc
--- /dev/null
+++ b/odb-tests/boost/common/template/template-vc9.vcproj
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-__value__(database).lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-__value__(database).lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/common/template/test.hxx b/odb-tests/boost/common/template/test.hxx
new file mode 100644
index 0000000..1d2a5f3
--- /dev/null
+++ b/odb-tests/boost/common/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/common/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/common/unordered/driver.cxx b/odb-tests/boost/common/unordered/driver.cxx
new file mode 100644
index 0000000..eda5891
--- /dev/null
+++ b/odb-tests/boost/common/unordered/driver.cxx
@@ -0,0 +1,212 @@
+// file : boost/common/unordered/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Boost unordered containers persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ object empty ("empty"), med ("medium"), full ("full");
+
+ //
+ // empty
+ //
+
+ //
+ // med
+ //
+
+ // set
+ //
+ med.ns.insert (123);
+ med.ns.insert (234);
+
+ med.ss.insert ("aaa");
+ med.ss.insert ("bbbb");
+
+ med.cms.insert (comp (123, "aaa"));
+ med.cms.insert (comp (234, "bbbb"));
+
+ // map
+ //
+ med.nsm[123] = "aaa";
+ med.nsm[234] = "bbbb";
+
+ med.snm["aaa"] = 123;
+ med.snm["bbbb"] = 234;
+
+ med.ncm[123] = comp (123, "aaa");
+ med.ncm[234] = comp (234, "bbbb");
+
+ med.csmm.insert (
+ comp_str_multimap::value_type (comp (123, "aaa"), "aaa"));
+ med.csmm.insert (
+ comp_str_multimap::value_type (comp (234, "bbbb"), "bbbb"));
+
+ //
+ // full
+ //
+
+ // set
+ //
+ full.ns.insert (1234);
+ full.ns.insert (2345);
+ full.ns.insert (3456);
+
+ full.ss.insert ("aaaa");
+ full.ss.insert ("bbbbb");
+ full.ss.insert ("cccccc");
+
+ full.cms.insert (comp (1234, "aaaa"));
+ full.cms.insert (comp (2345, "bbbbb"));
+ full.cms.insert (comp (3456, "cccccc"));
+
+ // map
+ //
+ full.nsm[1234] = "aaaa";
+ full.nsm[2345] = "bbbbb";
+ full.nsm[3456] = "cccccc";
+
+ full.snm["aaaa"] = 1234;
+ full.snm["bbbbb"] = 2345;
+ full.snm["cccccc"] = 3456;
+
+ full.ncm[1234] = comp (1234, "aaaa");
+ full.ncm[2345] = comp (2345, "bbbbb");
+ full.ncm[3456] = comp (3456, "cccccc");
+
+ full.csmm.insert (
+ comp_str_multimap::value_type (comp (1234, "aaaa"), "aaaa"));
+ full.csmm.insert (
+ comp_str_multimap::value_type (comp (2345, "bbbbb"), "bbbbb"));
+ full.csmm.insert (
+ comp_str_multimap::value_type (comp (3456, "cccccc"), "cccccc"));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (empty);
+ db->persist (med);
+ db->persist (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // empty
+ //
+ empty.ns.insert (12);
+ empty.ss.insert ("aa");
+ empty.cms.insert (comp (12, "aa"));
+
+ empty.nsm[12] = "aa";
+ empty.snm["aa"] = 12;
+ empty.ncm[12] = comp (12, "aa");
+ empty.csmm.insert (
+ comp_str_multimap::value_type (comp (12, "aa"), "aa"));
+
+ // med
+ //
+ med.ns.clear ();
+ med.ss.clear ();
+ med.cms.clear ();
+
+ med.nsm.clear ();
+ med.snm.clear ();
+ med.ncm.clear ();
+ med.csmm.clear ();
+
+ // full
+ //
+ full.ns.insert (4567);
+ full.ss.insert ("ddddddd");
+ full.cms.insert (comp (4567, "ddddddd"));
+
+ full.nsm[3456] += 'c';
+ full.nsm[4567] = "ddddddd";
+ full.snm["cccccc"]++;
+ full.snm["ddddddd"] = 4567;
+ full.ncm[3456].num++;
+ full.ncm[3456].str += 'c';
+ full.ncm[4567] = comp (4567, "ddddddd");
+ full.csmm.find (comp (3456, "cccccc"))->second += "c";
+ full.csmm.insert (
+ comp_str_multimap::value_type (comp (4567, "ddddddd"), "ddddddd"));
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (empty);
+ db->update (med);
+ db->update (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<object> ("empty");
+ db->erase<object> ("medium");
+ db->erase<object> ("full");
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/unordered/test.hxx b/odb-tests/boost/common/unordered/test.hxx
new file mode 100644
index 0000000..cd77845
--- /dev/null
+++ b/odb-tests/boost/common/unordered/test.hxx
@@ -0,0 +1,113 @@
+// file : boost/common/unordered/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <boost/unordered_set.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, const std::string& s) : num (n), str (s) {}
+
+ #pragma db column("number")
+ int num;
+ std::string str;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num && x.str == y.str;
+}
+
+inline bool
+operator!= (const comp& x, const comp& y)
+{
+ return !(x == y);
+}
+
+inline bool
+operator< (const comp& x, const comp& y)
+{
+ return x.num != y.num ? x.num < y.num : x.str < y.str;
+}
+
+inline std::size_t
+hash_value (const comp& x)
+{
+ std::size_t seed = 0;
+ boost::hash_combine (seed, x.num);
+ boost::hash_combine (seed, x.str);
+ return seed;
+}
+
+using boost::unordered_set;
+using boost::unordered_multiset;
+
+typedef unordered_set<int> num_set;
+typedef unordered_set<std::string> str_set;
+typedef unordered_multiset<comp> comp_multiset;
+
+using boost::unordered_map;
+using boost::unordered_multimap;
+
+typedef unordered_map<int, std::string> num_str_map;
+typedef unordered_map<std::string, int> str_num_map;
+typedef unordered_map<int, comp> num_comp_map;
+typedef unordered_multimap<comp, std::string> comp_str_multimap;
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ object (const std::string& id)
+ : id (id)
+ {
+ }
+
+
+ #pragma db id
+ std::string id;
+
+ // set
+ //
+ num_set ns;
+ str_set ss;
+ comp_multiset cms;
+
+ // map
+ //
+ num_str_map nsm;
+ str_num_map snm;
+ num_comp_map ncm;
+ comp_str_multimap csmm;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ return
+ x.id == y.id &&
+
+ x.ns == y.ns &&
+ x.ss == y.ss &&
+ x.cms == y.cms &&
+
+ x.nsm == y.nsm &&
+ x.snm == y.snm &&
+ x.ncm == y.ncm &&
+ x.csmm == y.csmm;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/common/uuid/driver.cxx b/odb-tests/boost/common/uuid/driver.cxx
new file mode 100644
index 0000000..aed3390
--- /dev/null
+++ b/odb-tests/boost/common/uuid/driver.cxx
@@ -0,0 +1,69 @@
+// file : boost/common/uuid/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Boost UUID persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <boost/uuid/uuid_generators.hpp>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace boost::uuids;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o (1);
+ o.uuid_ = random_generator() ();
+ o.null_ = nil_uuid ();
+ o.zero_ = nil_uuid ();
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (*p == o);
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::uuid == o.uuid_));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->id_ == o.id_);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/common/uuid/test.hxx b/odb-tests/boost/common/uuid/test.hxx
new file mode 100644
index 0000000..82ed95b
--- /dev/null
+++ b/odb-tests/boost/common/uuid/test.hxx
@@ -0,0 +1,37 @@
+// file : boost/common/uuid/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <boost/uuid/uuid.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ typedef boost::uuids::uuid uuid;
+
+ uuid uuid_;
+ uuid null_;
+
+ #pragma db not_null
+ uuid zero_;
+
+ bool operator== (const object& x) const
+ {
+ return id_ == x.id_ &&
+ uuid_ == x.uuid_ &&
+ null_ == x.null_ &&
+ zero_ == x.zero_;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/mssql/date-time/driver.cxx b/odb-tests/boost/mssql/date-time/driver.cxx
new file mode 100644
index 0000000..e97a276
--- /dev/null
+++ b/odb-tests/boost/mssql/date-time/driver.cxx
@@ -0,0 +1,158 @@
+// file : boost/mssql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost date/time type persistence. SQL Server version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace boost::gregorian;
+using namespace boost::posix_time;
+
+using namespace odb::core;
+
+bool
+test_invalid_special_value (object&, auto_ptr<database>&);
+
+bool
+test_out_of_range_value (object&, auto_ptr<database>&);
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Test all valid date-time mappings.
+ //
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.dates.push_back (day_clock::local_day ());
+ o.dates.push_back (date (not_a_date_time));
+ o.dates.push_back (date (max_date_time));
+ o.dates.push_back (date (min_date_time));
+
+ o.times.push_back (second_clock::local_time ());
+ o.times.push_back (not_a_date_time);
+ o.times.push_back (min_date_time);
+ o.times.push_back (ptime (max_date_time));
+#endif
+
+ // In DATETIME fractional seconds are rounded to .000, .003, or .007.
+ //
+ o.times_dt.push_back (ptime (date (2012, 1, 13),
+ time_duration (11, 57, 13, 7000)));
+
+ // SMALLDATETIME doesn't have seconds (always 0).
+ //
+ o.times_sdt.push_back (ptime (date (2012, 1, 13),
+ time_duration (11, 57, 0, 0)));
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.durations.push_back (time_duration (1, 2, 3, 123456));
+ o.durations.push_back (not_a_date_time);
+#endif
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ // Test invalid date mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.dates.push_back (date (neg_infin));
+ sv2.dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid ptime mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.times.push_back (neg_infin);
+ sv2.times.push_back (pos_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid time_duration mappings.
+ //
+ {
+ object sv1, sv2, or1;
+ sv1.durations.push_back (pos_infin);
+ sv2.durations.push_back (neg_infin);
+ or1.durations.push_back (time_duration (50, 2, 3, 123456700));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+
+ try
+ {
+ db->persist (or1);
+ assert (false);
+ }
+ catch (const odb::boost::date_time::value_out_of_range&)
+ {
+ }
+
+ t.commit ();
+ }
+#endif
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_invalid_special_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::special_value&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/boost/mssql/date-time/test.hxx b/odb-tests/boost/mssql/date-time/test.hxx
new file mode 100644
index 0000000..ed2276b
--- /dev/null
+++ b/odb-tests/boost/mssql/date-time/test.hxx
@@ -0,0 +1,58 @@
+// file : boost/mssql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ std::vector<boost::gregorian::date> dates;
+
+ std::vector<boost::posix_time::ptime> times;
+#endif
+
+ #pragma db value_type("DATETIME")
+ std::vector<boost::posix_time::ptime> times_dt;
+
+ #pragma db value_type("SMALLDATETIME")
+ std::vector<boost::posix_time::ptime> times_sdt;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ std::vector<boost::posix_time::time_duration> durations;
+#endif
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && dates == x.dates
+ && times == x.times
+#endif
+ && times_dt == x.times_dt
+ && times_sdt == x.times_sdt
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && durations == x.durations
+#endif
+ ;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/mssql/template/driver.cxx b/odb-tests/boost/mssql/template/driver.cxx
new file mode 100644
index 0000000..37614c4
--- /dev/null
+++ b/odb-tests/boost/mssql/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/mssql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/mssql/template/template-vc10.vcxproj b/odb-tests/boost/mssql/template/template-vc10.vcxproj
new file mode 100644
index 0000000..dcb625e
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mssql/template/template-vc10.vcxproj.filters b/odb-tests/boost/mssql/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mssql/template/template-vc11.vcxproj b/odb-tests/boost/mssql/template/template-vc11.vcxproj
new file mode 100644
index 0000000..d5951f1
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mssql/template/template-vc11.vcxproj.filters b/odb-tests/boost/mssql/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mssql/template/template-vc12.vcxproj b/odb-tests/boost/mssql/template/template-vc12.vcxproj
new file mode 100644
index 0000000..e0cb56f
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mssql/template/template-vc12.vcxproj.filters b/odb-tests/boost/mssql/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mssql/template/template-vc8.vcproj b/odb-tests/boost/mssql/template/template-vc8.vcproj
new file mode 100644
index 0000000..6d1c40b
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mssql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mssql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/mssql/template/template-vc9.vcproj b/odb-tests/boost/mssql/template/template-vc9.vcproj
new file mode 100644
index 0000000..422fbd7
--- /dev/null
+++ b/odb-tests/boost/mssql/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mssql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mssql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/mssql/template/test.hxx b/odb-tests/boost/mssql/template/test.hxx
new file mode 100644
index 0000000..753498f
--- /dev/null
+++ b/odb-tests/boost/mssql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/mssql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/mysql/date-time/driver.cxx b/odb-tests/boost/mysql/date-time/driver.cxx
new file mode 100644
index 0000000..8959f0c
--- /dev/null
+++ b/odb-tests/boost/mysql/date-time/driver.cxx
@@ -0,0 +1,218 @@
+// file : boost/mysql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost date/time type persistence. MySQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace boost::gregorian;
+using namespace boost::posix_time;
+
+using namespace odb::core;
+
+bool
+test_invalid_special_value (object&, auto_ptr<database>&);
+
+bool
+test_out_of_range_value (object&, auto_ptr<database>&);
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ mysql_version v;
+ {
+ transaction t (db->begin ());
+ db->query<mysql_version> ().begin ().load (v);
+ t.commit ();
+ }
+
+ // If we are running against MySQL 5.6.4 or later alter the tables
+ // to allow sub-second precision.
+ //
+ bool fs (v.major > 5 ||
+ (v.major == 5 && (v.minor > 6 ||
+ (v.minor == 6 && v.release >= 4))));
+ if (fs)
+ {
+ transaction t (db->begin ());
+
+ db->execute ("ALTER TABLE `boost_mysql_dt_object_durations`" \
+ " MODIFY COLUMN `value` TIME(6)");
+
+ db->execute ("ALTER TABLE `boost_mysql_dt_object_times`" \
+ " MODIFY COLUMN `value` DATETIME(6)");
+
+ db->execute ("ALTER TABLE `boost_mysql_dt_object_timestamps`" \
+ " MODIFY COLUMN `value` TIMESTAMP(6) NULL");
+
+ t.commit ();
+ }
+
+ object o;
+
+ // Test all valid date-time mappings.
+ //
+ o.dates.push_back (day_clock::local_day ());
+ o.dates.push_back (date (not_a_date_time));
+ o.dates.push_back (date (max_date_time));
+ o.dates.push_back (date (min_date_time));
+
+ if (fs)
+ o.times.push_back (microsec_clock::local_time ());
+ else
+ o.times.push_back (second_clock::local_time ());
+ o.times.push_back (not_a_date_time);
+ o.times.push_back (min_date_time);
+
+ // MySQL prior to 5.6.4 does not support fraction seconds. Construct
+ // with zero fractional seconds so that comparison test does not fail
+ // for invalid reasons.
+ //
+ o.times.push_back (
+ ptime (
+ date (max_date_time),
+ time_duration (
+ ptime (max_date_time).time_of_day ().hours (),
+ ptime (max_date_time).time_of_day ().minutes (),
+ ptime (max_date_time).time_of_day ().seconds ())));
+
+ if (fs)
+ o.timestamps.push_back (microsec_clock::local_time ());
+ else
+ o.timestamps.push_back (second_clock::local_time ());
+ o.timestamps.push_back (not_a_date_time);
+
+ o.durations.push_back (time_duration (1, 2, 3));
+ if (fs)
+ o.durations.back () += time_duration (microseconds (123456));
+ o.durations.push_back (time_duration (-1, 2, 3));
+ o.durations.push_back (not_a_date_time);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+ {
+ // Test invalid date mappings.
+ //
+ object sv1, sv2;
+ sv1.dates.push_back (date (neg_infin));
+ sv2.dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+
+ {
+ // Test invalid ptime (DATETIME) mappings.
+ //
+ object sv1, sv2;
+ sv1.times.push_back (neg_infin);
+ sv2.times.push_back (pos_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid ptime (TIMESTAMP) mappings.
+ //
+ object or1, or2, sv1, sv2;
+ or1.timestamps.push_back (min_date_time);
+ or2.timestamps.push_back (max_date_time);
+ sv1.timestamps.push_back (neg_infin);
+ sv2.timestamps.push_back (pos_infin);
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, db));
+ assert (test_out_of_range_value (or2, db));
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid time_duration mappings.
+ //
+ object or1, or2, sv1, sv2;
+ or1.durations.push_back (time_duration (850, 0, 0));
+ or2.durations.push_back (time_duration (-850, 0, 0));
+ sv1.durations.push_back (pos_infin);
+ sv2.durations.push_back (neg_infin);
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, db));
+ assert (test_out_of_range_value (or2, db));
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_invalid_special_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::special_value&)
+ {
+ }
+
+ return true;
+}
+
+bool
+test_out_of_range_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::value_out_of_range&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/boost/mysql/date-time/test.hxx b/odb-tests/boost/mysql/date-time/test.hxx
new file mode 100644
index 0000000..bf73b09
--- /dev/null
+++ b/odb-tests/boost/mysql/date-time/test.hxx
@@ -0,0 +1,65 @@
+// file : boost/mysql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ dates == x.dates &&
+ times == x.times &&
+ timestamps == x.timestamps &&
+ durations == x.durations;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<boost::gregorian::date> dates;
+ std::vector<boost::posix_time::ptime> times;
+
+ // Make timestamp NULL-able to suppress the auto-initialization and
+ // auto-update characteristics of the TIMESTAMP datatype, and to
+ // allow NULL values.
+ //
+ #pragma db value_type ("TIMESTAMP") value_null
+ std::vector<boost::posix_time::ptime> timestamps;
+
+ std::vector<boost::posix_time::time_duration> durations;
+};
+
+// MySQL server version view.
+//
+#pragma db view query( \
+ "SELECT " \
+ "CAST(SUBSTRING_INDEX(@@version, '.', 1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '.', 2), '.', -1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '-', 1), '.', -1) AS UNSIGNED)," \
+ "@@protocol_version")
+struct mysql_version
+{
+ unsigned int major;
+ unsigned int minor;
+ unsigned int release;
+
+ unsigned int protocol;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/mysql/template/driver.cxx b/odb-tests/boost/mysql/template/driver.cxx
new file mode 100644
index 0000000..1164950
--- /dev/null
+++ b/odb-tests/boost/mysql/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/mysql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/mysql/template/template-vc10.vcxproj b/odb-tests/boost/mysql/template/template-vc10.vcxproj
new file mode 100644
index 0000000..3137abc
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mysql/template/template-vc10.vcxproj.filters b/odb-tests/boost/mysql/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mysql/template/template-vc11.vcxproj b/odb-tests/boost/mysql/template/template-vc11.vcxproj
new file mode 100644
index 0000000..bc4b5a4
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mysql/template/template-vc11.vcxproj.filters b/odb-tests/boost/mysql/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mysql/template/template-vc12.vcxproj b/odb-tests/boost/mysql/template/template-vc12.vcxproj
new file mode 100644
index 0000000..e7d70bc
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/mysql/template/template-vc12.vcxproj.filters b/odb-tests/boost/mysql/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/mysql/template/template-vc8.vcproj b/odb-tests/boost/mysql/template/template-vc8.vcproj
new file mode 100644
index 0000000..2ef0383
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mysql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mysql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mysql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mysql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/mysql/template/template-vc9.vcproj b/odb-tests/boost/mysql/template/template-vc9.vcproj
new file mode 100644
index 0000000..b60c7e2
--- /dev/null
+++ b/odb-tests/boost/mysql/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mysql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mysql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mysql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mysql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/mysql/template/test.hxx b/odb-tests/boost/mysql/template/test.hxx
new file mode 100644
index 0000000..7c97ca2
--- /dev/null
+++ b/odb-tests/boost/mysql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/mysql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/oracle/date-time/driver.cxx b/odb-tests/boost/oracle/date-time/driver.cxx
new file mode 100644
index 0000000..82294c7
--- /dev/null
+++ b/odb-tests/boost/oracle/date-time/driver.cxx
@@ -0,0 +1,136 @@
+// file : boost/oracle/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost date/time type persistence. Oracle version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace boost::gregorian;
+using namespace boost::posix_time;
+
+using namespace odb::core;
+
+bool
+test_invalid_special_value (object&, auto_ptr<database>&);
+
+bool
+test_out_of_range_value (object&, auto_ptr<database>&);
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Test all valid date-time mappings.
+ //
+ o.dates.push_back (day_clock::local_day ());
+ o.dates.push_back (date (not_a_date_time));
+ o.dates.push_back (date (max_date_time));
+ o.dates.push_back (date (min_date_time));
+
+ o.times.push_back (second_clock::local_time ());
+ o.times.push_back (not_a_date_time);
+ o.times.push_back (min_date_time);
+ o.times.push_back (ptime (max_date_time));
+
+ o.times_d.push_back (ptime (date (2012, 6, 27),
+ time_duration (14, 17, 05, 0)));
+ o.times_d.push_back (not_a_date_time);
+
+ o.durations.push_back (time_duration (1, 2, 3, 123456));
+ o.durations.push_back (time_duration (-1, 2, 3));
+ o.durations.push_back (not_a_date_time);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+ // Test invalid date mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.dates.push_back (date (neg_infin));
+ sv2.dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid ptime mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.times.push_back (neg_infin);
+ sv2.times.push_back (pos_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid time_duration mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.durations.push_back (pos_infin);
+ sv2.durations.push_back (neg_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_invalid_special_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::special_value&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/boost/oracle/date-time/test.hxx b/odb-tests/boost/oracle/date-time/test.hxx
new file mode 100644
index 0000000..5eaab88
--- /dev/null
+++ b/odb-tests/boost/oracle/date-time/test.hxx
@@ -0,0 +1,42 @@
+// file : boost/oracle/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ dates == x.dates &&
+ times == x.times &&
+ times_d == x.times_d &&
+ durations == x.durations;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<boost::gregorian::date> dates;
+ std::vector<boost::posix_time::ptime> times;
+ #pragma db value_type("DATE")
+ std::vector<boost::posix_time::ptime> times_d;
+ std::vector<boost::posix_time::time_duration> durations;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/oracle/template/driver.cxx b/odb-tests/boost/oracle/template/driver.cxx
new file mode 100644
index 0000000..892b58f
--- /dev/null
+++ b/odb-tests/boost/oracle/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/oracle/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/oracle/template/template-vc10.vcxproj b/odb-tests/boost/oracle/template/template-vc10.vcxproj
new file mode 100644
index 0000000..0c93020
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/oracle/template/template-vc10.vcxproj.filters b/odb-tests/boost/oracle/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/oracle/template/template-vc11.vcxproj b/odb-tests/boost/oracle/template/template-vc11.vcxproj
new file mode 100644
index 0000000..4df5f5b
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/oracle/template/template-vc11.vcxproj.filters b/odb-tests/boost/oracle/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/oracle/template/template-vc12.vcxproj b/odb-tests/boost/oracle/template/template-vc12.vcxproj
new file mode 100644
index 0000000..0b942bc
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/oracle/template/template-vc12.vcxproj.filters b/odb-tests/boost/oracle/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/oracle/template/template-vc8.vcproj b/odb-tests/boost/oracle/template/template-vc8.vcproj
new file mode 100644
index 0000000..c13f330
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-oracle.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-oracle.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/oracle/template/template-vc9.vcproj b/odb-tests/boost/oracle/template/template-vc9.vcproj
new file mode 100644
index 0000000..a3061ee
--- /dev/null
+++ b/odb-tests/boost/oracle/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-oracle.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-oracle.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/oracle/template/test.hxx b/odb-tests/boost/oracle/template/test.hxx
new file mode 100644
index 0000000..141b6cd
--- /dev/null
+++ b/odb-tests/boost/oracle/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/oracle/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/pgsql/date-time/driver.cxx b/odb-tests/boost/pgsql/date-time/driver.cxx
new file mode 100644
index 0000000..94fcc46
--- /dev/null
+++ b/odb-tests/boost/pgsql/date-time/driver.cxx
@@ -0,0 +1,157 @@
+// file : boost/pgsql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost date/time type persistence. PostgreSQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace boost::gregorian;
+using namespace boost::posix_time;
+
+using namespace odb::core;
+
+bool
+test_invalid_special_value (object&, auto_ptr<database>&);
+
+bool
+test_out_of_range_value (object&, auto_ptr<database>&);
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Test all valid date-time mappings.
+ //
+ o.dates.push_back (day_clock::local_day ());
+ o.dates.push_back (date (not_a_date_time));
+ o.dates.push_back (date (max_date_time));
+ o.dates.push_back (date (min_date_time));
+
+ o.times.push_back (microsec_clock::local_time ());
+ o.times.push_back (not_a_date_time);
+ o.times.push_back (pos_infin);
+ o.times.push_back (neg_infin);
+ o.times.push_back (ptime (date (max_date_time),
+ time_duration (16, 23, 0, 123456)));
+ o.times.push_back (ptime (date (min_date_time),
+ time_duration (3, 14, 7, 123456)));
+ o.times.push_back (ptime (date (1969, 12, 31), // Before PG epoch.
+ time_duration (23, 59, 59, 123000)));
+
+ o.durations.push_back (time_duration (0, 0, 0));
+ o.durations.push_back (time_duration (12, 3, 4, 123456));
+ o.durations.push_back (time_duration (23, 59, 59, 123456));
+ o.durations.push_back (not_a_date_time);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+ {
+ // Test invalid date mappings.
+ //
+ object sv1, sv2;
+ sv1.dates.push_back (date (neg_infin));
+ sv2.dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid ptime mappings.
+ //
+ // object sv1, sv2;
+ // sv1.times.push_back (neg_infin);
+ // sv2.times.push_back (pos_infin);
+
+ // transaction t (db->begin ());
+ // assert (test_invalid_special_value (sv1, db));
+ // assert (test_invalid_special_value (sv2, db));
+ // t.commit ();
+ }
+
+ {
+ // Test invalid time_duration mappings.
+ //
+ // object or1, sv1, sv2;
+ // or1.durations.push_back (time_duration (0, 0, -1));
+ // sv1.durations.push_back (pos_infin);
+ // sv2.durations.push_back (neg_infin);
+
+ // transaction t (db->begin ());
+ // assert (test_out_of_range_value (or1, db));
+ // assert (test_invalid_special_value (sv1, db));
+ // assert (test_invalid_special_value (sv2, db));
+ // t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_invalid_special_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::special_value&)
+ {
+ }
+
+ return true;
+}
+
+bool
+test_out_of_range_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::value_out_of_range&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/boost/pgsql/date-time/test.hxx b/odb-tests/boost/pgsql/date-time/test.hxx
new file mode 100644
index 0000000..0b08093
--- /dev/null
+++ b/odb-tests/boost/pgsql/date-time/test.hxx
@@ -0,0 +1,39 @@
+// file : boost/pgsql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ dates == x.dates &&
+ times == x.times &&
+ durations == x.durations;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<boost::gregorian::date> dates;
+ std::vector<boost::posix_time::ptime> times;
+ std::vector<boost::posix_time::time_duration> durations;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/pgsql/template/driver.cxx b/odb-tests/boost/pgsql/template/driver.cxx
new file mode 100644
index 0000000..ed2d8a4
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/pgsql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/pgsql/template/template-vc10.vcxproj b/odb-tests/boost/pgsql/template/template-vc10.vcxproj
new file mode 100644
index 0000000..7bc0243
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/pgsql/template/template-vc10.vcxproj.filters b/odb-tests/boost/pgsql/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/pgsql/template/template-vc11.vcxproj b/odb-tests/boost/pgsql/template/template-vc11.vcxproj
new file mode 100644
index 0000000..9f8d2f0
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/pgsql/template/template-vc11.vcxproj.filters b/odb-tests/boost/pgsql/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/pgsql/template/template-vc12.vcxproj b/odb-tests/boost/pgsql/template/template-vc12.vcxproj
new file mode 100644
index 0000000..acbfc37
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/pgsql/template/template-vc12.vcxproj.filters b/odb-tests/boost/pgsql/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/pgsql/template/template-vc8.vcproj b/odb-tests/boost/pgsql/template/template-vc8.vcproj
new file mode 100644
index 0000000..65773c9
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-pgsql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-pgsql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-pgsql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-pgsql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/pgsql/template/template-vc9.vcproj b/odb-tests/boost/pgsql/template/template-vc9.vcproj
new file mode 100644
index 0000000..db49496
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-pgsql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-pgsql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-pgsql-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-pgsql.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/pgsql/template/test.hxx b/odb-tests/boost/pgsql/template/test.hxx
new file mode 100644
index 0000000..56eda31
--- /dev/null
+++ b/odb-tests/boost/pgsql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/pgsql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/sqlite/date-time/driver.cxx b/odb-tests/boost/sqlite/date-time/driver.cxx
new file mode 100644
index 0000000..97a7a0c
--- /dev/null
+++ b/odb-tests/boost/sqlite/date-time/driver.cxx
@@ -0,0 +1,208 @@
+// file : boost/sqlite/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test boost date/time type persistence. SQLite version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+
+using namespace boost::gregorian;
+using namespace boost::posix_time;
+
+using namespace odb::core;
+
+bool
+test_invalid_special_value (object&, auto_ptr<database>&);
+
+bool
+test_out_of_range_value (object&, auto_ptr<database>&);
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Test all valid date-time mappings.
+ //
+ o.dates.push_back (day_clock::local_day ());
+ o.dates.push_back (date (not_a_date_time));
+ o.dates.push_back (date (max_date_time));
+ o.dates.push_back (date (min_date_time));
+
+ o.times.push_back (second_clock::local_time ());
+ o.times.push_back (not_a_date_time);
+ o.times.push_back (min_date_time);
+ o.times.push_back (max_date_time);
+
+ o.durations.push_back (time_duration (123, 4, 5));
+ o.durations.push_back (not_a_date_time);
+
+ o.u_dates.push_back (day_clock::local_day ());
+ o.u_dates.push_back (date (not_a_date_time));
+
+ // Boost seems to handle 64 bit std::time_t incorrectly.
+ // Insert 32 bit minimum and maximum UNIX time values for now.
+ //
+ // o.u_dates.push_back (date (max_date_time));
+ // o.u_dates.push_back (date (min_date_time));
+ //
+ o.u_dates.push_back (date (2038, 1, 19));
+ o.u_dates.push_back (date (1901, 12, 14));
+
+ o.u_times.push_back (second_clock::local_time ());
+ o.u_times.push_back (not_a_date_time);
+ o.u_times.push_back (ptime (date (1930, 1, 1), time_duration (0, 0, 0)));
+
+ o.s_durations.push_back (time_duration (123, 4, 5));
+ o.s_durations.push_back (time_duration (-12, 3, 4));
+ o.s_durations.push_back (not_a_date_time);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+ {
+ // Test invalid date mappings.
+ //
+ object sv1, sv2;
+ sv1.dates.push_back (date (neg_infin));
+ sv2.dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid ptime mappings.
+ //
+ object sv1, sv2;
+ sv1.times.push_back (neg_infin);
+ sv2.times.push_back (pos_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid time_duration mappings.
+ //
+ object or1, sv1, sv2;
+ or1.durations.push_back (time_duration (0, 0, -1));
+ sv1.durations.push_back (pos_infin);
+ sv2.durations.push_back (neg_infin);
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, db));
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ {
+ // Test invalid UNIX date mappings.
+ //
+ object sv1, sv2;
+ sv1.u_dates.push_back (date (neg_infin));
+ sv2.u_dates.push_back (date (pos_infin));
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid UNIX times mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.u_times.push_back (pos_infin);
+ sv2.u_times.push_back (neg_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+
+ // Test invalid "seconds" duration mappings.
+ //
+ {
+ object sv1, sv2;
+ sv1.s_durations.push_back (pos_infin);
+ sv2.s_durations.push_back (neg_infin);
+
+ transaction t (db->begin ());
+ assert (test_invalid_special_value (sv1, db));
+ assert (test_invalid_special_value (sv2, db));
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_invalid_special_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::special_value&)
+ {
+ }
+
+ return true;
+}
+
+bool
+test_out_of_range_value (object& x, auto_ptr<database>& db)
+{
+ try
+ {
+ db->persist (x);
+ return false;
+ }
+ catch (const odb::boost::date_time::value_out_of_range&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/boost/sqlite/date-time/test.hxx b/odb-tests/boost/sqlite/date-time/test.hxx
new file mode 100644
index 0000000..924ce27
--- /dev/null
+++ b/odb-tests/boost/sqlite/date-time/test.hxx
@@ -0,0 +1,57 @@
+// file : boost/sqlite/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object ()
+ {
+ }
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ dates == x.dates &&
+ times == x.times &&
+ durations == x.durations &&
+ u_dates == x.u_dates &&
+ u_times == x.u_times &&
+ s_durations == x.s_durations;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<boost::gregorian::date> dates;
+ std::vector<boost::posix_time::ptime> times;
+ std::vector<boost::posix_time::time_duration> durations;
+
+ // Dates as UNIX time.
+ //
+ #pragma db value_type("INTEGER")
+ std::vector<boost::gregorian::date> u_dates;
+
+ // Times as UNIX time.
+ //
+ #pragma db value_type("INTEGER")
+ std::vector<boost::posix_time::ptime> u_times;
+
+ // Durations as seconds.
+ //
+ #pragma db value_type("INTEGER")
+ std::vector<boost::posix_time::time_duration> s_durations;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/boost/sqlite/template/driver.cxx b/odb-tests/boost/sqlite/template/driver.cxx
new file mode 100644
index 0000000..3e51eef
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/driver.cxx
@@ -0,0 +1,39 @@
+// file : boost/sqlite/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/boost/sqlite/template/template-vc10.vcxproj b/odb-tests/boost/sqlite/template/template-vc10.vcxproj
new file mode 100644
index 0000000..f94df08
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/sqlite/template/template-vc10.vcxproj.filters b/odb-tests/boost/sqlite/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/sqlite/template/template-vc11.vcxproj b/odb-tests/boost/sqlite/template/template-vc11.vcxproj
new file mode 100644
index 0000000..1c1a279
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/sqlite/template/template-vc11.vcxproj.filters b/odb-tests/boost/sqlite/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/sqlite/template/template-vc12.vcxproj b/odb-tests/boost/sqlite/template/template-vc12.vcxproj
new file mode 100644
index 0000000..034b16c
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;_SCL_SECURE_NO_WARNINGS;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/boost/sqlite/template/template-vc12.vcxproj.filters b/odb-tests/boost/sqlite/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/boost/sqlite/template/template-vc8.vcproj b/odb-tests/boost/sqlite/template/template-vc8.vcproj
new file mode 100644
index 0000000..df92637
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-sqlite-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-sqlite.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-sqlite-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-sqlite.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/sqlite/template/template-vc9.vcproj b/odb-tests/boost/sqlite/template/template-vc9.vcproj
new file mode 100644
index 0000000..32fb152
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-sqlite-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-sqlite.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-sqlite-d.lib odb-boost-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-sqlite.lib odb-boost.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/boost/sqlite/template/test.hxx b/odb-tests/boost/sqlite/template/test.hxx
new file mode 100644
index 0000000..b9daed6
--- /dev/null
+++ b/odb-tests/boost/sqlite/template/test.hxx
@@ -0,0 +1,25 @@
+// file : boost/sqlite/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/build/.gitignore b/odb-tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/odb-tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/odb-tests/build/bootstrap.build b/odb-tests/build/bootstrap.build
new file mode 100644
index 0000000..2fb5824
--- /dev/null
+++ b/odb-tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : build/bootstrap.build
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project = odb-tests
+
+using version
+using config
+using dist
+using test
diff --git a/odb-tests/build/export.build b/odb-tests/build/export.build
new file mode 100644
index 0000000..3c073d3
--- /dev/null
+++ b/odb-tests/build/export.build
@@ -0,0 +1,9 @@
+# file : build/export.build
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$out_root/
+{
+ include libcommon/
+}
+
+export $out_root/libcommon/$import.target
diff --git a/odb-tests/build/root.build b/odb-tests/build/root.build
new file mode 100644
index 0000000..5336399
--- /dev/null
+++ b/odb-tests/build/root.build
@@ -0,0 +1,270 @@
+# file : build/root.build
+# license : GNU GPL v2; see accompanying LICENSE file
+
+cxx.std = latest
+
+using cxx
+
+hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
+cxx{*}: extension = cxx
+
+# List of the identifiers of the databases to compile and run the tests
+# against. The valid identifiers are mysql, sqlite, pgsql, oracle, and mssql.
+#
+# @@ TODO: change to string_set once available.
+#
+config [strings] config.odb_tests.database
+
+assert ($defined(config.odb_tests.database) && \
+ $size($config.odb_tests.database) > 0) \
+'at least one database must be configured via config.odb_tests.database variable'
+
+databases = $config.odb_tests.database
+
+mysql = false
+sqlite = false
+pgsql = false
+oracle = false
+mssql = false
+
+for db: $databases
+{
+ switch $db
+ {
+ case 'mysql'
+ mysql = true
+
+ case 'sqlite'
+ sqlite = true
+
+ case 'pgsql'
+ pgsql = true
+
+ case 'oracle'
+ oracle = true
+
+ case 'mssql'
+ mssql = true
+
+ default
+ fail "invalid database '$db' specified in config.odb_tests.database value"
+ }
+}
+
+# If true, then build and run the test drivers in the dynamic multi-database
+# mode.
+#
+config [bool] config.odb_tests.multi_database ?= ($size($databases) > 1)
+multi = $config.odb_tests.multi_database
+
+assert ($multi || $size($databases) == 1) \
+'only one database can be configured if config.odb_tests.multi_database value is false'
+
+# Database connections.
+#
+
+# PostgreSQL
+#
+# The database user. Note that the named user must be allowed to connect to
+# the database server without specifying credentials.
+#
+config [string] config.odb_tests.pgsql.user ?= 'odb_test'
+
+# The database name. Note that it WILL BE MODIFIED by the tests.
+#
+config [string] config.odb_tests.pgsql.database ?= 'odb_test'
+
+# The database host. Leaving this variable undefined results in using
+# Unix-domain sockets. Machines without Unix-domain sockets will connect to
+# localhost.
+#
+config [string] config.odb_tests.pgsql.host
+
+# The database port or the socket file name extension for Unix-domain
+# connections.
+#
+config [string] config.odb_tests.pgsql.port
+
+# If true, then assume that libodb-pgsql supports the bulk operations.
+#
+# Note: config.odb_tests.pgsql.bulk_default is reflected from manifest.
+#
+config [bool] config.odb_tests.pgsql.bulk_default ?= false
+config [bool] config.odb_tests.pgsql.bulk ?= ($cxx.target.class != 'windows' && \
+ $config.odb_tests.pgsql.bulk_default)
+pgsql_bulk = $config.odb_tests.pgsql.bulk
+
+# MySQL
+#
+# The database user.
+#
+config [string] config.odb_tests.mysql.user ?= 'odb_test'
+
+# The database password.
+#
+config [string] config.odb_tests.mysql.passwd
+
+# The database name. Note that it WILL BE MODIFIED by the tests.
+#
+config [string] config.odb_tests.mysql.database ?= 'odb_test'
+
+# The database host.
+#
+config [string] config.odb_tests.mysql.host
+
+# The database port.
+#
+config [uint64] config.odb_tests.mysql.port
+
+# The database socket path.
+#
+config [path] config.odb_tests.mysql.socket
+
+define sql: file
+sql{*}: extension = sql
+
+define xml: file
+xml{*}: extension = xml
+
+if ($build.mode != 'skeleton')
+{
+ if ($cxx.target.system == 'win32-msvc')
+ cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+
+ switch $cxx.class
+ {
+ case 'gcc'
+ {
+ cxx.coptions += -Wno-unknown-pragmas
+ }
+ case 'msvc'
+ {
+ cxx.coptions += /wd4068 /wd4251 /wd4275 /wd4800
+ }
+ }
+
+ # @@ BUILD2 Clang issues the following warnings while compile the
+ # odb-generated headers:
+ #
+ # In file included from odb-tests/common/view/olv/test1-odb-sqlite.cxx:10:
+ # odb-tests/common/view/olv/test1-odb-sqlite.hxx:68:80: warning: instantiation of variable 'odb::query_columns<test1::object1, odb::id_common, odb::access::object_traits_impl< ::test1::object1, id_common>>::id' required here, but no definition is available [-Wundefined-var-template]
+ # 68 | id (query_columns< ::test1::object1, id_common, typename A::common_traits >::id,
+ # | ^
+ # odb-tests/common/view/olv/test1-odb.hxx:91:21: note: forward declaration of template entity is here
+ # 91 | static id_type_ id;
+ # | ^
+ # odb-tests/common/view/olv/test1-odb-sqlite.hxx:68:80: note: add an explicit instantiation declaration to suppress this warning if 'odb::query_columns<test1::object1, odb::id_common, odb::access::object_traits_impl< ::test1::object1, id_common>>::id' is explicitly instantiated in another translation unit
+ # 68 | id (query_columns< ::test1::object1, id_common, typename A::common_traits >::id,
+ #
+ # Note: -Wno-undefined-var-template is temporarily added to suppress them.
+ #
+ if ($cxx.id.type == 'clang')
+ cxx.coptions += -Wno-undefined-var-template
+
+ # Import odb that we are testing.
+ #
+ import! [metadata] odb = odb%exe{odb}
+
+ # Import the mysql client for creating the database schemas, etc.
+ #
+ if $mysql
+ {
+ import! mysql_client = mysql%exe{mysql}
+ testscript{*}: mysql_client = $mysql_client
+ }
+
+ # Import the psql client for creating the database schemas, etc.
+ #
+ if $pgsql
+ {
+ import! pgsql_client = psql%exe{psql}
+ testscript{*}: pgsql_client = $pgsql_client
+ }
+
+ # Note that we need ((-.+)?) instead of just (-.+)? because we use this
+ # capture as a back-reference in the pattern.
+ #
+ [rule_name=odb_compile] \
+ <hxx{~'/(.+)-odb((-.+)?)/'} \
+ ixx{~'/\1-odb\2/'} \
+ cxx{~'/\1-odb\2/'}>: hxx{~'/\1/'} libue{~'/.+-meta/'} $odb
+ {{
+ pops = $cxx.lib_poptions($<[1])
+ depdb hash $pops
+
+ hp = $path($>[0])
+ bn = $base($leaf($hp))
+ db = $regex.replace($bn, '.+-odb(-(.+))?', '\2')
+
+ if ($db == '') # *-odb.?xx target group?
+ db = ($multi ? 'common' : $databases[0])
+ end
+
+ # If the external SQL schema file will be generated, then add it as a
+ # dynamic target group member.
+ #
+ # @@ BUILD2 Probably we should add support for --generate-dep ODB compiler
+ # option. Then presumably this will be take care of automatically.
+ #
+ # We assume that the '--generate-schema' and '--schema-format' strings
+ # will never appear as standalone option values.
+ #
+ if ($db != 'common' && $regex.find_match($odb_options, '--generate-schema'))
+ schema_format = ($db == 'sqlite' ? 'embedded' : 'sql')
+
+ for o: $odb_options
+ if ($o == '--schema-format')
+ schema_format = [null] # Indicate that the schema format comes next.
+ elif ($schema_format == [null])
+ schema_format = $o
+ end
+ end
+ else
+ schema_format = ''
+ end
+
+ t = ($schema_format == 'sql' \
+ ? $directory($hp)/$regex.replace($bn, '(.+)-odb(-.+)?', '\1\2').sql \
+ : '')
+
+ depdb dyndep --dyn-target --target-what 'generated schema' --format lines \
+ -- echo "$t"
+
+ $odb --std c++11 \
+ ($multi ? --multi-database dynamic : ) \
+ --database $db \
+ --output-dir $out_base \
+ $odb_options \
+ "-I$src_base" \
+ $pops \
+ $path($<[0])
+ }}
+
+ # Every exe{} in this project is by default a test.
+ #
+ exe{*}: test = true
+
+ # Specify the test target for cross-testing.
+ #
+ test.target = $cxx.target
+}
+
+# The helper targets which can be used as prerequisites of test drivers
+# which require either a specific database client or multiple clients for
+# all the enabled databases.
+#
+alias{mysql-client}: $mysql_client:
+{
+ include = $mysql
+ clean = false
+}
+
+alias{pgsql-client}: $pgsql_client:
+{
+ include = $pgsql
+ clean = false
+}
+
+alias{database-client}: alias{mysql-client pgsql-client}
diff --git a/odb-tests/buildfile b/odb-tests/buildfile
new file mode 100644
index 0000000..2acd9fc
--- /dev/null
+++ b/odb-tests/buildfile
@@ -0,0 +1,10 @@
+# file : buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: libcommon/ common/ doc{README.md} legal{GPLv2 LICENSE} manifest
+
+./: mysql/: include = ($mysql && !$multi)
+./: sqlite/: include = ($sqlite && !$multi)
+./: pgsql/: include = ($pgsql && !$multi)
+
+./: testscript{*}: include = adhoc
diff --git a/odb-tests/common/access/buildfile b/odb-tests/common/access/buildfile
new file mode 100644
index 0000000..f1264d9
--- /dev/null
+++ b/odb-tests/common/access/buildfile
@@ -0,0 +1,45 @@
+# file : common/access/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix access_ \
+ --generate-schema \
+ --accessor-regex '#(.+)#Get\u\1#' \
+ --modifier-regex '#(.+)#Set\u\1#'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+# @@ BUILD2: Eventually we should be able to mark it as test.input once
+# this is supported for testscript tests.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/access/driver.cxx b/odb-tests/common/access/driver.cxx
new file mode 100644
index 0000000..b40e73c
--- /dev/null
+++ b/odb-tests/common/access/driver.cxx
@@ -0,0 +1,262 @@
+// file : common/access/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test accessor/modifier expressions.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic accessor/modifier functionality.
+ //
+ {
+ using namespace test1;
+
+ object o (1, 623, 723);
+ o.i1 () = 123;
+ o.i2 (223);
+ o.i3 () = 323;
+ o.i4 () = 423;
+ o.set_i5 (523);
+ o.s1 ("1bc");
+ memcpy (o.b1 (), "123456789012345", 16);
+ o.b2 ("123456789012345");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id ()));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+
+ // Test composite accessor/modifier functionality.
+ //
+ {
+ using namespace test2;
+
+ object o (1);
+
+ o.v1 () = value (1123, 1234);
+ o.v2 (value (2123, 2234));
+ o.v3_i1 (3123);
+ o.v3_i2 (3223);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id ()));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+
+ // Test object pointer accessor/modifier functionality.
+ //
+ {
+ using namespace test3;
+
+ object2 o (1);
+ o.p1 ().reset (new object1 (1));
+ o.p2 (object1_ptr (new object1 (2)));
+
+ {
+ transaction t (db->begin ());
+ const object1_ptr& ptr (o.p1 ());
+ db->persist (ptr);
+ db->persist (o.p2 ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p (db->load<object2> (o.id ()));
+ t.commit ();
+
+ assert (p->p1 ()->id () == o.p1 ()->id () &&
+ p->p2 ()->id () == o.p2 ()->id ());
+ }
+ }
+
+ // Test container accessor/modifier functionality.
+ //
+ {
+ using namespace test4;
+
+ object o (1);
+ o.c1 ().push_back (1123);
+ o.c1 ().push_back (1124);
+ o.c1 ().push_back (1125);
+
+ {
+ std::vector<int> v;
+ v.push_back (2123);
+ v.push_back (2124);
+ v.push_back (2125);
+ o.c2 (v);
+ }
+
+ o.v1 ().c1 ().push_back (1123);
+ o.v1 ().c1 ().push_back (1124);
+ o.v1 ().c1 ().push_back (1125);
+
+ {
+ std::vector<int> v;
+ v.push_back (2123);
+ v.push_back (2124);
+ v.push_back (2125);
+ o.v1 ().c2 (v);
+ }
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id ()));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+
+ // Test id accessor/modifier functionality.
+ //
+ {
+ using namespace test5;
+
+ object1 o1;
+ object2 o2;
+ object3 o3;
+ object4 o4;
+ o4.id (uuid ("\x60\x1D\x17\xF0-\x60\x05-\x47\x23-\x95\x37-"
+ "\xC1\xF8\x94\x41\x2B\xEC"));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object1> p1 (db->load<object1> (o1.id ()));
+ unique_ptr<object2> p2 (db->load<object2> (o2.id ()));
+ unique_ptr<object3> p3 (db->load<object3> (o3.id_));
+ unique_ptr<object4> p4 (db->load<object4> (o4.id ()));
+ t.commit ();
+ }
+ }
+
+ // Test version accessor/modifier functionality.
+ //
+ {
+ using namespace test6;
+
+ object1 o1 (1);
+ object2 o2;
+ object3 o3 (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+
+ assert (o1.version () == 1);
+ assert (o2.version () == 1);
+ assert (o3.version_ == 1);
+ }
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ db->update (o3);
+ t.commit ();
+
+ assert (o1.version () == 2);
+ assert (o2.version () == 2);
+ assert (o3.version_ == 2);
+ }
+ }
+
+ // Test basic accessor/modifier functionality.
+ //
+ {
+ using namespace test7;
+
+ object o (1);
+ o.i1 () = 123;
+ o.set_i2 (223);
+ o.setI3 (323);
+ o.seti4 (423);
+ o.i5 () = 523;
+ o.i6 () = 623;
+ o.SetI7 (723);
+ memcpy (o.b1 (), "123456789012345", 16);
+ o.b2 ("123456789012345");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/access/test.hxx b/odb-tests/common/access/test.hxx
new file mode 100644
index 0000000..3a3424d
--- /dev/null
+++ b/odb-tests/common/access/test.hxx
@@ -0,0 +1,592 @@
+// file : common/access/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+#include <cstring> // std::memcpy, std::memcmp, std::memset
+#include <memory> // std::unique_ptr
+#include <utility> // std::move
+
+#include <odb/core.hxx>
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_MYSQL)
+# define BINARY16_TYPE "BINARY(16)"
+# elif defined(ODB_DATABASE_SQLITE)
+# define BINARY16_TYPE "BLOB"
+# elif defined(ODB_DATABASE_PGSQL)
+# define BINARY16_TYPE "BYTEA"
+# elif defined(ODB_DATABASE_ORACLE)
+# define BINARY16_TYPE "RAW(16)"
+# elif defined(ODB_DATABASE_MSSQL)
+# define BINARY16_TYPE "BINARY(16)"
+# elif defined(ODB_DATABASE_COMMON)
+# define BINARY16_TYPE ""
+# else
+# error unknown database
+# endif
+#endif
+
+// Test basic accessor/modifier functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object
+ struct object
+ {
+ object (): i6_ (0), i7_ (0) {}
+ object (unsigned long id, int i6, int i7): id_ (id), i6_ (i6), i7_ (i7) {}
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ unsigned long id_;
+
+ public:
+ int i1 () const {return i1_;}
+ int& i1 () {return i1_;}
+ private:
+ #pragma db access(i1)
+ int i1_;
+
+ public:
+ int i2 () const {return i2_;}
+ void i2 (int i2) {i2_ = i2;}
+ private:
+ #pragma db access(i2)
+ int i2_;
+
+ // Prefer reference modifier.
+ //
+ public:
+ int i3 () const {return i3_;}
+ int& i3 () {return i3_;}
+ void i3 (int i3);
+ private:
+ #pragma db access(i3)
+ int i3_;
+
+ // Prefer reference modifier (reverse function order).
+ //
+ public:
+ int i4 () const {return i4_;}
+ void i4 (int i4);
+ int& i4 () {return i4_;}
+ private:
+ #pragma db access(i4)
+ int i4_;
+
+ public:
+ int get_i5 () const {return i5_;}
+ void set_i5 (int i5) {i5_ = i5;}
+ private:
+ #pragma db get(get_i5) set(set_i5)
+ int i5_;
+
+ // Const member via reference.
+ //
+ public:
+ const int& i6 () const {return i6_;}
+ private:
+ #pragma db get(i6) set(const_cast<int&> (this.i6 ()))
+ const int i6_;
+
+ // Const member via modifier.
+ //
+ public:
+ int i7 () const {return i7_;}
+ void i7 (int i7) const {const_cast<int&> (i7_) = i7;}
+ private:
+ #pragma db access(i7)
+ const int i7_;
+
+ public:
+ const char* s1 () const {return s1_.c_str ();}
+ void s1 (const char* s1) {s1_ = s1;}
+ //std::string s1 () const {return s1_;}
+ //void s1 (std::string s1) {s1_ = s1;}
+ private:
+ #pragma db get(s1) set(s1((?).c_str ()))
+ //#pragma db access(s1)
+ std::string s1_;
+
+ // Array member via ref.
+ //
+ public:
+ const char* b1 () const {return b1_;}
+ char* b1 () {return b1_;}
+ private:
+ #pragma db type(BINARY16_TYPE) access(b1)
+ char b1_[16];
+
+ // Array member via modifier.
+ //
+ public:
+ const char* b2 () const {return b2_;}
+ void b2 (const char* b2) {std::memcpy (b2_, b2, sizeof (b2_));}
+ private:
+ #pragma db type(BINARY16_TYPE) access(b2)
+ char b2_[16];
+
+ public:
+ bool operator== (const object& o) const
+ {
+ return id_ == o.id_ &&
+ i1_ == o.i1_ &&
+ i2_ == o.i2_ &&
+ i3_ == o.i3_ &&
+ i4_ == o.i4_ &&
+ i5_ == o.i5_ &&
+ i6_ == o.i6_ &&
+ i7_ == o.i7_ &&
+ s1_ == o.s1_ &&
+ std::memcmp (b1_, o.b1_, sizeof (b1_)) == 0 &&
+ std::memcmp (b2_, o.b2_, sizeof (b2_)) == 0;
+ }
+ };
+}
+
+// Test composite accessor/modifier functionality.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db value
+ struct value
+ {
+ value () {}
+ value (int i1, int i2): i1_ (i1), i2_ (i2) {}
+
+ bool operator== (const value& v) const
+ {
+ return i1_ == v.i1_ && i2_ == v.i2_;
+ }
+
+ public:
+ int i1 () const {return i1_;}
+ int& i1 () {return i1_;}
+ private:
+ #pragma db access(i1)
+ int i1_;
+
+ public:
+ int i2 () const {return i2_;}
+ void i2 (int i2) {i2_ = i2;}
+ private:
+ #pragma db access(i2)
+ int i2_;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ bool operator== (const object& o) const
+ {
+ return id_ == o.id_ &&
+ v1_ == o.v1_ &&
+ v2_ == o.v2_ &&
+ v3_ == o.v3_;
+ }
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ unsigned long id_;
+
+ public:
+ const value& v1 () const {return v1_;}
+ value& v1 () {return v1_;}
+ private:
+ #pragma db access(v1)
+ value v1_;
+
+ public:
+ const value& v2 () const {return v2_;}
+ void v2 (const value& v2) {v2_ = v2;}
+ private:
+ #pragma db access(v2)
+ value v2_;
+
+ public:
+ int v3_i1 () const {return v3_.i1 ();}
+ int v3_i2 () const {return v3_.i2 ();}
+ void v3_i1 (int i1) {v3_.i1 () = i1;}
+ void v3_i2 (int i2) {v3_.i2 (i2);}
+ private:
+ #pragma db get(test2::value (this.v3_i1 (), this.v3_i2 ())) \
+ set(this.v3_i1 ((?).i1 ()); this.v3_i2 ((?).i2 ()))
+ value v3_;
+ };
+}
+
+// Test object pointer accessor/modifier functionality.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ struct object1;
+
+ typedef std::unique_ptr<object1> object1_ptr;
+
+ #pragma db object pointer(object1_ptr)
+ struct object1
+ {
+ object1 () {}
+ object1 (unsigned long id): id_ (id) {}
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (unsigned long id): id_ (id) {}
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ unsigned long id_;
+
+ public:
+ const object1_ptr& p1 () const {return p1_;}
+ object1_ptr& p1 () {return p1_;}
+ private:
+ #pragma db access(p1)
+ object1_ptr p1_;
+
+ public:
+ const object1_ptr& p2 () const {return p2_;}
+
+ void p2 (object1_ptr p2) {p2_ = std::move (p2);}
+
+ private:
+ #pragma db get(p2) set(p2 (std::move (?)))
+
+ object1_ptr p2_;
+ };
+}
+
+// Test container accessor/modifier functionality.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db value
+ struct value
+ {
+ value (): c3_ (3, 999) {}
+ value (int v): c1_ (3, v), c2_ (3, v + 1), c3_ (3, v + 2) {}
+
+ bool operator== (const value& v) const
+ {
+ return c1_ == v.c1_ && c2_ == v.c2_ && c3_ == v.c3_;
+ }
+
+ public:
+ const std::vector<int>& c1 () const {return c1_;}
+ std::vector<int>& c1 () {return c1_;}
+ private:
+ #pragma db access(c1)
+ std::vector<int> c1_;
+
+ public:
+ const std::vector<int>& c2 () const {return c2_;}
+ void c2 (const std::vector<int>& c2) {c2_ = c2;}
+ private:
+ #pragma db access(c2)
+ std::vector<int> c2_;
+
+ public:
+ const std::vector<int> c3_;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (unsigned long id): id_ (id), c3_ (3, 3123), v2_ (2123) {}
+
+ bool operator== (const object& o) const
+ {
+ return id_ == o.id_ &&
+ c1_ == o.c1_ &&
+ c2_ == o.c2_ &&
+ c3_ == o.c3_ &&
+ v1_ == o.v1_ &&
+ v2_ == o.v2_;
+ }
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ unsigned long id_;
+
+ public:
+ const std::vector<int>& c1 () const {return c1_;}
+ std::vector<int>& c1 () {return c1_;}
+ private:
+ #pragma db access(c1)
+ std::vector<int> c1_;
+
+ public:
+ const std::vector<int>& c2 () const {return c2_;}
+ void c2 (const std::vector<int>& c2) {c2_ = c2;}
+ private:
+ #pragma db access(c2)
+ std::vector<int> c2_;
+
+ public:
+ const std::vector<int>& c3 () const {return c3_;}
+ private:
+ #pragma db get(c3) set(const_cast<std::vector<int>&> (this.c3 ()))
+ const std::vector<int> c3_;
+
+ public:
+ const value& v1 () const {return v1_;}
+ value& v1 () {return v1_;}
+ private:
+ #pragma db access(v1)
+ value v1_;
+
+ public:
+ const value v2_;
+ };
+}
+
+// Test id accessor/modifier functionality.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db object
+ struct object1
+ {
+ object1 (): id_ (0) {}
+
+ public:
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id auto access(id)
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (): id_ (0) {}
+
+ public:
+ unsigned long id () const {return id_;}
+ unsigned long& id () {return id_;}
+ private:
+ #pragma db id auto access(id)
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object3
+ {
+ object3 (): id_ (0) {}
+
+ #pragma db id auto
+ const unsigned long id_;
+ };
+
+ #pragma db value
+ struct uuid
+ {
+ uuid () {std::memset (data_, 0, sizeof (data_));}
+ explicit uuid (const char* d) {data (d);}
+
+ public:
+ const char* data () const {return data_;}
+ void data (const char* d) {std::memcpy (data_, d, sizeof (data_));}
+ private:
+ #pragma db type(BINARY16_TYPE) column("") access(data)
+ char data_[16];
+ };
+
+ #pragma db object
+ struct object4
+ {
+ public:
+ const uuid& id () const {return id_;}
+ void id (const uuid& id) {id_ = id;}
+ private:
+ #pragma db id access(id)
+ uuid id_;
+ };
+}
+
+// Test version accessor/modifier functionality.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ #pragma db object optimistic
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id), version_ (0) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ public:
+ unsigned long version () const {return version_;}
+ void version (unsigned long version) {version_ = version;}
+ private:
+ #pragma db version access(version)
+ unsigned long version_;
+ };
+
+ #pragma db object optimistic
+ struct object2
+ {
+ object2 (): version_ (0) {}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ public:
+ unsigned long version () const {return version_;}
+ unsigned long& version () {return version_;}
+ private:
+ #pragma db version access(version)
+ unsigned long version_;
+ };
+
+ #pragma db object optimistic
+ struct object3
+ {
+ object3 (unsigned long id = 0): id_ (id), version_ (0) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db version
+ const unsigned long version_;
+ };
+}
+
+// Test automatic discovery of accessor/modifier functions.
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ public:
+ int i1 () const {return i1_;}
+ int& i1 () {return i1_;}
+ private:
+ int i1_;
+
+ public:
+ const int& get_i2 () const {return i2_;}
+ void set_i2 (int i2) {i2_ = i2;}
+ private:
+ int i2_;
+
+ public:
+ const int& getI3 () const {return i3_;}
+ void setI3 (const int& i3) {i3_ = i3;}
+ private:
+ int i3_;
+
+ public:
+ int geti4 () const {return i4;}
+ int seti4 (int v) {int r (i4); i4 = v; return r;}
+ private:
+ int i4;
+
+ // Prefer reference modifier.
+ //
+ public:
+ int i5 () const {return i5_;}
+ int& i5 () {return i5_;}
+ void i5 (int i5);
+ private:
+ int i5_;
+
+ // Prefer reference modifier (reverse function order).
+ //
+ public:
+ int i6 () const {return i6_;}
+ void i6 (int i6);
+ int& i6 () {return i6_;}
+ private:
+ int i6_;
+
+ // Custom accessor/modifier regex.
+ //
+ public:
+ int GetI7 () const {return i7_;}
+ void SetI7 (int i7) {i7_ = i7;}
+ private:
+ int i7_;
+
+ // Array member via ref.
+ //
+ public:
+ const char* b1 () const {return b1_;}
+ char* b1 () {return b1_;}
+ private:
+ #pragma db type(BINARY16_TYPE)
+ char b1_[16];
+
+ // Array member via modifier.
+ //
+ public:
+ const char* b2 () const {return b2_;}
+ void b2 (const char* b2) {std::memcpy (b2_, b2, sizeof (b2_));}
+ private:
+ #pragma db type(BINARY16_TYPE)
+ char b2_[16];
+
+ public:
+ bool operator== (const object& o) const
+ {
+ return id_ == o.id_ &&
+ i1_ == o.i1_ &&
+ i2_ == o.i2_ &&
+ i3_ == o.i3_ &&
+ i4 == o.i4 &&
+ i5_ == o.i5_ &&
+ i6_ == o.i6_ &&
+ i7_ == o.i7_ &&
+ std::memcmp (b1_, o.b1_, sizeof (b1_)) == 0 &&
+ std::memcmp (b2_, o.b2_, sizeof (b2_)) == 0;
+ }
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/access/testscript b/odb-tests/common/access/testscript
new file mode 100644
index 0000000..04f0ec0
--- /dev/null
+++ b/odb-tests/common/access/testscript
@@ -0,0 +1,33 @@
+# file : common/access/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/as/buildfile b/odb-tests/common/as/buildfile
new file mode 100644
index 0000000..dcdc961
--- /dev/null
+++ b/odb-tests/common/as/buildfile
@@ -0,0 +1,49 @@
+# file : common/as/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix as_ \
+ --generate-schema \
+ --generate-query \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# @@ BUILD@ Temporarily suppress the following warning:
+#
+# test-odb.cxx(6234): warning C4244: 'argument': conversion from 'id_type::value_type' to 'test5::version_type::value_type', possible loss of data
+#
+if ($cxx.class == 'msvc')
+ cxx.coptions += /wd4244
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/as/driver.cxx b/odb-tests/common/as/driver.cxx
new file mode 100644
index 0000000..578eb23
--- /dev/null
+++ b/odb-tests/common/as/driver.cxx
@@ -0,0 +1,348 @@
+// file : common/as/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test C++ type mapping (#pragma map type as ...).
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic type mapping functionality.
+ //
+ {
+ using namespace test1;
+
+ object o1 (true, green, 123, 234);
+ o1.m[false] = 123;
+ o1.v.push_back (o1.ip);
+ o1.cv.push_back (red);
+ o1.cv.push_back (green);
+
+ object o2 (false, blue, 234, 456);
+ o2.m[true] = 234;
+ o2.v.push_back (o2.ip);
+ o2.cv.push_back (green);
+ o2.cv.push_back (blue);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o1.b = false;
+ o1.c = blue;
+ o1.ip.first++;
+ o1.ip.second--;
+ o1.m[false]++;
+ o1.m[true] = 234;
+ o1.v.back () = o1.ip;
+ o1.cv.modify_front () = green;
+ o1.cv.push_back (red);
+
+ o2.b = true;
+ o2.c = red;
+ o2.ip.first--;
+ o2.ip.second++;
+ o2.m[true]--;
+ o2.m[false] = 345;
+ o2.v.push_back (o2.ip);
+ o2.cv.pop_back ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+
+ // Test wrapped simple type mapping.
+ //
+ {
+ using namespace test2;
+
+ object o1;
+ o1.v.push_back (null_bool ());
+ o1.v.push_back (false);
+
+ object o2;
+ o2.b = true;
+ o2.v.push_back (true);
+ o2.v.push_back (null_bool ());
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o1.b = false;
+ o1.v[0] = true;
+ o1.v[1].reset ();
+
+ o2.b.reset ();
+ o2.v.push_back (false);
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+
+ // Test wrapped composite type mapping.
+ //
+ {
+ using namespace test3;
+
+ object o1;
+ o1.ip = intp (0, 0); // NULL
+ o1.npv.push_back (o1.np);
+ o1.ipv.push_back (o1.ip);
+
+ object o2;
+ o2.np = intp (123, 234);
+ o1.ip = intp (234, 123);
+ o2.npv.push_back (o2.np);
+ o2.ipv.push_back (o2.ip);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o1.np = o1.npv[0] = intp (234, 456);
+ o1.ip = o1.ipv.modify_at (0) = intp (456, 234);
+
+ o2.np.reset ();
+ o2.npv[0].reset ();
+ o2.ip = o2.ipv.modify_at (0) = intp (0, 0); // NULL
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+
+ // Test id type mapping.
+ //
+ {
+ using namespace test4;
+
+ object o1 (123);
+ o1.v.push_back (1);
+ o1.v.push_back (2);
+ o1.v.push_back (3);
+
+ object o2 (234);
+ o2.v.push_back (3);
+ o2.v.push_back (2);
+ o2.v.push_back (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o1.i++;
+ o1.v.pop_back ();
+ o1.v.modify_front ()++;
+
+ o2.i--;
+ o2.v.clear ();
+ o2.v.push_back (4);
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+
+ // Test version type mapping.
+ //
+ {
+ using namespace test5;
+
+ object o1 (100, 123);
+ object o2 (200, 234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+
+ p1->i--;
+ p2->i++;
+
+ db->update (*p1);
+ db->update (*p2);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ for (;;)
+ {
+ o1.i++;
+ o2.i--;
+
+ try
+ {
+
+ db->update (o1);
+ db->update (o2);
+ break;
+ }
+ catch (const odb::object_changed&)
+ {
+ db->reload (o1);
+ db->reload (o2);
+ }
+ }
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/as/test.hxx b/odb-tests/common/as/test.hxx
new file mode 100644
index 0000000..963abeb
--- /dev/null
+++ b/odb-tests/common/as/test.hxx
@@ -0,0 +1,270 @@
+// file : common/as/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <map>
+#include <vector>
+#include <string>
+#include <utility> // pair
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+#include <odb/nullable.hxx>
+
+// Test basic type mapping functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ enum color {red, green, blue};
+
+ inline const char*
+ color_to_string (color c)
+ {
+ return c == red ? "RED" : (c == green ? "GREEN" : "BLUE");
+ }
+
+ inline color
+ string_to_color (const std::string& s)
+ {
+ return s == "RED" ? red : (s == "GREEN" ? green : blue);
+ }
+
+ #pragma db map type(color) as(std::string) \
+ to(test1::color_to_string (?)) \
+ from(test1::string_to_color (?))
+
+ typedef std::pair<int, int> intp;
+
+ #pragma db value
+ struct comp
+ {
+ comp () {}
+ comp (int n1_, int n2_): n1 (n1_), n2 (n2_) {}
+
+ int n1;
+ int n2;
+ };
+
+ #pragma db map type(intp) as(comp) \
+ to(test1::comp ((?).first, (?).second)) \
+ from(test1::intp ((?).n1, (?).n2))
+
+ #pragma db object
+ struct object
+ {
+ // Class-scope mapping.
+ //
+ #pragma db map type(bool) as(std::string) \
+ to((?) ? "true" : "false") \
+ from((?) == "true")
+
+ #pragma db id auto
+ unsigned long id;
+
+ bool b;
+ color c;
+ intp ip;
+
+ std::map<bool, int> m;
+ std::vector<intp> v;
+ odb::vector<color> cv;
+
+ object () {}
+ object (bool b_, color c_, int n1, int n2): b (b_), c (c_), ip (n1, n2) {}
+ };
+
+ inline bool
+ operator== (const object& x, const object y)
+ {
+ return
+ x.b == y.b &&
+ x.c == y.c &&
+ x.ip == y.ip &&
+ x.m == y.m &&
+ x.v == y.v &&
+ x.cv == y.cv;
+ }
+}
+
+// Test wrapped simple type mapping.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db map type(bool) as(std::string) \
+ to((?) ? "true" : "false") \
+ from((?) == "true")
+
+ typedef odb::nullable<bool> null_bool;
+ typedef odb::nullable<std::string> null_string;
+
+ /*
+ #pragma db map type(null_bool) as(null_string) \
+ to((?) \
+ ? test2::null_string (*(?) ? "true" : "false") \
+ : test2::null_string ()) \
+ from((?) \
+ ? test2::null_bool (*(?) == "true") \
+ : test2::null_bool ())
+ */
+
+ #pragma db map type(null_bool) as(std::string) \
+ to((?) ? (*(?) ? "true" : "false") : "null") \
+ from((?) != "null" \
+ ? test2::null_bool ((?) == "true") \
+ : test2::null_bool ())
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ odb::nullable<bool> b;
+ std::vector<odb::nullable<bool> > v;
+ };
+
+ inline bool
+ operator== (const object& x, const object y)
+ {
+ return x.b == y.b && x.v == y.v;
+ }
+}
+
+// Test wrapped simple type mapping.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ typedef std::pair<int, int> intp;
+
+ #pragma db value
+ struct comp
+ {
+ comp () {}
+ comp (int n1_, int n2_): n1 (n1_), n2 (n2_) {}
+
+ int n1;
+ int n2;
+ };
+
+ typedef odb::nullable<intp> null_intp;
+ typedef odb::nullable<comp> null_comp;
+
+ #pragma db map type(null_intp) as(null_comp) \
+ to((?) \
+ ? test3::null_comp (test3::comp ((?)->first, (?)->second)) \
+ : test3::null_comp ()) \
+ from((?) \
+ ? test3::null_intp (test3::intp ((?)->n1, (?)->n2)) \
+ : test3::null_intp ())
+
+ // Map int pair with both members equal 0 to NULL comp.
+ //
+ #pragma db map type(intp) as(null_comp) \
+ to((?).first != 0 || (?).second != 0 \
+ ? test3::null_comp (test3::comp ((?).first, (?).second)) \
+ : test3::null_comp ()) \
+ from((?) \
+ ? test3::intp (test3::intp ((?)->n1, (?)->n2)) \
+ : test3::intp (0, 0))
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ odb::nullable<intp> np;
+ intp ip;
+
+ std::vector<odb::nullable<intp> > npv;
+ odb::vector<intp> ipv;
+ };
+
+ inline bool
+ operator== (const object& x, const object y)
+ {
+ return x.np == y.np && x.ip == y.ip && x.npv == y.npv && x.ipv == y.ipv;
+ }
+}
+
+// Test id type mapping.
+//
+struct id_type
+{
+ typedef unsigned long value_type;
+ value_type value;
+
+ id_type (value_type v = 0): value (v) {}
+ operator value_type () const {return value;}
+};
+
+#pragma db map type(id_type) as(id_type::value_type)
+
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ id_type id;
+
+ int i;
+ odb::vector<int> v;
+
+ object () {}
+ object (int i_): i (i_) {}
+ };
+
+ inline bool
+ operator== (const object& x, const object y)
+ {
+ return x.id == y.id && x.i == y.i && x.v == y.v;
+ }
+}
+
+// Test version type mapping.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ struct version_type
+ {
+ typedef unsigned short value_type;
+ value_type value;
+
+ version_type (value_type v = 0): value (v) {}
+ operator value_type () const {return value;}
+ version_type& operator++ () {value++; return *this;}
+ };
+
+ #pragma db map type(version_type) as(id_type::value_type)
+
+ #pragma db object optimistic
+ struct object
+ {
+ #pragma db id
+ id_type id;
+
+ #pragma db version
+ version_type v;
+
+ int i;
+
+ object () {}
+ object (id_type id_, int i_): id (id_), i (i_) {}
+ };
+
+ inline bool
+ operator== (const object& x, const object y)
+ {
+ return x.id == y.id && x.v == y.v && x.i == y.i;
+ }
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/as/testscript b/odb-tests/common/as/testscript
new file mode 100644
index 0000000..12d9753
--- /dev/null
+++ b/odb-tests/common/as/testscript
@@ -0,0 +1,33 @@
+# file : common/as/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/blob/buildfile b/odb-tests/common/blob/buildfile
new file mode 100644
index 0000000..cc6d164
--- /dev/null
+++ b/odb-tests/common/blob/buildfile
@@ -0,0 +1,40 @@
+# file : common/blob/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix blob_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/blob/driver.cxx b/odb-tests/common/blob/driver.cxx
new file mode 100644
index 0000000..269f415
--- /dev/null
+++ b/odb-tests/common/blob/driver.cxx
@@ -0,0 +1,76 @@
+// file : common/blob/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test BLOB mapping.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ const char data[] =
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"
+ "cccccccccccccccccccccccccccccccccccccccccccccccc"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"
+ "dddddddddddddddddddddddddddddddddddddddddddddddd"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"
+ "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"
+ "ffffffffffffffffffffffffffffffffffffffffffffffff";
+
+ const unsigned char* udata = reinterpret_cast<const unsigned char*> (data);
+
+ object o (1);
+ o.vc.assign (data, data + sizeof (data));
+ o.vuc.assign (udata, udata + sizeof (data));
+ memcpy (o.c, data, sizeof (data));
+ memcpy (o.uc, udata, sizeof (data));
+ memcpy (o.a.data (), data, sizeof (data));
+ memcpy (o.ua.data (), udata, sizeof (data));
+ o.cont.push_back (1);
+ o.cont.push_back (2);
+ o.cont.push_back (3);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/blob/test.hxx b/odb-tests/common/blob/test.hxx
new file mode 100644
index 0000000..9602ca2
--- /dev/null
+++ b/odb-tests/common/blob/test.hxx
@@ -0,0 +1,71 @@
+// file : common/blob/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <array>
+#include <vector>
+#include <cstring> // std::memcmp
+
+#include <odb/core.hxx>
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_PGSQL)
+# define BLOB_TYPE "BYTEA"
+# elif defined(ODB_DATABASE_MSSQL)
+//# define BLOB_TYPE "VARBINARY(1024)"
+# define BLOB_TYPE "VARBINARY(max)"
+# else
+//# define BLOB_TYPE "RAW(1024)"
+# define BLOB_TYPE "BLOB"
+# endif
+#endif
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db type(BLOB_TYPE)
+ std::vector<char> vc;
+
+ #pragma db type(BLOB_TYPE)
+ std::vector<unsigned char> vuc;
+
+ #pragma db type(BLOB_TYPE)
+ char c[1024];
+
+ #pragma db type(BLOB_TYPE)
+ unsigned char uc[1024];
+
+ #pragma db type(BLOB_TYPE)
+ std::array<char, 1024> a;
+
+ #pragma db type(BLOB_TYPE)
+ std::array<char, 1024> ua;
+
+ // Make sure we can still use std::vector<char> and std::array<char>
+ // as containers.
+ //
+ std::vector<unsigned char> cont;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ return x.id_ == y.id_
+ && x.vc == y.vc
+ && x.vuc == y.vuc
+ && std::memcmp (x.c, y.c, sizeof (x.c)) == 0
+ && std::memcmp (x.uc, y.uc, sizeof (x.uc)) == 0
+ && x.a == y.a
+ && x.ua == y.ua
+ && x.cont == y.cont;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/blob/testscript b/odb-tests/common/blob/testscript
new file mode 100644
index 0000000..4fb9955
--- /dev/null
+++ b/odb-tests/common/blob/testscript
@@ -0,0 +1,33 @@
+# file : common/blob/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/buildfile b/odb-tests/common/buildfile
new file mode 100644
index 0000000..cb9c748
--- /dev/null
+++ b/odb-tests/common/buildfile
@@ -0,0 +1,6 @@
+# file : common/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -bulk/}
+
+./: bulk/: include = (!$pgsql || $pgsql_bulk || $size($databases) != 1)
diff --git a/odb-tests/common/bulk/buildfile b/odb-tests/common/bulk/buildfile
new file mode 100644
index 0000000..417eb22
--- /dev/null
+++ b/odb-tests/common/bulk/buildfile
@@ -0,0 +1,49 @@
+# file : common/bulk/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert (!$pgsql || $pgsql_bulk || $size($databases) != 1) \
+"bulk operations are disabled for pgsql which is specified as single database"
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+{
+ if ($db != 'pgsql' || $pgsql_bulk)
+ import libs += libodb-$db%lib{odb-$db}
+}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: \
+ include = ($multi && ($db != 'pgsql' || $pgsql_bulk))
+
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix bulk_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/bulk/driver.cxx b/odb-tests/common/bulk/driver.cxx
new file mode 100644
index 0000000..23b49ad
--- /dev/null
+++ b/odb-tests/common/bulk/driver.cxx
@@ -0,0 +1,1203 @@
+// file : common/bulk/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test bulk database operations.
+//
+
+#include <memory> // std::unique_ptr
+#include <vector>
+#include <iostream>
+#include <iterator>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <odb/details/meta/remove-pointer.hxx>
+
+#include <libcommon/config.hxx> // DATABASE_*
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+// Sun CC with non-standard STL does not have iterator_traits in which
+// case we assume iterator is just a pointer.
+//
+template <typename I,
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ typename T = typename iterator_traits<I>::value_type
+#else
+ typename T = typename odb::details::meta::remove_pointer<I>::result
+#endif
+ >
+struct element_traits;
+
+template <typename I, typename T>
+struct element_traits
+{
+ typedef T type;
+ typedef T* pointer;
+ typedef std::unique_ptr<T> unique_ptr;
+
+ static T& ref (T& x) {return x;}
+ static T* ptr (T* p) {return p;}
+};
+
+template <typename I, typename T>
+struct element_traits<I, T*>
+{
+ typedef T type;
+ typedef T* pointer;
+ typedef std::unique_ptr<T> unique_ptr;
+
+ static T& ref (T* p) {return *p;}
+ static T* ptr (T* p) {return p;}
+};
+
+template <typename I, typename T>
+struct element_traits<I, std::unique_ptr<T> >
+{
+ typedef T type;
+ typedef std::unique_ptr<T> pointer;
+ typedef std::unique_ptr<T> unique_ptr;
+
+ static T& ref (const unique_ptr& p) {return *p;}
+ static T* ptr (const unique_ptr& p) {return p.get ();}
+};
+
+template <typename I>
+void
+persist (const unique_ptr<database>& db, I b, I e, bool cont = true)
+{
+ typedef element_traits<I> traits;
+ typedef typename traits::type type;
+ typedef typename traits::unique_ptr unique_ptr;
+
+ {
+ transaction t (db->begin ());
+ db->persist (b, e, cont);
+ t.commit ();
+ }
+
+ // Verify we can load the objects via their ids.
+ //
+ {
+ transaction t (db->begin ());
+
+ for (I i (b); i != e; ++i)
+ {
+ type& x (traits::ref (*i));
+ unique_ptr p (db->load<type> (x.id));
+ assert (p->n == x.n && p->s == x.s);
+ }
+
+ t.commit ();
+ }
+}
+
+template <typename I>
+void
+try_persist (const unique_ptr<database>& db, I b, I e, bool cont = true)
+{
+ try
+ {
+ persist (db, b, e, cont);
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+}
+
+template <typename I>
+void
+update (const unique_ptr<database>& db, I b, I e,
+ bool modify = true, bool cont = true)
+{
+ typedef element_traits<I> traits;
+ typedef typename traits::type type;
+ typedef typename traits::unique_ptr unique_ptr;
+
+ if (modify)
+ {
+ for (I i (b); i != e; ++i)
+ {
+ type& x (traits::ref (*i));
+ x.n++;
+ x.s[0]++;
+ }
+ }
+
+ {
+ transaction t (db->begin ());
+ db->update (b, e, cont);
+ t.commit ();
+ }
+
+ // Verify changes.
+ //
+ {
+ transaction t (db->begin ());
+
+ for (I i (b); i != e; ++i)
+ {
+ type& x (traits::ref (*i));
+ unique_ptr p (db->load<type> (x.id));
+ assert (p->n == x.n && p->s == x.s);
+ }
+
+ t.commit ();
+ }
+}
+
+template <typename I>
+void
+try_update (const unique_ptr<database>& db, I b, I e, bool cont = true)
+{
+ try
+ {
+ update (db, b, e, false, cont);
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+}
+
+template <typename I>
+void
+erase (const unique_ptr<database>& db, I b, I e)
+{
+ typedef element_traits<I> traits;
+ typedef typename traits::type type;
+
+ {
+ transaction t (db->begin ());
+ db->erase (b, e);
+ t.commit ();
+ }
+
+ // Verify the objects are gone.
+ //
+ {
+ transaction t (db->begin ());
+
+ for (I i (b); i != e; ++i)
+ {
+ type& x (traits::ref (*i));
+ typename traits::pointer p (db->find<type> (x.id));
+ assert (traits::ptr (p) == 0);
+ }
+
+ t.commit ();
+ }
+}
+
+template <typename T, typename I>
+void
+erase_id (const unique_ptr<database>& db, I b, I e, bool cont = true)
+{
+ typedef element_traits<T*> traits;
+ typedef T type;
+
+ {
+ transaction t (db->begin ());
+ db->erase<T> (b, e, cont);
+ t.commit ();
+ }
+
+ // Verify the objects are gone.
+ //
+ {
+ transaction t (db->begin ());
+
+ for (I i (b); i != e; ++i)
+ assert (traits::ptr (db->find<type> (*i)) == 0);
+
+ t.commit ();
+ }
+}
+
+template <typename T, typename A>
+void
+try_erase (const unique_ptr<database>& db, const A& a, bool cont = true)
+{
+ try
+ {
+ erase_id<T> (db, a, a + sizeof (a) / sizeof (a[0]), cont);
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+}
+
+
+template <typename I>
+void
+test (const unique_ptr<database>& db, I b, I e)
+{
+ persist (db, b, e);
+ update (db, b, e);
+ erase (db, b, e);
+}
+
+template <typename T>
+vector<T>
+fill (std::size_t count)
+{
+ vector<T> r;
+
+ unsigned int n (1);
+ std::string s ("a");
+
+ for (size_t i (0); i != count; ++i)
+ {
+ r.push_back (T (n, s));
+ n++;
+ s[0] = (s[0] == 'z' ? 'a' : s[0] + 1);
+ }
+
+ return r;
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+#if !defined(MULTI_DATABASE) && \
+ (defined(DATABASE_ORACLE) || \
+ defined(DATABASE_MSSQL) || \
+ defined(DATABASE_PGSQL))
+
+ // Test database class API with various forms of containers
+ // and elements (test #6 is a copy).
+ //
+ {
+ using namespace test1;
+
+ {
+ object a[2];
+ a[0] = object (1, "a");
+ a[1] = object (2, "b");
+ test (db, a, a + sizeof (a) / sizeof (a[0]));
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ object o1 (1, "a");
+ object o2 (2, "b");
+ object* a[2] = {&o1, &o2};
+ test (db, a, a + sizeof (a) / sizeof (a[0]));
+ }
+
+ {
+ object o1 (1, "a");
+ object o2 (2, "b");
+ vector<object*> v;
+ v.push_back (&o1);
+ v.push_back (&o2);
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<unique_ptr<unique_object>> v;
+ v.push_back (unique_ptr<unique_object> (new unique_object (1, "a")));
+ v.push_back (unique_ptr<unique_object> (new unique_object (2, "b")));
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ persist (db, v.begin (), v.end ());
+
+ unsigned long id[2] = {v[0].id, v[1].id};
+ erase_id<object> (db, id, id + sizeof (id) / sizeof (id[0]));
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ persist (db, v.begin (), v.end ());
+
+ vector<unsigned long> id;
+ id.push_back (v[0].id);
+ id.push_back (v[1].id);
+ erase_id<object> (db, id.begin (), id.end ());
+ }
+ }
+
+ // Test various batch sizes.
+ //
+ {
+ using namespace test1;
+
+ {
+ vector<object> v; // 0
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (1)); // 1
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (2)); // batch - 1
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (3)); // batch
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (4)); // batch + 1
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (5)); // 2 * batch - 1
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (6)); // 2 * batch
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v (fill<object> (100)); // 100
+ test (db, v.begin (), v.end ());
+ }
+ }
+
+ // Test object with manually assigned id.
+ //
+ {
+ using namespace test2;
+
+ {
+ vector<object> v;
+ v.push_back (object ("1", 1, "a"));
+ v.push_back (object ("2", 2, "b"));
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ typedef unique_ptr<unique_object> unique_ptr;
+
+ vector<unique_ptr> v;
+ v.push_back (unique_ptr (new unique_object ("1", 1, "a")));
+ v.push_back (unique_ptr (new unique_object ("2", 2, "b")));
+ test (db, v.begin (), v.end ());
+ }
+
+ // Test const objects.
+ //
+
+ {
+ const object a[1];
+ const object* e (a + sizeof (a) / sizeof (a[0]));
+
+ transaction t (db->begin ());
+ db->persist (a, e);
+ db->erase (a, e);
+ t.commit ();
+ }
+
+ {
+ object o1 ("1", 1, "a");
+ object o2 ("2", 2, "b");
+
+ vector<const object*> v;
+ v.push_back (&o1);
+ v.push_back (&o2);
+
+ transaction t (db->begin ());
+ db->persist (v.begin (), v.end ());
+ db->erase (v.begin (), v.end ());
+ t.commit ();
+ }
+ }
+
+ // Test failure.
+ //
+ {
+ using namespace test3;
+
+ vector<object> v;
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (9, 9));
+ v.push_back (object (10, 10));
+ v.push_back (object (11, 11));
+
+ persist (db, v.begin (), v.end ());
+
+ // persist
+ //
+ {
+ {
+ vector<object> v; // 1
+ v.push_back (object (6, 6));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch + 1
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (9, 9));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2 x batch - 1
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (9, 9));
+ v.push_back (object (10, 10));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2 x batch
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (9, 9));
+ v.push_back (object (10, 10));
+ v.push_back (object (11, 11));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ // Mixture of success and failure.
+ //
+
+ {
+ vector<object> v; // 1
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 1
+ v.push_back (object (6, 6));
+ v.push_back (object (0, 0));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (6, 6));
+ v.push_back (object (0, 0));
+ v.push_back (object (7, 7));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (0, 0));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (0, 0));
+ v.push_back (object (8, 8));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (0, 0));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // mixture
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ v.push_back (object (1, 1));
+ v.push_back (object (7, 7));
+ v.push_back (object (2, 2));
+ v.push_back (object (8, 8));
+ v.push_back (object (3, 3));
+ try_persist (db, v.begin (), v.end ());
+ }
+
+ // Test stopping after failure.
+ //
+ {
+ vector<object> v; // batch
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (6, 6));
+ v.push_back (object (2, 2));
+ v.push_back (object (3, 3));
+ try_persist (db, v.begin (), v.end (), false);
+ }
+ }
+
+ // update
+ //
+ {
+ {
+ vector<object> v; // 1
+ v.push_back (object (0, 0));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (2, 2));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch + 1
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (2, 2));
+ v.push_back (object (3, 3));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2 x batch - 1
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (2, 2));
+ v.push_back (object (3, 3));
+ v.push_back (object (4, 4));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2 x batch
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (2, 2));
+ v.push_back (object (3, 3));
+ v.push_back (object (4, 4));
+ v.push_back (object (5, 5));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ // Mixture of success and failure.
+ //
+
+ {
+ vector<object> v; // 1
+ v.push_back (object (6, 6));
+ v.push_back (object (0, 0));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 1
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (6, 6));
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ v.push_back (object (1, 1));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // 2
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (6, 6));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (6, 6));
+ v.push_back (object (2, 2));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // batch
+ v.push_back (object (0, 0));
+ v.push_back (object (1, 1));
+ v.push_back (object (2, 2));
+ v.push_back (object (6, 6));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // mixture
+ v.push_back (object (0, 0));
+ v.push_back (object (6, 6));
+ v.push_back (object (2, 2));
+ v.push_back (object (7, 7));
+ v.push_back (object (3, 3));
+ v.push_back (object (8, 8));
+ v.push_back (object (4, 4));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v; // mixture
+ v.push_back (object (0, 0));
+ v.push_back (object (2, 2));
+ v.push_back (object (3, 3));
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (8, 8));
+ v.push_back (object (4, 4));
+ try_update (db, v.begin (), v.end ());
+ }
+
+ // Test stopping after failure.
+ //
+ {
+ vector<object> v; // batch
+ v.push_back (object (6, 6));
+ v.push_back (object (7, 7));
+ v.push_back (object (0, 0));
+ v.push_back (object (8, 8));
+ v.push_back (object (9, 9));
+ try_update (db, v.begin (), v.end (), false);
+ }
+
+ // Test a database exception (unique constraint violation)
+ //
+ try
+ {
+ v[0].n++;
+ v[2].n++;
+
+ update (db, v.begin (), v.begin () + 3, false);
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+#ifndef DATABASE_PGSQL
+ assert (e.attempted () == 3 && e.failed () == 2);
+ assert (e[0] != 0 && e[1] == 0 && e[2] != 0);
+#else
+ // In PosgreSQL no further statements are attempted after the first
+ // failure.
+ //
+ assert (e.attempted () == 1 && e.failed () == 1);
+ assert (e[0] != 0);
+#endif
+ }
+ }
+
+ // erase
+ //
+ {
+ {
+ unsigned long a[] = {0}; // 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1}; // 2
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2}; // batch
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2, 3}; // batch + 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2, 3, 4}; // 2 x batch - 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2, 3, 4, 5}; // 2 x batch
+ try_erase<object> (db, a);
+ }
+
+ // Mixture of success and failure.
+ //
+
+ {
+ unsigned long a[] = {6, 0}; // 2
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 6}; // 2
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {6, 0, 1}; // batch
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 6, 1}; // batch
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 6}; // batch
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {6, 0, 1, 2}; // batch + 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 6, 1, 2}; // batch + 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 6, 2}; // batch + 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2, 6}; // batch + 1
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {6, 0, 7, 1, 8, 2, 9, 3}; // mixture
+ try_erase<object> (db, a);
+ }
+
+ {
+ unsigned long a[] = {0, 1, 2, 6, 7, 8, 3, 4, 5, 9}; // mixture
+ try_erase<object> (db, a);
+ }
+
+ // Test stopping after failure.
+ //
+ {
+ unsigned long a[] = {6, 7, 0, 8, 9};
+ try_erase<object> (db, a, false);
+ }
+ }
+
+ erase (db, v.begin (), v.end ());
+ }
+
+ // Test a large batch.
+ //
+ {
+ using namespace test4;
+
+ vector<object> v (fill<object> (5000));
+ test (db, v.begin (), v.end ());
+ }
+
+ // Test object without id.
+ //
+ {
+ using namespace test5;
+
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+
+ {
+ transaction t (db->begin ());
+ db->persist (v.begin (), v.end ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object> ("ORDER BY" + query::n));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end () && i->n == 1 && i->s == "a");
+ assert (++i != r.end () && i->n == 2 && i->s == "b");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase_query<object> ();
+ t.commit ();
+ }
+ }
+
+ // Test API with persistent class template instantiations (copy of
+ // test #1).
+ {
+ using namespace test6;
+
+ // Make sure we can still call the non-bulk API.
+ //
+ {
+ object o (0, "z");
+ transaction t (db->begin ());
+ db->persist (o);
+ db->update<object> (o);
+ db->reload<object> (o);
+ db->erase<object> (o);
+ t.commit ();
+ }
+
+
+ // The rest is a copy of test #1.
+ //
+ {
+ object a[2];
+ a[0] = object (1, "a");
+ a[1] = object (2, "b");
+ test (db, a, a + sizeof (a) / sizeof (a[0]));
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ object o1 (1, "a");
+ object o2 (2, "b");
+ object* a[2] = {&o1, &o2};
+ test (db, a, a + sizeof (a) / sizeof (a[0]));
+ }
+
+ {
+ object o1 (1, "a");
+ object o2 (2, "b");
+ vector<object*> v;
+ v.push_back (&o1);
+ v.push_back (&o2);
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<unique_ptr<unique_object>> v;
+ v.push_back (unique_ptr<unique_object> (new unique_object (1, "a")));
+ v.push_back (unique_ptr<unique_object> (new unique_object (2, "b")));
+ test (db, v.begin (), v.end ());
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ persist (db, v.begin (), v.end ());
+
+ unsigned long id[2] = {v[0].id, v[1].id};
+ erase_id<object> (db, id, id + sizeof (id) / sizeof (id[0]));
+ }
+
+ {
+ vector<object> v;
+ v.push_back (object (1, "a"));
+ v.push_back (object (2, "b"));
+ persist (db, v.begin (), v.end ());
+
+ vector<unsigned long> id;
+ id.push_back (v[0].id);
+ id.push_back (v[1].id);
+ erase_id<object> (db, id.begin (), id.end ());
+ }
+ }
+
+ // Test optimistic concurrency.
+ //
+ {
+ using namespace test7;
+
+ std::vector<object> v (fill<object> (4));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (v.begin (), v.end ());
+ t.commit ();
+
+ assert (v[0].v != 0 &&
+ v[1].v != 0 &&
+ v[2].v != 0 &&
+ v[3].v != 0);
+ }
+
+ // update
+ //
+ {
+ std::vector<object> c (v);
+
+ transaction t (db->begin ());
+ db->update (v.begin (), v.end ());
+ t.commit ();
+
+ assert (v[0].v > c[0].v &&
+ v[1].v > c[1].v &&
+ v[2].v > c[2].v &&
+ v[3].v > c[3].v);
+ }
+
+ {
+ object o2 (v[1]);
+ object o4 (v[3]);
+
+ o2.n++;
+ o4.n++;
+
+ transaction t (db->begin ());
+ db->update (o2);
+ db->update (o4);
+ t.commit ();
+ }
+
+ try
+ {
+ // Some updates may succeed spoiling the version for erase tests.
+ //
+ std::vector<object> c (v);
+
+ transaction t (db->begin ());
+ db->update (c.begin (), c.end ());
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+
+ // erase
+ //
+ try
+ {
+ transaction t (db->begin ());
+ db->erase (v.begin (), v.end ());
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+
+ {
+ transaction t (db->begin ());
+ db->reload (v[1]);
+ db->reload (v[3]);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (v.begin (), v.end ());
+ t.commit ();
+ }
+ }
+
+ // Test SQL Server optimistic concurrency with ROWVERSION.
+ //
+#ifdef DATABASE_MSSQL
+ {
+ using namespace test8;
+
+ std::vector<object> v (fill<object> (4));
+
+ v[0].id = 1;
+ v[1].id = 2;
+ v[2].id = 3;
+ v[3].id = 4;
+
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (v.begin (), v.end ());
+ t.commit ();
+
+ assert (v[0].v != 0 &&
+ v[1].v != 0 &&
+ v[2].v != 0 &&
+ v[3].v != 0);
+
+ //cerr << v[0].v << endl
+ // << v[1].v << endl
+ // << v[2].v << endl
+ // << v[3].v << endl;
+ }
+
+ // update
+ //
+
+ /*
+ {
+ std::vector<object> c (v);
+
+ transaction t (db->begin ());
+ db->update (v.begin (), v.end ());
+ t.commit ();
+
+ assert (v[0].v > c[0].v &&
+ v[1].v > c[1].v &&
+ v[2].v > c[2].v &&
+ v[3].v > c[3].v);
+ }
+ */
+
+ {
+ object o2 (v[1]);
+ object o4 (v[3]);
+
+ o2.n++;
+ o4.n++;
+
+ transaction t (db->begin ());
+ db->update (o2);
+ db->update (o4);
+ t.commit ();
+ }
+
+ /*
+ try
+ {
+ transaction t (db->begin ());
+ db->update (v.begin (), v.end ());
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ cout << e.what () << endl << endl;
+ }
+ */
+
+ // erase
+ //
+ try
+ {
+ transaction t (db->begin ());
+ db->erase (v.begin (), v.end ());
+ assert (false);
+ }
+ catch (const multiple_exceptions& e)
+ {
+ assert (e.attempted () == 4 && e.failed () == 4);
+ }
+
+ {
+ transaction t (db->begin ());
+ db->reload (v[1]);
+ db->reload (v[3]);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (v.begin (), v.end ());
+ t.commit ();
+ }
+ }
+#endif
+
+#endif
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/bulk/test.hxx b/odb-tests/common/bulk/test.hxx
new file mode 100644
index 0000000..71755f2
--- /dev/null
+++ b/odb-tests/common/bulk/test.hxx
@@ -0,0 +1,211 @@
+// file : common/bulk/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <memory> // std::unique_ptr
+
+#include <odb/core.hxx>
+
+// Test basic functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object bulk(3) session
+ struct object
+ {
+ object (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), n (n_), s (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ unsigned int n;
+
+ #pragma db oracle:type("CLOB") mssql:type("VARCHAR(max)") // Long data.
+ std::string s;
+ };
+
+ #pragma db object bulk(3) pointer(std::unique_ptr)
+ struct unique_object
+ {
+ unique_object (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), n (n_), s (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ unsigned int n;
+ std::string s;
+ };
+}
+
+// Test object with manually assigned id.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object bulk(3) session
+ struct object
+ {
+ // Can't use empty id because of Oracle.
+ //
+ object (std::string id_ = "!", unsigned int n_ = 0, std::string s_ = "")
+ : id (id_), n (n_), s (s_) {}
+
+ #pragma db id
+ std::string id;
+
+ unsigned int n;
+ std::string s;
+ };
+
+#pragma db object bulk(3) pointer(std::unique_ptr)
+ struct unique_object
+ {
+ unique_object (std::string id_ = "",
+ unsigned int n_ = 0,
+ std::string s_ = "")
+ : id (id_), n (n_), s (s_) {}
+
+ #pragma db id
+ std::string id;
+
+ unsigned int n;
+ std::string s;
+ };
+}
+
+// Test failure.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db object bulk(3)
+ struct object
+ {
+ object (unsigned long id_ = 0, unsigned int n_ = 0)
+ : id (id_), n (n_), s ("abc") {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db unique
+ unsigned int n;
+ std::string s;
+ };
+}
+
+// Test a large batch.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object bulk(3000)
+ struct object
+ {
+ object (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), n (n_), s (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ unsigned int n;
+
+ #pragma db oracle:type("CLOB") mssql:type("VARCHAR(max)") // Long data.
+ std::string s;
+ };
+}
+
+// Test object without id.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db object no_id bulk(3)
+ struct object
+ {
+ object (unsigned int n_ = 0, std::string s_ = ""): n (n_), s (s_) {}
+
+ unsigned int n;
+ std::string s;
+ };
+}
+
+// Test API with persistent class template instantiations.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ template <int>
+ struct object_template
+ {
+ object_template (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), n (n_), s (s_) {}
+
+ unsigned long id;
+ unsigned int n;
+ std::string s;
+ };
+
+ typedef object_template<1> object;
+
+ #pragma db object(object) bulk(3)
+ #pragma db member(object::id) id auto
+
+ typedef object_template<3> unique_object;
+
+ #pragma db object(unique_object) bulk(3) pointer(std::unique_ptr)
+ #pragma db member(unique_object::id) id auto
+}
+
+// Test optimistic concurrency.
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ #pragma db object optimistic bulk(3)
+ struct object
+ {
+ object (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), v (0), n (n_), s (s_) {}
+
+ #pragma db id auto
+ unsigned long long id;
+
+ #pragma db version
+ unsigned long long v;
+
+ unsigned int n;
+ std::string s;
+ };
+}
+
+// Test SQL Server optimistic concurrency with ROWVERSION.
+//
+#if defined(ODB_DATABASE_MSSQL) || defined(DATABASE_MSSQL)
+#pragma db namespace table("t8_")
+namespace test8
+{
+ #pragma db object optimistic bulk(3)
+ struct object
+ {
+ object (unsigned int n_ = 0, std::string s_ = "")
+ : id (0), v (0), n (n_), s (s_) {}
+
+ #pragma db id
+ unsigned long long id;
+
+ #pragma db version type("ROWVERSION")
+ unsigned long long v;
+
+ unsigned int n;
+ std::string s;
+ };
+}
+#endif
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/bulk/testscript b/odb-tests/common/bulk/testscript
new file mode 100644
index 0000000..e7567c9
--- /dev/null
+++ b/odb-tests/common/bulk/testscript
@@ -0,0 +1,503 @@
+# file : common/bulk/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
++cat <<EOI >=output
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object already persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0] object already persistent
+ [1] object already persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [2] object already persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [2] object already persistent
+ [3] object already persistent
+
+ multiple exceptions, 5 elements attempted, 5 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [2] object already persistent
+ [3] object already persistent
+ [4] object already persistent
+
+ multiple exceptions, 6 elements attempted, 6 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [2] object already persistent
+ [3] object already persistent
+ [4] object already persistent
+ [5] object already persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [1] object already persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [0] object already persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [1] object already persistent
+ [2] object already persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object already persistent
+ [2] object already persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object already persistent
+ [1] object already persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [3] object already persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object already persistent
+ [1] object already persistent
+ [2] object already persistent
+
+ multiple exceptions, 7 elements attempted, 3 failed:
+ [1] object already persistent
+ [3] object already persistent
+ [5] object already persistent
+
+ multiple exceptions, 3 elements attempted, 1 failed:
+ [2] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 5 elements attempted, 5 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+
+ multiple exceptions, 6 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+ [5] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0-1] (some) object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0-1] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 7 elements attempted, 7 failed:
+ [0-5] (some) object not persistent
+ [6] object not persistent
+
+ multiple exceptions, 7 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [6] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 5 elements attempted, 5 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+
+ multiple exceptions, 6 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+ [5] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0-1] (some) object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0-1] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 8 elements attempted, 8 failed:
+ [0-7] (some) object not persistent
+
+ multiple exceptions, 10 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [6] object not persistent
+ [7] object not persistent
+ [8] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0-2] (some) object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object changed concurrently
+ [3] object changed concurrently
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0-2] (some) object changed concurrently
+ [3] object changed concurrently
+
+ EOI
+
++cat <<EOI >=pgsql-output
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [1] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed, fatal:
+ [1] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed, fatal:
+ [0] object already persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed, fatal:
+ [1] object already persistent
+
+ multiple exceptions, 3 elements attempted, 1 failed:
+ [2] object already persistent
+
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 5 elements attempted, 5 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+
+ multiple exceptions, 6 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+ [5] object not persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [1] object not persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 7 elements attempted, 4 failed:
+ [0] object not persistent
+ [2] object not persistent
+ [4] object not persistent
+ [6] object not persistent
+
+ multiple exceptions, 7 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [6] object not persistent
+
+ multiple exceptions, 3 elements attempted, 1 failed:
+ [2] object not persistent
+
+ multiple exceptions, 1 element attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 2 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 3 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 4 elements attempted, 4 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 5 elements attempted, 5 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+
+ multiple exceptions, 6 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+ [4] object not persistent
+ [5] object not persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [1] object not persistent
+
+ multiple exceptions, 2 elements attempted, 1 failed:
+ [0] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 3 elements attempted, 2 failed:
+ [0] object not persistent
+ [1] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [1] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [2] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [3] object not persistent
+
+ multiple exceptions, 4 elements attempted, 3 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+
+ multiple exceptions, 8 elements attempted, 4 failed:
+ [1] object not persistent
+ [3] object not persistent
+ [5] object not persistent
+ [7] object not persistent
+
+ multiple exceptions, 10 elements attempted, 6 failed:
+ [0] object not persistent
+ [1] object not persistent
+ [2] object not persistent
+ [6] object not persistent
+ [7] object not persistent
+ [8] object not persistent
+
+ multiple exceptions, 3 elements attempted, 1 failed:
+ [2] object not persistent
+
+ multiple exceptions, 4 elements attempted, 2 failed:
+ [1] object changed concurrently
+ [3] object changed concurrently
+
+ multiple exceptions, 4 elements attempted, 2 failed:
+ [1] object changed concurrently
+ [3] object changed concurrently
+
+ EOI
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if ($pgsql && $pgsql_bulk)
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+
+ # Query the PostgreSQL server version and only run the test if it is 7.4 or
+ # above.
+ #
+ $pgsql_client_cmd --tuples-only -c 'SELECT VERSION()' | \
+ sed -n -e 's/.*PostgreSQL (\d+\.\d+).*/\1/p' | \
+ set version [string];
+
+ if ("$version" == "")
+ exit "unable to obtain PostgreSQL server version"
+ end;
+
+ sed -n -e 's/(.+)\..+/\1/p' <"$version" | set major_version [uint64];
+ sed -n -e 's/.+\.(.+)/\1/p' <"$version" | set minor_version [uint64];
+
+ if (($major_version == 7 && minor_version >= 4) || $major_version > 7)
+ if $multi
+ $* # Noop.
+ else
+ $* >>>../pgsql-output
+ end
+ end
+}
diff --git a/odb-tests/common/callback/buildfile b/odb-tests/common/callback/buildfile
new file mode 100644
index 0000000..2ecc3b8
--- /dev/null
+++ b/odb-tests/common/callback/buildfile
@@ -0,0 +1,41 @@
+# file : common/callback/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix callback_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/callback/driver.cxx b/odb-tests/common/callback/driver.cxx
new file mode 100644
index 0000000..80513c6
--- /dev/null
+++ b/odb-tests/common/callback/driver.cxx
@@ -0,0 +1,184 @@
+// file : common/callback/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test database operation callbacks.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+const char* events[] =
+{
+ "pre_persist",
+ "post_persist",
+ "pre_load",
+ "post_load",
+ "pre_update",
+ "post_update",
+ "pre_erase",
+ "post_erase"
+};
+
+void object::
+db_callback (callback_event e, database& db)
+{
+ cout << " " << events[e] << " " << id_ << endl;
+
+ // Test custom recursive loading.
+ //
+ if (e == callback_event::post_load && ref != 0)
+ {
+ robj = db.load<object> (ref);
+ cout << " " << id_ << ' ' << ref << ' ' << robj->id_ << endl;
+ }
+}
+
+void object::
+db_callback (callback_event e, database&) const
+{
+ cout << " " << events[e] << " " << id_ << " const" << endl;
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Persist.
+ //
+ cout << "persist" << endl;
+ {
+ object o1 (1, 1);
+ object const o2 (2, 2);
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (&o2);
+ t.commit ();
+ }
+ cout << "***" << endl;
+
+ // Load.
+ //
+ cout << "load" << endl;
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ object o2;
+ db->load<object> (2, o2);
+ t.commit ();
+ }
+ cout << "***" << endl;
+
+ // Query.
+ //
+ cout << "query" << endl;
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object> ((query::id < 3) + "ORDER BY" + query::id));
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ if (i->id_ > 3) // Load.
+ break;
+ }
+
+ t.commit ();
+ }
+ cout << "***" << endl;
+
+ // Update.
+ //
+ cout << "update" << endl;
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ unique_ptr<object> o2 (db->load<object> (2));
+ o1->data++;
+ o2->data++;
+ db->update (o1.get ());
+ db->update (static_cast<const object&> (*o2));
+ t.commit ();
+ }
+ cout << "***" << endl;
+
+ // Erase.
+ //
+ cout << "erase" << endl;
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ unique_ptr<object> o2 (db->load<object> (2));
+ db->erase (static_cast<const object*> (o1.get ()));
+ db->erase (*o2);
+ t.commit ();
+ }
+ cout << "***" << endl;
+
+ // Delayed (recursive) load.
+ //
+ cout << "delayed load" << endl;
+ {
+ {
+ object o1 (1, 1);
+ object o2 (2, 2);
+ object o3 (3, 3);
+ object o4 (4, 4);
+
+ o1.pobj = &o2;
+ o1.ref = 4;
+
+ o2.pobj = &o3;
+ o2.ref = 4;
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ object* o2 (o1->pobj);
+
+ cout << o1->id_ << ' ' << o1->ref << ' ' << o1->robj->id_ << endl;
+ cout << o2->id_ << ' ' << o2->ref << ' ' << o2->robj->id_ << endl;
+
+ delete o1->robj;
+ delete o2->robj;
+
+ delete o2->pobj;
+ delete o2;
+ t.commit ();
+ }
+ }
+ cout << "***" << endl;
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/callback/test.hxx b/odb-tests/common/callback/test.hxx
new file mode 100644
index 0000000..bd30907
--- /dev/null
+++ b/odb-tests/common/callback/test.hxx
@@ -0,0 +1,43 @@
+// file : common/callback/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+#include <odb/callback.hxx>
+
+#pragma db object callback(db_callback)
+struct object
+{
+ object (unsigned long id, unsigned long d)
+ : id_ (id), data (d), pobj (0), robj (0), ref (0)
+ {
+ }
+
+ object ()
+ : id_ (0), pobj (0), robj (0)
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ unsigned long data;
+
+ object* pobj;
+
+ // Test custom recursive loading.
+ //
+ #pragma db transient
+ object* robj;
+ unsigned long ref; // Unless 0, reference to another object.
+
+ void
+ db_callback (odb::callback_event, odb::database&);
+
+ void
+ db_callback (odb::callback_event, odb::database&) const;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/callback/testscript b/odb-tests/common/callback/testscript
new file mode 100644
index 0000000..c7d03ee
--- /dev/null
+++ b/odb-tests/common/callback/testscript
@@ -0,0 +1,100 @@
+# file : common/callback/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
++cat <<EOI >=output
+ persist
+ pre_persist 1 const
+ post_persist 1 const
+ pre_persist 2 const
+ post_persist 2 const
+ ***
+ load
+ pre_load 0
+ post_load 1
+ pre_load 0
+ post_load 2
+ ***
+ query
+ pre_load 0
+ post_load 1
+ pre_load 0
+ post_load 2
+ ***
+ update
+ pre_load 0
+ post_load 1
+ pre_load 0
+ post_load 2
+ pre_update 1 const
+ post_update 1 const
+ pre_update 2 const
+ post_update 2 const
+ ***
+ erase
+ pre_load 0
+ post_load 1
+ pre_load 0
+ post_load 2
+ pre_erase 1 const
+ post_erase 1 const
+ pre_erase 2 const
+ post_erase 2 const
+ ***
+ delayed load
+ pre_persist 1 const
+ post_persist 1 const
+ pre_persist 2 const
+ post_persist 2 const
+ pre_persist 3 const
+ post_persist 3 const
+ pre_persist 4 const
+ post_persist 4 const
+ pre_load 0
+ pre_load 0
+ pre_load 0
+ post_load 3
+ post_load 2
+ pre_load 0
+ post_load 4
+ 2 4 4
+ post_load 1
+ pre_load 0
+ post_load 4
+ 1 4 4
+ 1 4 4
+ 2 4 4
+ ***
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/changelog/.gitignore b/odb-tests/common/changelog/.gitignore
new file mode 100644
index 0000000..5352a2b
--- /dev/null
+++ b/odb-tests/common/changelog/.gitignore
@@ -0,0 +1,3 @@
+# Generate ODB options file.
+#
+odb.options
diff --git a/odb-tests/common/changelog/add-column-mssql-diff.xml b/odb-tests/common/changelog/add-column-mssql-diff.xml
new file mode 100644
index 0000000..4f9ba09
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-mssql-diff.xml
@@ -0,0 +1,16 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="num" type="INT" null="false"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-mssql-patch.xml b/odb-tests/common/changelog/add-column-mssql-patch.xml
new file mode 100644
index 0000000..4f396d9
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-mssql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-mysql-diff.xml b/odb-tests/common/changelog/add-column-mysql-diff.xml
new file mode 100644
index 0000000..992306d
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-mysql-diff.xml
@@ -0,0 +1,16 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="num" type="INT" null="false"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-mysql-patch.xml b/odb-tests/common/changelog/add-column-mysql-patch.xml
new file mode 100644
index 0000000..14f3f01
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-mysql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-oracle-diff.xml b/odb-tests/common/changelog/add-column-oracle-diff.xml
new file mode 100644
index 0000000..fa1dac6
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-oracle-diff.xml
@@ -0,0 +1,16 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="num" type="NUMBER(10)" null="false"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-oracle-patch.xml b/odb-tests/common/changelog/add-column-oracle-patch.xml
new file mode 100644
index 0000000..38fb8d6
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-oracle-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-pgsql-diff.xml b/odb-tests/common/changelog/add-column-pgsql-diff.xml
new file mode 100644
index 0000000..9524d9d
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-pgsql-diff.xml
@@ -0,0 +1,16 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="num" type="INTEGER" null="false"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-pgsql-patch.xml b/odb-tests/common/changelog/add-column-pgsql-patch.xml
new file mode 100644
index 0000000..7f7d9a0
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-pgsql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-sqlite-diff.xml b/odb-tests/common/changelog/add-column-sqlite-diff.xml
new file mode 100644
index 0000000..b59cc72
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-sqlite-diff.xml
@@ -0,0 +1,16 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="num" type="INTEGER" null="false"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column-sqlite-patch.xml b/odb-tests/common/changelog/add-column-sqlite-patch.xml
new file mode 100644
index 0000000..fbe4428
--- /dev/null
+++ b/odb-tests/common/changelog/add-column-sqlite-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-column.hxx b/odb-tests/common/changelog/add-column.hxx
new file mode 100644
index 0000000..54eab42
--- /dev/null
+++ b/odb-tests/common/changelog/add-column.hxx
@@ -0,0 +1,20 @@
+// file : common/changelog/add-column.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ADD_COLUMN_HXX
+#define ADD_COLUMN_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER > 1
+ int num;
+#endif
+};
+
+#endif // ADD_COLUMN_HXX
diff --git a/odb-tests/common/changelog/add-foreign-key-diff.xml b/odb-tests/common/changelog/add-foreign-key-diff.xml
new file mode 100644
index 0000000..d4f29ad
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="INTEGER" null="true"/>
+ <add-foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-mssql-diff.xml b/odb-tests/common/changelog/add-foreign-key-mssql-diff.xml
new file mode 100644
index 0000000..76ebce3
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-mssql-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="INT" null="true"/>
+ <add-foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-mssql-patch.xml b/odb-tests/common/changelog/add-foreign-key-mssql-patch.xml
new file mode 100644
index 0000000..6d75709
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-mssql-patch.xml
@@ -0,0 +1,25 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-mysql-diff.xml b/odb-tests/common/changelog/add-foreign-key-mysql-diff.xml
new file mode 100644
index 0000000..acdfd5b
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-mysql-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="INT" null="true"/>
+ <add-foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-mysql-patch.xml b/odb-tests/common/changelog/add-foreign-key-mysql-patch.xml
new file mode 100644
index 0000000..adc9081
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-mysql-patch.xml
@@ -0,0 +1,25 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-oracle-diff.xml b/odb-tests/common/changelog/add-foreign-key-oracle-diff.xml
new file mode 100644
index 0000000..6bd8bc3
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-oracle-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="NUMBER(10)" null="true"/>
+ <add-foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-oracle-patch.xml b/odb-tests/common/changelog/add-foreign-key-oracle-patch.xml
new file mode 100644
index 0000000..7aa01ea
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-oracle-patch.xml
@@ -0,0 +1,25 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="o1" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-pgsql-diff.xml b/odb-tests/common/changelog/add-foreign-key-pgsql-diff.xml
new file mode 100644
index 0000000..793b009
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-pgsql-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="INTEGER" null="true"/>
+ <add-foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-pgsql-patch.xml b/odb-tests/common/changelog/add-foreign-key-pgsql-patch.xml
new file mode 100644
index 0000000..a256831
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-pgsql-patch.xml
@@ -0,0 +1,25 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-sqlite-diff.xml b/odb-tests/common/changelog/add-foreign-key-sqlite-diff.xml
new file mode 100644
index 0000000..1510470
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-sqlite-diff.xml
@@ -0,0 +1,28 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="o1" type="INTEGER" null="true"/>
+ <add-foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </add-foreign-key>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key-sqlite-patch.xml b/odb-tests/common/changelog/add-foreign-key-sqlite-patch.xml
new file mode 100644
index 0000000..1c2d0ea
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key-sqlite-patch.xml
@@ -0,0 +1,25 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-foreign-key.hxx b/odb-tests/common/changelog/add-foreign-key.hxx
new file mode 100644
index 0000000..2a43eea
--- /dev/null
+++ b/odb-tests/common/changelog/add-foreign-key.hxx
@@ -0,0 +1,29 @@
+// file : common/changelog/add-foreign-key.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ADD_FOREIGN_KEY_HXX
+#define ADD_FOREIGN_KEY_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+struct object1;
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER > 1
+ object1* o1;
+#endif
+};
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ int id;
+};
+
+#endif // ADD_FOREIGN_KEY_HXX
diff --git a/odb-tests/common/changelog/add-index-mssql-diff.xml b/odb-tests/common/changelog/add-index-mssql-diff.xml
new file mode 100644
index 0000000..58c623f
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-mssql-diff.xml
@@ -0,0 +1,21 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="y" type="INT" null="false"/>
+ <add-index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </add-index>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="x" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-mssql-patch.xml b/odb-tests/common/changelog/add-index-mssql-patch.xml
new file mode 100644
index 0000000..2b10e65
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-mssql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="x" type="INT" null="false"/>
+ <column name="y" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-mysql-diff.xml b/odb-tests/common/changelog/add-index-mysql-diff.xml
new file mode 100644
index 0000000..a54a7e3
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-mysql-diff.xml
@@ -0,0 +1,21 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="y" type="INT" null="false"/>
+ <add-index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </add-index>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="x" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-mysql-patch.xml b/odb-tests/common/changelog/add-index-mysql-patch.xml
new file mode 100644
index 0000000..a2454b8
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-mysql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="x" type="INT" null="false"/>
+ <column name="y" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-oracle-diff.xml b/odb-tests/common/changelog/add-index-oracle-diff.xml
new file mode 100644
index 0000000..80f8ecc
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-oracle-diff.xml
@@ -0,0 +1,21 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="y" type="NUMBER(10)" null="false"/>
+ <add-index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </add-index>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="x" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-oracle-patch.xml b/odb-tests/common/changelog/add-index-oracle-patch.xml
new file mode 100644
index 0000000..a9bafea
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-oracle-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="x" type="NUMBER(10)" null="false"/>
+ <column name="y" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-pgsql-diff.xml b/odb-tests/common/changelog/add-index-pgsql-diff.xml
new file mode 100644
index 0000000..3988643
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-pgsql-diff.xml
@@ -0,0 +1,21 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="y" type="INTEGER" null="false"/>
+ <add-index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </add-index>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="x" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-pgsql-patch.xml b/odb-tests/common/changelog/add-index-pgsql-patch.xml
new file mode 100644
index 0000000..e9c564c
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-pgsql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="x" type="INTEGER" null="false"/>
+ <column name="y" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-sqlite-diff.xml b/odb-tests/common/changelog/add-index-sqlite-diff.xml
new file mode 100644
index 0000000..c1f7fdc
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-sqlite-diff.xml
@@ -0,0 +1,21 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <add-column name="y" type="INTEGER" null="false"/>
+ <add-index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </add-index>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="x" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index-sqlite-patch.xml b/odb-tests/common/changelog/add-index-sqlite-patch.xml
new file mode 100644
index 0000000..b9512e0
--- /dev/null
+++ b/odb-tests/common/changelog/add-index-sqlite-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="x" type="INTEGER" null="false"/>
+ <column name="y" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="xy_i" type="UNIQUE">
+ <column name="x"/>
+ <column name="y" options="DESC"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-index.hxx b/odb-tests/common/changelog/add-index.hxx
new file mode 100644
index 0000000..645cee2
--- /dev/null
+++ b/odb-tests/common/changelog/add-index.hxx
@@ -0,0 +1,24 @@
+// file : common/changelog/add-index.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ADD_INDEX_HXX
+#define ADD_INDEX_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+ int x;
+
+#if CVER > 1
+ int y;
+ #pragma db index ("xy_i") unique member(x) member(y, "DESC")
+#endif
+
+};
+
+#endif // ADD_INDEX_HXX
diff --git a/odb-tests/common/changelog/add-table-mssql-diff.xml b/odb-tests/common/changelog/add-table-mssql-diff.xml
new file mode 100644
index 0000000..8bf0e30
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-mssql-diff.xml
@@ -0,0 +1,45 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <add-table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </add-table>
+ <add-table name="object_nums" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-mssql-patch.xml b/odb-tests/common/changelog/add-table-mssql-patch.xml
new file mode 100644
index 0000000..9dd41f3
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-mssql-patch.xml
@@ -0,0 +1,44 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-mysql-diff.xml b/odb-tests/common/changelog/add-table-mysql-diff.xml
new file mode 100644
index 0000000..57f741b
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-mysql-diff.xml
@@ -0,0 +1,45 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <add-table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </add-table>
+ <add-table name="object_nums" options="ENGINE=InnoDB" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT UNSIGNED" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-mysql-patch.xml b/odb-tests/common/changelog/add-table-mysql-patch.xml
new file mode 100644
index 0000000..0db1e9f
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-mysql-patch.xml
@@ -0,0 +1,44 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" options="ENGINE=InnoDB" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT UNSIGNED" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-oracle-diff.xml b/odb-tests/common/changelog/add-table-oracle-diff.xml
new file mode 100644
index 0000000..70ec7c6
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-oracle-diff.xml
@@ -0,0 +1,45 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <add-table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <column name="o1" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </add-table>
+ <add-table name="object_nums" kind="container">
+ <column name="object_id" type="NUMBER(10)" null="false"/>
+ <column name="index" type="NUMBER(20)" null="false"/>
+ <column name="value" type="NUMBER(10)" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-oracle-patch.xml b/odb-tests/common/changelog/add-table-oracle-patch.xml
new file mode 100644
index 0000000..969c2e0
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-oracle-patch.xml
@@ -0,0 +1,44 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <column name="o1" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="NUMBER(10)" null="false"/>
+ <column name="index" type="NUMBER(20)" null="false"/>
+ <column name="value" type="NUMBER(10)" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-pgsql-diff.xml b/odb-tests/common/changelog/add-table-pgsql-diff.xml
new file mode 100644
index 0000000..9b48062
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-pgsql-diff.xml
@@ -0,0 +1,45 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <add-table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </add-table>
+ <add-table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-pgsql-patch.xml b/odb-tests/common/changelog/add-table-pgsql-patch.xml
new file mode 100644
index 0000000..b04a933
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-pgsql-patch.xml
@@ -0,0 +1,44 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-sqlite-diff.xml b/odb-tests/common/changelog/add-table-sqlite-diff.xml
new file mode 100644
index 0000000..573bc69
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-sqlite-diff.xml
@@ -0,0 +1,45 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <add-table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </add-table>
+ <add-table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="INTEGER" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table-sqlite-patch.xml b/odb-tests/common/changelog/add-table-sqlite-patch.xml
new file mode 100644
index 0000000..3506410
--- /dev/null
+++ b/odb-tests/common/changelog/add-table-sqlite-patch.xml
@@ -0,0 +1,44 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="INTEGER" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/add-table.hxx b/odb-tests/common/changelog/add-table.hxx
new file mode 100644
index 0000000..a22e206
--- /dev/null
+++ b/odb-tests/common/changelog/add-table.hxx
@@ -0,0 +1,34 @@
+// file : common/changelog/add-table.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ADD_TABLE_HXX
+#define ADD_TABLE_HXX
+
+#include <vector>
+
+#pragma db model version(BVER, CVER, open)
+
+struct object1;
+
+#if CVER > 1
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+ int num;
+
+ std::vector<int> nums;
+ object1* o1;
+};
+#endif
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ int id;
+ int num;
+};
+
+#endif // ADD_TABLE_HXX
diff --git a/odb-tests/common/changelog/alter-column-mssql-diff.xml b/odb-tests/common/changelog/alter-column-mssql-diff.xml
new file mode 100644
index 0000000..6c1fb6a
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-mssql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <alter-column name="num" null="true"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-mssql-patch.xml b/odb-tests/common/changelog/alter-column-mssql-patch.xml
new file mode 100644
index 0000000..15db347
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-mssql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-mysql-diff.xml b/odb-tests/common/changelog/alter-column-mysql-diff.xml
new file mode 100644
index 0000000..39ad6ef
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-mysql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <alter-column name="num" null="true"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-mysql-patch.xml b/odb-tests/common/changelog/alter-column-mysql-patch.xml
new file mode 100644
index 0000000..0131466
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-mysql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-oracle-diff.xml b/odb-tests/common/changelog/alter-column-oracle-diff.xml
new file mode 100644
index 0000000..d41d333
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-oracle-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <alter-column name="num" null="true"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-oracle-patch.xml b/odb-tests/common/changelog/alter-column-oracle-patch.xml
new file mode 100644
index 0000000..0e0794d
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-oracle-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-pgsql-diff.xml b/odb-tests/common/changelog/alter-column-pgsql-diff.xml
new file mode 100644
index 0000000..fd97fa0
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-pgsql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <alter-column name="num" null="true"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-pgsql-patch.xml b/odb-tests/common/changelog/alter-column-pgsql-patch.xml
new file mode 100644
index 0000000..dade1a3
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-pgsql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-sqlite-diff.xml b/odb-tests/common/changelog/alter-column-sqlite-diff.xml
new file mode 100644
index 0000000..7ecea06
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-sqlite-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <alter-column name="num" null="true"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column-sqlite-patch.xml b/odb-tests/common/changelog/alter-column-sqlite-patch.xml
new file mode 100644
index 0000000..de2762e
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column-sqlite-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/alter-column.hxx b/odb-tests/common/changelog/alter-column.hxx
new file mode 100644
index 0000000..02f091d
--- /dev/null
+++ b/odb-tests/common/changelog/alter-column.hxx
@@ -0,0 +1,21 @@
+// file : common/changelog/alter-column.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ALTER_COLUMN_HXX
+#define ALTER_COLUMN_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER > 1
+ #pragma db null
+#endif
+ int num;
+};
+
+#endif // ALTER_COLUMN_HXX
diff --git a/odb-tests/common/changelog/buildfile b/odb-tests/common/changelog/buildfile
new file mode 100644
index 0000000..04e0685
--- /dev/null
+++ b/odb-tests/common/changelog/buildfile
@@ -0,0 +1,30 @@
+# file : common/changelog/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+./: file{odb.options} xml{*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the below ad hoc recipe.
+#
+libue{test-meta}: $libodb
+
+file{odb.options}: libue{test-meta}
+{{
+ pops = $cxx.lib_poptions($<[0])
+ depdb hash $pops
+
+ f = $path($>[0])
+ rm -f $f
+
+ for o: $pops
+ echo $o >+$f
+ end
+}}
+
+# Testscript's run-time prerequisites.
+#
+testscript@./: test = $odb
+
+./: $odb: clean = false
diff --git a/odb-tests/common/changelog/drop-column-mssql-diff.xml b/odb-tests/common/changelog/drop-column-mssql-diff.xml
new file mode 100644
index 0000000..f2bab96
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-mssql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-column name="num"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-mssql-patch.xml b/odb-tests/common/changelog/drop-column-mssql-patch.xml
new file mode 100644
index 0000000..32402a3
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-mssql-patch.xml
@@ -0,0 +1,12 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-mysql-diff.xml b/odb-tests/common/changelog/drop-column-mysql-diff.xml
new file mode 100644
index 0000000..2bb321d
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-mysql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-column name="num"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-mysql-patch.xml b/odb-tests/common/changelog/drop-column-mysql-patch.xml
new file mode 100644
index 0000000..6572ebe
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-mysql-patch.xml
@@ -0,0 +1,12 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-oracle-diff.xml b/odb-tests/common/changelog/drop-column-oracle-diff.xml
new file mode 100644
index 0000000..e920a12
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-oracle-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-column name="num"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-oracle-patch.xml b/odb-tests/common/changelog/drop-column-oracle-patch.xml
new file mode 100644
index 0000000..b113664
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-oracle-patch.xml
@@ -0,0 +1,12 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-pgsql-diff.xml b/odb-tests/common/changelog/drop-column-pgsql-diff.xml
new file mode 100644
index 0000000..d2e91ba
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-pgsql-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-column name="num"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-pgsql-patch.xml b/odb-tests/common/changelog/drop-column-pgsql-patch.xml
new file mode 100644
index 0000000..06cc73d
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-pgsql-patch.xml
@@ -0,0 +1,12 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-sqlite-diff.xml b/odb-tests/common/changelog/drop-column-sqlite-diff.xml
new file mode 100644
index 0000000..1c9d138
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-sqlite-diff.xml
@@ -0,0 +1,17 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-column name="num"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column-sqlite-patch.xml b/odb-tests/common/changelog/drop-column-sqlite-patch.xml
new file mode 100644
index 0000000..6887530
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column-sqlite-patch.xml
@@ -0,0 +1,12 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-column.hxx b/odb-tests/common/changelog/drop-column.hxx
new file mode 100644
index 0000000..3de237d
--- /dev/null
+++ b/odb-tests/common/changelog/drop-column.hxx
@@ -0,0 +1,20 @@
+// file : common/changelog/drop-column.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef DROP_COLUMN_HXX
+#define DROP_COLUMN_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER == 1
+ int num;
+#endif
+};
+
+#endif // DROP_COLUMN_HXX
diff --git a/odb-tests/common/changelog/drop-foreign-key-mssql-diff.xml b/odb-tests/common/changelog/drop-foreign-key-mssql-diff.xml
new file mode 100644
index 0000000..da3ce73
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-mssql-diff.xml
@@ -0,0 +1,30 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-foreign-key name="object_o1_fk"/>
+ <drop-column name="o1"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-mssql-patch.xml b/odb-tests/common/changelog/drop-foreign-key-mssql-patch.xml
new file mode 100644
index 0000000..cd1a372
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-mssql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-mysql-diff.xml b/odb-tests/common/changelog/drop-foreign-key-mysql-diff.xml
new file mode 100644
index 0000000..aa179f2
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-mysql-diff.xml
@@ -0,0 +1,30 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-foreign-key name="object_o1_fk"/>
+ <drop-column name="o1"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-mysql-patch.xml b/odb-tests/common/changelog/drop-foreign-key-mysql-patch.xml
new file mode 100644
index 0000000..67f026e
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-mysql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-oracle-diff.xml b/odb-tests/common/changelog/drop-foreign-key-oracle-diff.xml
new file mode 100644
index 0000000..aa407d3
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-oracle-diff.xml
@@ -0,0 +1,30 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-foreign-key name="object_o1_fk"/>
+ <drop-column name="o1"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="o1" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-oracle-patch.xml b/odb-tests/common/changelog/drop-foreign-key-oracle-patch.xml
new file mode 100644
index 0000000..56253f0
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-oracle-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-pgsql-diff.xml b/odb-tests/common/changelog/drop-foreign-key-pgsql-diff.xml
new file mode 100644
index 0000000..9a6259a
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-pgsql-diff.xml
@@ -0,0 +1,30 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-foreign-key name="o1_fk"/>
+ <drop-column name="o1"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-pgsql-patch.xml b/odb-tests/common/changelog/drop-foreign-key-pgsql-patch.xml
new file mode 100644
index 0000000..df024b4
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-pgsql-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-sqlite-diff.xml b/odb-tests/common/changelog/drop-foreign-key-sqlite-diff.xml
new file mode 100644
index 0000000..6f9f994
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-sqlite-diff.xml
@@ -0,0 +1,30 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-foreign-key name="o1_fk"/>
+ <drop-column name="o1"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key-sqlite-patch.xml b/odb-tests/common/changelog/drop-foreign-key-sqlite-patch.xml
new file mode 100644
index 0000000..6e63218
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key-sqlite-patch.xml
@@ -0,0 +1,18 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-foreign-key.hxx b/odb-tests/common/changelog/drop-foreign-key.hxx
new file mode 100644
index 0000000..ba3005f
--- /dev/null
+++ b/odb-tests/common/changelog/drop-foreign-key.hxx
@@ -0,0 +1,29 @@
+// file : common/changelog/drop-foreign-key.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef DROP_FOREIGN_KEY_HXX
+#define DROP_FOREIGN_KEY_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+struct object1;
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER == 1
+ object1* o1;
+#endif
+};
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ int id;
+};
+
+#endif // DROP_FOREIGN_KEY_HXX
diff --git a/odb-tests/common/changelog/drop-index-mssql-diff.xml b/odb-tests/common/changelog/drop-index-mssql-diff.xml
new file mode 100644
index 0000000..ac95db5
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-mssql-diff.xml
@@ -0,0 +1,20 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-index name="num_i"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="num_i">
+ <column name="num"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-mssql-patch.xml b/odb-tests/common/changelog/drop-index-mssql-patch.xml
new file mode 100644
index 0000000..4f396d9
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-mssql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-mysql-diff.xml b/odb-tests/common/changelog/drop-index-mysql-diff.xml
new file mode 100644
index 0000000..f8c95ef
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-mysql-diff.xml
@@ -0,0 +1,20 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-index name="num_i"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="num_i">
+ <column name="num"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-mysql-patch.xml b/odb-tests/common/changelog/drop-index-mysql-patch.xml
new file mode 100644
index 0000000..14f3f01
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-mysql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-oracle-diff.xml b/odb-tests/common/changelog/drop-index-oracle-diff.xml
new file mode 100644
index 0000000..d174802
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-oracle-diff.xml
@@ -0,0 +1,20 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-index name="object_num_i"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <index name="object_num_i">
+ <column name="num"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-oracle-patch.xml b/odb-tests/common/changelog/drop-index-oracle-patch.xml
new file mode 100644
index 0000000..38fb8d6
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-oracle-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-pgsql-diff.xml b/odb-tests/common/changelog/drop-index-pgsql-diff.xml
new file mode 100644
index 0000000..375a3d8
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-pgsql-diff.xml
@@ -0,0 +1,20 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-index name="object_num_i"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="object_num_i">
+ <column name="num"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-pgsql-patch.xml b/odb-tests/common/changelog/drop-index-pgsql-patch.xml
new file mode 100644
index 0000000..7f7d9a0
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-pgsql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-sqlite-diff.xml b/odb-tests/common/changelog/drop-index-sqlite-diff.xml
new file mode 100644
index 0000000..bf54f9d
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-sqlite-diff.xml
@@ -0,0 +1,20 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <alter-table name="object">
+ <drop-index name="object_num_i"/>
+ </alter-table>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <index name="object_num_i">
+ <column name="num"/>
+ </index>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index-sqlite-patch.xml b/odb-tests/common/changelog/drop-index-sqlite-patch.xml
new file mode 100644
index 0000000..fbe4428
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index-sqlite-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-index.hxx b/odb-tests/common/changelog/drop-index.hxx
new file mode 100644
index 0000000..08fecba
--- /dev/null
+++ b/odb-tests/common/changelog/drop-index.hxx
@@ -0,0 +1,21 @@
+// file : common/changelog/drop-index.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef DROP_INDEX_HXX
+#define DROP_INDEX_HXX
+
+#pragma db model version(BVER, CVER, open)
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+#if CVER == 1
+ #pragma db index
+#endif
+ int num;
+};
+
+#endif // DROP_INDEX_HXX
diff --git a/odb-tests/common/changelog/drop-table-mssql-diff.xml b/odb-tests/common/changelog/drop-table-mssql-diff.xml
new file mode 100644
index 0000000..399d8bc
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-mssql-diff.xml
@@ -0,0 +1,47 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="2">
+ <drop-table name="object"/>
+ <drop-table name="object_nums"/>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-mssql-patch.xml b/odb-tests/common/changelog/drop-table-mssql-patch.xml
new file mode 100644
index 0000000..c5dda75
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-mssql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-mysql-diff.xml b/odb-tests/common/changelog/drop-table-mysql-diff.xml
new file mode 100644
index 0000000..3ccd553
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-mysql-diff.xml
@@ -0,0 +1,47 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="2">
+ <drop-table name="object"/>
+ <drop-table name="object_nums"/>
+ </changeset>
+
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <column name="o1" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" options="ENGINE=InnoDB" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT UNSIGNED" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-mysql-patch.xml b/odb-tests/common/changelog/drop-table-mysql-patch.xml
new file mode 100644
index 0000000..250bd20
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-mysql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-oracle-diff.xml b/odb-tests/common/changelog/drop-table-oracle-diff.xml
new file mode 100644
index 0000000..589d64b
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-oracle-diff.xml
@@ -0,0 +1,47 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="2">
+ <drop-table name="object"/>
+ <drop-table name="object_nums"/>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <column name="o1" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="NUMBER(10)" null="false"/>
+ <column name="index" type="NUMBER(20)" null="false"/>
+ <column name="value" type="NUMBER(10)" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-oracle-patch.xml b/odb-tests/common/changelog/drop-table-oracle-patch.xml
new file mode 100644
index 0000000..5f222dc
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-oracle-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-pgsql-diff.xml b/odb-tests/common/changelog/drop-table-pgsql-diff.xml
new file mode 100644
index 0000000..168ec46
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-pgsql-diff.xml
@@ -0,0 +1,47 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="2">
+ <drop-table name="object"/>
+ <drop-table name="object_nums"/>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-pgsql-patch.xml b/odb-tests/common/changelog/drop-table-pgsql-patch.xml
new file mode 100644
index 0000000..ebb7000
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-pgsql-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-sqlite-diff.xml b/odb-tests/common/changelog/drop-table-sqlite-diff.xml
new file mode 100644
index 0000000..6a258c4
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-sqlite-diff.xml
@@ -0,0 +1,47 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="2">
+ <drop-table name="object"/>
+ <drop-table name="object_nums"/>
+ </changeset>
+
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <column name="o1" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1"/>
+ <references table="object1">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="INTEGER" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table-sqlite-patch.xml b/odb-tests/common/changelog/drop-table-sqlite-patch.xml
new file mode 100644
index 0000000..45c6f00
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table-sqlite-patch.xml
@@ -0,0 +1,13 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="3"/>
+
+ <model version="2">
+ <table name="object1" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/drop-table.hxx b/odb-tests/common/changelog/drop-table.hxx
new file mode 100644
index 0000000..2919e52
--- /dev/null
+++ b/odb-tests/common/changelog/drop-table.hxx
@@ -0,0 +1,34 @@
+// file : common/changelog/drop-table.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef DROP_TABLE_HXX
+#define DROP_TABLE_HXX
+
+#include <vector>
+
+#pragma db model version(BVER, CVER, open)
+
+struct object1;
+
+#if CVER == 1
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+ int num;
+
+ std::vector<int> nums;
+ object1* o1;
+};
+#endif
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ int id;
+ int num;
+};
+
+#endif // DROP_TABLE_HXX
diff --git a/odb-tests/common/changelog/model-mssql-diff.xml b/odb-tests/common/changelog/model-mssql-diff.xml
new file mode 120000
index 0000000..e1f812d
--- /dev/null
+++ b/odb-tests/common/changelog/model-mssql-diff.xml
@@ -0,0 +1 @@
+model-mssql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-mssql-patch.xml b/odb-tests/common/changelog/model-mssql-patch.xml
new file mode 120000
index 0000000..e1f812d
--- /dev/null
+++ b/odb-tests/common/changelog/model-mssql-patch.xml
@@ -0,0 +1 @@
+model-mssql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-mssql.xml b/odb-tests/common/changelog/model-mssql.xml
new file mode 100644
index 0000000..509a210
--- /dev/null
+++ b/odb-tests/common/changelog/model-mssql.xml
@@ -0,0 +1,56 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mssql" version="1">
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="true" default="0" options="DUMMY=1"/>
+ <column name="v_x" type="INT" null="false"/>
+ <column name="v_y" type="INT" null="false"/>
+ <column name="o1_x" type="INT" null="true"/>
+ <column name="o1_y" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1_x"/>
+ <column name="o1_y"/>
+ <references table="object1">
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </references>
+ </foreign-key>
+ <index name="num_i" type="UNIQUE" method="BTREE" options="DUMMY=1">
+ <column name="num" options="DESC"/>
+ </index>
+ <index name="v_i">
+ <column name="v_x"/>
+ <column name="v_y"/>
+ </index>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id_x" type="INT" null="false"/>
+ <column name="id_y" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/model-mysql-diff.xml b/odb-tests/common/changelog/model-mysql-diff.xml
new file mode 120000
index 0000000..9100280
--- /dev/null
+++ b/odb-tests/common/changelog/model-mysql-diff.xml
@@ -0,0 +1 @@
+model-mysql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-mysql-patch.xml b/odb-tests/common/changelog/model-mysql-patch.xml
new file mode 120000
index 0000000..9100280
--- /dev/null
+++ b/odb-tests/common/changelog/model-mysql-patch.xml
@@ -0,0 +1 @@
+model-mysql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-mysql.xml b/odb-tests/common/changelog/model-mysql.xml
new file mode 100644
index 0000000..ffbcf8d
--- /dev/null
+++ b/odb-tests/common/changelog/model-mysql.xml
@@ -0,0 +1,56 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
+ <model version="1">
+ <table name="object" options="ENGINE=InnoDB" kind="object">
+ <column name="id" type="INT" null="false"/>
+ <column name="num" type="INT" null="true" default="0" options="DUMMY=1"/>
+ <column name="v_x" type="INT" null="false"/>
+ <column name="v_y" type="INT" null="false"/>
+ <column name="o1_x" type="INT" null="true"/>
+ <column name="o1_y" type="INT" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1_x"/>
+ <column name="o1_y"/>
+ <references table="object1">
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </references>
+ </foreign-key>
+ <index name="num_i" type="UNIQUE" method="BTREE" options="DUMMY=1">
+ <column name="num" options="DESC"/>
+ </index>
+ <index name="v_i">
+ <column name="v_x"/>
+ <column name="v_y"/>
+ </index>
+ </table>
+ <table name="object_nums" options="ENGINE=InnoDB" kind="container">
+ <column name="object_id" type="INT" null="false"/>
+ <column name="index" type="BIGINT UNSIGNED" null="false"/>
+ <column name="value" type="INT" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" options="ENGINE=InnoDB" kind="object">
+ <column name="id_x" type="INT" null="false"/>
+ <column name="id_y" type="INT" null="false"/>
+ <column name="num" type="INT" null="false"/>
+ <primary-key>
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/model-oracle-diff.xml b/odb-tests/common/changelog/model-oracle-diff.xml
new file mode 120000
index 0000000..36e4479
--- /dev/null
+++ b/odb-tests/common/changelog/model-oracle-diff.xml
@@ -0,0 +1 @@
+model-oracle.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-oracle-patch.xml b/odb-tests/common/changelog/model-oracle-patch.xml
new file mode 120000
index 0000000..36e4479
--- /dev/null
+++ b/odb-tests/common/changelog/model-oracle-patch.xml
@@ -0,0 +1 @@
+model-oracle.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-oracle.xml b/odb-tests/common/changelog/model-oracle.xml
new file mode 100644
index 0000000..1824690
--- /dev/null
+++ b/odb-tests/common/changelog/model-oracle.xml
@@ -0,0 +1,56 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="oracle" version="1">
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="true" default="0" options="DUMMY=1"/>
+ <column name="v_x" type="NUMBER(10)" null="false"/>
+ <column name="v_y" type="NUMBER(10)" null="false"/>
+ <column name="o1_x" type="NUMBER(10)" null="true"/>
+ <column name="o1_y" type="NUMBER(10)" null="true"/>
+ <primary-key auto="true" sequence="object_seq">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="object_o1_fk" deferrable="DEFERRED">
+ <column name="o1_x"/>
+ <column name="o1_y"/>
+ <references table="object1">
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </references>
+ </foreign-key>
+ <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1">
+ <column name="num" options="DESC"/>
+ </index>
+ <index name="object_v_i">
+ <column name="v_x"/>
+ <column name="v_y"/>
+ </index>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="NUMBER(10)" null="false"/>
+ <column name="index" type="NUMBER(20)" null="false"/>
+ <column name="value" type="NUMBER(10)" null="false"/>
+ <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id_x" type="NUMBER(10)" null="false"/>
+ <column name="id_y" type="NUMBER(10)" null="false"/>
+ <column name="num" type="NUMBER(10)" null="false"/>
+ <primary-key>
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/model-pgsql-diff.xml b/odb-tests/common/changelog/model-pgsql-diff.xml
new file mode 120000
index 0000000..b39ce26
--- /dev/null
+++ b/odb-tests/common/changelog/model-pgsql-diff.xml
@@ -0,0 +1 @@
+model-pgsql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-pgsql-patch.xml b/odb-tests/common/changelog/model-pgsql-patch.xml
new file mode 120000
index 0000000..b39ce26
--- /dev/null
+++ b/odb-tests/common/changelog/model-pgsql-patch.xml
@@ -0,0 +1 @@
+model-pgsql.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-pgsql.xml b/odb-tests/common/changelog/model-pgsql.xml
new file mode 100644
index 0000000..13aee6b
--- /dev/null
+++ b/odb-tests/common/changelog/model-pgsql.xml
@@ -0,0 +1,56 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="true" default="0" options="DUMMY=1"/>
+ <column name="v_x" type="INTEGER" null="false"/>
+ <column name="v_y" type="INTEGER" null="false"/>
+ <column name="o1_x" type="INTEGER" null="true"/>
+ <column name="o1_y" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1_x"/>
+ <column name="o1_y"/>
+ <references table="object1">
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </references>
+ </foreign-key>
+ <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1">
+ <column name="num" options="DESC"/>
+ </index>
+ <index name="object_v_i">
+ <column name="v_x"/>
+ <column name="v_y"/>
+ </index>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id_x" type="INTEGER" null="false"/>
+ <column name="id_y" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/model-sqlite-diff.xml b/odb-tests/common/changelog/model-sqlite-diff.xml
new file mode 120000
index 0000000..3454f51
--- /dev/null
+++ b/odb-tests/common/changelog/model-sqlite-diff.xml
@@ -0,0 +1 @@
+model-sqlite.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-sqlite-patch.xml b/odb-tests/common/changelog/model-sqlite-patch.xml
new file mode 120000
index 0000000..3454f51
--- /dev/null
+++ b/odb-tests/common/changelog/model-sqlite-patch.xml
@@ -0,0 +1 @@
+model-sqlite.xml \ No newline at end of file
diff --git a/odb-tests/common/changelog/model-sqlite.xml b/odb-tests/common/changelog/model-sqlite.xml
new file mode 100644
index 0000000..d0199ed
--- /dev/null
+++ b/odb-tests/common/changelog/model-sqlite.xml
@@ -0,0 +1,56 @@
+<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <model version="1">
+ <table name="object" kind="object">
+ <column name="id" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="true" default="0" options="DUMMY=1"/>
+ <column name="v_x" type="INTEGER" null="false"/>
+ <column name="v_y" type="INTEGER" null="false"/>
+ <column name="o1_x" type="INTEGER" null="true"/>
+ <column name="o1_y" type="INTEGER" null="true"/>
+ <primary-key auto="true">
+ <column name="id"/>
+ </primary-key>
+ <foreign-key name="o1_fk" deferrable="DEFERRED">
+ <column name="o1_x"/>
+ <column name="o1_y"/>
+ <references table="object1">
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </references>
+ </foreign-key>
+ <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1">
+ <column name="num" options="DESC"/>
+ </index>
+ <index name="object_v_i">
+ <column name="v_x"/>
+ <column name="v_y"/>
+ </index>
+ </table>
+ <table name="object_nums" kind="container">
+ <column name="object_id" type="INTEGER" null="false"/>
+ <column name="index" type="INTEGER" null="false"/>
+ <column name="value" type="INTEGER" null="false"/>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="object_id"/>
+ <references table="object">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <index name="object_nums_object_id_i">
+ <column name="object_id"/>
+ </index>
+ <index name="object_nums_index_i">
+ <column name="index"/>
+ </index>
+ </table>
+ <table name="object1" kind="object">
+ <column name="id_x" type="INTEGER" null="false"/>
+ <column name="id_y" type="INTEGER" null="false"/>
+ <column name="num" type="INTEGER" null="false"/>
+ <primary-key>
+ <column name="id_x"/>
+ <column name="id_y"/>
+ </primary-key>
+ </table>
+ </model>
+</changelog>
diff --git a/odb-tests/common/changelog/model.hxx b/odb-tests/common/changelog/model.hxx
new file mode 100644
index 0000000..aa8891a
--- /dev/null
+++ b/odb-tests/common/changelog/model.hxx
@@ -0,0 +1,46 @@
+// file : common/changelog/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_HXX
+#define MODEL_HXX
+
+#include <vector>
+
+#pragma db model version(1, 1, open)
+
+#pragma db value
+struct value
+{
+ int x;
+ int y;
+};
+
+struct object1;
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ int id;
+
+ #pragma db null default(0) options("DUMMY=1")
+ int num;
+
+ #pragma db index unique member(num, "DESC") method("BTREE") options("DUMMY=1")
+
+ #pragma db index
+ value v; // Multi-column.
+
+ std::vector<int> nums;
+ object1* o1;
+};
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ value id; // Multi-column.
+ int num;
+};
+
+#endif // MODEL_HXX
diff --git a/odb-tests/common/changelog/testscript b/odb-tests/common/changelog/testscript
new file mode 100644
index 0000000..9368938
--- /dev/null
+++ b/odb-tests/common/changelog/testscript
@@ -0,0 +1,66 @@
+# file : common/changelog/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+headers = [paths] $path_search($src_base/*.hxx)
+
+odb_options = --generate-schema-only \
+ --schema-format sql \
+ --suppress-migration \
+ --options-file $out_base/odb.options
+
+: mysql
+:
+if $mysql
+{
+ odb_options += --database 'mysql' --changelog-dir $~
+
+ for h: $headers
+ n = $base($leaf($h))
+
+ $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql
+
+ $* $odb_options -DBVER=1 -DCVER=2 $h
+ diff $src_base/$n-mysql-diff.xml $(n).xml
+
+ $* $odb_options -DBVER=2 -DCVER=3 $h
+ diff $src_base/$n-mysql-patch.xml $(n).xml
+ end
+}
+
+: sqlite
+:
+if $sqlite
+{
+ odb_options += --database 'sqlite' --changelog-dir $~
+
+ for h: $headers
+ n = $base($leaf($h))
+
+ $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql
+
+ $* $odb_options -DBVER=1 -DCVER=2 $h
+ diff $src_base/$n-sqlite-diff.xml $(n).xml
+
+ $* $odb_options -DBVER=2 -DCVER=3 $h
+ diff $src_base/$n-sqlite-patch.xml $(n).xml
+ end
+}
+
+: pgsql
+:
+if $pgsql
+{
+ odb_options += --database 'pgsql' --changelog-dir $~
+
+ for h: $headers
+ n = $base($leaf($h))
+
+ $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql
+
+ $* $odb_options -DBVER=1 -DCVER=2 $h
+ diff $src_base/$n-pgsql-diff.xml $(n).xml
+
+ $* $odb_options -DBVER=2 -DCVER=3 $h
+ diff $src_base/$n-pgsql-patch.xml $(n).xml
+ end
+}
diff --git a/odb-tests/common/circular/multiple/.gitignore b/odb-tests/common/circular/multiple/.gitignore
new file mode 100644
index 0000000..5d39d39
--- /dev/null
+++ b/odb-tests/common/circular/multiple/.gitignore
@@ -0,0 +1,6 @@
+# ODB-generated files.
+#
+test1-odb.?xx
+test1-odb-*.?xx
+test2-odb.?xx
+test2-odb-*.?xx
diff --git a/odb-tests/common/circular/multiple/buildfile b/odb-tests/common/circular/multiple/buildfile
new file mode 100644
index 0000000..b060cb5
--- /dev/null
+++ b/odb-tests/common/circular/multiple/buildfile
@@ -0,0 +1,49 @@
+# file : common/circular/multiple/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = test1 test2
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix circular_m_ \
+ --generate-schema \
+ --generate-query \
+ --schema-format embedded
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/circular/multiple/driver.cxx b/odb-tests/common/circular/multiple/driver.cxx
new file mode 100644
index 0000000..4887ac2
--- /dev/null
+++ b/odb-tests/common/circular/multiple/driver.cxx
@@ -0,0 +1,69 @@
+// file : common/circular/multiple/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test cases of circular dependencies between persistent classes, multiple
+// files version.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/connection.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test1.hxx"
+#include "test2.hxx"
+
+#include "test2-odb.hxx"
+#include "test1-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv, false));
+
+ // Create the database schema.
+ //
+ {
+ connection_ptr c (db->connection ());
+
+ // Temporarily disable foreign key constraints for MySQL and SQLite.
+ // For these databases this is the only way to drop circularly-
+ // dependant tables.
+ //
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
+
+ transaction t (c->begin ());
+ schema_catalog::create_schema (*db);
+ t.commit ();
+
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
+ }
+
+ query<base> bq (query<base>::d->id != 0);
+ query<derived> dq (query<derived>::b->id != 0);
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/circular/multiple/test1.hxx b/odb-tests/common/circular/multiple/test1.hxx
new file mode 100644
index 0000000..36df963
--- /dev/null
+++ b/odb-tests/common/circular/multiple/test1.hxx
@@ -0,0 +1,27 @@
+// file : common/circular/multiple/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct derived;
+
+#pragma db object polymorphic
+struct base
+{
+ virtual ~base () {}
+
+ #pragma db id
+ unsigned long id_;
+
+ derived* d_;
+};
+
+#ifdef ODB_COMPILER
+# include "test2.hxx"
+#endif
+
+#endif // TEST1_HXX
diff --git a/odb-tests/common/circular/multiple/test2.hxx b/odb-tests/common/circular/multiple/test2.hxx
new file mode 100644
index 0000000..49e9ed2
--- /dev/null
+++ b/odb-tests/common/circular/multiple/test2.hxx
@@ -0,0 +1,17 @@
+// file : common/circular/multiple/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#include <odb/core.hxx>
+
+#include "test1.hxx"
+
+#pragma db object
+struct derived: base
+{
+ base* b_;
+};
+
+#endif // TEST2_HXX
diff --git a/odb-tests/common/circular/multiple/testscript b/odb-tests/common/circular/multiple/testscript
new file mode 100644
index 0000000..6a05dc6
--- /dev/null
+++ b/odb-tests/common/circular/multiple/testscript
@@ -0,0 +1,31 @@
+# file : common/circular/multiple/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/circular/single/buildfile b/odb-tests/common/circular/single/buildfile
new file mode 100644
index 0000000..740ce91
--- /dev/null
+++ b/odb-tests/common/circular/single/buildfile
@@ -0,0 +1,41 @@
+# file : common/circular/single/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix circular_s_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/circular/single/driver.cxx b/odb-tests/common/circular/single/driver.cxx
new file mode 100644
index 0000000..9bcb135
--- /dev/null
+++ b/odb-tests/common/circular/single/driver.cxx
@@ -0,0 +1,40 @@
+// file : common/circular/single/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test cases of circular dependencies between persistent classes, single
+// file version.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ query<base> bq (query<base>::d->id != 0);
+ query<derived> dq (query<derived>::b->id != 0);
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/circular/single/test.hxx b/odb-tests/common/circular/single/test.hxx
new file mode 100644
index 0000000..7f95dea
--- /dev/null
+++ b/odb-tests/common/circular/single/test.hxx
@@ -0,0 +1,28 @@
+// file : common/circular/single/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+struct derived;
+
+#pragma db object polymorphic
+struct base
+{
+ virtual ~base () {}
+
+ #pragma db id
+ unsigned long id_;
+
+ derived* d_;
+};
+
+#pragma db object
+struct derived: base
+{
+ base* b_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/circular/single/testscript b/odb-tests/common/circular/single/testscript
new file mode 100644
index 0000000..b870306
--- /dev/null
+++ b/odb-tests/common/circular/single/testscript
@@ -0,0 +1,33 @@
+# file : common/circular/single/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/composite/buildfile b/odb-tests/common/composite/buildfile
new file mode 100644
index 0000000..0a60638
--- /dev/null
+++ b/odb-tests/common/composite/buildfile
@@ -0,0 +1,41 @@
+# file : common/composite/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_comp_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/composite/driver.cxx b/odb-tests/common/composite/driver.cxx
new file mode 100644
index 0000000..06b24b2
--- /dev/null
+++ b/odb-tests/common/composite/driver.cxx
@@ -0,0 +1,229 @@
+// file : common/composite/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test composite value types.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+#undef NDEBUG
+#include <cassert>
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic composite functionality.
+ //
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ using namespace test1;
+
+ person p (1);
+ p.name_.first = "Joe";
+ p.name_.last = "Dirt";
+ p.name_.title = "Mr";
+ p.name_.alias.first = "Anthony";
+ p.name_.alias.last = "Clean";
+ p.name_.nick = "Squeaky";
+ p.name_.flags.nick = true;
+ p.name_.flags.alias = false;
+ p.age_ = 32;
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (p);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<person> p1 (db->load<person> (1));
+ t.commit ();
+
+ assert (p == *p1);
+ }
+
+ p.name_.title = "Mrs";
+ p.name_.alias.first = "Anthonia";
+ p.name_.flags.nick = false;
+ p.name_.flags.alias = true;
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (p);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<person> p1 (db->load<person> (1));
+ t.commit ();
+
+ assert (p == *p1);
+ }
+
+ typedef odb::query<person> query;
+ typedef odb::result<person> result;
+
+ // query
+ //
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<person> (query::name.first == "Joe"));
+
+ assert (!r.empty ());
+ assert (*r.begin () == p);
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+
+ // query
+ //
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<person> (query::name.flags.alias));
+
+ assert (!r.empty ());
+ assert (*r.begin () == p);
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<person> (1);
+ t.commit ();
+ }
+ }
+
+ // Test composite class template instantiation.
+ //
+ {
+ using namespace test2;
+
+ object o (1);
+
+ o.comp_.num = 123;
+ o.comp_.str = "abc";
+ o.comp_.vec.push_back (int_str_pair (123, "abc"));
+ o.comp_.vec.push_back (int_str_pair (234, "bcd"));
+ o.comp_.vec.push_back (int_str_pair (345, "cde"));
+
+ o.pair_.first = 123;
+ o.pair_.second = "abc";
+
+ o.vec_.push_back (int_str_pair (123, "abc"));
+ o.vec_.push_back (int_str_pair (234, "bcd"));
+ o.vec_.push_back (int_str_pair (345, "cde"));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+
+ // Test empty column name.
+ //
+ {
+ using namespace test3;
+
+ object o (1);
+ o.c_.str = "abc";
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+
+ // Test composite definition inside object.
+ {
+ using namespace test4;
+
+ object o (1);
+ o.str ("abc");
+ o.x (123);
+ o.y (234);
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/composite/test.hxx b/odb-tests/common/composite/test.hxx
new file mode 100644
index 0000000..13b2025
--- /dev/null
+++ b/odb-tests/common/composite/test.hxx
@@ -0,0 +1,250 @@
+// file : common/composite/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+#include <utility> // std::pair
+
+#include <odb/core.hxx>
+
+// Test basic composite functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db value
+ struct name
+ {
+ std::string first;
+ std::string last;
+ };
+
+ #pragma db value
+ struct name_title
+ {
+ std::string title;
+ };
+
+ #pragma db value
+ struct name_title_ex: name_title
+ {
+ // Test value types without data members.
+ };
+
+ #pragma db value
+ struct name_flags
+ {
+ bool nick;
+ bool alias;
+ };
+
+ #pragma db value
+ struct name_ex: name, name_title_ex
+ {
+ name alias;
+ std::string nick;
+
+ #pragma db column("show_")
+ name_flags flags;
+ };
+
+ #pragma db object
+ struct person
+ {
+ person () {}
+ person (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db column("")
+ name_ex name_;
+
+ unsigned short age_;
+ };
+
+ inline bool
+ operator== (const person& x, const person& y)
+ {
+ return x.id_ == y.id_ &&
+ x.name_.first == y.name_.first&&
+ x.name_.last == y.name_.last &&
+ x.name_.title == y.name_.title &&
+ x.name_.alias.first == y.name_.alias.first &&
+ x.name_.alias.last == y.name_.alias.last &&
+ x.name_.nick == y.name_.nick &&
+ x.name_.flags.nick == y.name_.flags.nick &&
+ x.name_.flags.alias == y.name_.flags.alias &&
+ x.age_ == y.age_;
+ }
+}
+
+// Test composite class template instantiation.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ template <typename I, typename S>
+ struct comp
+ {
+ I num;
+ S str;
+ std::vector<std::pair<I, S> > vec;
+ };
+
+ template <typename I, typename S>
+ inline bool
+ operator== (const comp<I, S>& x, const comp<I, S>& y)
+ {
+ return x.num == y.num && x.str == y.str && x.vec == y.vec;
+ }
+
+ typedef std::pair<int, std::string> int_str_pair;
+ #pragma db value(int_str_pair)
+
+ // Make sure we use the name that was specified in the pragma.
+ //
+#ifdef ODB_COMPILER
+ typedef comp<int, std::string> int_str_comp1;
+#endif
+
+ typedef comp<int, std::string> int_str_comp;
+ #pragma db value(int_str_comp)
+
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ comp<int, std::string> comp_;
+ std::pair<int, std::string> pair_;
+ std::vector<int_str_pair> vec_;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.id_ == y.id_ &&
+ x.comp_ == y.comp_ &&
+ x.pair_ == y.pair_ &&
+ x.vec_ == y.vec_;
+ }
+}
+
+// Test empty column name.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db value
+ struct comp
+ {
+ #pragma db column("")
+ std::string str;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ comp c_;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.id_ == y.id_ && x.c_.str == y.c_.str;
+ }
+}
+
+// Test composite definition inside object.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ unsigned long id () const {return id_;}
+
+ void str (const std::string& s) {c_.str = s;}
+ const std::string& str () const {return c_.str;}
+
+ void x (int i) {p_.first = i;}
+ int x () const {return p_.first;}
+
+ void y (int i) {p_.second = i;}
+ int y () const {return p_.second;}
+
+ private:
+ friend class odb::access;
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db value
+ struct comp
+ {
+ std::string str;
+ };
+
+ comp c_;
+
+ typedef std::pair<int, int> int_pair;
+ #pragma db value(int_pair)
+
+ int_pair p_;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.id () == y.id () && x.str () == y.str () &&
+ x.x () == y.x () && x.y () == y.y ();
+ }
+}
+
+// Test composite name clashes in query columns (compilation test)
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ // Class-member conflict.
+ //
+ #pragma db value
+ struct value {int value_;};
+
+ // Class-class conflict.
+ //
+ #pragma db value
+ struct inner {int value;};
+
+ #pragma db value
+ struct outer {inner value;};
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ int id;
+
+ outer value;
+ test5::value v;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/composite/testscript b/odb-tests/common/composite/testscript
new file mode 100644
index 0000000..0747507
--- /dev/null
+++ b/odb-tests/common/composite/testscript
@@ -0,0 +1,33 @@
+# file : common/composite/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/const-member/buildfile b/odb-tests/common/const-member/buildfile
new file mode 100644
index 0000000..868f7fd
--- /dev/null
+++ b/odb-tests/common/const-member/buildfile
@@ -0,0 +1,40 @@
+# file : common/const-member/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix constm_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/const-member/driver.cxx b/odb-tests/common/const-member/driver.cxx
new file mode 100644
index 0000000..0c71dfa
--- /dev/null
+++ b/odb-tests/common/const-member/driver.cxx
@@ -0,0 +1,119 @@
+// file : common/const-member/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test const data members. The readonly test tests that const
+// members are automatically treated as read-only.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Const ids.
+ //
+ {
+ const_id o (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load<const_id> (1, o);
+ t.commit ();
+ assert (o.id == 1);
+ }
+ }
+
+ {
+ {
+ const_auto_id o;
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ assert (o.id == 1);
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<const_auto_id> o (db->load<const_auto_id> (1));
+ t.commit ();
+ assert (o->id == 1);
+ }
+ }
+
+ // Container.
+ //
+ {
+ container o (1, 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<container> o (db->load<container> (1));
+ t.commit ();
+
+ assert (o->ccom.vec.size () == 1 && o->ccom.vec[0] == 1 &&
+ o->ccom.cvec.size () == 1 && o->ccom.cvec[0] == 1 &&
+ o->cvec.size () == 1 && o->cvec[0] == 1);
+ }
+ }
+
+ // Wrapper.
+ //
+ {
+ wrapper o (1, "abc", 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<wrapper> o (db->load<wrapper> (1));
+ t.commit ();
+
+ assert (*o->str == "abc" &&
+ o->com->str == "abc" && o->com->num == 1 &&
+ o->com->vec.size () == 1 && o->com->vec[0] == 1 &&
+ o->vec->size () == 1 && (*o->vec)[0] == 1);
+ }
+ }
+
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/const-member/test.hxx b/odb-tests/common/const-member/test.hxx
new file mode 100644
index 0000000..ab75c55
--- /dev/null
+++ b/odb-tests/common/const-member/test.hxx
@@ -0,0 +1,109 @@
+// file : common/const-member/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+#include <string>
+#include <memory> // std::auto_ptr
+
+#include <odb/core.hxx>
+
+// Const ids.
+//
+#pragma db object
+struct const_id
+{
+ const_id (unsigned long i): id (i) {}
+ const_id (): id (0) {}
+
+ #pragma db id
+ const unsigned long id;
+};
+
+#pragma db object
+struct const_auto_id
+{
+ const_auto_id (): id (0) {}
+
+ #pragma db id auto
+ const unsigned long id;
+};
+
+// Container.
+//
+#pragma db value
+struct container_value
+{
+ container_value (unsigned long x)
+ {
+ vec.push_back (x);
+ const_cast<std::vector<unsigned long>&> (cvec).push_back (x);
+ }
+
+ container_value () {}
+
+ std::vector<unsigned long> vec;
+ const std::vector<unsigned long> cvec;
+};
+
+#pragma db object
+struct container
+{
+ container (unsigned long i, unsigned long x)
+ : id (i), ccom (x)
+ {
+ const_cast<std::vector<unsigned long>&> (cvec).push_back (x);
+ }
+
+ container () {}
+
+ #pragma db id
+ unsigned long id;
+
+ const container_value ccom;
+ const std::vector<unsigned long> cvec;
+};
+
+// Wrapper.
+//
+#pragma db value
+struct wrapped_value
+{
+ wrapped_value (const std::string& s, unsigned long n)
+ : str (s), num (n)
+ {
+ vec.push_back (n);
+ }
+
+ wrapped_value () {}
+
+ const std::string str;
+ unsigned long num;
+ std::vector<unsigned long> vec;
+};
+
+#pragma db object
+struct wrapper
+{
+ wrapper (unsigned long i, const std::string& s, unsigned long n)
+ : id (i),
+ str (new std::string (s)),
+ com (new wrapped_value (s, n)),
+ vec (new std::vector<unsigned long>)
+ {
+ const_cast<std::vector<unsigned long>&> (*vec).push_back (n);
+ }
+
+ wrapper () {}
+
+ #pragma db id
+ unsigned long id;
+
+ const std::unique_ptr<const std::string> str;
+ const std::unique_ptr<const wrapped_value> com;
+ const std::unique_ptr<const std::vector<unsigned long>> vec;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/const-member/testscript b/odb-tests/common/const-member/testscript
new file mode 100644
index 0000000..c81d856
--- /dev/null
+++ b/odb-tests/common/const-member/testscript
@@ -0,0 +1,33 @@
+# file : common/const-member/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/const-object/buildfile b/odb-tests/common/const-object/buildfile
new file mode 100644
index 0000000..853c831
--- /dev/null
+++ b/odb-tests/common/const-object/buildfile
@@ -0,0 +1,41 @@
+# file : common/const-object/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix consto_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/const-object/driver.cxx b/odb-tests/common/const-object/driver.cxx
new file mode 100644
index 0000000..7ef48ee
--- /dev/null
+++ b/odb-tests/common/const-object/driver.cxx
@@ -0,0 +1,216 @@
+// file : common/const-object/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test database operations with const objects.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ aggr a (1);
+ aggr ca_ (2); // o1 and o2 are NULL
+ const aggr& ca (ca_);
+
+ obj1* o1 (new obj1 (1));
+ obj1* co1_ (new obj1 (2));
+ const obj1* co1 (co1_);
+ a.o1 = co1;
+
+ unique_ptr<obj2> o2 (new obj2 (1));
+ obj2* co2_ (new obj2 (2));
+ a.o2.reset (co2_);
+ unique_ptr<const obj2>& co2 (a.o2);
+
+ // persist via references
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (*o1);
+ db->persist (*co1);
+ db->persist (*o2);
+ db->persist (*co2);
+ db->persist (a);
+ db->persist (ca);
+ t.commit ();
+ }
+
+ // persist via pointers
+ //
+ o1->id += 2;
+ co1_->id += 2;
+ o2->id += 2;
+ co2_->id += 2;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (co1);
+ db->persist (o2);
+ db->persist (co2);
+ t.commit ();
+ }
+
+ // load & compare
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<aggr> a (db->load<aggr> (1));
+ unique_ptr<const aggr> ca (db->load<aggr> (2));
+
+ t.commit ();
+
+ assert (a->o1->id == 2);
+ assert (a->o2->id == 2);
+
+ assert (ca->o1 == 0);
+ assert (ca->o2.get () == 0);
+ }
+
+ // update via references
+ //
+ {
+ transaction t (db->begin ());
+ db->update (*o1);
+ db->update (*co1);
+ db->update (*o2);
+ db->update (*co2);
+ db->update (a);
+ db->update (ca);
+ t.commit ();
+ }
+
+ // update via pointers
+ //
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (co1);
+ db->update (o2);
+ db->update (co2);
+ t.commit ();
+ }
+
+ // query
+ //
+ typedef odb::query<obj1> query1;
+ typedef odb::query<obj2> query2;
+
+ typedef odb::result<const obj1> result1;
+ typedef odb::result<const obj2> result2;
+
+ {
+ transaction t (db->begin ());
+ result1 r1 (db->query<obj1> (query1::id < 3));
+ // odb::result<obj1> ur (r1); // error
+ size_t n1 (0);
+
+ for (result1::iterator i (r1.begin ()); i != r1.end (); ++i)
+ {
+ // i->f (); // error
+ i->cf ();
+ // obj1* p (i.load ()); // error
+ const obj1* p (i.load ());
+ obj1 o (0);
+ i.load (o);
+ assert (p->id == o.id);
+ delete p;
+ n1++;
+ }
+
+ assert (n1 == 2);
+
+ result2 r2 (db->query<obj2> (query2::id < 3));
+ size_t n2 (0);
+
+ for (result2::iterator i (r2.begin ()); i != r2.end (); ++i)
+ {
+ // i->f (); // error
+ i->cf ();
+ //unique_ptr<obj2> p (i.load ()); // error
+ unique_ptr<const obj2> p (i.load ());
+ obj2 o (0);
+ i.load (o);
+ assert (p->id == o.id);
+ n2++;
+ }
+
+ assert (n2 == 2);
+
+ t.commit ();
+ }
+
+ // erase via references
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (*o1);
+ db->erase (*co1);
+ db->erase (*o2);
+ db->erase (*co2);
+ db->erase (a);
+ db->erase (ca);
+ t.commit ();
+ }
+
+ // erase via pointers
+ //
+ o1->id -= 2;
+ co1_->id -= 2;
+ o2->id -= 2;
+ co2_->id -= 2;
+
+ {
+ transaction t (db->begin ());
+ db->erase (o1);
+ db->erase (co1);
+ db->erase (o2);
+ db->erase (co2);
+ t.commit ();
+ }
+
+ // Test session and const/non-const object handling
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ obj1 o1 (1);
+ const obj1& co1 (o1);
+ db->persist (co1);
+
+ assert (db->load<obj1> (1) == &o1);
+
+ t.commit ();
+ }
+
+ delete o1;
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/const-object/test.hxx b/odb-tests/common/const-object/test.hxx
new file mode 100644
index 0000000..4e66231
--- /dev/null
+++ b/odb-tests/common/const-object/test.hxx
@@ -0,0 +1,51 @@
+// file : common/const-object/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <memory>
+#include <odb/core.hxx>
+
+#pragma db object pointer (obj1*) session
+struct obj1
+{
+ obj1 () {}
+ obj1 (int i): id (i) {}
+
+ #pragma db id
+ int id;
+
+ void f () {}
+ void cf () const {}
+};
+
+#pragma db object pointer (std::unique_ptr<obj2>)
+struct obj2
+{
+ obj2 () {}
+ obj2 (int i): id (i) {}
+
+ #pragma db id
+ int id;
+
+ void f () {}
+ void cf () const {}
+};
+
+#pragma db object
+struct aggr
+{
+ aggr (int i): id (i), o1 (0) {}
+ aggr (): o1 (0) {}
+ ~aggr () {delete o1;}
+
+ #pragma db id
+ int id;
+
+ const obj1* o1;
+
+ std::unique_ptr<const obj2> o2;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/const-object/testscript b/odb-tests/common/const-object/testscript
new file mode 100644
index 0000000..3885e96
--- /dev/null
+++ b/odb-tests/common/const-object/testscript
@@ -0,0 +1,33 @@
+# file : common/const-object/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/container/basics/buildfile b/odb-tests/common/container/basics/buildfile
new file mode 100644
index 0000000..f83444e
--- /dev/null
+++ b/odb-tests/common/container/basics/buildfile
@@ -0,0 +1,40 @@
+# file : common/container/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_cont_bs_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/container/basics/driver.cxx b/odb-tests/common/container/basics/driver.cxx
new file mode 100644
index 0000000..14e1984
--- /dev/null
+++ b/odb-tests/common/container/basics/driver.cxx
@@ -0,0 +1,523 @@
+// file : common/container/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic container persistence.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ object empty ("empty"), med ("medium"), full ("full");
+
+ //
+ // empty
+ //
+
+ empty.num = 0;
+ empty.str = "";
+
+ // array
+ //
+ empty.na[0] = 123;
+ empty.na[1] = 234;
+ empty.na[2] = 345;
+
+ empty.sa[0] = "aaa";
+ empty.sa[1] = "bbbb";
+ empty.sa[2] = "ccccc";
+
+ empty.ca[0] = comp (123, "aaa");
+ empty.ca[1] = comp (234, "bbbb");
+ empty.ca[2] = comp (345, "ccccc");
+
+
+ //
+ // med
+ //
+
+ med.num = 999;
+ med.str = "xxx";
+
+ // vector
+ //
+ med.nv.push_back (123);
+ med.nv.push_back (234);
+
+ med.sv.push_back ("aaa");
+ med.sv.push_back ("bbbb");
+
+ med.cv.push_back (comp (123, "aaa"));
+ med.cv.push_back (comp (234, "bbbb"));
+
+ med.uv.push_back (123);
+ med.uv.push_back (234);
+
+ // list
+ //
+ med.sl.push_back ("aaa");
+ med.sl.push_back ("bbbb");
+
+ // deque
+ //
+ med.nd.push_back (123);
+ med.nd.push_back (234);
+
+ // set
+ //
+ med.ns.insert (123);
+ med.ns.insert (234);
+
+ med.ss.insert ("aaa");
+ med.ss.insert ("bbbb");
+
+ med.cs.insert (comp (123, "aaa"));
+ med.cs.insert (comp (234, "bbbb"));
+
+ // map
+ //
+ med.nsm[123] = "aaa";
+ med.nsm[234] = "bbbb";
+
+ med.snm["aaa"] = 123;
+ med.snm["bbbb"] = 234;
+
+ med.ncm[123] = comp (123, "aaa");
+ med.ncm[234] = comp (234, "bbbb");
+
+ med.csm[comp (123, "aaa")] = "aaa";
+ med.csm[comp (234, "bbbb")] = "bbbb";
+
+ // array
+ //
+ med.na[0] = 123;
+ med.na[1] = 234;
+ med.na[2] = 345;
+
+ med.sa[0] = "aaa";
+ med.sa[1] = "bbbb";
+ med.sa[2] = "ccccc";
+
+ med.ca[0] = comp (123, "aaa");
+ med.ca[1] = comp (234, "bbbb");
+ med.ca[2] = comp (345, "ccccc");
+
+ // forward_list
+ //
+ med.nfl.push_front (234);
+ med.nfl.push_front (123);
+
+ med.sfl.push_front ("bbbb");
+ med.sfl.push_front ("aaa");
+
+ med.cfl.push_front (comp (234, "bbbb"));
+ med.cfl.push_front (comp (123, "aaa"));
+
+ // unordered_set
+ //
+ med.nus.insert (123);
+ med.nus.insert (234);
+
+ med.sus.insert ("aaa");
+ med.sus.insert ("bbbb");
+
+ med.cus.insert (comp (123, "aaa"));
+ med.cus.insert (comp (234, "bbbb"));
+
+ // unordered_map
+ //
+ med.nsum[123] = "aaa";
+ med.nsum[234] = "bbbb";
+
+ med.snum["aaa"] = 123;
+ med.snum["bbbb"] = 234;
+
+ med.ncum[123] = comp (123, "aaa");
+ med.ncum[234] = comp (234, "bbbb");
+
+ med.csum[comp (123, "aaa")] = "aaa";
+ med.csum[comp (234, "bbbb")] = "bbbb";
+
+ //
+ // full
+ //
+
+ full.num = 9999;
+ full.str = "xxxx";
+
+ // vector
+ //
+ full.nv.push_back (1234);
+ full.nv.push_back (2345);
+ full.nv.push_back (3456);
+
+ full.sv.push_back ("aaaa");
+ full.sv.push_back ("bbbbb");
+ full.sv.push_back ("cccccc");
+
+ full.cv.push_back (comp (1234, "aaaa"));
+ full.cv.push_back (comp (2345, "bbbbb"));
+ full.cv.push_back (comp (3456, "cccccc"));
+
+ full.uv.push_back (1234);
+ full.uv.push_back (2345);
+ full.uv.push_back (3456);
+
+ // list
+ //
+ full.sl.push_back ("aaaa");
+ full.sl.push_back ("bbbbb");
+ full.sl.push_back ("cccccc");
+
+ // deque
+ //
+ full.nd.push_back (1234);
+ full.nd.push_back (2345);
+ full.nd.push_back (3456);
+
+ // set
+ //
+ full.ns.insert (1234);
+ full.ns.insert (2345);
+ full.ns.insert (3456);
+
+ full.ss.insert ("aaaa");
+ full.ss.insert ("bbbbb");
+ full.ss.insert ("cccccc");
+
+ full.cs.insert (comp (1234, "aaaa"));
+ full.cs.insert (comp (2345, "bbbbb"));
+ full.cs.insert (comp (3456, "cccccc"));
+
+ // map
+ //
+ full.nsm[1234] = "aaaa";
+ full.nsm[2345] = "bbbbb";
+ full.nsm[3456] = "cccccc";
+
+ full.snm["aaaa"] = 1234;
+ full.snm["bbbbb"] = 2345;
+ full.snm["cccccc"] = 3456;
+
+ full.ncm[1234] = comp (1234, "aaaa");
+ full.ncm[2345] = comp (2345, "bbbbb");
+ full.ncm[3456] = comp (3456, "cccccc");
+
+ full.csm[comp (1234, "aaaa")] = "aaaa";
+ full.csm[comp (2345, "bbbbb")] = "bbbbb";
+ full.csm[comp (3456, "cccccc")] = "cccccc";
+
+ // array
+ //
+ full.na[0] = 123;
+ full.na[1] = 234;
+ full.na[2] = 345;
+
+ full.sa[0] = "aaa";
+ full.sa[1] = "bbbb";
+ full.sa[2] = "ccccc";
+
+ full.ca[0] = comp (123, "aaa");
+ full.ca[1] = comp (234, "bbbb");
+ full.ca[2] = comp (345, "ccccc");
+
+ // forward_list
+ //
+ full.nfl.push_front (345);
+ full.nfl.push_front (234);
+ full.nfl.push_front (123);
+
+ full.sfl.push_front ("ccccc");
+ full.sfl.push_front ("bbbb");
+ full.sfl.push_front ("aaa");
+
+ full.cfl.push_front (comp (345, "ccccc"));
+ full.cfl.push_front (comp (234, "bbbb"));
+ full.cfl.push_front (comp (123, "aaa"));
+
+ // unordered_set
+ //
+ full.nus.insert (1234);
+ full.nus.insert (2345);
+ full.nus.insert (3456);
+
+ full.sus.insert ("aaaa");
+ full.sus.insert ("bbbbb");
+ full.sus.insert ("cccccc");
+
+ full.cus.insert (comp (1234, "aaaa"));
+ full.cus.insert (comp (2345, "bbbbb"));
+ full.cus.insert (comp (3456, "cccccc"));
+
+ // unordered_map
+ //
+ full.nsum[1234] = "aaaa";
+ full.nsum[2345] = "bbbbb";
+ full.nsum[3456] = "cccccc";
+
+ full.snum["aaaa"] = 1234;
+ full.snum["bbbbb"] = 2345;
+ full.snum["cccccc"] = 3456;
+
+ full.ncum[1234] = comp (1234, "aaaa");
+ full.ncum[2345] = comp (2345, "bbbbb");
+ full.ncum[3456] = comp (3456, "cccccc");
+
+ full.csum[comp (1234, "aaaa")] = "aaaa";
+ full.csum[comp (2345, "bbbbb")] = "bbbbb";
+ full.csum[comp (3456, "cccccc")] = "cccccc";
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (empty);
+ db->persist (med);
+ db->persist (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> e (db->load<object> ("empty"));
+ unique_ptr<object> m (db->load<object> ("medium"));
+ unique_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ //
+ // empty
+ //
+
+ empty.num = 99;
+ empty.str = "xx";
+
+ empty.nv.push_back (12);
+ empty.sv.push_back ("aa");
+ empty.cv.push_back (comp (12, "aa"));
+ empty.uv.push_back (12);
+ empty.sl.push_back ("aa");
+ empty.nd.push_back (12);
+
+ empty.ns.insert (12);
+ empty.ss.insert ("aa");
+ empty.cs.insert (comp (12, "aa"));
+
+ empty.nsm[12] = "aa";
+ empty.snm["aa"] = 12;
+ empty.ncm[12] = comp (12, "aa");
+ empty.csm[comp (12, "aa")] = "aa";
+
+ empty.nfl.push_front (12);
+ empty.sfl.push_front ("aa");
+ empty.cfl.push_front (comp (12, "aa"));
+
+ empty.nus.insert (12);
+ empty.sus.insert ("aa");
+ empty.cus.insert (comp (12, "aa"));
+
+ empty.nsum[12] = "aa";
+ empty.snum["aa"] = 12;
+ empty.ncum[12] = comp (12, "aa");
+ empty.csum[comp (12, "aa")] = "aa";
+
+ //
+ // med
+ //
+
+ med.num = 0;
+ med.str = "";
+
+ med.nv.clear ();
+ med.sv.clear ();
+ med.cv.clear ();
+ med.uv.clear ();
+
+ med.sl.clear ();
+
+ med.nd.clear ();
+
+ med.ns.clear ();
+ med.ss.clear ();
+ med.cs.clear ();
+
+ med.nsm.clear ();
+ med.snm.clear ();
+ med.ncm.clear ();
+ med.csm.clear ();
+
+ med.nfl.clear ();
+ med.sfl.clear ();
+ med.cfl.clear ();
+
+ med.nus.clear ();
+ med.sus.clear ();
+ med.cus.clear ();
+
+ med.nsum.clear ();
+ med.snum.clear ();
+ med.ncum.clear ();
+ med.csum.clear ();
+
+ //
+ // full
+ //
+
+ full.num++;
+ full.str += "x";
+
+ // vector
+ //
+ full.nv.back ()++;
+ full.nv.push_back (4567);
+
+ full.sv.back () += "c";
+ full.sv.push_back ("ddddddd");
+
+ full.cv.back ().num++;
+ full.cv.back ().str += "c";
+ full.cv.push_back (comp (4567, "ddddddd"));
+
+ full.uv.back ()++;
+ full.uv.push_back (4567);
+
+ // list
+ //
+ full.sl.back () += "c";
+ full.sl.push_back ("ddddddd");
+
+ // deque
+ //
+ full.nd.push_front (456);
+
+ // set
+ //
+ full.ns.insert (4567);
+ full.ss.insert ("ddddddd");
+ full.cs.insert (comp (4567, "ddddddd"));
+
+ // map
+ //
+ full.nsm[3456] += 'c';
+ full.nsm[4567] = "ddddddd";
+
+ full.snm["cccccc"]++;
+ full.snm["ddddddd"] = 4567;
+
+ full.ncm[3456].num++;
+ full.ncm[3456].str += 'c';
+ full.ncm[4567] = comp (4567, "ddddddd");
+
+ full.csm[comp (3456, "cccccc")] += "c";
+ full.csm[comp (4567, "ddddddd")] = "ddddddd";
+
+ // array
+ //
+ full.na[0]++;
+ full.sa[0] += 'a';
+ full.ca[0].num++;
+ full.ca[0].str += 'a';
+
+ // forward_list
+ //
+ full.nfl.front ()++;
+ full.nfl.push_front (4567);
+
+ full.sfl.front () += 'a';
+ full.sfl.push_front ("ddddddd");
+
+ full.cfl.front ().num++;
+ full.cfl.front ().str += 'a';
+ full.cfl.push_front (comp (4567, "ddddddd"));
+
+ // unordered_set
+ //
+ full.nus.insert (4567);
+ full.sus.insert ("ddddddd1"); // 1 is to preserve order in VC++ 10.
+ full.cus.insert (comp (4567, "ddddddd1"));
+
+ // unordered_map
+ //
+ full.nsum[3456] += 'c';
+ full.nsum[4567] = "ddddddd";
+
+ full.snum["cccccc"]++;
+ full.snum["ddddddd1"] = 4567;
+
+ full.ncum[3456].num++;
+ full.ncum[3456].str += 'c';
+ full.ncum[4567] = comp (4567, "ddddddd");
+
+ full.csum[comp (3456, "cccccc")] += "c";
+ full.csum[comp (4567, "ddddddd1")] = "ddddddd";
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (empty);
+ db->update (med);
+ db->update (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> e (db->load<object> ("empty"));
+ unique_ptr<object> m (db->load<object> ("medium"));
+ unique_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<object> ("empty");
+ db->erase<object> ("medium");
+ db->erase<object> ("full");
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/container/basics/test.hxx b/odb-tests/common/container/basics/test.hxx
new file mode 100644
index 0000000..e8e329e
--- /dev/null
+++ b/odb-tests/common/container/basics/test.hxx
@@ -0,0 +1,245 @@
+// file : common/container/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <deque>
+#include <array>
+#include <string>
+#include <forward_list>
+#include <unordered_map>
+#include <unordered_set>
+
+#include <odb/core.hxx>
+
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, const std::string& s) : num (n), str (s) {}
+
+ #pragma db column("number")
+ int num = 0;
+ std::string str;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num && x.str == y.str;
+}
+
+inline bool
+operator!= (const comp& x, const comp& y)
+{
+ return !(x == y);
+}
+
+inline bool
+operator< (const comp& x, const comp& y)
+{
+ return x.num != y.num ? x.num < y.num : x.str < y.str;
+}
+
+typedef std::list<std::string> str_list;
+typedef std::deque<int> num_deque;
+
+typedef std::vector<int> num_vector;
+typedef std::vector<std::string> str_vector;
+
+typedef std::set<int> num_set;
+typedef std::set<std::string> str_set;
+typedef std::set<comp> comp_set;
+
+typedef std::map<int, std::string> num_str_map;
+typedef std::map<std::string, int> str_num_map;
+typedef std::map<int, comp> num_comp_map;
+typedef std::map<comp, std::string> comp_str_map;
+
+struct comp_hash
+{
+ std::size_t
+ operator() (const comp& x) const {return nh (x.num) + sh (x.str);}
+
+ std::hash<int> nh;
+ std::hash<std::string> sh;
+};
+
+typedef std::array<int, 3> num_array;
+typedef std::array<std::string, 3> str_array;
+typedef std::array<comp, 3> comp_array;
+
+typedef std::forward_list<int> num_flist;
+typedef std::forward_list<std::string> str_flist;
+typedef std::forward_list<comp> comp_flist;
+
+typedef std::unordered_set<int> num_uset;
+typedef std::unordered_set<std::string> str_uset;
+typedef std::unordered_set<comp, comp_hash> comp_uset;
+
+typedef std::unordered_map<int, std::string> num_str_umap;
+typedef std::unordered_map<std::string, int> str_num_umap;
+typedef std::unordered_map<int, comp> num_comp_umap;
+typedef std::unordered_map<comp, std::string, comp_hash> comp_str_umap;
+
+#pragma db value
+struct cont_comp1
+{
+ // This composite value does not have any columns.
+ //
+ num_vector sv; // Have the name "conflic" with the one in the object.
+};
+
+#pragma db value
+struct cont_comp2
+{
+ cont_comp2 (): num (777), str ("ggg") {}
+
+ int num;
+ str_list sl;
+ std::string str;
+};
+
+#pragma db object
+struct object
+{
+ object (): nv (comp1_.sv), sl (comp2_.sl) {}
+ object (const std::string& id) : id_ (id), nv (comp1_.sv), sl (comp2_.sl) {}
+
+ #pragma db id
+ std::string id_;
+
+ int num;
+
+ cont_comp1 comp1_;
+ cont_comp2 comp2_;
+
+ // vector
+ //
+ #pragma db transient
+ num_vector& nv;
+
+ #pragma db table("object_strings") id_column ("obj_id")
+ str_vector sv;
+
+ #pragma db value_column("")
+ std::vector<comp> cv;
+
+ #pragma db unordered
+ num_vector uv;
+
+ // list
+ //
+ #pragma db transient
+ str_list& sl;
+
+ // deque
+ //
+ num_deque nd;
+
+ // set
+ //
+ num_set ns;
+ str_set ss;
+ comp_set cs;
+
+ // map
+ //
+ num_str_map nsm;
+ str_num_map snm;
+ num_comp_map ncm;
+ comp_str_map csm;
+
+ // array
+ //
+ num_array na;
+ str_array sa;
+ comp_array ca;
+
+ // forward_list
+ //
+ num_flist nfl;
+ str_flist sfl;
+ comp_flist cfl;
+
+ // unordered_set
+ //
+ num_uset nus;
+ str_uset sus;
+ comp_uset cus;
+
+ // unordered_map
+ //
+ num_str_umap nsum;
+ str_num_umap snum;
+ num_comp_umap ncum;
+ comp_str_umap csum;
+
+ std::string str;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ if (x.uv.size () != y.uv.size ())
+ return false;
+
+ int xs (0), ys (0);
+
+ for (num_vector::size_type i (0); i < x.uv.size (); ++i)
+ {
+ xs += x.uv[i];
+ ys += y.uv[i];
+ }
+
+ return
+ x.id_ == y.id_ &&
+ x.num == y.num &&
+
+ x.comp2_.num == y.comp2_.num &&
+ x.comp2_.str == y.comp2_.str &&
+
+ x.nv == y.nv &&
+ x.sv == y.sv &&
+ x.cv == y.cv &&
+ xs == ys &&
+
+ x.sl == y.sl &&
+
+ x.nd == y.nd &&
+
+ x.ns == y.ns &&
+ x.ss == y.ss &&
+ x.cs == y.cs &&
+
+ x.nsm == y.nsm &&
+ x.snm == y.snm &&
+ x.ncm == y.ncm &&
+ x.csm == y.csm &&
+
+ x.na == y.na &&
+ x.sa == y.sa &&
+ x.ca == y.ca &&
+
+ x.nfl == y.nfl &&
+ x.sfl == y.sfl &&
+ x.cfl == y.cfl &&
+
+ x.nus == y.nus &&
+ x.sus == y.sus &&
+ x.cus == y.cus &&
+
+ x.nsum == y.nsum &&
+ x.snum == y.snum &&
+ x.ncum == y.ncum &&
+ x.csum == y.csum &&
+
+ x.str == y.str;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/container/basics/testscript b/odb-tests/common/container/basics/testscript
new file mode 100644
index 0000000..ea99498
--- /dev/null
+++ b/odb-tests/common/container/basics/testscript
@@ -0,0 +1,33 @@
+# file : common/container/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/container/change-tracking/buildfile b/odb-tests/common/container/change-tracking/buildfile
new file mode 100644
index 0000000..1dda818
--- /dev/null
+++ b/odb-tests/common/container/change-tracking/buildfile
@@ -0,0 +1,40 @@
+# file : common/container/change-tracking/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_cont_changet_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/container/change-tracking/driver.cxx b/odb-tests/common/container/change-tracking/driver.cxx
new file mode 100644
index 0000000..4894ed9
--- /dev/null
+++ b/odb-tests/common/container/change-tracking/driver.cxx
@@ -0,0 +1,729 @@
+// file : common/container/change-tracking/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test change-tracking containers.
+//
+
+#include <memory> // std::unique_ptr
+#include <utility> // std::move
+#include <iostream>
+
+#include <odb/tracer.hxx>
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct counting_tracer: odb::tracer
+{
+ void
+ reset (transaction& tr) {u = i = d = s = t = 0; tr.tracer (*this);}
+
+ virtual void
+ execute (odb::connection&, const char* stmt)
+ {
+ string p (stmt, 6);
+ if (p == "UPDATE")
+ u++;
+ else if (p == "INSERT")
+ i++;
+ else if (p == "DELETE")
+ d++;
+ else if (p == "SELECT")
+ s++;
+ t++;
+ }
+
+ size_t u, i, d, s, t;
+};
+
+static counting_tracer tr;
+
+// Compilation test: instantiate all the functions. In C++11 mode only
+// do this if we have a fairly conforming compiler that implements the
+// complete std::vector interface.
+//
+
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+#if defined (__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7
+struct item {};
+template class odb::vector<item>;
+template class odb::vector_iterator<odb::vector<item>,
+ std::vector<item>::iterator>;
+template class odb::vector_iterator<odb::vector<item>,
+ std::vector<item>::reverse_iterator>;
+#endif
+#endif
+
+void
+f (const std::vector<int>&) {}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ // Test extended interface.
+ //
+ {
+ typedef odb::vector<int> vector;
+
+ vector ov;
+ std::vector<int> sv;
+ f (ov); // Implicit conversion to std::vector.
+ vector ov1 (sv); // Initialization from std::vector.
+ ov = sv; // Assignement from std::vector.
+
+ // Container comparison.
+ //
+ if (ov != ov1 ||
+ ov != sv ||
+ sv != ov1)
+ ov.clear ();
+
+ // Iterator comparison/conversion.
+ //
+ vector::const_iterator i (ov.begin ());
+ if (i != ov.end ())
+ i = ov.end ();
+
+ // Things are just really borken in Sun CC, no matter which STL
+ // you use.
+ //
+#ifndef __SUNPRO_CC
+ vector::const_reverse_iterator j (ov.rbegin ());
+ if (j != ov.rend ())
+ j = ov.rend ();
+#endif
+ }
+
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test traits logic.
+ //
+ {
+ object o ("1");
+ o.i = 123;
+ o.s.push_back ("a");
+
+ assert (!o.s._tracking ());
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ assert (o.s._tracking ());
+
+ // load
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> ("1"));
+ assert (p->s._tracking ());
+ t.commit ();
+ }
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ assert (o.s._tracking ());
+
+ // erase
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+
+ assert (!o.s._tracking ());
+ }
+
+ // Test change tracking.
+ //
+ object o ("1");
+ o.i = 123;
+ o.s.push_back ("a");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // push_back/pop_back
+ //
+ {
+ o.s.push_back ("b"); // insert
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.pop_back ();
+ o.s.push_back ("c"); // update
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.pop_back ();
+ for (int i (0); i != 1024; ++i)
+ o.s.push_back ("x"); // realloc
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.i == 1023 && tr.t == 1025);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ for (int i (0); i != 1024; ++i)
+ o.s.pop_back (); // delete
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.push_back ("b");
+ o.s.pop_back (); // no-op
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.t == 1);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // insert
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.begin (), "a1"); // insert front
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.i == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.begin () + 1, "a2"); // insert middle
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.i == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.end (), "b1"); // insert back
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // erase
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.begin ()); // erase front
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 4 && tr.d == 1 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.begin () + 1); // erase middle
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.d == 1 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.end () - 1); // erase back
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // modify
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.modify (1) += 'b';
+ o.s.modify_at (2) += 'c';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.modify_front () += 'a';
+ o.s.modify_back () += 'd';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.begin ().modify () += 'a';
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ o.s.rbegin ().modify () += 'c';
+#endif
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ assert (tr.u == 3 && tr.t == 3);
+#else
+ assert (tr.u == 2 && tr.t == 2);
+#endif
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ {
+ (o.s.rbegin () + 1).modify (1) += 'a';
+ (o.s.rbegin () + 1).modify (-1) += 'c';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+#endif
+
+ {
+ o.s.mbegin ();
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 5 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // clear
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.clear ();
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // assign
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.assign (4, "x");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 4 && tr.i == 1 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // resize
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.pop_back ();
+ o.s.resize (4, "x"); // expand
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.i == 1 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.push_back ("y");
+ o.s.resize (3); // shrink
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // Transaction rollback.
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ {
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ db->update (o);
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 4 && tr.d == 1 && tr.t == 6);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Armed copy.
+ //
+ {
+ unique_ptr<object> c;
+
+ {
+ o.s.pop_back ();
+
+ transaction t (db->begin ());
+ db->update (o);
+ c.reset (new object (o));
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 3 && tr.d == 1 && tr.t == 5);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Armed swap.
+ //
+ {
+ object c (o);
+
+ {
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ db->update (o);
+ assert (o.s._tracking () && !c.s._tracking ());
+ c.s.swap (o.s);
+ assert (!o.s._tracking () && c.s._tracking ());
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 4 && tr.d == 1 && tr.t == 6);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Armed move.
+ //
+ {
+ unique_ptr<object> c;
+
+ {
+ o.s.pop_back ();
+
+ transaction t (db->begin ());
+ db->update (o);
+ assert (o.s._tracking ());
+ c.reset (new object (std::move (o)));
+ assert (!o.s._tracking () && c->s._tracking ());
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 2 && tr.d == 1 && tr.t == 4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Test mixing "smart" and "dumb" container (specifically, erase(obj)).
+ //
+ {
+ mix_object o (1);
+ o.ov.assign (3, 123);
+ o.sv.assign (3, 123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test using change tracking container as inverse member.
+ //
+ {
+ inv_object1 o1;
+ inv_object2 o2;
+ o1.o2 = &o2;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o2);
+ db->persist (o1);
+ t.commit ();
+ }
+
+ assert (!o2.o1._tracking ());
+
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<inv_object1> p1 (db->load<inv_object1> (o1.id_));
+ unique_ptr<inv_object2> p2 (db->load<inv_object2> (o2.id_));
+ assert (p2->o1[0] == p1.get ());
+ assert (!p2->o1._tracking ());
+ t.commit ();
+ }
+ }
+
+ // Test read-only values.
+ {
+ ro_object o (1);
+ o.v.push_back (ro_value (1, 1));
+ o.v.push_back (ro_value (2, 2));
+ o.v.push_back (ro_value (3, 3));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.v.erase (o.v.begin ());
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (db->load<ro_object> (1)->v == o.v);
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/container/change-tracking/test.hxx b/odb-tests/common/container/change-tracking/test.hxx
new file mode 100644
index 0000000..8e06f4a
--- /dev/null
+++ b/odb-tests/common/container/change-tracking/test.hxx
@@ -0,0 +1,106 @@
+// file : common/container/change-tracking/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <memory>
+#include <vector>
+#include <utility> // std::move
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+
+#pragma db object pointer(std::unique_ptr)
+struct object
+{
+ object () {}
+ object (const std::string& id): id_ (id) {}
+
+ object (const object& x): id_ (x.id_), i (x.i), s (x.s) {}
+ object (object&& x): id_ (std::move (x.id_)), i (x.i), s (std::move (x.s)) {}
+
+ #pragma db id
+ std::string id_;
+
+ unsigned int i;
+
+ odb::vector<std::string> s;
+
+ inline bool
+ operator== (const object& o) const {return id_ == o.id_ && i == o.i && s == o.s;}
+};
+
+// Test mixing "smart" and "dumb" container (specifically, erase(obj)).
+//
+#pragma db object
+struct mix_object
+{
+ mix_object () {}
+ mix_object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<int> ov;
+ std::vector<int> sv;
+};
+
+// Test using change tracking container as inverse member.
+//
+struct inv_object2;
+
+#pragma db object session
+struct inv_object1
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ inv_object2* o2;
+};
+
+#pragma db object session
+struct inv_object2
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ #pragma db inverse(o2)
+ odb::vector<inv_object1*> o1;
+};
+
+// Test read-only values (we still need to include them in the UPDATE
+// statement).
+//
+#pragma db value
+struct ro_value
+{
+ ro_value (int i_ = 0, int j_ = 0): i (i_), j (j_) {}
+
+ #pragma db readonly
+ int i;
+
+ #pragma db readonly
+ int j;
+};
+
+inline bool
+operator== (const ro_value& x, const ro_value& y)
+{
+ return x.i == y.i && x.j == y.j;
+}
+
+#pragma db object
+struct ro_object
+{
+ ro_object () {}
+ ro_object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<ro_value> v;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/container/change-tracking/testscript b/odb-tests/common/container/change-tracking/testscript
new file mode 100644
index 0000000..2169869
--- /dev/null
+++ b/odb-tests/common/container/change-tracking/testscript
@@ -0,0 +1,33 @@
+# file : common/container/change-tracking/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/ctor/buildfile b/odb-tests/common/ctor/buildfile
new file mode 100644
index 0000000..a9892bc
--- /dev/null
+++ b/odb-tests/common/ctor/buildfile
@@ -0,0 +1,41 @@
+# file : common/ctor/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix ctor_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/ctor/driver.cxx b/odb-tests/common/ctor/driver.cxx
new file mode 100644
index 0000000..c9b445d
--- /dev/null
+++ b/odb-tests/common/ctor/driver.cxx
@@ -0,0 +1,79 @@
+// file : common/ctor/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test support for persistent objects without default constructors.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ typedef odb::query<person> query;
+ typedef odb::result<person> result;
+
+ unique_ptr<database> db (create_database (argc, argv));
+
+ person p1 ("John", "Doe", 30);
+ person p2 ("Jane", "Doe", 29);
+ person p3 ("Joe", "Dirt", 31);
+
+ {
+ transaction t (db->begin ());
+
+ db->persist (p1);
+ db->persist (p2);
+ db->persist (p3);
+
+ t.commit ();
+ }
+
+ {
+ person p ("", "", 0);
+
+ transaction t (db->begin ());
+
+ db->load (p1.id_, p);
+
+ assert (p.first_ == p1.first_);
+ assert (p.last_ == p1.last_);
+ assert (p.age_ == p1.age_);
+
+ result r (db->query<person> (query::age < 30));
+
+ assert (!r.empty ());
+
+ result::iterator i (r.begin ());
+ i.load (p);
+ assert (p.first_ == "Jane");
+ assert (p.last_ == "Doe");
+ assert (p.age_ == 29);
+
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/ctor/test.hxx b/odb-tests/common/ctor/test.hxx
new file mode 100644
index 0000000..2a2becd
--- /dev/null
+++ b/odb-tests/common/ctor/test.hxx
@@ -0,0 +1,29 @@
+// file : common/ctor/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct person
+{
+ person (const std::string& first,
+ const std::string& last,
+ unsigned short age)
+ : first_ (first), last_ (last), age_ (age)
+ {
+ }
+
+ #pragma db id auto
+ unsigned long id_;
+
+ std::string first_;
+ std::string last_;
+ unsigned short age_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/ctor/testscript b/odb-tests/common/ctor/testscript
new file mode 100644
index 0000000..8946ddb
--- /dev/null
+++ b/odb-tests/common/ctor/testscript
@@ -0,0 +1,33 @@
+# file : common/ctor/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/default/buildfile b/odb-tests/common/default/buildfile
new file mode 100644
index 0000000..e25bd08
--- /dev/null
+++ b/odb-tests/common/default/buildfile
@@ -0,0 +1,41 @@
+# file : common/default/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix default_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/default/driver.cxx b/odb-tests/common/default/driver.cxx
new file mode 100644
index 0000000..2d3ef01
--- /dev/null
+++ b/odb-tests/common/default/driver.cxx
@@ -0,0 +1,81 @@
+// file : common/default/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test default values.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Insert an object using an ad-hoc SQL statement. This way
+ // we get all the default values.
+ //
+ {
+ transaction t (db->begin ());
+
+ if (db->id () != odb::id_oracle)
+ db->execute ("INSERT INTO default_object (obj_id) VALUES (1)");
+ else
+ db->execute ("INSERT INTO \"default_object\" (\"obj_id\") VALUES (1)");
+
+ t.commit ();
+ }
+
+ // Now load the object and check all the values.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ t.commit ();
+
+ assert (o->b);
+ assert (o->pi == 1234);
+ assert (o->ni == -1234);
+ assert (o->zi == 0);
+ assert (o->pf == 1.234);
+ assert (o->nf == -1.234);
+ assert (o->zf == 0.0);
+ assert (o->sf == 1.123e+10);
+ assert (o->str == "Someone's string");
+ assert (o->e == green);
+ }
+
+ // Check the NULL default value using a query.
+ //
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::null.is_null ()));
+ assert (!r.empty ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/default/test.hxx b/odb-tests/common/default/test.hxx
new file mode 100644
index 0000000..7f35ed4
--- /dev/null
+++ b/odb-tests/common/default/test.hxx
@@ -0,0 +1,67 @@
+// file : common/default/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <odb/core.hxx>
+
+enum color {red, green, blue};
+
+#pragma db value(unsigned long) default(0)
+
+#pragma db object
+struct object
+{
+ #pragma db id
+ unsigned long obj_id;
+
+ // NULL.
+ //
+ #pragma db null default(null)
+ unsigned long null;
+
+ // Boolean.
+ //
+ #pragma db default(true)
+ bool b;
+
+ // Integers.
+ //
+ #pragma db default(1234)
+ unsigned long pi;
+
+ #pragma db default(-1234)
+ long ni;
+
+ // 0 default taken from the type.
+ unsigned long zi;
+
+ // Floats.
+ //
+ #pragma db default(1.234)
+ double pf;
+
+ #pragma db default(-1.234)
+ double nf;
+
+ #pragma db default(0.0)
+ double zf;
+
+ #pragma db default(1.123e+10)
+ double sf;
+
+ // Strings. MySQL doesn't support default values on TEXT
+ // columns, so make the type VARCHAR.
+ //
+ #pragma db type("VARCHAR(64)") default("Someone's string")
+ std::string str;
+
+ // Enums.
+ //
+ #pragma db default(green)
+ color e;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/default/testscript b/odb-tests/common/default/testscript
new file mode 100644
index 0000000..f29cef4
--- /dev/null
+++ b/odb-tests/common/default/testscript
@@ -0,0 +1,33 @@
+# file : common/default/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/definition/.gitignore b/odb-tests/common/definition/.gitignore
new file mode 100644
index 0000000..5838670
--- /dev/null
+++ b/odb-tests/common/definition/.gitignore
@@ -0,0 +1,6 @@
+# ODB-generated files.
+#
+time-mapping-odb.?xx
+time-mapping-odb-*.?xx
+time-mapping.sql
+time-mapping-*.sql
diff --git a/odb-tests/common/definition/buildfile b/odb-tests/common/definition/buildfile
new file mode 100644
index 0000000..09ad1db
--- /dev/null
+++ b/odb-tests/common/definition/buildfile
@@ -0,0 +1,52 @@
+# file : common/definition/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = test time-mapping
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix definition_ \
+ --generate-schema
+
+<{hxx ixx cxx}{time-mapping-odb}>: odb_options =
+
+for db: $databases
+ {hxx ixx cxx}{time-mapping-odb-$db}: odb_options =
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/definition/driver.cxx b/odb-tests/common/definition/driver.cxx
new file mode 100644
index 0000000..223eeaf
--- /dev/null
+++ b/odb-tests/common/definition/driver.cxx
@@ -0,0 +1,56 @@
+// file : common/definition/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test overriding composite value definition point. This is primarily
+// useful to make composite values out of third-party types.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.time.tv_sec = 1;
+ o.time.tv_usec = 1000;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ t.commit ();
+
+ assert (p->time.tv_sec == o.time.tv_sec &&
+ p->time.tv_usec == o.time.tv_usec);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/definition/test.hxx b/odb-tests/common/definition/test.hxx
new file mode 100644
index 0000000..38fc02a
--- /dev/null
+++ b/odb-tests/common/definition/test.hxx
@@ -0,0 +1,26 @@
+// file : common/definition/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#ifdef _WIN32
+# include <winsock2.h> // timeval
+#else
+# include <sys/time.h> // timeval
+#endif
+
+#include <odb/core.hxx>
+
+#include "time-mapping.hxx"
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id;
+
+ timeval time;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/definition/testscript b/odb-tests/common/definition/testscript
new file mode 100644
index 0000000..c9dea6d
--- /dev/null
+++ b/odb-tests/common/definition/testscript
@@ -0,0 +1,33 @@
+# file : common/definition/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/definition/time-mapping.hxx b/odb-tests/common/definition/time-mapping.hxx
new file mode 100644
index 0000000..469cfb7
--- /dev/null
+++ b/odb-tests/common/definition/time-mapping.hxx
@@ -0,0 +1,17 @@
+// file : common/definition/time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TIME_MAPPING_HXX
+#define TIME_MAPPING_HXX
+
+#ifdef _WIN32
+# include <winsock2.h> // timeval
+#else
+# include <sys/time.h> // timeval
+#endif
+
+#pragma db value(timeval) definition
+#pragma db member(timeval::tv_sec) column("sec")
+#pragma db member(timeval::tv_usec) column("usec")
+
+#endif // TIME_MAPPING_HXX
diff --git a/odb-tests/common/enum/buildfile b/odb-tests/common/enum/buildfile
new file mode 100644
index 0000000..eb3a29a
--- /dev/null
+++ b/odb-tests/common/enum/buildfile
@@ -0,0 +1,41 @@
+# file : common/enum/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix enum_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/enum/driver.cxx b/odb-tests/common/enum/driver.cxx
new file mode 100644
index 0000000..ed3eb59
--- /dev/null
+++ b/odb-tests/common/enum/driver.cxx
@@ -0,0 +1,84 @@
+// file : common/enum/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test automatic C++ enum mapping.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.color_ = green;
+ o.taste_ = object::sweet;
+ o.position_ = object::left;
+
+ o.gender_ = object::gender::female;
+ o.scale_ = object::scale::ten;
+ o.yesno_ = object::yesno::yes;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ {
+ transaction t (db->begin ());
+
+ result r1 (db->query<object> (query::color == blue));
+ result r2 (db->query<object> (query::taste == object::sweet));
+ result r3 (db->query<object> (query::position == object::left));
+
+ assert (r1.empty ());
+ assert (!r2.empty ());
+ assert (!r3.empty ());
+
+ result r4 (db->query<object> (query::gender == object::gender::female));
+ result r5 (db->query<object> (query::scale == object::scale::ten));
+ result r6 (db->query<object> (query::yesno == object::yesno::yes));
+
+ assert (!r4.empty ());
+ assert (!r5.empty ());
+ assert (!r6.empty ());
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/enum/test.hxx b/odb-tests/common/enum/test.hxx
new file mode 100644
index 0000000..a279112
--- /dev/null
+++ b/odb-tests/common/enum/test.hxx
@@ -0,0 +1,47 @@
+// file : common/enum/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+enum color {red, green, blue};
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ color color_;
+ enum taste {bitter, sweet, sour};
+ taste taste_;
+
+ enum position {left = -1, center = 0, right = 1};
+ position position_;
+
+
+ enum class gender {male, female};
+ enum class scale: unsigned char {one = 1, ten = 10, hundred = 100};
+ enum class yesno: bool {no, yes};
+
+ gender gender_;
+ scale scale_;
+ yesno yesno_;
+};
+
+inline bool
+operator == (const object& x, const object& y)
+{
+ return
+ x.id_ == y.id_
+ && x.color_ == y.color_
+ && x.taste_ == y.taste_
+ && x.position_ == y.position_
+ && x.gender_ == y.gender_
+ && x.scale_ == y.scale_
+ && x.yesno_ == y.yesno_;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/enum/testscript b/odb-tests/common/enum/testscript
new file mode 100644
index 0000000..d2ca28c
--- /dev/null
+++ b/odb-tests/common/enum/testscript
@@ -0,0 +1,33 @@
+# file : common/enum/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/erase-query/buildfile b/odb-tests/common/erase-query/buildfile
new file mode 100644
index 0000000..d833b6e
--- /dev/null
+++ b/odb-tests/common/erase-query/buildfile
@@ -0,0 +1,41 @@
+# file : common/erase-query/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix erase_query_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/erase-query/driver.cxx b/odb-tests/common/erase-query/driver.cxx
new file mode 100644
index 0000000..6c11957
--- /dev/null
+++ b/odb-tests/common/erase-query/driver.cxx
@@ -0,0 +1,181 @@
+// file : common/erase-query/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test query-based erase.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+void
+persist (database& db)
+{
+ object o1 (1);
+ object o2 (2);
+ object o3 (3);
+ object o4 (4);
+
+ transaction t (db.begin ());
+ db.persist (o1);
+ db.persist (o2);
+ db.persist (o3);
+ db.persist (o4);
+ t.commit ();
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ typedef odb::query<object> query;
+
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // erase_query()
+ //
+ persist (*db);
+
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> () == 4);
+ t.commit ();
+ }
+
+ // erase_query(const char*)
+ //
+ persist (*db);
+
+ {
+ transaction t (db->begin ());
+
+ if (db->id () != odb::id_oracle)
+ assert (db->erase_query<object> (
+ "erase_query_object.id < 3") == 2);
+ else
+ assert (db->erase_query<object> (
+ "\"erase_query_object\".\"id\" < 3") == 2);
+
+ db->erase_query<object> ();
+ t.commit ();
+ }
+
+ // erase_query(query)
+ //
+ persist (*db);
+
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> (query::id == 2 || query::id == 4) == 2);
+ db->erase_query<object> ();
+ t.commit ();
+ }
+
+ // Test predicates involving object pointers (DELETE JOIN).
+ //
+ /*
+ {
+ object o11 (1);
+ object o12 (2);
+ object o13 (3);
+ object2 o2;
+
+ o11.o2 = &o2;
+ o2.num = 123;
+
+ o12.o1 = &o13;
+ o13.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o2);
+ db->persist (o13);
+ db->persist (o12);
+ db->persist (o11);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> (query::o1::num == 123) == 1);
+ assert (db->erase_query<object> (query::o2::num == 123) == 1);
+ db->erase_query<object> ();
+ t.commit ();
+ }
+ */
+
+ // For now we can only do column-based tests, like is_null().
+ //
+ {
+ object o11 (1);
+ object o12 (2);
+ object o13 (3);
+ object2 o2;
+
+ o12.o2 = &o2;
+
+ transaction t (db->begin ());
+ db->persist (o2);
+ db->persist (o13);
+ db->persist (o12);
+ db->persist (o11);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> (query::o2.is_null ()) == 2);
+ db->erase_query<object> ();
+ t.commit ();
+ }
+
+ // Make sure container data is deleted.
+ //
+ {
+ object o (1);
+ o.v.push_back (1);
+ o.v.push_back (2);
+ o.v.push_back (3);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> () == 1);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ if (db->id () != odb::id_oracle)
+ assert (db->execute ("SELECT * FROM erase_query_object_v "
+ "WHERE object_id = 1") == 0);
+ else
+ assert (db->execute ("SELECT * FROM \"erase_query_object_v\" "
+ "WHERE \"object_id\" = 1") == 0);
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/erase-query/test.hxx b/odb-tests/common/erase-query/test.hxx
new file mode 100644
index 0000000..9e73f12
--- /dev/null
+++ b/odb-tests/common/erase-query/test.hxx
@@ -0,0 +1,46 @@
+// file : common/erase-query/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+struct object2;
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id), o1 (0), o2 (0)
+ {
+ }
+
+ object ()
+ : o1 (0), o2 (0)
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::vector<int> v;
+
+ int num;
+
+ object* o1;
+ object2* o2;
+};
+
+#pragma db object
+struct object2
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ int num;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/erase-query/testscript b/odb-tests/common/erase-query/testscript
new file mode 100644
index 0000000..90862ab
--- /dev/null
+++ b/odb-tests/common/erase-query/testscript
@@ -0,0 +1,33 @@
+# file : common/erase-query/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/id/auto/buildfile b/odb-tests/common/id/auto/buildfile
new file mode 100644
index 0000000..c340200
--- /dev/null
+++ b/odb-tests/common/id/auto/buildfile
@@ -0,0 +1,40 @@
+# file : common/id/auto/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_id_auto_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/id/auto/driver.cxx b/odb-tests/common/id/auto/driver.cxx
new file mode 100644
index 0000000..d294e69
--- /dev/null
+++ b/odb-tests/common/id/auto/driver.cxx
@@ -0,0 +1,96 @@
+// file : common/id/auto/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test automatic id assignment.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // object
+ //
+ {
+ unsigned long id1, id2, id3;
+ {
+ object o1 ("one");
+ object o2 ("two");
+ object o3 ("three");
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+
+ id1 = o1.id_;
+ id2 = o2.id_;
+ id3 = o3.id_;
+
+ assert (id1 != id2);
+ assert (id1 != id3);
+ assert (id2 != id3);
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (id1));
+ unique_ptr<object> o2 (db->load<object> (id2));
+ unique_ptr<object> o3 (db->load<object> (id3));
+ t.commit ();
+
+ assert (o1->id_ == id1 && o1->str_ == "one");
+ assert (o2->id_ == id2 && o2->str_ == "two");
+ assert (o3->id_ == id3 && o3->str_ == "three");
+ }
+ }
+
+ // auto_only
+ //
+ {
+ unsigned short id;
+ {
+ auto_only o;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ id = o.id_;
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<auto_only> o (db->load<auto_only> (id));
+ t.commit ();
+
+ assert (o->id_ == id);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/id/auto/test.hxx b/odb-tests/common/id/auto/test.hxx
new file mode 100644
index 0000000..233c79f
--- /dev/null
+++ b/odb-tests/common/id/auto/test.hxx
@@ -0,0 +1,40 @@
+// file : common/id/auto/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (const std::string& str)
+ : id_ (1), str_ (str)
+ {
+ }
+
+ #pragma db auto id
+ unsigned long id_;
+ std::string str_;
+
+private:
+ object ()
+ {
+ }
+
+ friend class odb::access;
+};
+
+// Test the case where the object has just the auto id.
+//
+#pragma db object
+struct auto_only
+{
+ #pragma db auto id pgsql:type("BIGINT")
+ unsigned short id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/id/auto/testscript b/odb-tests/common/id/auto/testscript
new file mode 100644
index 0000000..bb2a3a4
--- /dev/null
+++ b/odb-tests/common/id/auto/testscript
@@ -0,0 +1,33 @@
+# file : common/id/auto/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/id/composite/buildfile b/odb-tests/common/id/composite/buildfile
new file mode 100644
index 0000000..4bc9f9a
--- /dev/null
+++ b/odb-tests/common/id/composite/buildfile
@@ -0,0 +1,42 @@
+# file : common/id/composite/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_id_comp_ \
+ --generate-schema \
+ --generate-query \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/id/composite/driver.cxx b/odb-tests/common/id/composite/driver.cxx
new file mode 100644
index 0000000..3d66101
--- /dev/null
+++ b/odb-tests/common/id/composite/driver.cxx
@@ -0,0 +1,731 @@
+// file : common/id/composite/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test composite object ids.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test 1.
+ //
+ {
+ using namespace test1;
+
+ object o1 (scomp ("aaa", "bbb", "ccc"), 123);
+ o1.vec.push_back (scomp ("xxx", "xxx", "xxx"));
+ o1.vec.push_back (scomp ("yyy", "yyy", "yyy"));
+
+ object o2 (scomp ("aaa", "bbb", "ccd"), 234);
+ o2.vec.push_back (scomp ("zzz", "", "zzz"));
+
+ object o3 (scomp ("baa", "bbb", "ccc"), 345);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ unique_ptr<object> p3 (db->load<object> (o3.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ assert (*p3 == o3);
+ }
+
+ // Update.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o1.id));
+ p->num++;
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o1.id));
+ t.commit ();
+
+ assert (p->num == o1.num + 1);
+ }
+
+ // Erase.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase<object> (o1.id);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->find<object> (o1.id));
+ assert (p.get () == 0);
+ t.commit ();
+ }
+ }
+
+ // Test 2.
+ //
+ {
+ using namespace test2;
+
+ object2 o2 (ncomp (2, 0, 1));
+ o2.o1 = new object1 (scomp ("o1", "o2", "aaa"));
+
+ object3 o3 (ncomp (3, 0, 1));
+ o3.o1.push_back (new object1 (scomp ("o1", "o3", "aaa")));
+ o3.o1.push_back (new object1 (scomp ("o1", "o3", "bbb")));
+
+ object4 o4 (ncomp (4, 0, 1));
+ o4.c.o2 = new object2 (ncomp (2, 4, 1));
+ o4.c.o2->o1 = new object1 (scomp ("o1", "o2", "ccc"));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2.o1);
+ db->persist (o2);
+ db->persist (o3.o1[0]);
+ db->persist (o3.o1[1]);
+ db->persist (o3);
+ db->persist (o4.c.o2->o1);
+ db->persist (o4.c.o2);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ unique_ptr<object3> p3 (db->load<object3> (o3.id));
+ unique_ptr<object4> p4 (db->load<object4> (o4.id));
+ t.commit ();
+
+ assert (p2->o1->id == o2.o1->id);
+ assert (p3->o1.size () == o3.o1.size ());
+ assert (p3->o1[0]->id == o3.o1[0]->id);
+ assert (p3->o1[1]->id == o3.o1[1]->id);
+ assert (p4->c.o2->id == o4.c.o2->id);
+ assert (p4->c.o2->o1->id == o4.c.o2->o1->id);
+ }
+
+ // Update.
+ //
+ {
+ scomp id2, id3;
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ delete p2->o1;
+ p2->o1 = new object1 (scomp ("o1", "o2", "bbb"));
+ id2 = db->persist (p2->o1);
+ db->update (*p2);
+
+ unique_ptr<object3> p3 (db->load<object3> (o3.id));
+ delete p3->o1.back ();
+ p3->o1.pop_back ();
+ p3->o1.push_back (new object1 (scomp ("o1", "o3", "ccc")));
+ id3 = db->persist (p3->o1.back ());
+ db->update (*p3);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ unique_ptr<object3> p3 (db->load<object3> (o3.id));
+ t.commit ();
+
+ assert (p2->o1->id == id2);
+ assert (p3->o1.back ()->id == id3);
+ }
+ }
+
+ // Query.
+ //
+ {
+ {
+ typedef odb::query<object2> query;
+ typedef odb::result<object2> result;
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object2> (query::o1->id.str3 == "bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id == o2.id);
+ assert (++i == r.end ());
+ }
+
+ {
+ // As id (dual interface).
+ //
+ result r (db->query<object2> (query::o1.str3 == "bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id == o2.id);
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+
+ // Second level composite object pointer.
+ //
+ {
+ typedef odb::query<object4> query;
+ typedef odb::result<object4> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object4> (query::c.o2->o1.str3 == "ccc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id == o4.id);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // View.
+ //
+ {
+ transaction t (db->begin ());
+
+ {
+ typedef odb::query<view2> query;
+ typedef odb::result<view2> result;
+
+ result r (db->query<view2> (query::object2::id.num2 == 0));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "bbb");
+ assert (++i == r.end ());
+ }
+
+ {
+ typedef odb::query<view3> query;
+ typedef odb::result<view3> result;
+
+ result r (db->query<view3> ((query::object3::id.num2 == 0) +
+ "ORDER BY" + query::object1::id.str3));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "aaa");
+ assert (++i != r.end ());
+ assert (i->num == 1 && i->str == "ccc");
+ assert (++i == r.end ());
+ }
+
+ {
+ typedef odb::query<view4> query;
+ typedef odb::result<view4> result;
+
+ result r (db->query<view4> (query::object4::id.num2 == 0));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num4 == 1 && i->num2 == 1 && i->str == "ccc");
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 3.
+ //
+ {
+ using namespace test3;
+
+ object2 o2 (ncomp (2, 0, 1));
+ o2.o1 = new object1 (scomp ("o1", "o2", "aaa"));
+ o2.o1->o2 = &o2;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2.o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ t.commit ();
+
+ assert (p2->o1->o2->id == o2.id);
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<object1> query;
+ typedef odb::result<object1> result;
+
+ transaction t (db->begin ());
+
+ {
+ session s;
+
+ result r (db->query<object1> (query::o2->id.num2 == 0));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id == o2.o1->id);
+
+ i->o2->o1 = 0;
+ delete i->o2;
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+
+ // View.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<view> (query::object1::id.str2 == "o2"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "aaa");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // Test 4.
+ //
+ {
+ using namespace test4;
+
+ object2 o2 (ncomp (2, 0, 1));
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "aaa")));
+ o2.o1.back ()->o2 = &o2;
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "bbb")));
+ o2.o1.back ()->o2 = &o2;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2.o1[0]);
+ db->persist (o2.o1[1]);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ t.commit ();
+
+ assert (p2->o1.size () == 2);
+ assert (p2->o1[0]->o2->id == o2.id);
+ assert (p2->o1[1]->o2->id == o2.id);
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<object1> query;
+ typedef odb::result<object1> result;
+
+ transaction t (db->begin ());
+
+ {
+ session s;
+
+ result r (db->query<object1> (query::o2->id.num2 == 0));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id == o2.o1[0]->id);
+ i->o2->o1.clear ();
+
+ assert (++i != r.end ());
+ assert (i->id == o2.o1[1]->id);
+
+ i->o2->o1.clear ();
+ delete i->o2;
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+
+ // View.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<view> (query::object1::id.str3 == "bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "bbb");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // Test 5.
+ //
+ {
+ using namespace test5;
+
+ object2 o2 (ncomp (2, 0, 1));
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "aaa")));
+ o2.o1.back ()->o2 = &o2;
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "bbb")));
+ o2.o1.back ()->o2 = &o2;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2.o1[0]);
+ db->persist (o2.o1[1]);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ t.commit ();
+
+ assert (p2->o1.size () == 2);
+
+ assert (p2->o1[0]->id == o2.o1[0]->id);
+ assert (p2->o1[0]->o2->id == o2.id);
+
+ assert (p2->o1[1]->id == o2.o1[1]->id);
+ assert (p2->o1[1]->o2->id == o2.id);
+ }
+
+ // View.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<view> ((query::object2::id.num2 == 0) +
+ "ORDER BY" + query::object1::id.str3));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "aaa");
+ assert (++i != r.end ());
+ assert (i->num == 1 && i->str == "bbb");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // Test 6.
+ //
+ {
+ using namespace test6;
+
+ object2 o2 (ncomp (2, 0, 1));
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "aaa")));
+ o2.o1.back ()->o2.push_back (&o2);
+
+ o2.o1.push_back (new object1 (scomp ("o1", "o2", "bbb")));
+ o2.o1.back ()->o2.push_back (&o2);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2.o1[0]);
+ db->persist (o2.o1[1]);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> (o2.id));
+ t.commit ();
+
+ assert (p2->o1.size () == 2);
+
+ assert (p2->o1[0]->id == o2.o1[0]->id);
+ assert (p2->o1[0]->o2[0]->id == o2.id);
+
+ assert (p2->o1[1]->id == o2.o1[1]->id);
+ assert (p2->o1[1]->o2[0]->id == o2.id);
+ }
+
+ // View.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<view> ((query::object2::id.num2 == 0) +
+ "ORDER BY" + query::object1::id.str3));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "aaa");
+ assert (++i != r.end ());
+ assert (i->num == 1 && i->str == "bbb");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // Test 7.
+ //
+ {
+ using namespace test7;
+
+ object o (scomp ("aaa", "bbb", "ccc"), 123);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*p == o);
+ }
+
+ // Update.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ p->num++;
+ db->update (*p);
+
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ }
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ t.commit ();
+
+ assert (p->num == o.num + 1);
+ }
+
+ // Erase.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 8.
+ //
+ {
+ using namespace test8;
+
+ object2 o2a, o2b;
+ object3 o3;
+
+ o2b.o1 = new object1 (scomp ("222", "aaa", "bbb"), 123);
+ o3.o1.push_back (0);
+ o3.o1.push_back (new object1 (scomp ("333", "aaa", "bbb"), 234));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o2a);
+ db->persist (o2b);
+ db->persist (o2b.o1);
+ db->persist (o3);
+ db->persist (o3.o1[1]);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p2a (db->load<object2> (o2a.id));
+ unique_ptr<object2> p2b (db->load<object2> (o2b.id));
+ unique_ptr<object3> p3 (db->load<object3> (o3.id));
+ t.commit ();
+
+ assert (p2a->o1 == 0);
+ assert (p2b->o1 != 0 && *p2b->o1 == *o2b.o1);
+ assert (p3->o1[0] == 0);
+ assert (p3->o1[1] != 0 && *p3->o1[1] == *o3.o1[1]);
+ }
+
+ // Update.
+ //
+ {
+ object1* o1 (o3.o1[1]);
+
+ o3.o1.clear ();
+ o3.o1.push_back (o2b.o1);
+ o3.o1.push_back (0);
+
+ o2a.o1 = o1;
+ o2b.o1 = 0;
+
+ transaction t (db->begin ());
+ db->update (o2a);
+ db->update (o2b);
+ db->update (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p2a (db->load<object2> (o2a.id));
+ unique_ptr<object2> p2b (db->load<object2> (o2b.id));
+ unique_ptr<object3> p3 (db->load<object3> (o3.id));
+ t.commit ();
+
+ assert (p2a->o1 != 0 && *p2a->o1 == *o2a.o1);
+ assert (p2b->o1 == 0);
+ assert (p3->o1[0] != 0 && *p3->o1[0] == *o3.o1[0]);
+ assert (p3->o1[1] == 0);
+ }
+ }
+
+ // Test 9.
+ {
+ using namespace test9;
+
+ object o (123, "abc");
+ o.v.push_back (123);
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ result<object> r (db->query<object> ());
+ result<object>::iterator i (r.begin ());
+ assert (i != r.end () && o == *i && ++i == r.end ());
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/id/composite/test.hxx b/odb-tests/common/id/composite/test.hxx
new file mode 100644
index 0000000..70856a6
--- /dev/null
+++ b/odb-tests/common/id/composite/test.hxx
@@ -0,0 +1,519 @@
+// file : common/id/composite/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db value
+struct scomp
+{
+ scomp () {}
+ scomp (const std::string& s1, const std::string& s2, const std::string& s3)
+ : str1 (s1), str2 (s2), str3 (s3)
+ {
+ }
+
+ std::string str1;
+ std::string str2;
+ std::string str3;
+};
+
+inline bool
+operator== (const scomp& x, const scomp& y)
+{
+ return x.str1 == y.str1 && x.str2 == y.str2 && x.str3 == y.str3;
+}
+
+inline bool
+operator< (const scomp& x, const scomp& y)
+{
+ return x.str1 < y.str1 ||
+ (x.str1 == y.str1 && x.str2 < y.str2) ||
+ (x.str1 == y.str1 && x.str2 == y.str2 && x.str3 < y.str3);
+}
+
+#pragma db value
+struct ncomp
+{
+ ncomp () {}
+ ncomp (unsigned short n1, unsigned short n2, unsigned short n3)
+ : num1 (n1), num2 (n2), num3 (n3)
+ {
+ }
+
+ unsigned short num1;
+ unsigned short num2;
+ unsigned short num3;
+};
+
+inline bool
+operator== (const ncomp& x, const ncomp& y)
+{
+ return x.num1 == y.num1 && x.num2 == y.num2 && x.num3 == y.num3;
+}
+
+inline bool
+operator< (const ncomp& x, const ncomp& y)
+{
+ return x.num1 < y.num1 ||
+ (x.num1 == y.num1 && x.num2 < y.num2) ||
+ (x.num1 == y.num1 && x.num2 == y.num2 && x.num3 < y.num3);
+}
+
+// Test object with composite id, container.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object
+ struct object
+ {
+ object () {}
+ object (const scomp& i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ scomp id;
+
+ unsigned long num;
+ std::vector<scomp> vec;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.id == y.id && x.num == y.num && x.vec == y.vec;
+ }
+}
+
+// Test to-one and to-many relationships with composite id as well as
+// queries and views.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i): id (i) {}
+
+ #pragma db id
+ scomp id;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (): o1 (0) {}
+ object2 (const ncomp& i): id (i), o1 (0) {}
+ ~object2 () {delete o1;}
+
+ #pragma db id
+ ncomp id;
+
+ object1* o1;
+ };
+
+ #pragma db object
+ struct object3
+ {
+ object3 () {}
+ object3 (const ncomp& i): id (i) {}
+
+ ~object3 ()
+ {
+ for (std::vector<object1*>::iterator i (o1.begin ());
+ i != o1.end (); ++i)
+ delete *i;
+ }
+
+ #pragma db id
+ ncomp id;
+
+ std::vector<object1*> o1;
+ };
+
+ // Test second-level query pointer test as well as pointers in
+ // composite types.
+ //
+ #pragma db value
+ struct comp
+ {
+ comp (): o2 (0) {}
+ ~comp () {delete o2;}
+
+ object2* o2;
+ };
+
+ #pragma db object
+ struct object4
+ {
+ object4 () {}
+ object4 (const ncomp& i): id (i) {}
+
+ #pragma db id
+ ncomp id;
+
+ comp c;
+ };
+
+ #pragma db view object(object2) object(object1)
+ struct view2
+ {
+ #pragma db column (object2::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+
+ #pragma db view object(object3) object(object1)
+ struct view3
+ {
+ #pragma db column (object3::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+
+ #pragma db view object(object4) object(object2) object(object1)
+ struct view4
+ {
+ #pragma db column (object4::id.num3)
+ unsigned short num4;
+
+ #pragma db column (object2::id.num3)
+ unsigned short num2;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+}
+
+// Test one-to-one(i) relationship with composite id.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ struct object2;
+
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i): id (i) {}
+
+ #pragma db id
+ scomp id;
+
+ #pragma db inverse(o1)
+ object2* o2;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (): o1 (0) {}
+ object2 (const ncomp& i): id (i), o1 (0) {}
+ ~object2 () {delete o1;}
+
+ #pragma db id
+ ncomp id;
+
+ object1* o1;
+ };
+
+ #pragma db view object(object2) object(object1)
+ struct view
+ {
+ #pragma db column (object2::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+}
+
+// Test many-to-one(i) relationship with composite id.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ struct object2;
+
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i): id (i) {}
+
+ #pragma db id
+ scomp id;
+
+ #pragma db inverse(o1)
+ object2* o2;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const ncomp& i): id (i) {}
+
+ ~object2 ()
+ {
+ for (std::vector<object1*>::iterator i (o1.begin ());
+ i != o1.end (); ++i)
+ delete *i;
+ }
+
+ #pragma db id
+ ncomp id;
+
+ std::vector<object1*> o1;
+ };
+
+ #pragma db view object(object2) object(object1)
+ struct view
+ {
+ #pragma db column (object2::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+}
+
+// Test one-to-many(i) relationship with composite id.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ struct object2;
+
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i): id (i) {}
+
+ #pragma db id
+ scomp id;
+
+ object2* o2;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const ncomp& i): id (i) {}
+
+ ~object2 ()
+ {
+ for (std::vector<object1*>::iterator i (o1.begin ());
+ i != o1.end (); ++i)
+ delete *i;
+ }
+
+ #pragma db id
+ ncomp id;
+
+ #pragma db inverse(o2)
+ std::vector<object1*> o1;
+ };
+
+ #pragma db view object(object2) object(object1)
+ struct view
+ {
+ #pragma db column (object2::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+}
+
+// Test many-to-many(i) relationship with composite id.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ struct object2;
+
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i): id (i) {}
+
+ #pragma db id
+ scomp id;
+
+ std::vector<object2*> o2;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const ncomp& i): id (i) {}
+
+ ~object2 ()
+ {
+ for (std::vector<object1*>::iterator i (o1.begin ());
+ i != o1.end (); ++i)
+ delete *i;
+ }
+
+ #pragma db id
+ ncomp id;
+
+ #pragma db inverse(o2)
+ std::vector<object1*> o1;
+ };
+
+ #pragma db view object(object2) object(object1)
+ struct view
+ {
+ #pragma db column (object2::id.num3)
+ unsigned short num;
+
+ #pragma db column (object1::id.str3)
+ std::string str;
+ };
+}
+
+// Test object with composite id and version (optimistic concurrency).
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ #pragma db object optimistic
+ struct object
+ {
+ object () {}
+ object (const scomp& i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ scomp id;
+
+ #pragma db version
+ unsigned long ver;
+
+ unsigned long num;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.id == y.id && x.ver == y.ver && x.num == y.num;
+ }
+}
+
+// Test composite NULL pointers.
+//
+#pragma db namespace table("t8_")
+namespace test8
+{
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+ object1 (const scomp& i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ scomp id;
+
+ unsigned long num;
+ };
+
+ inline bool
+ operator== (const object1& x, const object1& y)
+ {
+ return x.id == y.id && x.num == y.num;
+ }
+
+ #pragma db object
+ struct object2
+ {
+ object2 (): o1 (0) {}
+ ~object2 () {delete o1;}
+
+ #pragma db id auto
+ unsigned long id;
+
+ object1* o1;
+ };
+
+ #pragma db object
+ struct object3
+ {
+ ~object3 ()
+ {
+ for (std::vector<object1*>::iterator i (o1.begin ());
+ i != o1.end (); ++i)
+ delete *i;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<object1*> o1;
+ };
+}
+
+// Test composite id definition inside object.
+//
+#pragma db namespace table("t9_")
+namespace test9
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long n = 0, const std::string& s = "")
+ {
+ id_.num = n;
+ id_.str = s;
+ }
+
+ unsigned long num () const {return id_.num;}
+ const std::string& str () const {return id_.str;}
+
+ std::vector<int> v;
+
+ private:
+ friend class odb::access;
+
+ #pragma db value
+ struct comp
+ {
+ unsigned long num;
+ std::string str;
+
+ bool
+ operator< (const comp& x) const
+ {
+ return num < x.num || (num == x.num && str < x.str);
+ }
+ };
+
+ #pragma db id
+ comp id_;
+ };
+
+ inline bool
+ operator== (const object& x, const object& y)
+ {
+ return x.num () == y.num () && x.str () == y.str () && x.v == y.v;
+ }
+}
+
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/id/composite/testscript b/odb-tests/common/id/composite/testscript
new file mode 100644
index 0000000..f87d4bc
--- /dev/null
+++ b/odb-tests/common/id/composite/testscript
@@ -0,0 +1,33 @@
+# file : common/id/composite/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/id/nested/buildfile b/odb-tests/common/id/nested/buildfile
new file mode 100644
index 0000000..777cb65
--- /dev/null
+++ b/odb-tests/common/id/nested/buildfile
@@ -0,0 +1,41 @@
+# file : common/nested/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_id_nested_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/id/nested/driver.cxx b/odb-tests/common/id/nested/driver.cxx
new file mode 100644
index 0000000..92a80f6
--- /dev/null
+++ b/odb-tests/common/id/nested/driver.cxx
@@ -0,0 +1,266 @@
+// file : common/id/nested/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test nested ids.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct failed {};
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+
+ // Simple nested id.
+ //
+ {
+ using namespace test1;
+
+ object o1 (1, "a", 3);
+ o1.v.push_back (123);
+
+ object o2 (4, "b", 6);
+ o2.v.push_back (234);
+
+ object1 o (new object (10, "abc", 11));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o.p);
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ unique_ptr<object1> p (db->load<object1> (o.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ assert (*p == o);
+ }
+
+ o1.z++;
+ o1.v.pop_back ();
+ o1.v.push_back (234);
+
+ o2.z--;
+ o2.v.back ()++;
+ o2.v.push_back (123);
+
+ delete o.p;
+ o.p = new object (20, "xyz", 11);
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ db->persist (o.p);
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ unique_ptr<object1> p (db->load<object1> (o.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ assert (*p == o);
+ }
+ }
+
+ // Composite nested id.
+ //
+ {
+ using namespace test2;
+
+ object o1 (1, 2, "a", 123);
+ o1.v.push_back (123);
+
+ object o2 (1, 3, "b", 234);
+ o2.v.push_back (234);
+
+ object1 o (new object (2, 2, "abc", 123));
+ o.p->v.push_back (345);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o.p);
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.c));
+ unique_ptr<object> p2 (db->load<object> (o2.id.c));
+ unique_ptr<object1> p (db->load<object1> (o.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ assert (*p == o);
+ }
+
+ o1.z++;
+ o1.v.pop_back ();
+ o1.v.push_back (234);
+
+ o2.z--;
+ o2.v.modify_back ()++;
+ o2.v.push_back (123);
+
+ delete o.p;
+ o.p = new object (2, 3, "xyz", 234);
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ db->persist (o.p);
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.c));
+ unique_ptr<object> p2 (db->load<object> (o2.id.c));
+ unique_ptr<object1> p (db->load<object1> (o.id));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ assert (*p == o);
+ }
+ }
+
+ // Custom/by-value access.
+ //
+ {
+ using namespace test3;
+
+ object o1 (1, "a", 3);
+ object o2 (4, "b", 6);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o1.z++;
+ o2.z--;
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+
+ // Polymorphic.
+ //
+ {
+ using namespace test4;
+
+ base o1 (1, "a");
+ object o2 (2, "b", 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> p1 (db->load<base> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+
+ o2.z--;
+
+ {
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> p1 (db->load<base> (o1.id.y));
+ unique_ptr<object> p2 (db->load<object> (o2.id.y));
+ t.commit ();
+
+ assert (*p1 == o1);
+ assert (*p2 == o2);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/id/nested/test.hxx b/odb-tests/common/id/nested/test.hxx
new file mode 100644
index 0000000..06ee6b8
--- /dev/null
+++ b/odb-tests/common/id/nested/test.hxx
@@ -0,0 +1,217 @@
+// file : common/id/nested/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+
+// Simple nested id.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db value
+ struct comp
+ {
+ int x;
+ std::string y;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id(y)
+ comp id;
+
+ int z;
+ std::vector<int> v;
+
+ object () {}
+ object (int x, std::string y, int z_): z (z_) {id.x = x; id.y = y;}
+ };
+
+ inline bool
+ operator== (object a, object b)
+ {
+ return a.id.x == b.id.x && a.id.y == b.id.y && a.z == b.z && a.v == b.v;
+ }
+
+ #pragma db object
+ struct object1
+ {
+ #pragma db id auto
+ int id;
+
+ object* p;
+
+ object1 (object* p_ = 0): p (p_) {}
+ ~object1 () {delete p;}
+ };
+
+ inline bool
+ operator== (const object1& a, const object1& b)
+ {
+ return a.id == b.id && *a.p == *b.p;
+ }
+}
+
+// Composite nested id.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db value
+ struct comp1
+ {
+ int x;
+ int y;
+ };
+
+ #pragma db value
+ struct comp2
+ {
+ comp1 c;
+ std::string s;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id(c)
+ comp2 id;
+
+ int z;
+ odb::vector<int> v;
+
+ object () {}
+ object (int x, int y, std::string s, int z_)
+ : z (z_) {id.c.x = x; id.c.y = y; id.s = s;}
+ };
+
+ inline bool
+ operator== (object a, object b)
+ {
+ return a.id.c.x == b.id.c.x && a.id.c.y == b.id.c.y &&
+ a.id.s == b.id.s && a.z == b.z && a.v == b.v;
+ }
+
+ #pragma db object
+ struct object1
+ {
+ #pragma db id auto
+ int id;
+
+ object* p;
+
+ object1 (object* p_ = 0): p (p_) {}
+ ~object1 () {delete p;}
+ };
+
+ inline bool
+ operator== (const object1& a, const object1& b)
+ {
+ return a.id == b.id && *a.p == *b.p;
+ }
+
+ // Multiple levels of nesting, just a compile test.
+ //
+ #pragma db object
+ struct object2
+ {
+ #pragma db id(c.x)
+ comp2 id;
+
+ int z;
+ };
+}
+
+// Custom/by-value access.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db value
+ struct comp
+ {
+ int x;
+
+ std::string get_y () const {return y;}
+ void set_y (std::string v) {y = v;}
+
+ #pragma db get(get_y) set(set_y)
+ std::string y;
+ };
+
+ #pragma db object
+ struct object
+ {
+ comp get_id () const {return id;}
+ void set_id (comp v) {id = v;}
+
+ #pragma db id(y) get(get_id) set(set_id)
+ comp id;
+
+ int z;
+
+ object () {}
+ object (int x, std::string y, int z_): z (z_) {id.x = x; id.y = y;}
+ };
+
+ inline bool
+ operator== (object a, object b)
+ {
+ return a.id.x == b.id.x && a.id.y == b.id.y && a.z == b.z;
+ }
+}
+
+// Polymorphic.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db value
+ struct comp
+ {
+ int x;
+ std::string y;
+ };
+
+ #pragma db object polymorphic
+ struct base
+ {
+ #pragma db id(y)
+ comp id;
+
+ virtual ~base () {}
+ base () {}
+ base (int x, std::string y) {id.x = x; id.y = y;}
+ };
+
+ inline bool
+ operator== (const base& a, const base& b)
+ {
+ return a.id.x == b.id.x && a.id.y == b.id.y;
+ }
+
+ #pragma db object
+ struct object: base
+ {
+ int z;
+
+ object () {}
+ object (int x, std::string y, int z_): base (x, y), z (z_) {}
+ };
+
+ inline bool
+ operator== (const object& a, const object& b)
+ {
+ return a.id.x == b.id.x && a.id.y == b.id.y && a.z == b.z;
+ }
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/id/nested/testscript b/odb-tests/common/id/nested/testscript
new file mode 100644
index 0000000..89e8d7a
--- /dev/null
+++ b/odb-tests/common/id/nested/testscript
@@ -0,0 +1,33 @@
+# file : common/nested/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/include/.gitignore b/odb-tests/common/include/.gitignore
new file mode 100644
index 0000000..d52f166
--- /dev/null
+++ b/odb-tests/common/include/.gitignore
@@ -0,0 +1,17 @@
+# ODB-generated files.
+#
+obj1-odb.?xx
+obj1-odb-*.?xx
+obj2-odb.?xx
+obj2-odb-*.?xx
+obj3-odb.?xx
+obj3-odb-*.?xx
+
+test1-odb.?xx
+test1-odb-*.?xx
+test2-odb.?xx
+test2-odb-*.?xx
+test3-odb.?xx
+test3-odb-*.?xx
+test4-odb.?xx
+test4-odb-*.?xx
diff --git a/odb-tests/common/include/buildfile b/odb-tests/common/include/buildfile
new file mode 100644
index 0000000..6db878c
--- /dev/null
+++ b/odb-tests/common/include/buildfile
@@ -0,0 +1,51 @@
+# file : common/include/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = obj1 obj2 obj3 test1 test2 test3 test4
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details). Also see driver.cxx for the details on
+# the -I options usage.
+#
+odb_options = --table-prefix include_ \
+ "-I$out_base" \
+ "-I$src_base/.." \
+ "-I$src_base/../.."
+
+cxx.poptions =+ "-I$out_base" "-I$src_base" \
+ "-I$out_base/../.." "-I$src_base/../.."
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/include/driver.cxx b/odb-tests/common/include/driver.cxx
new file mode 100644
index 0000000..561746a
--- /dev/null
+++ b/odb-tests/common/include/driver.cxx
@@ -0,0 +1,42 @@
+// file : common/include/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test inclusion of -odb files (compilation test).
+//
+// The setup of this test is as follows: the ODB compiler has two
+// additional include directories in its search path: .. and ../..
+// while the C++ compiler has only ../.. . This way, if a ..-based
+// path is used in the generated code, the C++ compilation will
+// fail.
+//
+
+#include <memory>
+#include <iostream>
+
+#include <odb/exceptions.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test1.hxx"
+#include "test1-odb.hxx"
+
+#include "test2.hxx"
+#include "test2-odb.hxx"
+
+#include "test3.hxx"
+#include "test3-odb.hxx"
+
+#include "test4.hxx"
+#include "test4-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main ()
+{
+}
diff --git a/odb-tests/common/include/obj1.hxx b/odb-tests/common/include/obj1.hxx
new file mode 100644
index 0000000..33ae0d6
--- /dev/null
+++ b/odb-tests/common/include/obj1.hxx
@@ -0,0 +1,25 @@
+// file : common/include/obj1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJ1_HXX
+#define OBJ1_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object1
+{
+ object1 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object1 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // OBJ1_HXX
diff --git a/odb-tests/common/include/obj2.hxx b/odb-tests/common/include/obj2.hxx
new file mode 100644
index 0000000..2f20f58
--- /dev/null
+++ b/odb-tests/common/include/obj2.hxx
@@ -0,0 +1,25 @@
+// file : common/include/obj2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJ2_HXX
+#define OBJ2_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object2
+{
+ object2 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object2 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // OBJ2_HXX
diff --git a/odb-tests/common/include/obj3.hxx b/odb-tests/common/include/obj3.hxx
new file mode 100644
index 0000000..432145b
--- /dev/null
+++ b/odb-tests/common/include/obj3.hxx
@@ -0,0 +1,25 @@
+// file : common/include/obj3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJ3_HXX
+#define OBJ3_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object3
+{
+ object3 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object3 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // OBJ3_HXX
diff --git a/odb-tests/common/include/objs1.hxx b/odb-tests/common/include/objs1.hxx
new file mode 100644
index 0000000..6e949e2
--- /dev/null
+++ b/odb-tests/common/include/objs1.hxx
@@ -0,0 +1,13 @@
+// file : common/include/objs1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJS1_HXX
+#define OBJS1_HXX
+
+#ifdef ODB_COMPILER
+# include <include/obj1.hxx>
+# include <include/obj2.hxx>
+# include <include/obj3.hxx>
+#endif
+
+#endif // OBJS1_HXX
diff --git a/odb-tests/common/include/objs2.hxx b/odb-tests/common/include/objs2.hxx
new file mode 100644
index 0000000..4f8133b
--- /dev/null
+++ b/odb-tests/common/include/objs2.hxx
@@ -0,0 +1,13 @@
+// file : common/include/objs2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJS2_HXX
+#define OBJS2_HXX
+
+#ifdef ODB_COMPILER
+# include "include/obj1.hxx"
+# include "include/obj2.hxx"
+# include "include/obj3.hxx"
+#endif
+
+#endif // OBJS2_HXX
diff --git a/odb-tests/common/include/objs3.hxx b/odb-tests/common/include/objs3.hxx
new file mode 100644
index 0000000..2f7aaff
--- /dev/null
+++ b/odb-tests/common/include/objs3.hxx
@@ -0,0 +1,11 @@
+// file : common/include/objs3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJS3_HXX
+#define OBJS3_HXX
+
+#include "../include/obj1.hxx"
+#include "../include/obj2.hxx"
+#include "../include/obj3.hxx"
+
+#endif // OBJS3_HXX
diff --git a/odb-tests/common/include/objs4.hxx b/odb-tests/common/include/objs4.hxx
new file mode 100644
index 0000000..d766fe6
--- /dev/null
+++ b/odb-tests/common/include/objs4.hxx
@@ -0,0 +1,11 @@
+// file : common/include/objs1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef OBJS4_HXX
+#define OBJS4_HXX
+
+#include <common/include/obj1.hxx>
+#include <common/include/obj2.hxx>
+#include <common/include/obj3.hxx>
+
+#endif // OBJS4_HXX
diff --git a/odb-tests/common/include/test1.hxx b/odb-tests/common/include/test1.hxx
new file mode 100644
index 0000000..1914ddb
--- /dev/null
+++ b/odb-tests/common/include/test1.hxx
@@ -0,0 +1,16 @@
+// file : common/include/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+// Test include directive parsing.
+//
+#include"obj1.hxx"
+
+ # include \
+ <common/include/obj2.hxx>
+
+/*comment*/ # /*comment*/ include /* comment */ "obj3.hxx" // comment
+
+#endif // TEST1_HXX
diff --git a/odb-tests/common/include/test2.hxx b/odb-tests/common/include/test2.hxx
new file mode 100644
index 0000000..6017ac4
--- /dev/null
+++ b/odb-tests/common/include/test2.hxx
@@ -0,0 +1,15 @@
+// file : common/include/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+// Test preference of includes from the main file.
+//
+#include "objs1.hxx"
+
+#include "obj1.hxx"
+#include "obj2.hxx"
+#include "obj3.hxx"
+
+#endif // TEST2_HXX
diff --git a/odb-tests/common/include/test3.hxx b/odb-tests/common/include/test3.hxx
new file mode 100644
index 0000000..e55ecdb
--- /dev/null
+++ b/odb-tests/common/include/test3.hxx
@@ -0,0 +1,12 @@
+// file : common/include/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+// Test preference of longer (more qualified) paths.
+//
+#include "objs2.hxx"
+#include "objs3.hxx"
+
+#endif // TEST3_HXX
diff --git a/odb-tests/common/include/test4.hxx b/odb-tests/common/include/test4.hxx
new file mode 100644
index 0000000..b58e679
--- /dev/null
+++ b/odb-tests/common/include/test4.hxx
@@ -0,0 +1,12 @@
+// file : common/include/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+// Test preference of <> over "".
+//
+#include "objs2.hxx"
+#include "objs4.hxx"
+
+#endif // TEST3_HXX
diff --git a/odb-tests/common/include/testscript b/odb-tests/common/include/testscript
new file mode 100644
index 0000000..089f7a1
--- /dev/null
+++ b/odb-tests/common/include/testscript
@@ -0,0 +1,31 @@
+# file : common/include/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $* &!odb-test.db
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/index/buildfile b/odb-tests/common/index/buildfile
new file mode 100644
index 0000000..535bd26
--- /dev/null
+++ b/odb-tests/common/index/buildfile
@@ -0,0 +1,40 @@
+# file : common/index/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix index_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/index/driver.cxx b/odb-tests/common/index/driver.cxx
new file mode 100644
index 0000000..7a22a7c
--- /dev/null
+++ b/odb-tests/common/index/driver.cxx
@@ -0,0 +1,44 @@
+// file : common/index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test index creation with db pragma index. See also database-specific
+// tests.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ // This is just a schema creation test.
+ //
+ unique_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/index/test.hxx b/odb-tests/common/index/test.hxx
new file mode 100644
index 0000000..f27783f
--- /dev/null
+++ b/odb-tests/common/index/test.hxx
@@ -0,0 +1,142 @@
+// file : common/index/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Test basic functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id_;
+
+ #pragma db index
+ int i1;
+
+ #pragma db unique
+ int i2;
+
+ #pragma db unique index
+ int i3;
+
+ int i4;
+ #pragma db index unique member(i4)
+
+ int i5;
+ #pragma db index type("UNIQUE") member(i5)
+
+ int i6;
+ #pragma db index("object_i6_index") member(i6)
+
+ int i7;
+ int i8;
+ int i9;
+
+ int i10;
+ #pragma db index member(i10, "ASC")
+ };
+
+ #pragma db index(object) member(i7)
+ #pragma db index(object::"object_i8_index") member(i8)
+}
+
+#pragma db index(test1::object::"object_i9_index") member(i9)
+
+// Test composite indexes.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db value
+ struct nested
+ {
+ int x;
+ int y;
+ };
+
+ #pragma db value
+ struct comp
+ {
+ int x;
+ int y;
+ nested n;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id_;
+
+ int i1a;
+ int i1b;
+ #pragma db index("object_i1_i") member(i1a) member(i1b)
+
+ int i2a;
+ int i2b;
+ #pragma db index("object_i2_i") members(i2a, i2b)
+
+ #pragma db index
+ comp c1;
+
+ #pragma db index column("")
+ comp c2;
+
+ comp c3;
+ #pragma db index member(c3.x)
+ #pragma db index member(c3.y)
+
+ comp c4;
+ #pragma db index("object_c4_i") members(c4.x, c4.y, c4.n.x)
+
+ comp c5;
+ int i5;
+ #pragma db index("object_ci5_i") member(c5) member(i5)
+ };
+}
+
+// Test container indexes.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db value
+ struct id
+ {
+ int x;
+ int y;
+ };
+
+ #pragma db value
+ struct comp
+ {
+ int x;
+ std::vector<int> v;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ id id_;
+
+ std::vector<int> v;
+ #pragma db index unique member(v.id)
+ #pragma db index("object_v_index_index") member(v.index)
+
+ comp c;
+ #pragma db index("object_c_v_id_index") member(c.v.id)
+ #pragma db index unique member(c.v.index)
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/index/testscript b/odb-tests/common/index/testscript
new file mode 100644
index 0000000..cbce341
--- /dev/null
+++ b/odb-tests/common/index/testscript
@@ -0,0 +1,33 @@
+# file : common/index/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/inheritance/polymorphism/.gitignore b/odb-tests/common/inheritance/polymorphism/.gitignore
new file mode 100644
index 0000000..f183a6f
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/.gitignore
@@ -0,0 +1,76 @@
+# ODB-generated files.
+#
+test1-odb.?xx
+test1-odb-*.?xx
+test1.sql
+test1-*.sql
+
+test2-odb.?xx
+test2-odb-*.?xx
+test2.sql
+test2-*.sql
+
+test3-odb.?xx
+test3-odb-*.?xx
+test3.sql
+test3-*.sql
+
+test4-odb.?xx
+test4-odb-*.?xx
+test4.sql
+test4-*.sql
+
+test5-odb.?xx
+test5-odb-*.?xx
+test5.sql
+test5-*.sql
+
+test6-odb.?xx
+test6-odb-*.?xx
+test6.sql
+test6-*.sql
+
+test7-odb.?xx
+test7-odb-*.?xx
+test7.sql
+test7-*.sql
+
+test8-odb.?xx
+test8-odb-*.?xx
+test8.sql
+test8-*.sql
+
+test9-odb.?xx
+test9-odb-*.?xx
+test9.sql
+test9-*.sql
+
+test10-odb.?xx
+test10-odb-*.?xx
+test10.sql
+test10-*.sql
+
+test11-odb.?xx
+test11-odb-*.?xx
+test11.sql
+test11-*.sql
+
+test12-odb.?xx
+test12-odb-*.?xx
+test12.sql
+test12-*.sql
+
+test13-odb.?xx
+test13-odb-*.?xx
+test13.sql
+test13-*.sql
+
+test14-odb.?xx
+test14-odb-*.?xx
+test14.sql
+test14-*.sql
+
+test15-odb.?xx
+test15-odb-*.?xx
+test15.sql
+test15-*.sql
diff --git a/odb-tests/common/inheritance/polymorphism/buildfile b/odb-tests/common/inheritance/polymorphism/buildfile
new file mode 100644
index 0000000..846eb12
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/buildfile
@@ -0,0 +1,52 @@
+# file : common/inheritance/polymorphism/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
+ test12 test13 test14 test15
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix inhrt_p_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
+
+testscript@./: schemas = $hs
diff --git a/odb-tests/common/inheritance/polymorphism/driver.cxx b/odb-tests/common/inheritance/polymorphism/driver.cxx
new file mode 100644
index 0000000..12f4666
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/driver.cxx
@@ -0,0 +1,2093 @@
+// file : common/inheritance/polymorphism/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test polymorphic object inheritance.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test1.hxx"
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test4.hxx"
+#include "test5.hxx"
+#include "test6.hxx"
+#include "test7.hxx"
+#include "test8.hxx"
+#include "test9.hxx"
+#include "test10.hxx"
+#include "test11.hxx"
+#include "test12.hxx"
+#include "test13.hxx"
+#include "test14.hxx"
+#include "test15.hxx"
+
+#include "test1-odb.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+#include "test4-odb.hxx"
+#include "test5-odb.hxx"
+#include "test6-odb.hxx"
+#include "test7-odb.hxx"
+#include "test8-odb.hxx"
+#include "test9-odb.hxx"
+#include "test10-odb.hxx"
+#include "test11-odb.hxx"
+#include "test12-odb.hxx"
+#include "test13-odb.hxx"
+#include "test14-odb.hxx"
+#include "test15-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+const char* events[] =
+{
+ "pre_persist",
+ "post_persist",
+ "pre_load",
+ "post_load",
+ "pre_update",
+ "post_update",
+ "pre_erase",
+ "post_erase"
+};
+
+namespace test6
+{
+ void base::
+ db_callback (callback_event e, database&)
+ {
+ cout << "base " << events[e] << " " << id << endl;
+ }
+
+ void base::
+ db_callback (callback_event e, database&) const
+ {
+ cout << "base " << events[e] << " " << id << " const" << endl;
+ }
+
+ void derived::
+ db_callback (callback_event e, database&) const
+ {
+ cout << "derived " << events[e] << " " << id << " const" << endl;
+ }
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test 1: basic polymorphism functionality.
+ //
+ {
+ using namespace test1;
+
+ root r (1, 1);
+ base b (2, 2, "bbb");
+ derived d (3, 3, "ddd");
+
+ r.strs.push_back ("a");
+ r.strs.push_back ("aa");
+ r.strs.push_back ("aaa");
+
+ b.nums.push_back (21);
+ b.nums.push_back (22);
+ b.nums.push_back (23);
+ b.strs.push_back ("b");
+ b.strs.push_back ("bb");
+ b.strs.push_back ("bbb");
+
+ d.nums.push_back (31);
+ d.nums.push_back (32);
+ d.nums.push_back (33);
+ d.strs.push_back ("d");
+ d.strs.push_back ("dd");
+ d.strs.push_back ("ddd");
+
+ {
+ transaction t (db->begin ());
+
+ // Static persist.
+ //
+ db->persist (r);
+ db->persist (b);
+
+ // Dynamic persist.
+ //
+ root& r (d);
+ db->persist (r);
+
+ t.commit ();
+ }
+
+ // Static load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+ t.commit ();
+
+ assert (*pr == r);
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+
+ // Dynamic load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd1 (db->load<root> (d.id));
+ unique_ptr<base> pd2 (db->load<base> (d.id));
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd1 == d);
+ assert (*pd2 == d);
+ }
+
+ // Invalid load.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ unique_ptr<base> p (db->load<base> (r.id));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ try
+ {
+ unique_ptr<derived> p (db->load<derived> (b.id));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ t.commit ();
+ }
+
+ // Static load into existing instance.
+ //
+ {
+ transaction t (db->begin ());
+ root r1;
+ db->load (r.id, r1);
+ base b1;
+ db->load (b.id, b1);
+ derived d1;
+ db->load (d.id, d1);
+ t.commit ();
+
+ assert (r1 == r);
+ assert (b1 == b);
+ assert (d1 == d);
+ }
+
+ // Dynamic load into existing instance.
+ //
+ {
+ transaction t (db->begin ());
+ base b1;
+ db->load (b.id, static_cast<root&> (b1));
+ derived d1;
+ db->load (d.id, static_cast<base&> (d1));
+ t.commit ();
+
+ assert (b1 == b);
+ assert (d1 == d);
+ }
+
+ // Invalid load into existing instance.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ base b;
+ db->load (r.id, static_cast<root&> (b));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ try
+ {
+ derived d;
+ db->load (b.id, static_cast<base&> (d));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ t.commit ();
+ }
+
+ // Slicing load.
+ //
+ {
+ transaction t (db->begin ());
+ root b1;
+ db->load (b.id, b1);
+ base d1;
+ db->load (d.id, d1);
+ t.commit ();
+
+ assert (b1 == static_cast<root> (b));
+ assert (d1 == static_cast<base> (d));
+ }
+
+ // Static reload.
+ //
+ {
+ transaction t (db->begin ());
+ root r1;
+ r1.id = r.id;
+ db->reload (r1);
+ base b1;
+ b1.id = b.id;
+ db->reload (b1);
+ derived d1;
+ d1.id = d.id;
+ db->reload (d1);
+ t.commit ();
+
+ assert (r1 == r);
+ assert (b1 == b);
+ assert (d1 == d);
+ }
+
+ // Dynamic reload.
+ //
+ {
+ transaction t (db->begin ());
+ base b1;
+ b1.id = b.id;
+ db->reload (static_cast<root&> (b1));
+ derived d1;
+ d1.id = d.id;
+ db->reload (static_cast<base&> (d1));
+ t.commit ();
+
+ assert (b1 == b);
+ assert (d1 == d);
+ }
+
+ // Invalid reload.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ base b;
+ b.id = r.id;
+ db->reload (static_cast<root&> (b));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ try
+ {
+ derived d;
+ d.id = b.id;
+ db->reload (static_cast<base&> (d));
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ t.commit ();
+ }
+
+ // Slicing reload.
+ //
+ {
+ transaction t (db->begin ());
+ root b1;
+ b1.id = b.id;
+ db->reload (b1);
+ base d1;
+ d1.id = d.id;
+ db->reload (d1);
+ t.commit ();
+
+ assert (b1 == static_cast<root> (b));
+ assert (d1 == static_cast<base> (d));
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<root> root_query;
+ typedef odb::result<root> root_result;
+
+ typedef odb::query<base> base_query;
+ typedef odb::result<base> base_result;
+
+ typedef odb::result<derived> derived_result;
+
+ transaction t (db->begin ());
+
+ // Test loading via root.
+ //
+ {
+ root_result qr (db->query<root> ("ORDER BY" + root_query::id));
+ root_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == r);
+ assert (++i != e && *i == b);
+ assert (++i != e && *i == d);
+ assert (++i == e);
+ }
+
+ // Test loading via base.
+ //
+ {
+ base_result qr (db->query<base> ("ORDER BY" + base_query::id));
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == b);
+ assert (++i != e && *i == d);
+ assert (++i == e);
+ }
+
+ // Test loading via derived.
+ //
+ {
+ derived_result qr (db->query<derived> ());
+ derived_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == d);
+ assert (++i == e);
+ }
+
+ // Test loading into an existing instance.
+ //
+ {
+ root_result qr (db->query<root> ());
+
+ unsigned short mask (0);
+
+ for (root_result::iterator i (qr.begin ()); i != qr.end (); ++i)
+ {
+ string ds (i.discriminator ());
+
+ if (ds == "test1::root")
+ {
+ root r1;
+ i.load (r1);
+ assert (r1 == r);
+ mask |= 1;
+ }
+ else if (ds == "test1::base")
+ {
+ base b1;
+ i.load (b1);
+ assert (b1 == b);
+ mask |= 2;
+ }
+ else if (ds == "test1::derived")
+ {
+ derived d1;
+ i.load (d1);
+ assert (d1 == d);
+ mask |= 4;
+ }
+ else
+ assert (false);
+ }
+
+ assert (mask == 7);
+ }
+
+ // Test query conditions with columns from multiple tables.
+ //
+ {
+ base_result qr (
+ db->query<base> (
+ base_query::num == 3 && base_query::str == "ddd"));
+
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == d);
+ assert (++i == e);
+ }
+
+ // Test discriminator access.
+ //
+ {
+ base_result qr (db->query<base> (base_query::id == 3));
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i.discriminator () == "test1::derived");
+ assert (++i == e);
+ }
+
+ // Test loading of an object from the same hierarchy during
+ // query result iteration (tests image copying via change
+ // callbacks in some databases).
+ //
+ {
+ base_result qr (db->query<base> ());
+
+ unsigned short mask (0);
+
+ for (base_result::iterator i (qr.begin ()); i != qr.end (); ++i)
+ {
+ string ds (i.discriminator ());
+
+ if (ds == "test1::base")
+ {
+ unique_ptr<derived> d1 (db->load<derived> (d.id));
+ assert (*d1 == d);
+ assert (*i == b);
+ mask |= 1;
+ }
+ else if (ds == "test1::derived")
+ {
+ unique_ptr<base> b1 (db->load<base> (b.id));
+ assert (*b1 == b);
+ assert (*i == d);
+ mask |= 2;
+ }
+ }
+
+ assert (mask == 3);
+ }
+
+ t.commit ();
+ }
+
+ // Views.
+ //
+ {
+ typedef odb::query<root_view> root_query;
+ typedef odb::result<root_view> root_result;
+
+ typedef odb::query<base_view> base_query;
+ typedef odb::result<base_view> base_result;
+
+ typedef odb::result<derived_view> derived_result;
+
+ transaction t (db->begin ());
+
+ // root
+ //
+ {
+ root_result qr (db->query<root_view> ("ORDER BY" + root_query::id));
+ root_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i->typeid_ == "test1::root" && i->num == r.num);
+ assert (++i != e && i->typeid_ == "test1::base" && i->num == b.num);
+ assert (++i != e && i->typeid_ == "test1::derived" && i->num == d.num);
+ assert (++i == e);
+ }
+
+ // base
+ //
+ {
+ base_result qr (db->query<base_view> ("ORDER BY" + base_query::id));
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->id == b.id && i->num == b.num && i->str == b.str);
+ assert (++i != e &&
+ i->id == d.id && i->num == d.num && i->str == d.str);
+ assert (++i == e);
+ }
+
+ // derived
+ //
+ {
+ derived_result qr (db->query<derived_view> ());
+ derived_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->num == d.num && i->str == d.str &&
+ i->dnum == d.dnum && i->dstr == d.dstr);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ r.num++;
+ r.strs.push_back ("aaaa");
+
+ b.num++;
+ b.str += "b";
+ b.nums.push_back (24);
+ b.strs.push_back ("bbbb");
+
+ d.num++;
+ d.str += "d";
+ d.dnum++;
+ d.dstr += "d";
+ d.nums.push_back (34);
+ d.strs.push_back ("dddd");
+
+ {
+ transaction t (db->begin ());
+
+ // Static update.
+ //
+ db->update (r);
+ db->update (b);
+
+ // Dynamic update.
+ //
+ root& r (d);
+ db->update (r);
+
+ t.commit ();
+ }
+
+ // Verify update.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+ t.commit ();
+
+ assert (*pr == r);
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+
+ // Invalid erase via id.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->erase<base> (r.id);
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ try
+ {
+ db->erase<derived> (b.id);
+ assert (false);
+ }
+ catch (const object_not_persistent&) {}
+
+ t.commit ();
+ }
+
+ // Static erase via id.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase<root> (r.id);
+ db->erase<base> (b.id);
+ t.commit ();
+ }
+
+ // Dynamic erase via id.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase<root> (d.id);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->persist (r);
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+ }
+
+ // Static erase via object.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (r);
+ db->erase (b);
+ t.commit ();
+ }
+
+ // Dynamic erase via object.
+ //
+ {
+ const root& r (d);
+ transaction t (db->begin ());
+ db->erase (r);
+ t.commit ();
+ }
+ }
+
+ // Test 2: inverse object pointers in polymorhic bases.
+ //
+ {
+ using namespace test2;
+
+ derived d (1, "d", 1);
+ root_pointer rp (&d);
+ base_pointer bp (&d);
+
+ {
+ transaction t (db->begin ());
+ db->persist (rp);
+ db->persist (bp);
+
+ d.rp.reset (*db, &rp);
+ d.bp.reset (*db, &bp);
+
+ db->persist (d);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+ unique_ptr<base> pb (db->load<base> (d.id));
+ unique_ptr<root> pr (db->load<root> (d.id));
+ t.commit ();
+
+ assert (pd->rp.object_id<root_pointer> () == rp.id &&
+ pd->bp.object_id<base_pointer> () == bp.id);
+
+ derived* p (dynamic_cast<derived*> (pb.get ()));
+ assert (p != 0 &&
+ p->rp.object_id<root_pointer> () == rp.id &&
+ p->bp.object_id<base_pointer> () == bp.id);
+
+ p = dynamic_cast<derived*> (pr.get ());
+ assert (p != 0 &&
+ p->rp.object_id<root_pointer> () == rp.id &&
+ p->bp.object_id<base_pointer> () == bp.id);
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<base> base_query;
+ typedef odb::result<base> base_result;
+
+ transaction t (db->begin ());
+
+ // Test query conditions with columns in pointed-to objects from
+ // multiple tables.
+ //
+ {
+ base_result qr (
+ db->query<base> (
+ base_query::rp->id == rp.id &&
+ base_query::bp->id == bp.id));
+
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i.discriminator () == "test2::derived");
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+
+ // Views.
+ //
+ {
+ typedef odb::result<root_view> root_result;
+ typedef odb::result<base_view> base_result;
+
+ transaction t (db->begin ());
+
+ // root
+ //
+ {
+ root_result qr (db->query<root_view> ());
+ root_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i->rp_id == rp.id && i->r_id == d.id);
+ assert (++i == e);
+ }
+
+ // base
+ //
+ {
+ base_result qr (db->query<base_view> ());
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->bp_id == bp.id && i->b_id == d.id && i->str == d.str);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 3: delayed loading.
+ //
+ {
+ using namespace test3;
+
+ base b1 (21, 21);
+ base b2 (22, 22);
+ base b3 (23, 23);
+
+ derived d1 (31, 31, "d");
+ derived d2 (32, 32, "dd");
+ derived d3 (33, 33, "ddd");
+
+ b1.rptr = new root (1);
+ b2.rptr = new base (2, 2);
+ b3.rptr = new derived (3, 3, "b3");
+
+ d1.rptr = new root (4);
+ d2.rptr = new base (5, 5);
+ d3.rptr = new derived (6, 6, "d3");
+
+ d2.bptr = new base (7, 7);
+ d3.bptr = new derived (8, 8, "d3b");
+
+ {
+ transaction t (db->begin ());
+ db->persist (b1);
+ db->persist (b2);
+ db->persist (b3);
+
+ db->persist (d1);
+ db->persist (d2);
+ db->persist (d3);
+
+ db->persist (b1.rptr);
+ db->persist (b2.rptr);
+ db->persist (b3.rptr);
+
+ db->persist (d1.rptr);
+ db->persist (d2.rptr);
+ db->persist (d3.rptr);
+
+ db->persist (d2.bptr);
+ db->persist (d3.bptr);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ {
+ unique_ptr<base> p1 (db->load<base> (b1.id));
+ unique_ptr<base> p2 (db->load<base> (b2.id));
+ unique_ptr<root> p3 (db->load<root> (b3.id));
+ assert (*p1 == b1);
+ assert (*p2 == b2);
+ assert (*p3 == b3);
+ }
+
+ {
+ unique_ptr<derived> p1 (db->load<derived> (d1.id));
+ unique_ptr<base> p2 (db->load<base> (d2.id));
+ unique_ptr<root> p3 (db->load<root> (d3.id));
+ assert (*p1 == d1);
+ assert (*p2 == d2);
+ assert (*p3 == d3);
+ }
+
+ t.commit ();
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<derived> derived_query;
+ typedef odb::result<derived> derived_result;
+
+ transaction t (db->begin ());
+
+ // Test query conditions with columns in pointed-to objects from
+ // multiple tables.
+ //
+ {
+ derived_result qr (
+ db->query<derived> (
+ derived_query::rptr->id == 6 &&
+ derived_query::bptr->id == 8 &&
+ derived_query::bptr->num == 8));
+
+ derived_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == d3);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+
+ // Views.
+ //
+ {
+ typedef odb::query<base_view> base_query;
+ typedef odb::result<base_view> base_result;
+
+ typedef odb::query<derived_view> derived_query;
+ typedef odb::result<derived_view> derived_result;
+
+ typedef odb::query<root_view> root_query;
+ typedef odb::result<root_view> root_result;
+
+ transaction t (db->begin ());
+
+ // base
+ //
+ {
+ base_result qr (
+ db->query<base_view> (
+ base_query::base::num == b2.num &&
+ base_query::base::id == b2.id &&
+ base_query::r::id == b2.rptr->id));
+
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->b_id == b2.id &&
+ i->r_id == b2.rptr->id &&
+ i->num == b2.num);
+ assert (++i == e);
+ }
+
+ // derived
+ //
+ {
+ derived_result qr (
+ db->query<derived_view> (
+ derived_query::d::str == d3.str &&
+ derived_query::d::num == d3.num &&
+ derived_query::b::num == d3.bptr->num &&
+ derived_query::d::id == d3.id &&
+ derived_query::b::id == d3.bptr->id &&
+ derived_query::r::id == d3.rptr->id));
+
+ derived_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->d_id == d3.id &&
+ i->b_id == d3.bptr->id &&
+ i->r_id == d3.rptr->id &&
+ i->d_num == d3.num &&
+ i->b_num == d3.bptr->num &&
+ i->str == d3.str);
+ assert (++i == e);
+ }
+
+ // root
+ //
+ {
+ root_result qr (
+ db->query<root_view> (
+ root_query::r::id.in (b2.rptr->id, d2.rptr->id)));
+
+ root_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e &&
+ i->r_id == d2.rptr->id &&
+ i->d_id == d2.id &&
+ i->str == d2.str);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 4: views.
+ //
+ {
+ using namespace test4;
+
+ base1 b1 (21, 1);
+
+ root2 r2 (11, 0);
+ base2 b2 (21, 1, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (b1);
+ db->persist (r2);
+ db->persist (b2);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view1> query;
+ typedef odb::result<view1> result;
+
+ transaction t (db->begin ());
+
+ {
+ result qr (
+ db->query<view1> (
+ query::base1::num == b1.num));
+
+ result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i->str == "abc");
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<view2> result;
+
+ transaction t (db->begin ());
+
+ {
+ result qr (db->query<view2> ());
+ result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i->min_num == 1);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<view3> result;
+
+ transaction t (db->begin ());
+
+ {
+ result qr (db->query<view3> ());
+ result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && i->str == "abc");
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 5: polymorphism and optimistic concurrency.
+ //
+ {
+ using namespace test5;
+
+ root r (1, 1);
+ base b (2, 2, "bbb");
+ derived d (3, 3, "ddd");
+
+ r.strs.push_back ("a");
+ r.strs.push_back ("aa");
+ r.strs.push_back ("aaa");
+
+ b.nums.push_back (21);
+ b.nums.push_back (22);
+ b.nums.push_back (23);
+ b.strs.push_back ("b");
+ b.strs.push_back ("bb");
+ b.strs.push_back ("bbb");
+
+ d.nums.push_back (31);
+ d.nums.push_back (32);
+ d.nums.push_back (33);
+ d.strs.push_back ("d");
+ d.strs.push_back ("dd");
+ d.strs.push_back ("ddd");
+
+ {
+ transaction t (db->begin ());
+ db->persist (r);
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+ }
+
+ // Update.
+ //
+ {
+ transaction t (db->begin ());
+
+ // Root.
+ //
+ {
+ unique_ptr<root> p (db->load<root> (r.id));
+
+ r.num++;
+ r.strs.push_back ("aaaa");
+ db->update (r);
+
+ p->num--;
+ p->strs.pop_back ();
+ try
+ {
+ db->update (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ // Make sure the object is intact.
+ //
+ db->reload (p);
+ assert (r == *p);
+ }
+
+ // Base.
+ //
+ {
+ unique_ptr<base> p (db->load<base> (b.id));
+
+ b.num++;
+ b.str += "b";
+ b.strs.push_back ("bbbb");
+ b.nums.push_back (24);
+ db->update (b);
+
+ p->num--;
+ p->str += "B";
+ p->strs.pop_back ();
+ p->nums.pop_back ();
+ try
+ {
+ db->update (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ // Make sure the object is intact.
+ //
+ db->reload (p);
+ assert (b == *p);
+ }
+
+ // Derived.
+ //
+ {
+ unique_ptr<root> p (db->load<root> (d.id)); // Via root.
+
+ d.num++;
+ d.str += "d";
+ d.strs.push_back ("dddd");
+ d.nums.push_back (24);
+ d.dnum++;
+ d.dstr += "d";
+ db->update (d);
+
+ derived& d1 (static_cast<derived&> (*p));
+ d1.num--;
+ d1.str += "D";
+ d1.strs.pop_back ();
+ d1.nums.pop_back ();
+ d1.dnum--;
+ d1.dstr += "D";
+ try
+ {
+ db->update (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ // Make sure the object is intact.
+ //
+ db->reload (p);
+ assert (d == *p);
+ }
+
+ t.commit ();
+ }
+
+ // Reload.
+ //
+ {
+ transaction t (db->begin ());
+
+ // Make sure reload doesn't modify the object if the versions
+ // match.
+ //
+ derived d1 (d);
+ d1.num++;
+ d1.str += "d";
+ d1.strs.push_back ("dddd");
+ d1.nums.push_back (24);
+ d1.dnum++;
+ d1.dstr += "d";
+ derived d2 (d1);
+
+ db->reload (d1);
+ assert (d1 == d2);
+
+ t.commit ();
+ }
+
+ // Erase.
+ //
+ {
+ transaction t (db->begin ());
+
+ // Root.
+ //
+ {
+ unique_ptr<root> p (db->load<root> (r.id));
+
+ r.num++;
+ r.strs.push_back ("aaaaa");
+ db->update (r);
+
+ try
+ {
+ db->erase (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ db->reload (p);
+ db->erase (p);
+ }
+
+ // Base.
+ //
+ {
+ unique_ptr<base> p (db->load<base> (b.id));
+
+ b.num++;
+ b.str += "b";
+ b.strs.push_back ("bbbb");
+ b.nums.push_back (24);
+ db->update (b);
+
+ try
+ {
+ db->erase (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ db->reload (p);
+ db->erase (p);
+ }
+
+ // Derived.
+ //
+ {
+ unique_ptr<root> p (db->load<root> (d.id)); // Via root.
+
+ d.num++;
+ d.str += "d";
+ d.strs.push_back ("dddd");
+ d.nums.push_back (24);
+ d.dnum++;
+ d.dstr += "d";
+ db->update (d);
+
+ try
+ {
+ db->erase (p);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+
+ db->reload (p);
+ db->erase (p);
+ }
+
+ // Try to update non-existent object.
+ //
+ {
+ try
+ {
+ db->update (d);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+ }
+
+ // Try to erase non-existent object.
+ //
+ {
+ try
+ {
+ db->erase (d);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 6: polymorphism and callbacks.
+ //
+ {
+ using namespace test6;
+
+ base b (1, 1, "bbb");
+
+ unique_ptr<base> d (new derived (2, 2, "ddd"));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<root> pd (db->load<root> (d->id));
+
+ db->load (b.id, *pb);
+ db->load (d->id, *pd);
+
+ db->reload (*pb);
+ db->reload (*pd);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ {
+ b.num++;
+ d->num++;
+
+ transaction t (db->begin ());
+ db->update (b);
+ db->update (d);
+ t.commit ();
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<base> ("ORDER BY" + query::id));
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ *i;
+
+ t.commit ();
+ }
+
+ // Erase.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (b);
+ db->erase (d);
+ t.commit ();
+ }
+
+ // Recursive (delayed) loading.
+ //
+ {
+ derived d (3, 3, "dddd");
+ d.ptr.reset (new derived (4, 4, "ddddd"));
+
+ {
+ transaction t (db->begin ());
+ db->persist (d);
+ db->persist (d.ptr);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<root> p (db->load<root> (d.id));
+ t.commit ();
+ }
+ }
+ }
+
+ // Test 7: polymorphism and object cache (session).
+ //
+ {
+ using namespace test7;
+
+ shared_ptr<root> r (new root (1, 1));
+ shared_ptr<base> b (new base (2, 2, "b"));
+ shared_ptr<root> d (new derived (3, 3, "d"));
+
+ // Persist.
+ //
+ {
+ session s;
+
+ {
+ transaction t (db->begin ());
+ db->persist (r);
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+ }
+
+ assert (db->load<root> (r->id) == r);
+ assert (db->load<base> (b->id) == b);
+ assert (db->load<root> (d->id) == d);
+ }
+
+ // Load.
+ //
+ {
+ session s;
+
+ transaction t (db->begin ());
+ shared_ptr<root> r1 (db->load<root> (r->id));
+ shared_ptr<base> b1 (db->load<base> (b->id));
+ shared_ptr<derived> d1 (db->load<derived> (d->id));
+ t.commit ();
+
+ assert (db->load<root> (r->id) == r1);
+ assert (db->load<base> (b->id) == b1);
+ assert (db->load<root> (d->id) == d1);
+
+ assert (!db->find<derived> (b->id));
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<root> query;
+ typedef odb::result<root> result;
+
+ session s;
+
+ transaction t (db->begin ());
+ shared_ptr<root> r1 (db->load<root> (r->id));
+ shared_ptr<base> b1 (db->load<base> (b->id));
+ shared_ptr<derived> d1 (db->load<derived> (d->id));
+ t.commit ();
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<root> ("ORDER BY" + query::id));
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e && i.load () == r1);
+ assert (++i != e && i.load () == b1);
+ assert (++i != e && i.load () == d1);
+ assert (++i == e);
+
+ t.commit ();
+ }
+ }
+
+ // Erase.
+ //
+ {
+ session s;
+
+ {
+ transaction t (db->begin ());
+ db->load<root> (r->id);
+ db->load<root> (b->id);
+ db->load<root> (d->id);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (r);
+ db->erase (b);
+ db->erase (d);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (!db->find<root> (r->id));
+ assert (!db->find<base> (b->id));
+ assert (!db->find<root> (d->id));
+ t.commit ();
+ }
+ }
+ }
+
+ // Test 8: polymorphism and abstract bases.
+ //
+ {
+ using namespace test8;
+
+ base b (1, 1, "b");
+ interm i (2, 2, "i", true);
+ derived1 d1 (3, 3, "d1", true);
+ derived2 d2 (4, 4, "d2", false);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (static_cast<root&> (d1));
+ db->persist (static_cast<interm&> (d2));
+
+ try
+ {
+ db->persist (i);
+ assert (false);
+ }
+ catch (const odb::abstract_class&) {}
+
+ try
+ {
+ db->persist (static_cast<base&> (i));
+ assert (false);
+ }
+ catch (const odb::no_type_info&) {}
+
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ base vb;
+ interm vi;
+ derived1 vd1;
+ derived2 vd2;
+
+ transaction t (db->begin ());
+
+ // load (id)
+ //
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<interm> pd1 (db->load<interm> (d1.id));
+ unique_ptr<derived2> pd2 (db->load<derived2> (d2.id));
+
+ assert (*pb == b);
+ assert (*pd1 == d1);
+ assert (*pd2 == d2);
+
+ // load (id, obj)
+ //
+ db->load (b.id, static_cast<root&> (vb));
+ db->load (d1.id, static_cast<base&> (vd1));
+ db->load (d2.id, static_cast<interm&> (vd2));
+
+ assert (vb == b);
+ assert (vd1 == d1);
+ assert (vd2 == d2);
+
+ try
+ {
+ db->load (i.id, static_cast<root&> (vi));
+ assert (false);
+ }
+ catch (const odb::no_type_info&) {}
+
+ // reload (obj)
+ //
+ vb.num = 0;
+ vd1.num = 0;
+ vd2.num = 0;
+
+ db->reload (static_cast<root&> (vb));
+ db->reload (static_cast<base&> (vd1));
+ db->reload (static_cast<interm&> (vd2));
+
+ assert (vb == b);
+ assert (vd1 == d1);
+ assert (vd2 == d2);
+
+ try
+ {
+ db->reload (static_cast<root&> (vi));
+ assert (false);
+ }
+ catch (const odb::no_type_info&) {}
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ {
+ b.num++;
+ b.str += 'b';
+ d1.num++;
+ d1.str += "d1";
+ d2.num++;
+ d2.str += "d1";
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<root&> (b));
+ db->update (d1);
+ db->update (static_cast<interm&> (d2));
+
+ try
+ {
+ db->update (i);
+ assert (false);
+ }
+ catch (const odb::abstract_class&) {}
+
+ try
+ {
+ db->update (static_cast<base&> (i));
+ assert (false);
+ }
+ catch (const odb::no_type_info&) {}
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<root> pd1 (db->load<root> (d1.id));
+ unique_ptr<base> pd2 (db->load<base> (d2.id));
+
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd1 == d1);
+ assert (*pd2 == d2);
+ }
+ }
+
+ // Erase.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (b);
+ db->erase<interm> (d1.id);
+ db->erase (static_cast<root&> (d2));
+
+ try
+ {
+ db->erase (i);
+ assert (false);
+ }
+ catch (const odb::abstract_class&) {}
+
+ try
+ {
+ db->erase (static_cast<base&> (i));
+ assert (false);
+ }
+ catch (const odb::no_type_info&) {}
+
+ t.commit ();
+ }
+ }
+
+ // Test 9: polymorphism and readonly classes.
+ //
+ {
+ using namespace test9;
+
+ ro_root ro_r (1, 1);
+ rw_base rw_b (2, 2, "b");
+ ro_derived ro_d (3, 3, "d");
+
+ rw_root rw_r (1, 1);
+ ro_base ro_b (2, 2, "b");
+ rw_derived rw_d (3, 3, "d");
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (ro_r);
+ db->persist (rw_b);
+ db->persist (ro_d);
+
+ db->persist (rw_r);
+ db->persist (ro_b);
+ db->persist (rw_d);
+ t.commit ();
+ }
+
+ // Update.
+ //
+ {
+ ro_root ro_r1 (ro_r);
+ rw_base rw_b1 (rw_b);
+ ro_derived ro_d1 (ro_d);
+
+ ro_base ro_b1 (ro_b);
+ rw_derived rw_d1 (rw_d);
+
+ ro_r1.num++;
+ ro_r1.strs.push_back ("b");
+
+ rw_b1.num++;
+ rw_b1.strs.push_back ("b");
+ rw_b1.str += "b";
+ rw_b1.nums.push_back (2);
+ rw_b.str += "b";
+ rw_b.nums.push_back (2);
+
+ ro_d1.num++;
+ ro_d1.strs.push_back ("d");
+ ro_d1.str += "d";
+ ro_d1.nums.push_back (3);
+ ro_d1.dnum++;
+ ro_d1.dstr += "d";
+
+ rw_r.num++;
+ rw_r.strs.push_back ("b");
+
+ ro_b1.num++;
+ ro_b1.strs.push_back ("b");
+ ro_b1.str += "b";
+ ro_b1.nums.push_back (2);
+
+ rw_d1.num++;
+ rw_d1.strs.push_back ("d");
+ rw_d1.str += "d";
+ rw_d1.nums.push_back (3);
+ rw_d1.dnum++;
+ rw_d1.dstr += "d";
+ rw_d.dnum++;
+ rw_d.dstr += "d";
+
+ {
+ // These should be no-ops.
+ //
+ db->update (ro_r1);
+ db->update (static_cast<ro_root&> (ro_d1));
+ db->update (ro_b1);
+
+ transaction t (db->begin ());
+ db->update (static_cast<ro_root&> (rw_b1));
+ db->update (rw_r);
+ db->update (static_cast<ro_base&> (rw_d1));
+ t.commit ();
+ }
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<ro_root> p_ro_r (db->load<ro_root> (ro_r.id));
+ unique_ptr<ro_root> p_rw_b (db->load<ro_root> (rw_b.id));
+ unique_ptr<ro_root> p_ro_d (db->load<ro_root> (ro_d.id));
+
+ unique_ptr<rw_root> p_rw_r (db->load<rw_root> (rw_r.id));
+ unique_ptr<rw_root> p_ro_b (db->load<rw_root> (ro_b.id));
+ unique_ptr<rw_root> p_rw_d (db->load<rw_root> (rw_d.id));
+
+ t.commit ();
+
+ assert (*p_ro_r == ro_r);
+ assert (*p_rw_b == rw_b);
+ assert (*p_ro_d == ro_d);
+
+ assert (*p_rw_r == rw_r);
+ assert (*p_ro_b == ro_b);
+ assert (*p_rw_d == rw_d);
+ }
+ }
+
+ // Test 10: empty polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ base b (1, 1);
+ derived d (2, 2);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (static_cast<root&> (d));
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd (db->load<root> (d.id));
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+
+ // Update.
+ //
+ {
+ b.num++;
+ d.num++;
+
+ transaction t (db->begin ());
+ db->update (static_cast<root&> (b));
+ db->update (d);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd (db->load<root> (d.id));
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+ }
+
+ // Test 11: reuse and polymorphic inheritance.
+ //
+ {
+ using namespace test11;
+
+ base b (1, 1, "b");
+ derived d (2, 2, "d");
+
+ b.strs.push_back ("b");
+ b.nums.push_back (1);
+
+ d.strs.push_back ("d");
+ d.nums.push_back (1);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (static_cast<base&> (d));
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<base> pd (db->load<base> (d.id));
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+
+ // Update.
+ //
+ {
+ b.num++;
+ b.str += "b";
+ b.strs.push_back ("bb");
+ b.nums.push_back (2);
+
+ d.num++;
+ d.str += "d";
+ d.strs.push_back ("dd");
+ d.nums.push_back (2);
+ d.dnum++;
+ d.dstr += "d";
+
+ transaction t (db->begin ());
+ db->update (b);
+ db->update (d);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<base> pd (db->load<base> (d.id));
+
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<base> base_query;
+ typedef odb::result<base> base_result;
+
+ typedef odb::query<derived> derived_query;
+ typedef odb::result<derived> derived_result;
+
+ transaction t (db->begin ());
+
+ {
+ base_result qr (db->query<base> (base_query::num == 2));
+ base_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == b);
+ assert (++i == e);
+ }
+
+ {
+ derived_result qr (db->query<derived> (derived_query::num == 3));
+ derived_result::iterator i (qr.begin ()), e (qr.end ());
+
+ assert (i != e && *i == d);
+ assert (++i == e);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test 12: polymorphic objects with auto id.
+ //
+ {
+ using namespace test12;
+
+ base b (1);
+ derived d (2);
+
+ unsigned long id1, id2;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ id1 = db->persist (b);
+ id2 = db->persist (static_cast<root&> (d));
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<root> pb (db->load<root> (id1));
+ unique_ptr<root> pd (db->load<root> (id2));
+
+ t.commit ();
+
+ assert (*pb == b);
+ assert (*pd == d);
+ }
+ }
+
+ // Test 13: polymorphic derived without any non-container data members
+ // (which results in an empty SELECT statement).
+ //
+ {
+ using namespace test13;
+
+ base b;
+ b.nums.push_back (123);
+ derived d;
+ d.nums.push_back (123);
+ d.strs.push_back ("abc");
+
+ base1 b1;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ db->persist (b1);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<root> pbr (db->load<root> (b.id));
+ unique_ptr<root> pdr (db->load<root> (d.id));
+ unique_ptr<base> pdb (db->load<base> (d.id));
+ unique_ptr<root> pb1r (db->load<root> (b1.id));
+ t.commit ();
+
+ base& rb (static_cast<base&> (*pbr));
+ derived& rd1 (static_cast<derived&> (*pdr));
+ derived& rd2 (static_cast<derived&> (*pdb));
+ base1 rb1 (static_cast<base1&> (*pb1r));
+
+ assert (rb.id == b.id && rb.nums == b.nums);
+ assert (rd1.id == d.id && rd1.nums == rd1.nums &&
+ rd1.strs == rd1.strs);
+ assert (rd2.id == d.id && rd2.nums == rd2.nums &&
+ rd2.strs == rd2.strs);
+ assert (rb1.id == b1.id);
+ }
+ }
+
+ // Test 14: inverse pointer in polymorphic base.
+ //
+ {
+ using namespace test14;
+
+ derived d;
+ d.num = 123;
+
+ d.o1 = new object1;
+ d.o2 = new object2;
+ d.o3.push_back (new object3);
+ d.o4.push_back (new object4);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (d.o1);
+ db->persist (d.o2);
+ db->persist (d.o3[0]);
+ db->persist (d.o4[0]);
+ db->persist (d);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+
+ transaction t (db->begin ());
+ object1* p1 (db->load<object1> (d.o1->id));
+ object2* p2 (db->load<object2> (d.o2->id));
+ object3* p3 (db->load<object3> (d.o3[0]->id));
+ object4* p4 (db->load<object4> (d.o4[0]->id));
+ t.commit ();
+
+ assert (p1->d->num == d.num);
+ assert (p2->d[0]->num == d.num);
+ assert (p3->d[0]->num == d.num);
+ assert (p4->d->num == d.num);
+ delete p1->d;
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::query<object1> query;
+ typedef odb::result<object1> result;
+
+ session s;
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::d->num == d.num));
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e && i->d->num == d.num);
+ delete i.load ()->d;
+ assert (++i == e);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object4> query;
+ typedef odb::result<object4> result;
+
+ session s;
+ transaction t (db->begin ());
+
+ result r (db->query<object4> (query::d->num == d.num));
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e && i->d->num == d.num);
+ delete i.load ()->d;
+ assert (++i == e);
+ t.commit ();
+ }
+ }
+
+ // Test 15: LOB/long data and polymorphism.
+ //
+ {
+ using namespace test15;
+
+ const char data[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B";
+
+ derived d;
+ d.blob.assign (data, data + sizeof (data));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ base* b (&d);
+ db->persist (b);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<base> pb (db->load<base> (d.id));
+ t.commit ();
+
+ derived* pd (dynamic_cast<derived*> (pb.get ()));
+ assert (pd != 0 && pd->blob == d.blob);
+ }
+
+ // Query.
+ //
+ {
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<base> ());
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e);
+
+ derived* pd (dynamic_cast<derived*> (&*i));
+ assert (pd != 0 && pd->blob == d.blob);
+
+ assert (++i == e);
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/inheritance/polymorphism/test1.hxx b/odb-tests/common/inheritance/polymorphism/test1.hxx
new file mode 100644
index 0000000..7f598de
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test1.hxx
@@ -0,0 +1,115 @@
+// file : common/inheritance/polymorphism/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#include <string>
+#include <vector>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test basic polymorphism functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () {}
+ root () {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id column("object_id")
+ unsigned long id;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id == r.id && num == r.num && strs == r.strs;
+ }
+ };
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return root::compare (r, false) && str == b.str && nums == b.nums;
+ }
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived))
+ return false;
+
+ const derived& d (static_cast<const derived&> (r));
+ return base::compare (r, false) && dnum == d.dnum && dstr == d.dstr;
+ }
+ };
+
+ // Views.
+ //
+ #pragma db view object(root)
+ struct root_view
+ {
+ //#pragma db column(root::typeid_)
+ std::string typeid_; // @@ tmp
+
+ unsigned long num;
+ };
+
+ #pragma db view object(base = b)
+ struct base_view
+ {
+ unsigned long id;
+ unsigned long num;
+ std::string str;
+ };
+
+ #pragma db view object(derived)
+ struct derived_view
+ {
+ unsigned long num;
+ std::string str;
+ unsigned long dnum;
+ std::string dstr;
+ };
+}
+
+#endif // TEST1_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test10.hxx b/odb-tests/common/inheritance/polymorphism/test10.hxx
new file mode 100644
index 0000000..63673a1
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test10.hxx
@@ -0,0 +1,78 @@
+// file : common/inheritance/polymorphism/test10.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST10_HXX
+#define TEST10_HXX
+
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test empty polymorphic classes.
+//
+#pragma db namespace table("t10_")
+namespace test10
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () = 0; // Auto-abstract.
+ root () {}
+ root (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id == r.id;
+ }
+ };
+
+ inline root::
+ ~root () {}
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n): root (i), num (n) {}
+
+ unsigned long num;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return root::compare (r, false) && num == b.num;
+ }
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n): base (i, n) {}
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived))
+ return false;
+
+ return base::compare (r, false);
+ }
+ };
+}
+
+#endif // TEST10_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test11.hxx b/odb-tests/common/inheritance/polymorphism/test11.hxx
new file mode 100644
index 0000000..2d38a6c
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test11.hxx
@@ -0,0 +1,78 @@
+// file : common/inheritance/polymorphism/test11.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST11_HXX
+#define TEST11_HXX
+
+#include <string>
+#include <vector>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test mixing reuse and polymorphic inheritance.
+//
+#pragma db namespace table("t11_")
+namespace test11
+{
+ #pragma db object abstract
+ struct root
+ {
+ root () {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+ };
+
+ #pragma db object polymorphic
+ struct base: root
+ {
+ virtual ~base () {}
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const base& b, bool tc = true) const
+ {
+ if (tc && typeid (b) != typeid (base))
+ return false;
+
+ return id == b.id && num == b.num && strs == b.strs &&
+ str == b.str && nums == b.nums;
+ }
+ };
+
+ inline bool
+ operator== (const base& x, const base& y) {return x.compare (y);}
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ virtual bool
+ compare (const base& b, bool tc = true) const
+ {
+ if (tc && typeid (b) != typeid (derived))
+ return false;
+
+ const derived& d (static_cast<const derived&> (b));
+ return base::compare (b, false) && dnum == d.dnum && dstr == d.dstr;
+ }
+ };
+}
+
+#endif // TEST11_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test12.hxx b/odb-tests/common/inheritance/polymorphism/test12.hxx
new file mode 100644
index 0000000..85000ac
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test12.hxx
@@ -0,0 +1,79 @@
+// file : common/inheritance/polymorphism/test12.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST12_HXX
+#define TEST12_HXX
+
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test polymorphic classes with private auto id.
+//
+#pragma db namespace table("t12_")
+namespace test12
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () = 0; // Auto-abstract.
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id_ == r.id_;
+ }
+
+ unsigned long id () const {return id_;}
+ void id (unsigned long id) {id_ = id;}
+ private:
+ #pragma db id auto access(id)
+ unsigned long id_;
+ };
+
+ inline root::
+ ~root () {}
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long n): num (n) {}
+
+ unsigned long num;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return root::compare (r, false) && num == b.num;
+ }
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long n): base (n) {}
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived))
+ return false;
+
+ return base::compare (r, false);
+ }
+ };
+}
+
+#endif // TEST12_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test13.hxx b/odb-tests/common/inheritance/polymorphism/test13.hxx
new file mode 100644
index 0000000..3240a9a
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test13.hxx
@@ -0,0 +1,46 @@
+// file : common/inheritance/polymorphism/test13.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST13_HXX
+#define TEST13_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Test polymorphic derived without any non-container data members (which
+// results in an empty SELECT statement).
+//
+#pragma db namespace table("t13_")
+namespace test13
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ std::vector<int> nums;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ std::vector<std::string> strs;
+ };
+
+ #pragma db object
+ struct base1: root
+ {
+ // Nothing.
+ };
+}
+
+#endif // TEST13_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test14.hxx b/odb-tests/common/inheritance/polymorphism/test14.hxx
new file mode 100644
index 0000000..1050861
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test14.hxx
@@ -0,0 +1,99 @@
+// file : common/inheritance/polymorphism/test14.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST14_HXX
+#define TEST14_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Test inverse pointer in polymorphic base.
+//
+#pragma db namespace table("t14_")
+namespace test14
+{
+ struct object1;
+ struct object2;
+ struct object3;
+ struct object4;
+
+ #pragma db object polymorphic session
+ struct base
+ {
+ virtual ~base ();
+
+ #pragma db id auto
+ unsigned long id;
+
+ object1* o1;
+ object2* o2;
+ std::vector<object3*> o3;
+ std::vector<object4*> o4;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ unsigned long num;
+ };
+
+ // one-to-one(i)
+ //
+ #pragma db object session
+ struct object1
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db inverse(o1)
+ derived* d;
+ };
+
+ // one-to-many(i)
+ //
+ #pragma db object session
+ struct object2
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db inverse(o2)
+ std::vector<derived*> d;
+ };
+
+ // many-to-many(i)
+ //
+ #pragma db object session
+ struct object3
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db inverse(o3)
+ std::vector<derived*> d;
+ };
+
+ // many-to-one(i)
+ //
+ #pragma db object session
+ struct object4
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db inverse(o4)
+ derived* d;
+ };
+
+ inline base::
+ ~base ()
+ {
+ delete o1;
+ delete o2;
+ delete o3[0];
+ delete o4[0];
+ }
+}
+
+#endif // TEST14_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test15.hxx b/odb-tests/common/inheritance/polymorphism/test15.hxx
new file mode 100644
index 0000000..5799ace
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test15.hxx
@@ -0,0 +1,44 @@
+// file : common/inheritance/polymorphism/test15.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST15_HXX
+#define TEST15_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_PGSQL)
+# define BLOB_TYPE "BYTEA"
+# elif defined(ODB_DATABASE_MSSQL)
+# define BLOB_TYPE "VARBINARY(max)"
+# else
+# define BLOB_TYPE "BLOB"
+# endif
+#endif
+
+
+// Test LOB/long data and polymorphism.
+//
+#pragma db namespace table("t15_")
+namespace test15
+{
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual ~base () {}
+
+ #pragma db id auto
+ unsigned long id;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ #pragma db type(BLOB_TYPE)
+ std::vector<char> blob;
+ };
+}
+
+#endif // TEST15_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test2.hxx b/odb-tests/common/inheritance/polymorphism/test2.hxx
new file mode 100644
index 0000000..9890e02
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test2.hxx
@@ -0,0 +1,105 @@
+// file : common/inheritance/polymorphism/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/lazy-ptr.hxx>
+
+// Test inverse object pointers in polymorhic bases.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ struct root;
+
+ #pragma db object
+ struct root_pointer
+ {
+ root_pointer (root* r = 0): p (r) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ root* p;
+ };
+
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () {}
+ root () {}
+ root (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db inverse(p)
+ odb::lazy_ptr<root_pointer> rp;
+ };
+
+ struct base;
+
+ #pragma db object
+ struct base_pointer
+ {
+ base_pointer (base* b = 0) {if (b != 0) vp.push_back (b);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::vector<base*> vp;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, const std::string& s): root (i), str (s) {}
+
+ std::string str;
+
+ #pragma db inverse(vp)
+ odb::lazy_ptr<base_pointer> bp;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, const std::string& s, unsigned long n)
+ : base (i, s), num (n) {}
+
+ unsigned long num;
+ };
+
+ // Views.
+ //
+ #pragma db view object(root_pointer = rp) object(root)
+ struct root_view
+ {
+ #pragma db column(rp::id)
+ unsigned long rp_id;
+
+ #pragma db column(root::id)
+ unsigned long r_id;
+ };
+
+ #pragma db view object(base_pointer) object(base = b)
+ struct base_view
+ {
+ #pragma db column(base_pointer::id)
+ unsigned long bp_id;
+
+ #pragma db column(b::id)
+ unsigned long b_id;
+
+ std::string str;
+ };
+}
+
+#endif // TEST2_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test3.hxx b/odb-tests/common/inheritance/polymorphism/test3.hxx
new file mode 100644
index 0000000..fd68f24
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test3.hxx
@@ -0,0 +1,146 @@
+// file : common/inheritance/polymorphism/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#include <string>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test delayed loading.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () {}
+ root () {}
+ root (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id == r.id;
+ }
+ };
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ virtual ~base () {delete rptr;}
+ base (): rptr (0) {}
+ base (unsigned long i, unsigned long n): root (i), num (n), rptr (0) {}
+
+ unsigned long num;
+ root* rptr;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return
+ root::compare (r, false) &&
+ num == b.num &&
+ ((rptr == 0 && b.rptr == 0) || rptr->compare (*b.rptr));
+ }
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ virtual ~derived () {delete bptr;}
+ derived (): bptr (0) {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n), str (s), bptr (0) {}
+
+ std::string str;
+ base* bptr;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived))
+ return false;
+
+ const derived& d (static_cast<const derived&> (r));
+ return
+ base::compare (r, false) &&
+ str == d.str &&
+ ((bptr == 0 && d.bptr == 0) || bptr->compare (*d.bptr));
+ }
+ };
+
+ // Views.
+ //
+ #pragma db view object(base) object(root = r)
+ struct base_view
+ {
+ #pragma db column(base::id)
+ unsigned long b_id;
+
+ #pragma db column(r::id)
+ unsigned long r_id;
+
+ unsigned long num;
+ };
+
+ #pragma db view \
+ object(derived = d) \
+ object(base = b) \
+ object(root = r: d::rptr)
+ struct derived_view
+ {
+ #pragma db column(d::id)
+ unsigned long d_id;
+
+ #pragma db column(b::id)
+ unsigned long b_id;
+
+ #pragma db column(r::id)
+ unsigned long r_id;
+
+ #pragma db column(d::num)
+ unsigned long d_num;
+
+ #pragma db column(b::num)
+ unsigned long b_num;
+
+ std::string str;
+ };
+
+ // This is an example of a pathological case, where the right-hand-side
+ // of the join condition comes from one of the bases. As a result, we
+ // join the base table first, which means we will get both bases and
+ // derived objects instead of just derived.
+ //
+ //#pragma db view object(root = r) object(derived = d)
+ #pragma db view object(derived = d) object(root = r)
+ struct root_view
+ {
+ #pragma db column(r::id)
+ unsigned long r_id;
+
+ #pragma db column(d::id)
+ unsigned long d_id;
+
+ std::string str;
+ };
+}
+
+#endif // TEST3_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test4.hxx b/odb-tests/common/inheritance/polymorphism/test4.hxx
new file mode 100644
index 0000000..148c53c
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test4.hxx
@@ -0,0 +1,84 @@
+// file : common/inheritance/polymorphism/test4.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST4_HXX
+#define TEST4_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+// Test views.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object polymorphic
+ struct root1
+ {
+ virtual ~root1 () {}
+ root1 () {}
+ root1 (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+ };
+
+ #pragma db object
+ struct base1: root1
+ {
+ base1 () {}
+ base1 (unsigned long i, unsigned long n): root1 (i), num (n) {}
+
+ unsigned long num;
+ };
+
+ #pragma db object polymorphic
+ struct root2
+ {
+ virtual ~root2 () {}
+ root2 () {}
+ root2 (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct base2: root2
+ {
+ base2 () {}
+ base2 (unsigned long i, unsigned long n, const std::string& s)
+ : root2 (i, n), str (s) {}
+
+ std::string str;
+ };
+
+ // Test custom join condition.
+ //
+ #pragma db view object(base2) object(base1: base2::num == base1::num)
+ struct view1
+ {
+ std::string str;
+ };
+
+ #pragma db view object(base2)
+ struct view2
+ {
+ #pragma db column("min(" + base2::num + ")")
+ unsigned long min_num;
+ };
+
+ // Test custom join condition that uses object id. It cannot come
+ // from the base since the base table hasn't been join'ed yet.
+ //
+ #pragma db view object(base1) object(base2: base2::id == base1::id)
+ struct view3
+ {
+ std::string str;
+ };
+}
+
+#endif // TEST4_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test5.hxx b/odb-tests/common/inheritance/polymorphism/test5.hxx
new file mode 100644
index 0000000..172e7e8
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test5.hxx
@@ -0,0 +1,92 @@
+// file : common/inheritance/polymorphism/test5.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST5_HXX
+#define TEST5_HXX
+
+#include <string>
+#include <vector>
+#include <memory>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test polymorphism and optimistic concurrency.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db object polymorphic optimistic pointer(std::unique_ptr)
+ struct root
+ {
+ virtual ~root () {}
+ root () {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db version
+ unsigned long version;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id == r.id && version == r.version &&
+ num == r.num && strs == r.strs;
+ }
+ };
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return root::compare (r, false) && str == b.str && nums == b.nums;
+ }
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived))
+ return false;
+
+ const derived& d (static_cast<const derived&> (r));
+ return base::compare (r, false) && dnum == d.dnum && dstr == d.dstr;
+ }
+ };
+}
+
+#endif // TEST5_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test6.hxx b/odb-tests/common/inheritance/polymorphism/test6.hxx
new file mode 100644
index 0000000..b0f9a16
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test6.hxx
@@ -0,0 +1,64 @@
+// file : common/inheritance/polymorphism/test6.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST6_HXX
+#define TEST6_HXX
+
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+#include <odb/callback.hxx>
+
+// Test polymorphism and callbacks.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ #pragma db object polymorphic pointer(std::unique_ptr)
+ struct root
+ {
+ virtual ~root () {}
+ root (): id (0) {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ };
+
+ #pragma db object callback(db_callback)
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+
+ void
+ db_callback (odb::callback_event, odb::database&);
+
+ void
+ db_callback (odb::callback_event, odb::database&) const;
+ };
+
+ #pragma db object callback(db_callback)
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ std::unique_ptr<root> ptr;
+
+ void
+ db_callback (odb::callback_event, odb::database&) const;
+ };
+}
+
+#endif // TEST6_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test7.hxx b/odb-tests/common/inheritance/polymorphism/test7.hxx
new file mode 100644
index 0000000..60da98e
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test7.hxx
@@ -0,0 +1,54 @@
+// file : common/inheritance/polymorphism/test7.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST7_HXX
+#define TEST7_HXX
+
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+
+// Test polymorphism and object cache (session).
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ using std::shared_ptr;
+
+ #pragma db object polymorphic pointer(shared_ptr) session
+ struct root
+ {
+ virtual ~root () {}
+ root (): id (0) {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived () {}
+ derived (unsigned long i, unsigned long n, const std::string& s)
+ : base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+ };
+}
+
+#endif // TEST7_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test8.hxx b/odb-tests/common/inheritance/polymorphism/test8.hxx
new file mode 100644
index 0000000..84b6688
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test8.hxx
@@ -0,0 +1,129 @@
+// file : common/inheritance/polymorphism/test8.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST8_HXX
+#define TEST8_HXX
+
+#include <string>
+#include <vector>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test polymorphism and abstract bases.
+//
+#pragma db namespace table("t8_")
+namespace test8
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ virtual ~root () = 0; // Auto-abstract.
+ root () {}
+ root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (root))
+ return false;
+
+ return id == r.id && num == r.num && strs == r.strs;
+ }
+ };
+
+ inline root::
+ ~root () {}
+
+ inline bool
+ operator== (const root& x, const root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct base: root
+ {
+ base () {}
+ base (unsigned long i, unsigned long n, const std::string& s)
+ : root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (base))
+ return false;
+
+ const base& b (static_cast<const base&> (r));
+ return root::compare (r, false) && str == b.str && nums == b.nums;
+ }
+ };
+
+ #pragma db object abstract
+ struct interm: base
+ {
+ interm () {}
+ interm (unsigned long i, unsigned long n, const std::string& s, bool b)
+ : base (i, n, s), bln (b) {}
+
+ bool bln;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (interm))
+ return false;
+
+ const interm& i (static_cast<const interm&> (r));
+ return base::compare (r, false) && bln == i.bln;
+ }
+ };
+
+ #pragma db object
+ struct derived1: interm
+ {
+ derived1 () {}
+ derived1 (unsigned long i, unsigned long n, const std::string& s, bool b)
+ : interm (i, n, s, b), dnum (n + 1) {}
+
+ unsigned long dnum;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived1))
+ return false;
+
+ const derived1& d (static_cast<const derived1&> (r));
+ return interm::compare (r, false) && dnum == d.dnum;
+ }
+ };
+
+ #pragma db object
+ struct derived2: interm
+ {
+ derived2 () {}
+ derived2 (unsigned long i, unsigned long n, const std::string& s, bool b)
+ : interm (i, n, s, b), dstr (s + 'd') {}
+
+ std::string dstr;
+
+ virtual bool
+ compare (const root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (derived2))
+ return false;
+
+ const derived2& d (static_cast<const derived2&> (r));
+ return interm::compare (r, false) && dstr == d.dstr;
+ }
+ };
+}
+
+#endif // TEST8_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/test9.hxx b/odb-tests/common/inheritance/polymorphism/test9.hxx
new file mode 100644
index 0000000..cdc97ae
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/test9.hxx
@@ -0,0 +1,161 @@
+// file : common/inheritance/polymorphism/test9.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST9_HXX
+#define TEST9_HXX
+
+#include <string>
+#include <vector>
+#include <typeinfo>
+
+#include <odb/core.hxx>
+
+// Test polymorphism and readonly classes.
+//
+#pragma db namespace table("t9_")
+namespace test9
+{
+ //
+ // ro_root, rw_base, ro_derived
+ //
+ #pragma db object polymorphic readonly
+ struct ro_root
+ {
+ virtual ~ro_root () {}
+ ro_root () {}
+ ro_root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+
+ virtual bool
+ compare (const ro_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (ro_root))
+ return false;
+
+ return id == r.id && num == r.num && strs == r.strs;
+ }
+ };
+
+ inline bool
+ operator== (const ro_root& x, const ro_root& y) {return x.compare (y);}
+
+ #pragma db object
+ struct rw_base: ro_root
+ {
+ rw_base () {}
+ rw_base (unsigned long i, unsigned long n, const std::string& s)
+ : ro_root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const ro_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (rw_base))
+ return false;
+
+ const rw_base& b (static_cast<const rw_base&> (r));
+ return ro_root::compare (r, false) && str == b.str && nums == b.nums;
+ }
+ };
+
+ #pragma db object readonly
+ struct ro_derived: rw_base
+ {
+ ro_derived () {}
+ ro_derived (unsigned long i, unsigned long n, const std::string& s)
+ : rw_base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ virtual bool
+ compare (const ro_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (ro_derived))
+ return false;
+
+ const ro_derived& d (static_cast<const ro_derived&> (r));
+ return rw_base::compare (r, false) && dnum == d.dnum && dstr == d.dstr;
+ }
+ };
+
+ //
+ // rw_root, ro_base, rw_derived
+ //
+ #pragma db object polymorphic
+ struct rw_root
+ {
+ virtual ~rw_root () {}
+ rw_root () {}
+ rw_root (unsigned long i, unsigned long n): id (i), num (n) {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long num;
+ std::vector<std::string> strs;
+
+ virtual bool
+ compare (const rw_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (rw_root))
+ return false;
+
+ return id == r.id && num == r.num && strs == r.strs;
+ }
+ };
+
+ inline bool
+ operator== (const rw_root& x, const rw_root& y) {return x.compare (y);}
+
+ #pragma db object readonly
+ struct ro_base: rw_root
+ {
+ ro_base () {}
+ ro_base (unsigned long i, unsigned long n, const std::string& s)
+ : rw_root (i, n), str (s) {}
+
+ std::string str;
+ std::vector<unsigned long> nums;
+
+ virtual bool
+ compare (const rw_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (ro_base))
+ return false;
+
+ const ro_base& b (static_cast<const ro_base&> (r));
+ return rw_root::compare (r, false) && str == b.str && nums == b.nums;
+ }
+ };
+
+ #pragma db object
+ struct rw_derived: ro_base
+ {
+ rw_derived () {}
+ rw_derived (unsigned long i, unsigned long n, const std::string& s)
+ : ro_base (i, n, s), dnum (n + 1), dstr (s + 'd') {}
+
+ unsigned long dnum;
+ std::string dstr;
+
+ virtual bool
+ compare (const rw_root& r, bool tc = true) const
+ {
+ if (tc && typeid (r) != typeid (rw_derived))
+ return false;
+
+ const rw_derived& d (static_cast<const rw_derived&> (r));
+ return ro_base::compare (r, false) && dnum == d.dnum && dstr == d.dstr;
+ }
+ };
+}
+
+#endif // TEST9_HXX
diff --git a/odb-tests/common/inheritance/polymorphism/testscript b/odb-tests/common/inheritance/polymorphism/testscript
new file mode 100644
index 0000000..89e5726
--- /dev/null
+++ b/odb-tests/common/inheritance/polymorphism/testscript
@@ -0,0 +1,80 @@
+# file : common/inheritance/polymorphism/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
++cat <<EOI >=output
+ base pre_persist 1 const
+ base post_persist 1 const
+ derived pre_persist 2 const
+ derived post_persist 2 const
+ base pre_load 0
+ base post_load 1
+ derived pre_load 0 const
+ derived post_load 2 const
+ base pre_load 1
+ base post_load 1
+ derived pre_load 2 const
+ derived post_load 2 const
+ base pre_load 1
+ base post_load 1
+ derived pre_load 2 const
+ derived post_load 2 const
+ base pre_update 1 const
+ base post_update 1 const
+ derived pre_update 2 const
+ derived post_update 2 const
+ base pre_load 0
+ base post_load 1
+ derived pre_load 0 const
+ derived post_load 2 const
+ base pre_erase 1 const
+ base post_erase 1 const
+ derived pre_erase 2 const
+ derived post_erase 2 const
+ derived pre_persist 3 const
+ derived post_persist 3 const
+ derived pre_persist 4 const
+ derived post_persist 4 const
+ derived pre_load 0 const
+ derived pre_load 0 const
+ derived post_load 4 const
+ derived post_load 3 const
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql-schema.testscript
+
+ for s: $schemas
+ cat $out_base/"$s"($multi ? '-mysql' : '').sql | $create_schema_cmd
+ end;
+
+ $* ($multi ? 'mysql' : ) $mysql_options
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql-schema.testscript
+
+ for s: $schemas
+ $create_schema_cmd -f $out_base/"$s"($multi ? '-pgsql' : '').sql
+ end;
+
+ $* ($multi ? 'pgsql' : ) $pgsql_options
+}
diff --git a/odb-tests/common/inheritance/reuse/buildfile b/odb-tests/common/inheritance/reuse/buildfile
new file mode 100644
index 0000000..b82439a
--- /dev/null
+++ b/odb-tests/common/inheritance/reuse/buildfile
@@ -0,0 +1,41 @@
+# file : common/inheritance/reuse/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix inhrt_r_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/inheritance/reuse/driver.cxx b/odb-tests/common/inheritance/reuse/driver.cxx
new file mode 100644
index 0000000..e6122bb
--- /dev/null
+++ b/odb-tests/common/inheritance/reuse/driver.cxx
@@ -0,0 +1,237 @@
+// file : common/inheritance/reuse/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test reuse object inheritance.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ base b;
+ b.comp_.bools.push_back (true);
+ b.comp_.obools.push_back (true);
+ b.comp_.num = 10;
+ b.comp_.str = "comp bbb";
+ b.comp_.nums.push_back (101);
+ b.comp_.nums.push_back (102);
+ b.comp_.onums.push_back (101);
+ b.comp_.onums.push_back (102);
+ b.num_ = 0;
+ b.str_ = "bbb";
+ b.strs_.push_back ("bbb one");
+ b.strs_.push_back ("bbb two");
+ b.ostrs_.push_back ("bbb one");
+ b.ostrs_.push_back ("bbb two");
+
+ object1 o1;
+ o1.comp_.bools.push_back (false);
+ o1.comp_.obools.push_back (false);
+ o1.comp_.num = 11;
+ o1.comp_.str = "comp o1o1o1";
+ o1.comp_.nums.push_back (111);
+ o1.comp_.nums.push_back (112);
+ o1.comp_.onums.push_back (111);
+ o1.comp_.onums.push_back (112);
+ static_cast<base&> (o1).num_ = 1;
+ o1.num1_ = 21;
+ o1.str_ = "base o1o1o1";
+ o1.strs_.push_back ("base o1o1o1 one");
+ o1.strs_.push_back ("base o1o1o1 two");
+ o1.ostrs_.push_back ("base o1o1o1 one");
+ o1.ostrs_.push_back ("base o1o1o1 two");
+
+ object2 o2;
+ o2.comp_.bools.push_back (true);
+ o2.comp_.bools.push_back (false);
+ o2.comp_.obools.push_back (true);
+ o2.comp_.obools.push_back (false);
+ o2.comp_.num = 12;
+ o2.comp_.str = "comp o2o2o2";
+ o2.comp_.nums.push_back (121);
+ o2.comp_.nums.push_back (122);
+ o2.comp_.onums.push_back (121);
+ o2.comp_.onums.push_back (122);
+ o2.num_ = 2;
+ static_cast<base&> (o2).str_ = "base o2o2o2";
+ o2.str_ = "o2o2o2";
+ o2.strs_.push_back ("base o2o2o2 one");
+ o2.strs_.push_back ("base o2o2o2 two");
+ o2.ostrs_.push_back ("base o2o2o2 one");
+ o2.ostrs_.push_back ("base o2o2o2 two");
+
+ object3 o3;
+ o3.comp_.bools.push_back (false);
+ o3.comp_.bools.push_back (false);
+ o3.comp_.obools.push_back (false);
+ o3.comp_.obools.push_back (false);
+ o3.comp_.num = 13;
+ o3.comp_.str = "comp o3o3o3";
+ o3.comp_.nums.push_back (131);
+ o3.comp_.nums.push_back (132);
+ o3.comp_.onums.push_back (131);
+ o3.comp_.onums.push_back (132);
+ o3.num_ = 3;
+ o3.str_ = "base o3o3o3";
+ o3.strs_.push_back ("base o3o3o3 one");
+ o3.strs_.push_back ("base o3o3o3 two");
+ o3.ostrs_.push_back ("base o3o3o3 one");
+ o3.ostrs_.push_back ("base o3o3o3 two");
+
+ reference r;
+ r.o1_ = &o1;
+
+ empty_object e;
+ e.comp_.bools.push_back (true);
+ e.comp_.bools.push_back (true);
+ e.comp_.obools.push_back (true);
+ e.comp_.obools.push_back (true);
+ e.comp_.num = 14;
+ e.comp_.str = "comp eee";
+ e.comp_.nums.push_back (141);
+ e.comp_.nums.push_back (142);
+ e.comp_.onums.push_back (141);
+ e.comp_.onums.push_back (142);
+ e.num_ = 4;
+ e.str_ = "base eee";
+ e.strs_.push_back ("base eee one");
+ e.strs_.push_back ("base eee two");
+ e.ostrs_.push_back ("base eee one");
+ e.ostrs_.push_back ("base eee two");
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (r);
+ db->persist (e);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> lb (db->load<base> (b.id_));
+ unique_ptr<object1> lo1 (db->load<object1> (o1.id_));
+ unique_ptr<object2> lo2 (db->load<object2> (o2.id_));
+ unique_ptr<object3> lo3 (db->load<object3> (o3.id_));
+ unique_ptr<empty_object> le (db->load<empty_object> (e.id_));
+ unique_ptr<reference> lr (db->load<reference> (r.id_));
+ t.commit ();
+
+ assert (b == *lb);
+ assert (o1 == *lo1);
+ assert (o2 == *lo2);
+ assert (o3 == *lo3);
+ assert (lr->o1_->id_ == r.o1_->id_);
+ assert (e == *le);
+
+ delete lr->o1_;
+ }
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (b);
+ db->update (o1);
+ db->update (o2);
+ db->update (o3);
+ db->update (r);
+ db->update (e);
+ t.commit ();
+ }
+
+ // query
+ //
+ {
+ typedef odb::query<base> b_query;
+ typedef odb::query<object1> o1_query;
+ typedef odb::query<object2> o2_query;
+ typedef odb::query<reference> r_query;
+
+ typedef odb::result<reference> r_result;
+
+ transaction t (db->begin ());
+
+ assert (!db->query<base> (b_query::comp.num == 10).empty ());
+ assert (!db->query<object1> (o1_query::num1 == 21).empty ());
+ assert (!db->query<object2> (o2_query::num == 2).empty ());
+
+ // Query condition with hidden members.
+ //
+ assert (
+ !db->query<object2> (o2_query::base::str == "base o2o2o2").empty ());
+
+ // Query condition with referenced composite member in base class.
+ //
+ {
+ r_result r (db->query<reference> (r_query::o1->comp.num == 11));
+ assert (!r.empty ());
+ delete r.begin ()->o1_;
+ }
+
+ t.commit ();
+ }
+
+ // views
+ //
+ {
+ typedef odb::query<object2_view> query;
+ typedef odb::result<object2_view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object2_view> (query::num == o2.num_));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->num == o2.num_ && i->id == o2.id_ && i->str == o2.str_);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // erase
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (b);
+ db->erase (o1);
+ db->erase (o2);
+ db->erase (o3);
+ db->erase (r);
+ db->erase (e);
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/inheritance/reuse/test.hxx b/odb-tests/common/inheritance/reuse/test.hxx
new file mode 100644
index 0000000..48f474f
--- /dev/null
+++ b/odb-tests/common/inheritance/reuse/test.hxx
@@ -0,0 +1,163 @@
+// file : common/inheritance/reuse/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+
+#pragma db value
+struct comp_base
+{
+ std::vector<unsigned char> bools;
+ odb::vector<unsigned char> obools;
+
+ bool
+ operator== (const comp_base& y) const
+ {
+ return bools == y.bools && obools == y.obools;
+ }
+};
+
+#pragma db value
+struct comp: comp_base
+{
+ unsigned int num;
+ std::string str;
+
+ std::vector<unsigned int> nums;
+ odb::vector<unsigned int> onums;
+
+ bool
+ operator== (const comp& y) const
+ {
+ return
+ static_cast<const comp_base&> (*this) == y &&
+ num == y.num &&
+ str == y.str &&
+ nums == y.nums &&
+ onums == y.onums;
+ }
+};
+
+#pragma db object abstract
+struct abstract_base
+{
+ comp comp_;
+
+ unsigned int num_;
+ std::string str_;
+
+ std::vector<std::string> strs_;
+ odb::vector<std::string> ostrs_;
+
+ bool
+ operator== (const abstract_base& y) const
+ {
+ return
+ comp_ == y.comp_ &&
+ num_ == y.num_ &&
+ str_ == y.str_ &&
+ strs_ == y.strs_ &&
+ ostrs_ == y.ostrs_;
+ }
+};
+
+#pragma db object
+struct base: abstract_base
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ bool
+ operator== (const base& y) const
+ {
+ return id_ == y.id_ && static_cast<const abstract_base&> (*this) == y;
+ }
+};
+
+#pragma db object
+struct object1: base
+{
+ unsigned int num1_;
+
+ bool
+ operator== (const object1& y) const
+ {
+ return static_cast<const base&> (*this) == y && num1_ == y.num1_;
+ }
+};
+
+#pragma db object
+struct object2: base
+{
+ #pragma db column("derived_str")
+ std::string str_;
+
+ bool
+ operator== (const object2& y) const
+ {
+ return static_cast<const base&> (*this) == y && str_ == y.str_;
+ }
+};
+
+// Reference to derived object.
+//
+#pragma db object
+struct reference
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ object1* o1_;
+};
+
+// Multiple inheritance.
+//
+#pragma db object abstract
+struct id_base
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ bool
+ operator== (const id_base& y) const
+ {
+ return id_ == y.id_;
+ }
+};
+
+#pragma db object
+struct object3: abstract_base, id_base
+{
+ bool
+ operator== (const object3& y) const
+ {
+ return
+ static_cast<const abstract_base&> (*this) == y &&
+ static_cast<const id_base&> (*this) == y;
+ }
+};
+
+// Empty derived object.
+//
+#pragma db object
+struct empty_object: base
+{
+};
+
+// View based on the derived object.
+//
+#pragma db view object(object2)
+struct object2_view
+{
+ unsigned int num; // from abstract_base
+ unsigned long id; // from base
+ std::string str; // from object2, hides one from abstract_base
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/inheritance/reuse/testscript b/odb-tests/common/inheritance/reuse/testscript
new file mode 100644
index 0000000..995b3f5
--- /dev/null
+++ b/odb-tests/common/inheritance/reuse/testscript
@@ -0,0 +1,33 @@
+# file : common/inheritance/reuse/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/inheritance/transient/buildfile b/odb-tests/common/inheritance/transient/buildfile
new file mode 100644
index 0000000..1961abc
--- /dev/null
+++ b/odb-tests/common/inheritance/transient/buildfile
@@ -0,0 +1,41 @@
+# file : common/inheritance/transient/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix inhrt_t_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/inheritance/transient/driver.cxx b/odb-tests/common/inheritance/transient/driver.cxx
new file mode 100644
index 0000000..1caae6c
--- /dev/null
+++ b/odb-tests/common/inheritance/transient/driver.cxx
@@ -0,0 +1,80 @@
+// file : common/inheritance/transient/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test transient inheritance of objects, composite value types, and views.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.num = 1;
+ o.str = "abc";
+ o.strs.push_back ("abc 1");
+ o.strs.push_back ("abc 2");
+ o.c.num = 11;
+ o.c.str = "comp abc";
+ o.c.nums.push_back (111);
+ o.c.nums.push_back (112);
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (*p == o);
+ }
+
+ // view
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<view> (query::id == o.id_));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->num == o.num && i->str == o.str);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/inheritance/transient/test.hxx b/odb-tests/common/inheritance/transient/test.hxx
new file mode 100644
index 0000000..394ee8f
--- /dev/null
+++ b/odb-tests/common/inheritance/transient/test.hxx
@@ -0,0 +1,60 @@
+// file : common/inheritance/transient/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+struct object;
+
+struct base
+{
+ int n;
+ std::vector<std::string> v;
+ object* p;
+};
+
+#pragma db value
+struct comp: base
+{
+ unsigned int num;
+ std::string str;
+ std::vector<unsigned int> nums;
+
+ bool
+ operator== (const comp& y) const
+ {
+ return num == y.num && str == y.str && nums == y.nums;
+ }
+};
+
+#pragma db object
+struct object: base
+{
+ #pragma db id auto
+ unsigned int id_;
+
+ unsigned int num;
+ std::string str;
+ std::vector<std::string> strs;
+ comp c;
+
+ bool
+ operator== (const object& y) const
+ {
+ return num == y.num && str == y.str && strs == y.strs && c == y.c;
+ }
+};
+
+#pragma db view object(object)
+struct view: base
+{
+ unsigned int num;
+ std::string str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/inheritance/transient/testscript b/odb-tests/common/inheritance/transient/testscript
new file mode 100644
index 0000000..bce91de
--- /dev/null
+++ b/odb-tests/common/inheritance/transient/testscript
@@ -0,0 +1,33 @@
+# file : common/inheritance/transient/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/inverse/buildfile b/odb-tests/common/inverse/buildfile
new file mode 100644
index 0000000..63fa1cb
--- /dev/null
+++ b/odb-tests/common/inverse/buildfile
@@ -0,0 +1,42 @@
+# file : common/inverse/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_inverse_ \
+ --generate-schema \
+ --generate-query \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/inverse/driver.cxx b/odb-tests/common/inverse/driver.cxx
new file mode 100644
index 0000000..842438e
--- /dev/null
+++ b/odb-tests/common/inverse/driver.cxx
@@ -0,0 +1,502 @@
+// file : common/inverse/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test bidirectional relationships with inverse sides.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test raw pointers.
+ //
+ {
+ using namespace test1;
+
+ obj1_ptr o1_1 (new obj1);
+ obj1_ptr o1_2 (new obj1);
+ obj2_ptr o2 (new obj2);
+ obj3_ptr o3_1 (new obj3);
+ obj3_ptr o3_2 (new obj3);
+ obj4_ptr o4_1 (new obj4);
+ obj4_ptr o4_2 (new obj4);
+ obj5_ptr o5_1 (new obj5);
+ obj5_ptr o5_2 (new obj5);
+ obj5_ptr o5_3 (new obj5);
+ obj5_ptr o5_4 (new obj5);
+
+ o1_1->id = "obj1 1";
+ o1_1->o2 = o2;
+ o1_1->o3.insert (o3_1);
+ o1_1->o3.insert (o3_2);
+ o1_1->o4 = o4_1;
+ o1_1->o5.insert (o5_1);
+ o1_1->o5.insert (o5_2);
+
+ o1_2->id = "obj1 2";
+ o1_2->o2 = 0;
+ o1_2->o3.clear ();
+ o1_2->o4 = o4_2;
+ o1_2->o5.insert (o5_3);
+ o1_2->o5.insert (o5_4);
+
+ o2->str = "obj2";
+ o2->o1 = o1_1;
+
+ o3_1->str = "obj3 1";
+ o3_1->o1 = o1_1;
+
+ o3_2->str = "obj3 2";
+ o3_2->o1 = o1_1;
+
+ o4_1->str = "obj4 1";
+ o4_1->o1.insert (o1_1);
+
+ o4_2->str = "obj4 2";
+ o4_2->o1.insert (o1_2);
+
+ o5_1->str = "obj5 1";
+ o5_1->o1.insert (o1_1);
+
+ o5_2->str = "obj5 2";
+ o5_2->o1.insert (o1_1);
+
+ o5_3->str = "obj5 3";
+ o5_3->o1.insert (o1_2);
+
+ o5_4->str = "obj5 4";
+ o5_4->o1.insert (o1_2);
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+
+ // objN come before obj1 to get object id assigned.
+ //
+ db->persist (o5_1);
+ db->persist (o5_2);
+ db->persist (o5_3);
+ db->persist (o5_4);
+ db->persist (o4_1);
+ db->persist (o4_2);
+ db->persist (o3_1);
+ db->persist (o3_2);
+ db->persist (o2);
+ db->persist (o1_1);
+ db->persist (o1_2);
+
+ t.commit ();
+ }
+
+ // load
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ obj2_ptr x2 (db->load<obj2> (o2->id));
+ obj3_ptr x3_1 (db->load<obj3> (o3_1->id));
+ obj3_ptr x3_2 (db->load<obj3> (o3_2->id));
+ obj4_ptr x4_1 (db->load<obj4> (o4_1->id));
+ obj4_ptr x4_2 (db->load<obj4> (o4_2->id));
+ obj5_ptr x5_1 (db->load<obj5> (o5_1->id));
+ obj5_ptr x5_2 (db->load<obj5> (o5_2->id));
+ obj5_ptr x5_3 (db->load<obj5> (o5_3->id));
+ obj5_ptr x5_4 (db->load<obj5> (o5_4->id));
+ t.commit ();
+
+ assert (x2->str == o2->str);
+ assert (x2->o1->id == o1_1->id);
+ assert (x2->o1->o2 == x2);
+
+ assert (x3_1->str == o3_1->str);
+ assert (x3_2->str == o3_2->str);
+ assert (x3_1->o1 == x3_2->o1);
+ assert (x3_1->o1->id == o1_1->id);
+ assert (x3_1->o1->o3.find (x3_1) != x3_1->o1->o3.end ());
+ assert (x3_1->o1->o3.find (x3_2) != x3_1->o1->o3.end ());
+
+ assert (x4_1->str == o4_1->str);
+ assert (x4_2->str == o4_2->str);
+ assert ((*x4_1->o1.begin ())->id == o1_1->id);
+ assert ((*x4_2->o1.begin ())->id == o1_2->id);
+ assert ((*x4_1->o1.begin ())->o4 == x4_1);
+ assert ((*x4_2->o1.begin ())->o4 == x4_2);
+
+ assert (x5_1->str == o5_1->str);
+ assert (x5_2->str == o5_2->str);
+ assert ((*x5_1->o1.begin ())->id == o1_1->id);
+ assert ((*x5_2->o1.begin ())->id == o1_1->id);
+ assert ((*x5_3->o1.begin ())->id == o1_2->id);
+ assert ((*x5_4->o1.begin ())->id == o1_2->id);
+ assert ((*x5_1->o1.begin ())->o5.find (x5_1) !=
+ (*x5_1->o1.begin ())->o5.end ());
+ assert ((*x5_2->o1.begin ())->o5.find (x5_2) !=
+ (*x5_2->o1.begin ())->o5.end ());
+ assert ((*x5_3->o1.begin ())->o5.find (x5_3) !=
+ (*x5_3->o1.begin ())->o5.end ());
+ assert ((*x5_4->o1.begin ())->o5.find (x5_4) !=
+ (*x5_4->o1.begin ())->o5.end ());
+
+ delete *x4_1->o1.begin ();
+ delete *x4_2->o1.begin ();
+ }
+
+ // query
+ //
+ {
+ // one(i)-to-one
+ //
+ typedef odb::query<obj2> query;
+ typedef odb::result<obj2> result;
+
+ session s;
+ transaction t (db->begin ());
+
+ result r (db->query<obj2> (query::o1->id == "obj1 1"));
+ assert (!r.empty ());
+ assert (r.begin ()->id == o2->id);
+ assert (r.begin ()->o1->id == o1_1->id);
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+
+ {
+ // one(i)-to-many
+ //
+ typedef odb::query<obj3> query;
+ typedef odb::result<obj3> result;
+
+ session s;
+ transaction t (db->begin ());
+
+ result r (db->query<obj3> (query::o1->id == "obj1 1"));
+ size_t n (0);
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ assert (i->id == o3_1->id || i->id == o3_2->id);
+ assert (i->o1->id == o1_1->id);
+ n++;
+ }
+
+ assert (n == 2);
+
+ t.commit ();
+ }
+
+ delete o1_1;
+ delete o1_2;
+ }
+
+ // Test shared_ptr/weak_ptr.
+ //
+ {
+ using namespace test2;
+
+ obj1_ptr o1_1 (new obj1);
+ obj1_ptr o1_2 (new obj1);
+ obj2_ptr o2 (new obj2);
+ obj3_ptr o3_1 (new obj3);
+ obj3_ptr o3_2 (new obj3);
+ obj4_ptr o4 (new obj4);
+ obj5_ptr o5_1 (new obj5);
+ obj5_ptr o5_2 (new obj5);
+
+ o1_1->id = "obj1 1";
+ o1_1->o2 = o2;
+ o1_1->o3.push_back (o3_1);
+ o1_1->o3.push_back (o3_2);
+ o1_1->o4 = o4;
+ o1_1->o5.push_back (o5_1);
+ o1_1->o5.push_back (o5_2);
+
+ o1_2->id = "obj1 2";
+ o1_2->o2 = obj2_ptr ();
+ o1_2->o3.clear ();
+ o1_2->o4 = o4;
+ o1_2->o5.push_back (o5_1);
+
+ o2->str = "obj2";
+ o2->o1 = o1_1;
+
+ o3_1->str = "obj3 1";
+ o3_1->o1 = o1_1;
+
+ o3_2->str = "obj3 3";
+ o3_2->o1 = o1_1;
+
+ o4->str = "obj4";
+ o4->o1.push_back (o1_1);
+ o4->o1.push_back (o1_2);
+
+ o5_1->str = "obj5 1";
+ o5_1->o1.push_back (o1_1);
+ o5_1->o1.push_back (o1_2);
+
+ o5_2->str = "obj5 2";
+ o5_2->o1.push_back (o1_1);
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+
+ // objN come before obj1 to get object id assigned.
+ //
+ db->persist (o5_1);
+ db->persist (o5_2);
+ db->persist (o4);
+ db->persist (o3_1);
+ db->persist (o3_2);
+ db->persist (o2);
+ db->persist (o1_1);
+ db->persist (o1_2);
+
+ t.commit ();
+ }
+
+ // load
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ obj2_ptr x2 (db->load<obj2> (o2->id));
+ obj3_ptr x3_1 (db->load<obj3> (o3_1->id));
+ obj3_ptr x3_2 (db->load<obj3> (o3_2->id));
+ obj4_ptr x4 (db->load<obj4> (o4->id));
+ obj5_ptr x5_1 (db->load<obj5> (o5_1->id));
+ obj5_ptr x5_2 (db->load<obj5> (o5_2->id));
+ t.commit ();
+
+ assert (x2->str == o2->str);
+ assert (x2->o1.lock ()->id == o1_1->id);
+ assert (x2->o1.lock ()->o2 == x2);
+
+ assert (x3_1->str == o3_1->str);
+ assert (x3_2->str == o3_2->str);
+ assert (x3_1->o1.lock () == x3_2->o1.lock ());
+ assert (x3_1->o1.lock ()->id == o1_1->id);
+ assert (x3_1->o1.lock ()->o3[0] == x3_1);
+ assert (x3_1->o1.lock ()->o3[1] == x3_2);
+
+ {
+ assert (x4->str == o4->str);
+
+ obj1_ptr t1 (x4->o1[0].lock ()), t2 (x4->o1[1].lock ());
+
+ assert (t1->id == o1_1->id || t2->id == o1_1->id);
+ assert (t1->id == o1_2->id || t2->id == o1_2->id);
+ }
+
+ {
+ assert (x5_1->str == o5_1->str);
+ assert (x5_2->str == o5_2->str);
+
+ obj1_ptr t1 (x5_1->o1[0].lock ()), t2 (x5_1->o1[1].lock ()),
+ t3 (x5_2->o1[0].lock ());
+
+ assert (t1->id == o1_1->id || t2->id == o1_1->id);
+ assert (t1->id == o1_2->id || t2->id == o1_2->id);
+ assert (t3->id == o1_1->id);
+ }
+ }
+ }
+
+ // Test inverse based on points_to.
+ //
+ {
+ using namespace test3;
+
+ {
+ obj1 o1 (1, 2);
+ o1.o2 = new obj2;
+
+ {
+ transaction t (db->begin ());
+
+ o1.o2->o1 = db->persist (o1);
+ db->persist (o1.o2);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<obj1> p (db->load<obj1> (o1.id));
+ assert (p->o2->id == o1.o2->id);
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<obj1> query;
+
+ transaction t (db->begin ());
+
+ unique_ptr<obj1> p (db->query_one<obj1> (query::o2->o1.i == o1.id.i &&
+ query::o2->o1.j == o1.id.j));
+ assert (p->o2->id == o1.o2->id);
+
+ t.commit ();
+ }
+ }
+
+ {
+ obj3 o3;
+ o3.o4.push_back (new obj4);
+ o3.o4.push_back (new obj4);
+
+ {
+ transaction t (db->begin ());
+
+ o3.o4[0]->o3 = o3.o4[1]->o3 = db->persist (o3);
+ db->persist (o3.o4[0]);
+ db->persist (o3.o4[1]);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<obj3> p (db->load<obj3> (o3.id));
+ assert (p->o4[0]->id == o3.o4[0]->id);
+ assert (p->o4[1]->id == o3.o4[1]->id);
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<obj3> query;
+
+ transaction t (db->begin ());
+
+ unique_ptr<obj3> p (db->query_one<obj3> (query::id == o3.id));
+ assert (p->o4[0]->id == o3.o4[0]->id);
+ assert (p->o4[1]->id == o3.o4[1]->id);
+
+ t.commit ();
+ }
+ }
+ }
+
+ // Test inverse with nested data members.
+ //
+ {
+ using namespace test4;
+
+ {
+ obj1 o1;
+ o1.o2 = new obj2;
+
+ {
+ transaction t (db->begin ());
+
+ o1.o2->id.i = db->persist (o1);
+ o1.o2->id.j = 123;
+ db->persist (o1.o2);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<obj1> p (db->load<obj1> (o1.id));
+ assert (p->o2->id.i == o1.o2->id.i && p->o2->id.j == o1.o2->id.j);
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<obj1> query;
+
+ transaction t (db->begin ());
+
+ unique_ptr<obj1> p (db->query_one<obj1> (
+ query::o2->id.i == o1.o2->id.i &&
+ query::o2->id.j == o1.o2->id.j));
+ assert (p->o2->id.i == o1.o2->id.i && p->o2->id.j == o1.o2->id.j);
+
+ t.commit ();
+ }
+ }
+
+ {
+ obj3 o3;
+ o3.o4.push_back (new obj4);
+ o3.o4.push_back (new obj4);
+
+ {
+ transaction t (db->begin ());
+
+ o3.o4[0]->id.i = o3.o4[1]->id.i = db->persist (o3);
+ o3.o4[0]->id.j = 123;
+ o3.o4[1]->id.j = 234;
+ db->persist (o3.o4[0]);
+ db->persist (o3.o4[1]);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<obj3> p (db->load<obj3> (o3.id));
+ assert (p->o4[0]->id.i == o3.o4[0]->id.i &&
+ p->o4[0]->id.j == o3.o4[0]->id.j);
+
+ assert (p->o4[1]->id.i == o3.o4[1]->id.i &&
+ p->o4[1]->id.j == o3.o4[1]->id.j);
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<obj3> query;
+
+ transaction t (db->begin ());
+
+ unique_ptr<obj3> p (db->query_one<obj3> (query::id == o3.id));
+
+ assert (p->o4[0]->id.i == o3.o4[0]->id.i &&
+ p->o4[0]->id.j == o3.o4[0]->id.j);
+
+ assert (p->o4[1]->id.i == o3.o4[1]->id.i &&
+ p->o4[1]->id.j == o3.o4[1]->id.j);
+
+ t.commit ();
+ }
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/inverse/test.hxx b/odb-tests/common/inverse/test.hxx
new file mode 100644
index 0000000..a7b8678
--- /dev/null
+++ b/odb-tests/common/inverse/test.hxx
@@ -0,0 +1,391 @@
+// file : common/inverse/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <set>
+#include <vector>
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+
+// Test raw pointers.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ struct obj1;
+ struct obj2;
+ struct obj3;
+ struct obj4;
+ struct obj5;
+
+ typedef obj1* obj1_ptr;
+ typedef obj2* obj2_ptr;
+ typedef obj3* obj3_ptr;
+ typedef obj4* obj4_ptr;
+ typedef obj5* obj5_ptr;
+
+ typedef std::set<obj1_ptr> obj1_ptr_set;
+ typedef std::set<obj3_ptr> obj3_ptr_set;
+ typedef std::set<obj5_ptr> obj5_ptr_set;
+
+ #pragma db object
+ struct obj1
+ {
+ obj1 (): o2 (0), o4 (0) {}
+ ~obj1 ();
+
+ #pragma db id
+ std::string id;
+
+ obj2_ptr o2;
+
+ #pragma db id_column("obj1_id") value_column("obj3_id")
+ obj3_ptr_set o3;
+
+ obj4_ptr o4;
+
+ obj5_ptr_set o5;
+ };
+
+ #pragma db object
+ struct obj2
+ {
+ #pragma db id auto
+ int id;
+
+ // one-to-one
+ //
+ #pragma db inverse(o2)
+ obj1_ptr o1;
+
+ std::string str;
+ };
+
+ #pragma db object
+ struct obj3
+ {
+ std::string str;
+
+ // one(i)-to-many
+ //
+ #pragma db inverse (o3)
+ obj1_ptr o1;
+
+ #pragma db id auto
+ int id;
+ };
+
+ #pragma db object
+ struct obj4
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // many(i)-to-one
+ //
+ #pragma db inverse (o4)
+ obj1_ptr_set o1;
+ };
+
+ #pragma db object
+ struct obj5
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // many(i)-to-many
+ //
+ #pragma db inverse (o5)
+ obj1_ptr_set o1;
+ };
+
+ inline obj1::
+ ~obj1 ()
+ {
+ delete o2;
+ for (obj3_ptr_set::iterator i (o3.begin ()); i != o3.end (); ++i)
+ delete *i;
+ delete o4;
+ for (obj5_ptr_set::iterator i (o5.begin ()); i != o5.end (); ++i)
+ delete *i;
+ }
+}
+
+// Test shared_ptr/weak_ptr.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ using std::shared_ptr;
+ using std::weak_ptr;
+
+ struct obj1;
+ struct obj2;
+ struct obj3;
+ struct obj4;
+ struct obj5;
+
+ typedef shared_ptr<obj1> obj1_ptr;
+ typedef shared_ptr<obj2> obj2_ptr;
+ typedef shared_ptr<obj3> obj3_ptr;
+ typedef shared_ptr<obj4> obj4_ptr;
+ typedef shared_ptr<obj5> obj5_ptr;
+
+ typedef weak_ptr<obj1> obj1_wptr;
+
+ typedef std::vector<obj1_wptr> obj1_wptr_vec;
+ typedef std::vector<obj3_ptr> obj3_ptr_vec;
+ typedef std::vector<obj5_ptr> obj5_ptr_vec;
+
+ #pragma db object pointer(obj1_ptr)
+ struct obj1
+ {
+ #pragma db id
+ std::string id;
+
+ obj2_ptr o2;
+
+ #pragma db id_column("obj1_id") value_column("obj3_id")
+ obj3_ptr_vec o3;
+
+ obj4_ptr o4;
+ obj5_ptr_vec o5;
+ };
+
+ #pragma db object pointer(obj2_ptr)
+ struct obj2
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // one(i)-to-one
+ //
+ #pragma db inverse(o2)
+ obj1_wptr o1;
+ };
+
+ #pragma db object pointer(obj3_ptr)
+ struct obj3
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // one(i)-to-many
+ //
+ #pragma db inverse (o3)
+ obj1_wptr o1;
+ };
+
+ #pragma db object pointer(obj4_ptr)
+ struct obj4
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // many(i)-to-one
+ //
+ #pragma db inverse (o4)
+ obj1_wptr_vec o1;
+ };
+
+ #pragma db object pointer(obj5_ptr)
+ struct obj5
+ {
+ #pragma db id auto
+ int id;
+
+ std::string str;
+
+ // many(i)-to-many
+ //
+ #pragma db inverse (o5)
+ obj1_wptr_vec o1;
+ };
+}
+
+// Test inverse based on points_to.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ // Inverse pointer.
+ //
+ #pragma db value
+ struct comp
+ {
+ int i;
+ int j;
+ };
+
+ inline bool
+ operator< (comp x, comp y) {return x.i < y.i || (x.i == y.i && x.j < y.j);}
+
+ struct obj2;
+
+ #pragma db object
+ struct obj1
+ {
+ #pragma db id
+ comp id;
+
+ #pragma db inverse(o1)
+ obj2* o2;
+
+ obj1 (int i = 0, int j = 0): o2 (0) {id.i = i; id.j = j;}
+ ~obj1 ();
+ };
+
+ #pragma db object
+ struct obj2
+ {
+ #pragma db id auto
+ int id;
+
+ #pragma db points_to(obj1)
+ comp o1;
+
+#ifndef ODB_DATABASE_MYSQL
+ #pragma db member(o1) on_delete(cascade)
+#endif
+ };
+
+ inline obj1::
+ ~obj1 () {delete o2;}
+
+ // Inverse container of pointers.
+ //
+ struct obj4;
+
+ #pragma db object
+ struct obj3
+ {
+ #pragma db id auto
+ int id;
+
+ #pragma db inverse(o3)
+ std::vector<obj4*> o4;
+
+ ~obj3 ();
+ };
+
+ #pragma db object
+ struct obj4
+ {
+ #pragma db id auto
+ int id;
+
+ #pragma db points_to(obj3)
+ int o3;
+ };
+
+ inline obj3::
+ ~obj3 ()
+ {
+ for (std::vector<obj4*>::iterator i (o4.begin ()); i != o4.end (); ++i)
+ delete *i;
+ }
+};
+
+// Test inverse with nested data members.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ // Inverse pointer.
+ //
+ struct obj1;
+ struct obj2;
+
+ #pragma db value
+ struct obj2_id
+ {
+ #pragma db points_to(obj1)
+ int i;
+ int j;
+ };
+
+ inline bool
+ operator< (obj2_id x, obj2_id y)
+ {return x.i < y.i || (x.i == y.i && x.j < y.j);}
+
+ #pragma db object
+ struct obj1
+ {
+ #pragma db id auto
+ int id;
+
+ #pragma db inverse(id.i)
+ obj2* o2;
+
+ obj1 (): o2 (0) {}
+ ~obj1 ();
+ };
+
+ #pragma db object
+ struct obj2
+ {
+ #pragma db id
+ obj2_id id;
+ };
+
+ inline obj1::
+ ~obj1 () {delete o2;}
+
+ // Inverse container of pointers.
+ //
+ struct obj3;
+ struct obj4;
+
+ #pragma db value
+ struct obj4_id
+ {
+ #pragma db points_to(obj3)
+ int i;
+ int j;
+ };
+
+ inline bool
+ operator< (obj4_id x, obj4_id y)
+ {return x.i < y.i || (x.i == y.i && x.j < y.j);}
+
+ #pragma db object
+ struct obj3
+ {
+ #pragma db id auto
+ int id;
+
+ #pragma db inverse(id.i)
+ std::vector<obj4*> o4;
+
+ ~obj3 ();
+ };
+
+ #pragma db object
+ struct obj4
+ {
+ #pragma db id
+ obj4_id id;
+ };
+
+ inline obj3::
+ ~obj3 ()
+ {
+ for (std::vector<obj4*>::iterator i (o4.begin ()); i != o4.end (); ++i)
+ delete *i;
+ }
+};
+#endif // TEST_HXX
diff --git a/odb-tests/common/inverse/testscript b/odb-tests/common/inverse/testscript
new file mode 100644
index 0000000..c2a4e3e
--- /dev/null
+++ b/odb-tests/common/inverse/testscript
@@ -0,0 +1,33 @@
+# file : common/inverse/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/lazy-ptr/buildfile b/odb-tests/common/lazy-ptr/buildfile
new file mode 100644
index 0000000..d495d2f
--- /dev/null
+++ b/odb-tests/common/lazy-ptr/buildfile
@@ -0,0 +1,41 @@
+# file : common/lazy-ptr/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix lazy_ptr_ \
+ --generate-schema \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/lazy-ptr/driver.cxx b/odb-tests/common/lazy-ptr/driver.cxx
new file mode 100644
index 0000000..9a3b324
--- /dev/null
+++ b/odb-tests/common/lazy-ptr/driver.cxx
@@ -0,0 +1,360 @@
+// file : common/lazy-ptr/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test lazy object pointers.
+//
+
+#include <memory> // std::unique_ptr
+#include <utility> // std::move
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+namespace test2
+{
+ cont::cont (unsigned long i)
+ : id (i)
+ {
+ }
+
+ obj_ptr
+ create (unsigned int id)
+ {
+ obj_ptr r (new obj (id));
+ return r;
+ }
+
+ lazy_obj_ptr
+ create (database& db, unsigned int id)
+ {
+ lazy_obj_ptr r (db, id);
+ return r;
+ }
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Raw.
+ //
+ {
+ using namespace test1;
+
+ // persist
+ //
+ obj* o1 (new obj (1));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ t.commit ();
+ }
+
+ unique_ptr<cont> c1 (new cont (1));
+ unique_ptr<cont> c2 (new cont (2));
+
+ lazy_ptr<obj> lo1 (*db, 1);
+ obj* o2 (new obj (2));
+
+ obj* o3 (new obj (3));
+ obj* o4 (new obj (4));
+
+ c1->o.push_back (lo1);
+ c1->o.push_back (o2);
+ c2->o.push_back (o3);
+ c2->o.push_back (o4);
+
+ // Test pointer comparison.
+ //
+ assert (lazy_ptr<obj> () == lazy_ptr<obj> ());
+ assert (lazy_ptr<obj> (o1) != lazy_ptr<obj> ());
+ assert (lo1 != lazy_ptr<obj> ());
+ assert (lazy_ptr<obj> (o1) == lazy_ptr<obj> (o1));
+ assert (lo1 == lazy_ptr<obj> (*db, o1));
+ assert (lo1 != lazy_ptr<obj> (*db, o2));
+
+ delete o1;
+
+ {
+ transaction t (db->begin ());
+
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+
+ db->persist (*c1);
+ db->persist (*c2);
+
+ t.commit ();
+ }
+
+ // load
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<cont> c (db->load<cont> (1));
+ obj* o (db->load<obj> (1));
+
+ // Not loaded.
+ //
+ assert (c->o.size () == 2);
+ assert (!c->o[0].loaded ());
+ assert (!c->o[1].loaded ());
+
+ assert (!o->c.loaded ());
+
+ // Correct object ids.
+ //
+ assert (c->o[0].object_id () == o->id);
+ assert (o->c.object_id () == c->id);
+
+ // Load.
+ //
+ cont* cl (o->c.load ());
+ obj* ol (c->o[0].load ());
+
+ assert (cl == c.get ());
+ assert (ol == o);
+
+ // Test unload/reload.
+ //
+ o->c.unload ();
+ assert (!o->c.loaded ());
+ o->c.load ();
+ assert (o->c.loaded ());
+
+ t.commit ();
+ }
+ }
+
+ // std::unique_ptr
+ //
+ {
+ using namespace test2;
+
+ // persist
+ //
+ {
+ obj_ptr o1 (new obj (1));
+ transaction t (db->begin ());
+ db->persist (*o1);
+ t.commit ();
+ }
+
+ cont_ptr c1 (new cont (1));
+ cont_ptr c2 (new cont (2));
+
+ lazy_obj_ptr lo1 = create (*db, 1);
+ lo1 = create (*db, 1);
+
+ c1->o = std::move (lo1);
+ c2->o = create (2);
+
+ {
+ transaction t (db->begin ());
+
+ db->persist (*c2->o);
+
+ db->persist (*c1);
+ db->persist (*c2);
+
+ t.commit ();
+ }
+
+ // load
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ cont_ptr c (db->load<cont> (1));
+ obj* o (db->load<obj> (1));
+
+ // Not loaded.
+ //
+ assert (!c->o.loaded ());
+ assert (!o->c.loaded ());
+
+ // Correct object ids.
+ //
+ assert (c->o.object_id () == o->id);
+ assert (o->c.object_id () == c->id);
+
+ // Load.
+ //
+ cont* cl (o->c.load ());
+ const obj_ptr& ol (c->o.load ());
+
+ assert (cl == c.get ());
+ assert (ol.get () == o);
+
+ t.commit ();
+ }
+
+ // unload/reload
+ //
+ {
+ // No session.
+ transaction t (db->begin ());
+ cont_ptr c (db->load<cont> (1));
+
+ assert (!c->o.loaded ());
+ c->o.load ();
+ assert (c->o.loaded ());
+ c->o.unload ();
+ assert (!c->o.loaded ());
+ c->o.load ();
+ assert (c->o.loaded ());
+
+ t.commit ();
+ }
+ }
+
+ // Shared pointer from C++11 or TR1.
+ //
+ {
+ using namespace test3;
+
+ // persist
+ //
+ shared_ptr<cont> c1 (new cont (1));
+
+ {
+ transaction t (db->begin ());
+ db->persist (c1);
+ t.commit ();
+ }
+
+ lazy_shared_ptr<cont> lc1 (*db, 1);
+ shared_ptr<cont> c2 (new cont (2));
+
+ shared_ptr<obj> o1 (new obj (1));
+ shared_ptr<obj> o2 (new obj (2));
+
+ shared_ptr<obj> o3 (new obj (3));
+ shared_ptr<obj> o4 (new obj (4));
+
+ o1->c = lc1;
+ o2->c = lc1;
+ o3->c = c2;
+ o4->c = c2;
+
+ // Test pointer comparison.
+ //
+ assert (lazy_shared_ptr<cont> () == lazy_shared_ptr<cont> ());
+ assert (lazy_shared_ptr<cont> (c1) != lazy_shared_ptr<cont> ());
+ assert (lc1 != lazy_shared_ptr<cont> ());
+ assert (lazy_shared_ptr<cont> (c1) == lazy_shared_ptr<cont> (c1));
+ assert (lc1 == lazy_shared_ptr<cont> (*db, c1));
+ assert (lc1 != lazy_shared_ptr<cont> (*db, c2));
+
+ // Test move constructors.
+ //
+ {
+ lazy_shared_ptr<cont> tmp (*db, 1);
+ lazy_shared_ptr<cont> l (std::move (tmp));
+ assert (lc1 == l);
+ }
+
+ {
+ shared_ptr<cont> tmp (c1);
+ lazy_shared_ptr<cont> l (*db, std::move (tmp));
+ assert (lc1 == l);
+ }
+
+ {
+ transaction t (db->begin ());
+
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+
+ db->persist (c2);
+
+ t.commit ();
+ }
+
+ // load
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+ shared_ptr<cont> c (db->load<cont> (1));
+ shared_ptr<obj> o (db->load<obj> (1));
+
+ // Not loaded.
+ //
+ assert (c->o.size () == 2);
+ assert (!c->o[0].loaded ());
+ assert (!c->o[1].loaded ());
+
+ assert (!o->c.loaded ());
+
+ // Correct object ids.
+ //
+ assert (c->o[0].object_id () == o->id);
+ assert (o->c.object_id () == c->id);
+
+ // Load.
+ //
+ shared_ptr<cont> cl (o->c.load ());
+ shared_ptr<obj> ol (c->o[0].load ());
+
+ assert (cl == c);
+ assert (ol == o);
+
+ t.commit ();
+ }
+
+ // Test lazy weak locking and reloading.
+ //
+ {
+ // No session.
+ transaction t (db->begin ());
+ shared_ptr<cont> c (db->load<cont> (1));
+
+ // Lock.
+ //
+ assert (!c->o[1].loaded ());
+ lazy_shared_ptr<obj> l (c->o[1].lock ());
+ assert (!l.loaded ());
+ assert (l.object_id () == c->o[1].object_id ());
+
+ // Reload.
+ //
+ assert (!c->o[1].loaded ());
+ shared_ptr<obj> ol (c->o[1].load ());
+ assert (c->o[1].loaded ());
+ ol.reset ();
+ assert (!c->o[1].loaded ());
+ ol = c->o[1].load ();
+ assert (c->o[1].loaded ());
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/lazy-ptr/test.hxx b/odb-tests/common/lazy-ptr/test.hxx
new file mode 100644
index 0000000..f946029
--- /dev/null
+++ b/odb-tests/common/lazy-ptr/test.hxx
@@ -0,0 +1,147 @@
+// file : common/lazy-ptr/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+#include <odb/lazy-ptr.hxx>
+
+// Raw pointer.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ using odb::lazy_ptr;
+ class obj;
+
+ #pragma db object
+ class cont
+ {
+ public:
+ cont () {}
+ cont (unsigned long i): id (i) {}
+ ~cont ();
+
+ #pragma db id
+ unsigned long id;
+
+ typedef std::vector<lazy_ptr<obj> > obj_list;
+
+ #pragma db value_not_null
+ obj_list o;
+ };
+
+ #pragma db object
+ class obj
+ {
+ public:
+ obj () {}
+ obj (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db inverse(o) not_null
+ lazy_ptr<cont> c; // weak
+ };
+
+ inline cont::
+ ~cont ()
+ {
+ for (obj_list::iterator i (o.begin ()); i != o.end (); ++i)
+ if (obj* p = i->get ())
+ delete p;
+ }
+}
+
+// std::auto_ptr/std::unique_ptr
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ using odb::lazy_ptr;
+
+ class obj;
+ class cont;
+
+ typedef std::unique_ptr<obj> obj_ptr;
+ typedef std::unique_ptr<cont> cont_ptr;
+ typedef odb::lazy_unique_ptr<obj> lazy_obj_ptr;
+
+ #pragma db object
+ class cont
+ {
+ public:
+ cont () = default;
+ cont (unsigned long id);
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db not_null
+ lazy_obj_ptr o;
+ };
+
+ #pragma db object
+ class obj
+ {
+ public:
+ obj () = default;
+ obj (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db inverse(o) not_null
+ lazy_ptr<cont> c; // weak
+ };
+}
+
+// shared_ptr
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ using std::shared_ptr;
+ using odb::lazy_shared_ptr;
+ using odb::lazy_weak_ptr;
+
+ class obj;
+
+ #pragma db object pointer(shared_ptr<cont>)
+ class cont
+ {
+ public:
+ cont () {}
+ cont (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ typedef std::vector<lazy_weak_ptr<obj> > obj_list;
+
+ #pragma db inverse(c) value_not_null
+ obj_list o;
+ };
+
+ #pragma db object pointer(shared_ptr<obj>)
+ class obj
+ {
+ public:
+ obj () {}
+ obj (unsigned long i): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db not_null
+ lazy_shared_ptr<cont> c;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/lazy-ptr/testscript b/odb-tests/common/lazy-ptr/testscript
new file mode 100644
index 0000000..736fa4c
--- /dev/null
+++ b/odb-tests/common/lazy-ptr/testscript
@@ -0,0 +1,33 @@
+# file : common/lazy-ptr/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/lifecycle/buildfile b/odb-tests/common/lifecycle/buildfile
new file mode 100644
index 0000000..b5b2b00
--- /dev/null
+++ b/odb-tests/common/lifecycle/buildfile
@@ -0,0 +1,40 @@
+# file : common/lifecycle/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix lifecycle_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/lifecycle/driver.cxx b/odb-tests/common/lifecycle/driver.cxx
new file mode 100644
index 0000000..a01d5bd
--- /dev/null
+++ b/odb-tests/common/lifecycle/driver.cxx
@@ -0,0 +1,248 @@
+// file : common/lifecycle/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test object state transistions.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Database operation out of transaction.
+ //
+ try
+ {
+ object o (1);
+ db->persist (o);
+ assert (false);
+ }
+ catch (const not_in_transaction&)
+ {
+ }
+
+ // Transient.
+ //
+ try
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+
+ // Persistent.
+ //
+ {
+ object o (1);
+ o.str_ = "value 1";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_already_persistent&)
+ {
+ }
+ }
+
+ // Find.
+ //
+ {
+ transaction t (db->begin ());
+
+ unique_ptr<object> o1 (db->find<object> (1));
+ assert (o1.get () != 0 && o1->str_ == "value 1");
+
+ unique_ptr<object> o2 (db->find<object> (2));
+ assert (o2.get () == 0);
+
+ t.commit ();
+ }
+
+ // Find (into existing).
+ //
+ {
+ object o;
+
+ transaction t (db->begin ());
+
+ assert (db->find (1, o));
+ assert (o.str_ == "value 1");
+
+ assert (!db->find (2, o));
+
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ assert (o->str_ == "value 1");
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (2));
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+
+ // Load (into existing).
+ //
+ {
+ object o;
+
+ transaction t (db->begin ());
+ db->load (1, o);
+ assert (o.str_ == "value 1");
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ db->load (2, o);
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+
+ // Reload.
+ //
+ {
+ object o;
+
+ transaction t (db->begin ());
+ db->load (1, o);
+ o.str_ = "junk";
+ db->reload (o);
+ assert (o.str_ == "value 1");
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ o.id_ = 2;
+ db->reload (o);
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+
+ // Modified.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ o->str_ = "value 2";
+ db->update (*o);
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ o->id_ = 2;
+ db->update (*o);
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ assert (o->str_ == "value 2");
+ t.commit ();
+ }
+
+ // Update of unmodified object.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ db->update (*o);
+ t.commit ();
+ }
+
+ // Transient.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ db->erase (*o);
+ t.commit ();
+
+ try
+ {
+ transaction t (db->begin ());
+ db->erase<object> (1);
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+
+ try
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o (db->load<object> (1));
+ assert (false);
+ t.commit ();
+ }
+ catch (const object_not_persistent&)
+ {
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/lifecycle/test.hxx b/odb-tests/common/lifecycle/test.hxx
new file mode 100644
index 0000000..8d260d2
--- /dev/null
+++ b/odb-tests/common/lifecycle/test.hxx
@@ -0,0 +1,27 @@
+// file : common/lifecycle/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+ std::string str_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/lifecycle/testscript b/odb-tests/common/lifecycle/testscript
new file mode 100644
index 0000000..0337bba
--- /dev/null
+++ b/odb-tests/common/lifecycle/testscript
@@ -0,0 +1,33 @@
+# file : common/lifecycle/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/no-id/buildfile b/odb-tests/common/no-id/buildfile
new file mode 100644
index 0000000..1a64401
--- /dev/null
+++ b/odb-tests/common/no-id/buildfile
@@ -0,0 +1,41 @@
+# file : common/no-id/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix no_id_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/no-id/driver.cxx b/odb-tests/common/no-id/driver.cxx
new file mode 100644
index 0000000..eee69a5
--- /dev/null
+++ b/odb-tests/common/no-id/driver.cxx
@@ -0,0 +1,102 @@
+// file : common/no-id/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test persistent classes without id.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o1 (1, "aaa");
+ object o2 (2, "bbb");
+ object o3 (3, "ccc");
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o2); // Ok, since there is no id.
+ db->persist (o3);
+ t.commit ();
+ }
+
+ // Compile errors.
+ //
+ {
+ //db->load<object> (1);
+ //db->find<object> (1);
+ //db->update (o1);
+ //db->erase<object> (1);
+ }
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // Query.
+ //
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> ());
+ assert (size (r) == 4);
+ }
+
+ {
+ result r (db->query<object> (query::str == "aaa"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->num == 1 && i->str == "aaa");
+ object o;
+ i.load (o);
+ //i.id (); // Compile-time error.
+ assert (o.num == 1 && o.str == "aaa");
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> (query::num < 3));
+ assert (size (r) == 3);
+ }
+
+ t.commit ();
+ }
+
+ // Erase (query).
+ //
+ {
+ transaction t (db->begin ());
+ assert (db->erase_query<object> (query::num == 2) == 2);
+ assert (db->erase_query<object> () == 2);
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/no-id/test.hxx b/odb-tests/common/no-id/test.hxx
new file mode 100644
index 0000000..c5b5c65
--- /dev/null
+++ b/odb-tests/common/no-id/test.hxx
@@ -0,0 +1,21 @@
+// file : common/no-id/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object no_id
+struct object
+{
+ object () {}
+ object (unsigned long n, const std::string& s): num (n), str (s) {}
+
+ unsigned long num;
+ std::string str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/no-id/testscript b/odb-tests/common/no-id/testscript
new file mode 100644
index 0000000..5ec57ee
--- /dev/null
+++ b/odb-tests/common/no-id/testscript
@@ -0,0 +1,33 @@
+# file : common/no-id/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/object/buildfile b/odb-tests/common/object/buildfile
new file mode 100644
index 0000000..cb56aee
--- /dev/null
+++ b/odb-tests/common/object/buildfile
@@ -0,0 +1,41 @@
+# file : common/object/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix object_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/object/driver.cxx b/odb-tests/common/object/driver.cxx
new file mode 100644
index 0000000..1c29417
--- /dev/null
+++ b/odb-tests/common/object/driver.cxx
@@ -0,0 +1,84 @@
+// file : common/object/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test persistent classes.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test persistent class template instantiation.
+ //
+ {
+ using namespace test1;
+
+ pair_object po;
+ po.second = "abc";
+
+ derived d;
+ d.x = "abc";
+ d.n = 123;
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist<pair_object> (po);
+ db->persist (d);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<pair_object> po1 (db->load<pair_object> (po.first));
+ unique_ptr<derived> d1 (db->load<derived> (d.id));
+ t.commit ();
+
+ assert (po == *po1);
+
+ assert (d.x == d1->x);
+ assert (d.n == d1->n);
+ }
+
+ // Test the API confusion.
+ //
+ {
+ transaction t (db->begin ());
+ db->update<pair_object> (po);
+ db->reload<pair_object> (po);
+ db->erase<pair_object> (po);
+
+ db->query<pair_object> ();
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/object/test.hxx b/odb-tests/common/object/test.hxx
new file mode 100644
index 0000000..87bac91
--- /dev/null
+++ b/odb-tests/common/object/test.hxx
@@ -0,0 +1,49 @@
+// file : common/object/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <utility> // std::pair
+
+#include <odb/core.hxx>
+
+// Test persistent class template instantiation.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ typedef std::pair<unsigned long, std::string> pair_object;
+ #pragma db object(pair_object)
+ #pragma db member(pair_object::first) id auto
+
+ #pragma db object abstract
+ struct base_data
+ {
+ #pragma db id auto
+ unsigned long id;
+ };
+
+ template <typename T>
+ struct base: base_data
+ {
+ T x;
+ };
+
+ typedef base<std::string> base_derived;
+ #pragma db object(base_derived) abstract
+
+ #pragma db object
+ struct derived: base_derived
+ {
+ int n;
+ };
+
+ // Test instantiation in order to "see" id, etc.
+ //
+ typedef base<int> int_base;
+ #pragma db object(int_base)
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/object/testscript b/odb-tests/common/object/testscript
new file mode 100644
index 0000000..6982409
--- /dev/null
+++ b/odb-tests/common/object/testscript
@@ -0,0 +1,33 @@
+# file : common/object/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/optimistic/buildfile b/odb-tests/common/optimistic/buildfile
new file mode 100644
index 0000000..06af705
--- /dev/null
+++ b/odb-tests/common/optimistic/buildfile
@@ -0,0 +1,41 @@
+# file : common/optimistic/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_optimistic_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/optimistic/driver.cxx b/odb-tests/common/optimistic/driver.cxx
new file mode 100644
index 0000000..6dfec6e
--- /dev/null
+++ b/odb-tests/common/optimistic/driver.cxx
@@ -0,0 +1,300 @@
+// file : common/optimistic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test optimistic concurrency support.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+unsigned long
+version (const unique_ptr<database>& db, unsigned long id)
+{
+ typedef odb::query<object_version> query;
+ typedef odb::result<object_version> result;
+
+ result r (db->query<object_version> (query::id == id));
+ return r.empty () ? 0 : r.begin ()->ver;
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o (1);
+ o.num = 123;
+ o.str = "abc";
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Verify initial version in the instance and database.
+ //
+ assert (o.ver == 1);
+ {
+ transaction t (db->begin ());
+ assert (version (db, 1) == 1);
+ t.commit ();
+ }
+
+ object c (o);
+ o.num++;
+ o.str += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ // Verify updated version in the instance and database.
+ //
+ assert (o.ver == 2);
+ {
+ transaction t (db->begin ());
+ assert (version (db, 1) == 2);
+ t.commit ();
+ }
+
+ // Verify the data has been updated.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o1->ver == 2 && o1->num == 124 && o1->str == "abcd");
+ }
+
+ // Try to update using outdated object.
+ //
+ c.num--;
+ c.str += 'z';
+
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (c);
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ // Verify the data hasn't changed.
+ //
+ unique_ptr<object> o1 (db->load<object> (1));
+ assert (o1->ver == 2 && o1->num == 124 && o1->str == "abcd");
+
+ // Reload the object.
+ //
+ db->reload (c);
+ assert (c.ver == 2 && c.num == 124);
+
+ // Check that we don't reload an object that is up-to-date.
+ //
+ c.num--;
+ db->reload (c);
+ assert (c.ver == 2 && c.num == 123);
+
+ t.commit ();
+ }
+
+ // Try to delete using an outdated object.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (o);
+ db->erase (c);
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ t.commit ();
+ }
+
+ // Try to delete using an up-to-date object.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+
+ // Try to update deleted object.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const object_not_persistent&)
+ {
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ t.commit ();
+ }
+
+ // Optimistic delete of objects with container requires
+ // extra logic. Test it here.
+ //
+ {
+ container o ("abc");
+ o.nums.push_back (1);
+ o.nums.push_back (2);
+ o.nums.push_back (3);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ container c (o);
+ o.nums.pop_back ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ // Try to delete using an outdated object.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->erase (c);
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ // Verify the container data hasn't changed.
+ //
+ unique_ptr<container> o1 (db->load<container> ("abc"));
+ assert (o1->nums.size () == 2 && o1->nums[0] == 1 && o1->nums[1] == 2);
+
+ t.commit ();
+ }
+
+ // Try to delete using an up-to-date object.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test optimistic class inheritance. This is a shortened version
+ // of the object test.
+ //
+ {
+ derived o;
+ o.num = 123;
+ o.str = "abc";
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ derived c (o);
+ o.num++;
+ o.str += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ // Try to update using outdated object.
+ //
+ c.num--;
+ c.str += 'z';
+
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (c);
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ // Reload the object.
+ //
+ db->reload (c);
+ assert (c.ver == 2 && c.num == 124);
+
+ t.commit ();
+ }
+
+ // Try to delete using an outdated object.
+ //
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ db->update (o);
+ db->erase (c);
+ assert (false);
+ }
+ catch (const object_changed&) {}
+
+ t.commit ();
+ }
+
+ // Try to delete using an up-to-date object.
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/optimistic/test.hxx b/odb-tests/common/optimistic/test.hxx
new file mode 100644
index 0000000..fcefa3d
--- /dev/null
+++ b/odb-tests/common/optimistic/test.hxx
@@ -0,0 +1,76 @@
+// file : common/optimistic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db object optimistic
+struct object
+{
+ object (): ver (123) {}
+ object (unsigned long id): id_ (id), ver (123) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db version
+ unsigned long ver;
+
+ unsigned int num;
+ std::string str;
+};
+
+#pragma db view object(object)
+struct object_version
+{
+ unsigned long ver;
+};
+
+// Optimistic class with a container.
+//
+#pragma db object optimistic
+struct container
+{
+ container (): ver (123) {}
+ container (const std::string& id): id_ (id), ver (123) {}
+
+ #pragma db id
+ std::string id_;
+
+ #pragma db version
+ unsigned long ver;
+
+ std::vector<unsigned int> nums;
+};
+
+// Optimistic class inheritance.
+//
+#pragma db object abstract optimistic
+struct base
+{
+ base (): ver (123) {}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ #pragma db version
+ const unsigned long ver;
+
+ std::string str;
+
+ #pragma db readonly
+ std::string ro;
+};
+
+#pragma db object
+struct derived: base
+{
+ unsigned int num;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/optimistic/testscript b/odb-tests/common/optimistic/testscript
new file mode 100644
index 0000000..9ebafb2
--- /dev/null
+++ b/odb-tests/common/optimistic/testscript
@@ -0,0 +1,33 @@
+# file : common/optimistic/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/pragma/buildfile b/odb-tests/common/pragma/buildfile
new file mode 100644
index 0000000..a2eeaa0
--- /dev/null
+++ b/odb-tests/common/pragma/buildfile
@@ -0,0 +1,39 @@
+# file : common/pragma/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pragma_
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/pragma/driver.cxx b/odb-tests/common/pragma/driver.cxx
new file mode 100644
index 0000000..a9cc6e0
--- /dev/null
+++ b/odb-tests/common/pragma/driver.cxx
@@ -0,0 +1,27 @@
+// file : common/pragma/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test #pragma db parsing.
+//
+
+#include <memory>
+#include <iostream>
+
+#include <odb/exceptions.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main ()
+{
+}
diff --git a/odb-tests/common/pragma/test.hxx b/odb-tests/common/pragma/test.hxx
new file mode 100644
index 0000000..6877e73
--- /dev/null
+++ b/odb-tests/common/pragma/test.hxx
@@ -0,0 +1,40 @@
+// file : common/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db value(bool) type ("INTEGER")
+
+struct x {int i;};
+#pragma db value (x)
+
+namespace N
+{
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db member type ("INTEGER")
+ bool b_;
+ };
+
+ struct object2
+ {
+ object2 () {}
+
+ unsigned long id_;
+ };
+
+ #pragma db object (object2)
+}
+
+PRAGMA_DB (member (N::object2::id_) id auto);
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/pragma/testscript b/odb-tests/common/pragma/testscript
new file mode 100644
index 0000000..089f7a1
--- /dev/null
+++ b/odb-tests/common/pragma/testscript
@@ -0,0 +1,31 @@
+# file : common/include/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $* &!odb-test.db
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/prepared/buildfile b/odb-tests/common/prepared/buildfile
new file mode 100644
index 0000000..4006a4f
--- /dev/null
+++ b/odb-tests/common/prepared/buildfile
@@ -0,0 +1,43 @@
+# file : common/prepared/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix prepared_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared \
+ --omit-unprepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/prepared/driver.cxx b/odb-tests/common/prepared/driver.cxx
new file mode 100644
index 0000000..44df651
--- /dev/null
+++ b/odb-tests/common/prepared/driver.cxx
@@ -0,0 +1,444 @@
+// file : common/prepared/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test prepared query functionality.
+//
+
+#include <memory> // std::unique_ptr
+#include <utility> // std::move
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct params
+{
+ unsigned short age;
+ std::string name;
+};
+
+static void
+query_factory (const char* name, connection& c)
+{
+ typedef odb::query<person> query;
+
+ unique_ptr<params> p (new params);
+ prepared_query<person> pq (
+ c.prepare_query<person> (
+ name,
+ query::age > query::_ref (p->age) &&
+ query::name != query::_ref (p->name)));
+ c.cache_query (pq, move (p));
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ {
+ person p1 ("John First", 91);
+ person p2 ("John Second", 81);
+ person p3 ("John Third", 71);
+ person p4 ("John Fourth", 61);
+ person p5 ("John Fifth", 51);
+
+ transaction t (db->begin ());
+ db->persist (p1);
+ db->persist (p2);
+ db->persist (p3);
+ db->persist (p4);
+ db->persist (p5);
+ t.commit ();
+ }
+
+ typedef odb::query<person> query;
+ typedef odb::prepared_query<person> prep_query;
+ typedef odb::result<person> result;
+
+ // Uncached query in the same transaction.
+ //
+ {
+ transaction t (db->begin ());
+
+ unsigned short age (90);
+ prep_query pq (
+ db->prepare_query<person> (
+ "person-age-query",
+ query::age > query::_ref (age)));
+
+ for (unsigned short i (1); i < 6; ++i, age -= 10)
+ {
+ result r (pq.execute ());
+ assert (size (r) == i);
+ }
+
+ age = 90;
+ result r (pq.execute ());
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->name_ == "John First" && i->age_ == 91);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // Uncached query in multiple transaction.
+ //
+ {
+ connection_ptr c (db->connection ());
+
+ unsigned short age (90);
+ prep_query pq (
+ c->prepare_query<person> (
+ "person-age-query",
+ query::age > query::_ref (age)));
+
+ for (unsigned short i (1); i < 6; ++i, age -= 10)
+ {
+ transaction t (c->begin ());
+
+ result r (pq.execute ());
+ assert (size (r) == i);
+
+ t.commit ();
+ }
+
+ transaction t (c->begin ());
+
+ age = 90;
+ result r (pq.execute ());
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->name_ == "John First" && i->age_ == 91);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // Cached query without parameters.
+ //
+ {
+ for (unsigned short i (1); i < 6; ++i)
+ {
+ transaction t (db->begin ());
+
+ prep_query pq (db->lookup_query<person> ("person-val-age-query"));
+
+ if (!pq)
+ {
+ assert (i == 1);
+ pq = db->prepare_query<person> (
+ "person-val-age-query",
+ query::age > 90);
+ db->cache_query (pq);
+ }
+ else if (i == 2)
+ {
+ try
+ {
+ db->cache_query (pq);
+ assert (false);
+ }
+ catch (const odb::prepared_already_cached&)
+ {
+ }
+ }
+
+ result r (pq.execute ());
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+ }
+
+ // Cached query with parameters.
+ //
+ {
+ for (unsigned short i (1); i < 6; ++i)
+ {
+ transaction t (db->begin ());
+
+ unsigned short* age;
+ prep_query pq (db->lookup_query<person> ("person-ref-age-query", age));
+
+ if (!pq)
+ {
+ assert (i == 1);
+
+ unique_ptr<unsigned short> p (new unsigned short);
+ age = p.get ();
+ pq = db->prepare_query<person> (
+ "person-ref-age-query",
+ query::age > query::_ref (*age));
+
+ db->cache_query (pq, move (p));
+ }
+ else if (i == 2)
+ {
+ // Object type mismatch.
+ //
+ try
+ {
+ db->lookup_query<int> ("person-ref-age-query", age);
+ assert (false);
+ }
+ catch (const odb::prepared_type_mismatch&)
+ {
+ }
+
+ // Parameters type mismatch.
+ //
+ try
+ {
+ int* age;
+ db->lookup_query<person> ("person-ref-age-query", age);
+ assert (false);
+ }
+ catch (const odb::prepared_type_mismatch&)
+ {
+ }
+ }
+
+ *age = 100 - i * 10;
+ result r (pq.execute ());
+ assert (size (r) == i);
+
+ t.commit ();
+ }
+ }
+
+ // Cached query with factory.
+ //
+ {
+ db->query_factory ("person-params-query", &query_factory);
+
+ for (unsigned int i (1); i < 6; ++i)
+ {
+ transaction t (db->begin ());
+
+ params* p;
+ prep_query pq (db->lookup_query<person> ("person-params-query", p));
+ assert (pq);
+
+ p->age = 100 - i * 10;
+ p->name = "John First";
+ result r (pq.execute ());
+ assert (size (r) == i - 1);
+
+ t.commit ();
+ }
+
+ db->query_factory ("person-params-query",
+ database::query_factory_ptr ());
+ }
+
+ // Cached query with wildcard factory.
+ //
+ {
+ db->query_factory ("", &query_factory);
+
+ for (unsigned int i (1); i < 6; ++i)
+ {
+ transaction t (db->begin ());
+
+ params* p;
+ prep_query pq (db->lookup_query<person> ("person-params-query-1", p));
+ assert (pq);
+
+ p->age = 100 - i * 10;
+ p->name = "John First";
+ result r (pq.execute ());
+ assert (size (r) == i - 1);
+
+ t.commit ();
+ }
+
+ db->query_factory ("", database::query_factory_ptr ());
+ }
+
+ // Cached query with lambda factory.
+ //
+ {
+ db->query_factory (
+ "person-params-query-2",
+ [] (const char* name, connection& c)
+ {
+ typedef odb::query<person> query;
+
+ unique_ptr<params> p (new params);
+ prepared_query<person> pq (
+ c.prepare_query<person> (
+ name,
+ query::age > query::_ref (p->age) &&
+ query::name != query::_ref (p->name)));
+ c.cache_query (pq, move (p));
+ });
+
+ for (unsigned int i (1); i < 6; ++i)
+ {
+ transaction t (db->begin ());
+
+ params* p;
+ prep_query pq (db->lookup_query<person> ("person-params-query-2", p));
+ assert (pq);
+
+ p->age = 100 - i * 10;
+ p->name = "John First";
+ result r (pq.execute ());
+ assert (size (r) == i - 1);
+
+ t.commit ();
+ }
+
+ db->query_factory ("person-params-query-2",
+ database::query_factory_ptr ());
+ }
+
+ // Cached query with lambda factory using closure. Forces nonoptimized
+ // representation of std::function.
+ //
+ {
+ const std::string person_name ("John First");
+
+ db->query_factory (
+ "person-params-query-3",
+ [person_name] (const char* name, connection& c)
+ {
+ typedef odb::query<person> query;
+
+ prepared_query<person> pq (
+ c.prepare_query<person> (
+ name,
+ query::age > 50 && query::name != person_name));
+ c.cache_query (pq);
+ });
+
+ {
+ transaction t (db->begin ());
+
+ prep_query pq (db->lookup_query<person> ("person-params-query-3"));
+ assert (pq);
+
+ result r (pq.execute ());
+ assert (size (r) == 4);
+
+ t.commit ();
+ }
+
+ db->query_factory ("person-params-query-3", nullptr);
+ }
+
+ // View prepared query.
+ //
+ {
+ typedef odb::query<person_view> query;
+ typedef odb::prepared_query<person_view> prep_query;
+ typedef odb::result<person_view> result;
+
+ transaction t (db->begin ());
+
+ unsigned short age (90);
+ prep_query pq (
+ db->prepare_query<person_view> (
+ "person-view-age-query",
+ query::age > query::_ref (age)));
+
+ for (unsigned short i (1); i < 6; ++i, age -= 10)
+ {
+ result r (pq.execute ());
+ assert (size (r) == i);
+ }
+
+ age = 90;
+ result r (pq.execute ());
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->name == "John First" && i->age == 91);
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // By-ref parameter image growth.
+ //
+ {
+ transaction t (db->begin ());
+
+ string name;
+ prep_query pq (
+ db->prepare_query<person> (
+ "person-name-query",
+ query::name != query::_ref (name)));
+
+ {
+ name = "John First";
+ result r (pq.execute ());
+ assert (size (r) == 4);
+ }
+
+ {
+ name.assign (2048, 'x');
+ result r (pq.execute ());
+ assert (size (r) == 5);
+ }
+
+ t.commit ();
+ }
+
+ // Test execute_one() and execute_value().
+ //
+ {
+ transaction t (db->begin ());
+
+ person p ("John Doe", 23);
+ db->persist (p);
+
+ prep_query pq1 (
+ db->prepare_query<person> ("query-1", query::id == p.id_));
+ prep_query pq0 (
+ db->prepare_query<person> ("query-0", query::id == p.id_ + 1));
+
+ {
+ unique_ptr<person> p (pq1.execute_one ());
+ assert (p.get () != 0 && p->name_ == "John Doe");
+ }
+
+ {
+ unique_ptr<person> p (pq0.execute_one ());
+ assert (p.get () == 0);
+ }
+
+ {
+ person p;
+ assert (pq1.execute_one (p) && p.name_ == "John Doe");
+ }
+
+ {
+ person p ("", 0);
+ assert (!pq0.execute_one (p) &&
+ p.id_ == 0 && p.name_.empty () && p.age_ == 0);
+ }
+
+ {
+ person p (pq1.execute_value ());
+ assert (p.name_ == "John Doe");
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/prepared/test.hxx b/odb-tests/common/prepared/test.hxx
new file mode 100644
index 0000000..db16e67
--- /dev/null
+++ b/odb-tests/common/prepared/test.hxx
@@ -0,0 +1,32 @@
+// file : common/prepared/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct person
+{
+ person (): id_ (0) {}
+ person (const std::string& name, unsigned short age)
+ : id_ (0), name_ (name), age_ (age) {}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ std::string name_;
+ unsigned short age_;
+};
+
+#pragma db view object(person)
+struct person_view
+{
+ std::string name;
+ unsigned short age;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/prepared/testscript b/odb-tests/common/prepared/testscript
new file mode 100644
index 0000000..3530c5b
--- /dev/null
+++ b/odb-tests/common/prepared/testscript
@@ -0,0 +1,33 @@
+# file : common/prepared/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/query/array/buildfile b/odb-tests/common/query/array/buildfile
new file mode 100644
index 0000000..3beb6d0
--- /dev/null
+++ b/odb-tests/common/query/array/buildfile
@@ -0,0 +1,43 @@
+# file : common/query/array/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_query_array_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared \
+ --sql-name-case oracle:upper
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/query/array/driver.cxx b/odb-tests/common/query/array/driver.cxx
new file mode 100644
index 0000000..9327751
--- /dev/null
+++ b/odb-tests/common/query/array/driver.cxx
@@ -0,0 +1,220 @@
+// file : common/query/array/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test query support for C arrays.
+//
+
+#include <string>
+#include <memory> // std::unique_ptr
+#include <cstring> // std::memcpy
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/config.hxx> // DATABASE_*
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+#ifndef MULTI_DATABASE
+# if defined(DATABASE_MYSQL)
+const odb::mysql::database_type_id bt = odb::mysql::id_blob;
+# elif defined(DATABASE_SQLITE)
+const odb::sqlite::database_type_id bt = odb::sqlite::id_blob;
+# elif defined(DATABASE_PGSQL)
+const odb::pgsql::database_type_id bt = odb::pgsql::id_bytea;
+# elif defined(DATABASE_ORACLE)
+const odb::oracle::database_type_id bt = odb::oracle::id_raw;
+# elif defined(DATABASE_MSSQL)
+const odb::mssql::database_type_id bt = odb::mssql::id_binary;
+# else
+# error unknown database
+# endif
+#endif
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ typedef odb::query<object> query;
+
+ const char buf[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6};
+
+ //
+ //
+ {
+ object o1 (1, "abc", buf);
+ object o2 (2, "bcd", buf);
+ object o3 (3, "cde", buf);
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ // string
+ //
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == "abc")) == 1);
+ assert (size (db->query<object> (query::s == query::_val ("bcd"))) == 1);
+ assert (size (db->query<object> ("s = " + query::_val ("bcd"))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref ("bcd"))) == 1);
+#endif
+
+ {
+ char a[] = "bcd";
+ char* ra = a;
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == a)) == 1);
+ assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
+ assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
+ }
+
+ {
+ const char a[] = "bcd";
+ const char* ra = a;
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == a)) == 1);
+ assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
+ assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
+ }
+
+ {
+ const char* p = "cde";
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == p)) == 1);
+ assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
+ assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
+ }
+
+ {
+ char a[] = "cde";
+ char* p = a;
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == p)) == 1);
+ assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
+ assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
+ }
+
+#ifndef MULTI_DATABASE
+ string s ("abc");
+ //assert (size (db->query<object> (query::s == s)) == 1);
+ assert (size (db->query<object> (query::s == s.c_str ())) == 1);
+ //assert (size (db->query<object> (query::s == query::_val (s))) == 1);
+ assert (size (db->query<object> (query::s == query::_val (s.c_str ()))) == 1);
+
+ assert (size (db->query<object> ("s = " + query::_val (s))) == 1);
+ assert (size (db->query<object> ("s = " + query::_ref (s))) == 1);
+#endif
+
+ // @@ BUILD2 Ends up with the following warning, but strangely only in the
+ // multi-database mode:
+ //
+ // In file included from odb/odb-tests/common/query/array/test-odb.hxx:31,
+ // from odb/odb-tests/common/query/array/driver.cxx:20:
+ // odb/libodb/odb/query-dynamic.hxx: In instantiation of ‘odb::query_base odb::query_column<T>::operator==(const odb::query_column<T2>&) const [with T2 = char [17]; T = char [17]]’:
+ // odb/odb-tests/common/query/array/driver.cxx:144:7: required from here
+ // odb/libodb/odb/query-dynamic.hxx:895:43: error: comparison between two arrays is deprecated in C++20 [-Werror=array-compare]
+ // 895 | (void) (sizeof (type_instance<T> () == type_instance<T2> ()));
+ // | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
+ // odb/libodb/odb/query-dynamic.hxx:895:43: note: use unary ‘+’ which decays operands to pointers or ‘&‘indirect_ref’ not supported by dump_decl<declaration error>[0] == &‘indirect_ref’ not supported by dump_decl<declaration error>[0]’ to compare the addresses
+ //
+ // Looks like compile-time assertion. Doesn't make much sense for
+ // arrays since compares pointers to objects rather than objects.
+ // Should we somehow suppress the assertion for arrays or similar?
+ //
+ // Note: temporarily ifndef-ed.
+ //
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::s == query::s1)) == 3);
+#endif
+
+ // std::array
+ //
+ array<char, 17> a;
+ memcpy (a.data (), "abc", 4); // VC++ strcpy deprecation.
+
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::a == a)) == 1);
+ assert (size (db->query<object> (query::a == query::_val (a))) == 1);
+#endif
+ assert (size (db->query<object> (query::a == query::_ref (a))) == 1);
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("a = " + query::_val (a))) == 1);
+ assert (size (db->query<object> ("a = " + query::_ref (a))) == 1);
+#endif
+
+ // char
+ //
+ assert (size (db->query<object> (query::c == 'a')) == 1);
+
+ char c ('b');
+ assert (size (db->query<object> (query::c == query::_val (c))) == 1);
+ assert (size (db->query<object> (query::c == query::_ref (c))) == 1);
+
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("c = " + query::_val ('c'))) == 1);
+ assert (size (db->query<object> ("c = " + query::_ref (c))) == 1);
+#endif
+
+ assert (size (db->query<object> (query::c == query::c1)) == 3);
+
+ // buffer
+ //
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> (query::b == buf)) == 3);
+ assert (size (db->query<object> (query::b == query::_val (buf))) == 3);
+#endif
+
+ assert (size (db->query<object> (query::b == query::_ref (buf))) == 3);
+
+#ifndef MULTI_DATABASE
+ assert (size (db->query<object> ("b = " + query::_val<bt> (buf))) == 3);
+ assert (size (db->query<object> ("b = " + query::_ref<bt> (buf))) == 3);
+#endif
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/query/array/test.hxx b/odb-tests/common/query/array/test.hxx
new file mode 100644
index 0000000..f0d5f3b
--- /dev/null
+++ b/odb-tests/common/query/array/test.hxx
@@ -0,0 +1,70 @@
+// file : common/query/array/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <array>
+#include <cstring> // std::memcpy, std::strlen
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id, const char* s, const char* b)
+ : id_ (id)
+ {
+ std::memcpy (s_, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ std::memcpy (s1_, s, std::strlen (s) + 1);
+ std::memcpy (a_.data (), s, std::strlen (s) + 1);
+ c_ = c1_ = *s;
+ std::memcpy (b_, b, sizeof (b_));
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ char s_[17];
+ char s1_[17];
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_MYSQL) || \
+ defined(ODB_DATABASE_PGSQL) || \
+ defined(ODB_DATABASE_ORACLE) || \
+ defined(ODB_DATABASE_MSSQL)
+# pragma db type("VARCHAR(16)")
+# elif defined(ODB_DATABASE_SQLITE)
+# pragma db type("TEXT")
+# elif defined(ODB_DATABASE_COMMON)
+# pragma db type("DYMMU") // Necessary to make it a value.
+# else
+# error unknown database
+# endif
+#endif
+ std::array<char, 17> a_;
+
+ char c_;
+ char c1_;
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_MYSQL)
+# pragma db type("BINARY(16)")
+# elif defined(ODB_DATABASE_SQLITE)
+# pragma db type("BLOB")
+# elif defined(ODB_DATABASE_PGSQL)
+# pragma db type("BYTEA")
+# elif defined(ODB_DATABASE_ORACLE)
+# pragma db type("RAW(16)")
+# elif defined(ODB_DATABASE_MSSQL)
+# pragma db type("BINARY(16)")
+# elif defined(ODB_DATABASE_COMMON)
+# else
+# error unknown database
+# endif
+#endif
+ char b_[16];
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/query/array/testscript b/odb-tests/common/query/array/testscript
new file mode 100644
index 0000000..631ae24
--- /dev/null
+++ b/odb-tests/common/query/array/testscript
@@ -0,0 +1,33 @@
+# file : common/query/array/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/query/basics/buildfile b/odb-tests/common/query/basics/buildfile
new file mode 100644
index 0000000..e38e6fe
--- /dev/null
+++ b/odb-tests/common/query/basics/buildfile
@@ -0,0 +1,42 @@
+# file : common/query/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_query_basics_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/query/basics/driver.cxx b/odb-tests/common/query/basics/driver.cxx
new file mode 100644
index 0000000..73b81d2
--- /dev/null
+++ b/odb-tests/common/query/basics/driver.cxx
@@ -0,0 +1,668 @@
+// file : common/query/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic query support.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/config.hxx> // DATABASE_XXX
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+void
+print (result<person>& r)
+{
+ for (result<person>::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ unique_ptr<person> o (i.load ());
+ cout << *o << endl;
+ }
+ cout << endl;
+}
+
+const char* names[] = { "John", "Jane", "Joe" };
+const char** names_end = names + sizeof (names)/sizeof (names[0]);
+
+const char* key_data[] = { "\x23\x03\x15", "\x13\x13\x54", "\x08\x62\x35" };
+
+int
+main (int argc, char* argv[])
+{
+ buffer
+ key1 (key_data[0], key_data[0] + 3),
+ key2 (key_data[1], key_data[1] + 3),
+ key3 (key_data[2], key_data[2] + 3);
+
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+ odb::database_id db_id (db->id ());
+
+ typedef odb::query<person> query;
+ typedef odb::result<person> result;
+
+ //
+ //
+ {
+ person p1 (1, "John", "Doe", 30, true, key1);
+ person p2 (2, "Jane", "Doe", 29, true, key2);
+ person p3 (3, "Joe", "Dirt", 31, false, key3);
+ p3.middle_name_.reset (new string ("Squeaky"));
+ person p4 (4, "Johansen", "Johansen", 32, false);
+ p4.middle_name_.reset (new string ("J"));
+
+ transaction t (db->begin ());
+ db->persist (p1);
+ db->persist (p2);
+ db->persist (p3);
+ db->persist (p4);
+ t.commit ();
+ }
+
+ //
+ // Native queries.
+ //
+
+ // Compilation tests.
+ //
+#ifndef MULTI_DATABASE
+ if (false)
+ {
+ string name;
+ unsigned short age;
+
+ db->query<person> ("age = " + query::_ref (age));
+ db->query<person> ("age = " + query::_val (age));
+
+ query age_q (query::_ref (age) + " = age");
+ query name_q ("first = " + query::_val (name));
+ query q (age_q + "AND" + name_q);
+
+ db->query<person> (q);
+ db->query<person> (age_q + "OR" +
+ name_q + "OR" +
+ "age < " + query::_ref (age));
+
+ query q1 (query::_val (name));
+ q1 += " = first";
+ }
+#endif
+
+ // Select-all query.
+ //
+ cout << "test 001" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> ());
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ person p;
+ i.load (p);
+ cout << p << endl;
+ }
+
+ t.commit ();
+ }
+
+ // Select-all query with order by.
+ //
+ cout << "test 002" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> ("ORDER BY" + query::age));
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ person& p (*i);
+
+ cout << p.first_name_;
+
+ if (i->middle_name_.get () != 0)
+ cout << ' ' << *i->middle_name_;
+
+ cout << ' ' << i->last_name_ << ' ' << i->age_ <<
+ (i->married_ ? " married" : " single") << endl;
+ }
+ cout << endl;
+
+ t.commit ();
+ }
+
+ // String query.
+ //
+ cout << "test 003" << endl;
+ {
+ transaction t (db->begin ());
+
+ result r;
+ if (db_id != odb::id_oracle)
+ r = db->query<person> ("age >= 30 AND last = 'Doe'");
+ else
+ r = db->query<person> ("\"age\" >= 30 AND \"last\" = 'Doe'");
+
+ print (r);
+ t.commit ();
+ }
+
+ // Value binding.
+ //
+ cout << "test 004" << endl;
+ {
+ transaction t (db->begin ());
+
+ const char* name = "Doe";
+
+#if defined(MULTI_DATABASE)
+ result r (
+ db->query<person> (
+ query::age >= query::_val (30) &&
+ query::last_name == query::_val (name)));
+
+#elif defined(DATABASE_ORACLE)
+ result r (
+ db->query<person> (
+ "\"age\" >= " + query::_val (30) + "AND" +
+ "\"last\" = " + query::_val (name)));
+#else
+ result r (
+ db->query<person> (
+ "age >= " + query::_val (30) + "AND" +
+ "last = " + query::_val (name)));
+#endif
+
+ print (r);
+ t.commit ();
+ }
+
+ // Reference binding.
+ //
+ cout << "test 005" << endl;
+ {
+ transaction t (db->begin ());
+
+ string name;
+ unsigned short age;
+
+#if defined(MULTI_DATABASE)
+ query q (query::age >= query::_ref (age) &&
+ query::last_name == query::_ref (name));
+#elif defined(DATABASE_ORACLE)
+ query q ("\"age\" >= " + query::_ref (age) + "AND" +
+ "\"last\" = " + query::_ref (name));
+#else
+ query q ("age >= " + query::_ref (age) + "AND" +
+ "last = " + query::_ref (name));
+#endif
+
+ name = "Doe";
+ age = 30;
+ result r (db->query<person> (q));
+ print (r);
+
+ name = "Dirt";
+ age = 31;
+ r = db->query<person> (q);
+ print (r);
+
+ t.commit ();
+ }
+
+ //
+ // Language-embedded queries.
+ //
+
+ // Compilation tests.
+ //
+ if (false)
+ {
+ string name;
+ unsigned short age;
+
+ // Column operators.
+ //
+ query q1 (query::married);
+ db->query<person> (query::married);
+ db->query<person> (query::married == true);
+
+ //db->query<person> (query::age);
+
+ db->query<person> (query::age == 30);
+ db->query<person> (query::age == age);
+ db->query<person> (query::age == query::_val (30));
+ db->query<person> (query::age == query::_val (age));
+ db->query<person> (query::age == query::_ref (age));
+ //db->query<person> (query::age == "123");
+ //db->query<person> ("123" == query::age);
+ //db->query<person> (query::age == query::_val ("123"));
+ //db->query<person> (query::age == query::_ref (name));
+ db->query<person> (query::last_name == "Doe");
+ db->query<person> (query::last_name == name);
+#ifndef MULTI_DATABASE
+ db->query<person> (query::last_name == query::_val ("Doe"));
+#endif
+ db->query<person> (query::last_name == query::_val (name));
+ db->query<person> (query::last_name == query::_ref (name));
+ //db->query<person> (query::last_name == 30);
+ //db->query<person> (query::last_name == query::_val (30));
+ //db->query<person> (query::last_name == query::_ref (age));
+
+ db->query<person> (query::last_name.is_null ());
+ db->query<person> (query::last_name.is_not_null ());
+
+ db->query<person> (query::first_name == query::last_name);
+
+ db->query<person> (query::first_name.in ("John", "Jane"));
+ db->query<person> (query::first_name.in_range (names, names_end));
+
+ db->query<person> (query::first_name.like ("J%"));
+ db->query<person> (query::first_name.like ("J%!%", "!"));
+
+ // Query operators.
+ //
+ db->query<person> (query::age == 30 && query::last_name == "Doe");
+ db->query<person> (query::age == 30 || query::last_name == "Doe");
+ db->query<person> (!(query::age == 30 || query::last_name == "Doe"));
+ db->query<person> ((query::last_name == "Doe") + "ORDER BY age");
+ }
+
+ // Test is_null/is_not_null.
+ //
+ cout << "test 006" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::middle_name.is_null ()));
+ print (r);
+ r = db->query<person> (query::middle_name.is_not_null ());
+ print (r);
+ t.commit ();
+ }
+
+ // Test boolean columns.
+ //
+ cout << "test 007" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::married));
+ print (r);
+ r = db->query<person> (!query::married);
+ print (r);
+ t.commit ();
+ }
+
+ // Test implicit by-value, explicit by-value, and by-reference.
+ //
+ cout << "test 008" << endl;
+ {
+ string name ("Dirt");
+
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "Doe"));
+ print (r);
+ r = db->query<person> (query::last_name == query::_val (name));
+ print (r);
+ query q (query::last_name == query::_ref (name));
+ name = "Doe";
+ r = db->query<person> (q);
+ print (r);
+ t.commit ();
+ }
+
+ // Test column operators (==, !=, <, >, <=, >=).
+ //
+ cout << "test 009" << endl;
+ {
+ transaction t (db->begin ());
+
+ // ==
+ //
+ result r (db->query<person> (query::last_name == "Doe"));
+ print (r);
+
+ // !=
+ //
+ r = db->query<person> (query::last_name != "Doe");
+ print (r);
+
+ // <
+ //
+ r = db->query<person> (query::age < 31);
+ print (r);
+
+ // >
+ //
+ r = db->query<person> (query::age > 30);
+ print (r);
+
+ // <=
+ //
+ r = db->query<person> (query::age <= 30);
+ print (r);
+
+ // >=
+ //
+ r = db->query<person> (query::age >= 31);
+ print (r);
+
+ t.commit ();
+ }
+
+ // Test query operators (&&, ||, (), !, +).
+ //
+ cout << "test 010" << endl;
+ {
+ transaction t (db->begin ());
+
+ // &&
+ //
+ result r (db->query<person> (
+ query::last_name == "Doe" && query::age == 29));
+ print (r);
+
+ // ||
+ //
+ r = db->query<person> (query::last_name == "Doe" || query::age == 31);
+ print (r);
+
+ // ()
+ //
+ r = db->query<person> (
+ (query::last_name != "Doe" || query::age == 29) && query::married);
+ print (r);
+
+ // !=
+ //
+ r = db->query<person> (!(query::last_name == "Doe"));
+ print (r);
+
+ // +
+ //
+ r = db->query<person> ((query::last_name == "Doe") +
+ "ORDER BY" + query::age);
+ print (r);
+
+ t.commit ();
+ }
+
+ // Test in/in_range.
+ //
+ cout << "test 011" << endl;
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<person> (query::first_name.in ("John", "Jane")));
+ print (r);
+
+ r = db->query<person> (query::first_name.in_range (names, names_end));
+ print (r);
+
+ // Empty range.
+ //
+ r = db->query<person> (query::last_name == "Doe" &&
+ query::first_name.in_range (names, names));
+ assert (r.empty ());
+
+ t.commit ();
+ }
+
+ // Test column-to-column comparison.
+ //
+ cout << "test 012" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::first_name == query::last_name));
+ print (r);
+ t.commit ();
+ }
+
+ // Test value_traits::value_type != value_traits::query_type.
+ //
+ cout << "test 013" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::middle_name == "Squeaky"));
+ print (r);
+ t.commit ();
+ }
+
+ // Test that loading of the same object type during iteration does
+ // not invalidate the result.
+ //
+ cout << "test 014" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "Doe"));
+
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ ++i;
+ assert (i != r.end ());
+
+ {
+ unique_ptr<person> joe (db->load<person> (3));
+ }
+
+ {
+ person p (5, "Peter", "Peterson", 70, false, key3);
+ db->persist (p);
+ db->erase (p);
+ }
+
+ // SQL Server does not support re-loading of an object with long data
+ // from a query result.
+ //
+ if (db_id != odb::id_mssql)
+ assert (i->last_name_ == "Doe"); // Actual load.
+
+ // Overwrite object image again.
+ //
+ unique_ptr<person> joe (db->load<person> (3));
+ person p;
+ i.load (p);
+ assert (p.last_name_ == "Doe");
+
+ t.commit ();
+ }
+
+ // Test uncached result.
+ //
+ cout << "test 015" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "Doe", false));
+ print (r);
+ t.commit ();
+ }
+
+ // Test BLOB column operations.
+ //
+ cout << "test 016" << endl;
+ {
+ transaction t (db->begin ());
+
+ result r;
+ result::iterator i;
+
+ // ==
+ //
+
+ // Oracle does not support LOB comparisons.
+ //
+#if defined(MULTI_DATABASE) || !defined(DATABASE_ORACLE)
+ if (db_id != odb::id_oracle)
+ {
+ r = db->query<person> (query::public_key == key2);
+
+ i = r.begin ();
+ assert (i != r.end ());
+
+ assert (*i->public_key_ == key2);
+ assert (++i == r.end ());
+ }
+#endif
+
+ // is_null
+ //
+ r = db->query<person> (query::public_key.is_null ());
+
+ i = r.begin ();
+ assert (i != r.end ());
+
+ assert (i->first_name_ == "Johansen" && i->last_name_ == "Johansen");
+ assert (++i == r.end ());
+
+ // is_not_null
+ //
+ r = db->query<person> (query::public_key.is_not_null ());
+
+ i = r.begin ();
+ assert (i != r.end ());
+
+ assert (i->first_name_ == "John" && i->last_name_ == "Doe");
+ assert (++i != r.end ());
+
+ assert (i->first_name_ == "Jane" && i->last_name_ == "Doe");
+ assert (++i != r.end ());
+
+ assert (i->first_name_ == "Joe" && i->last_name_ == "Dirt");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // Test iterator::id().
+ //
+ cout << "test 017" << endl;
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "Dirt"));
+
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i.id () == 3);
+
+ t.commit ();
+ }
+
+ // Test empty result set.
+ //
+ cout << "test 018" << endl;
+ {
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "None"));
+ assert (r.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "None"));
+ assert (r.begin () == r.end ());
+ t.commit ();
+ }
+ }
+
+ // Test size() validity at the beginning/middle/end of result set.
+ //
+ cout << "test 019" << endl;
+ if (db_id != odb::id_sqlite &&
+ db_id != odb::id_oracle &&
+ db_id != odb::id_mssql)
+ {
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> ());
+ assert (r.size () == 4);
+ result::iterator i (r.begin ());
+ assert (r.size () == 4);
+ ++i;
+ ++i;
+ ++i;
+ assert (r.size () == 4);
+ ++i;
+ assert (r.size () == 4);
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (false));
+ result::iterator i (r.begin ());
+ ++i;
+ ++i;
+ r.cache (); // Cache in the middle.
+ assert (r.size () == 4);
+ ++i;
+ assert (r.size () == 4);
+ ++i;
+ assert (r.size () == 4);
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (false));
+ result::iterator i (r.begin ());
+ ++i;
+ ++i;
+ ++i;
+ r.cache (); // Cache at the end.
+ assert (r.size () == 4);
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<person> (query::last_name == "None"));
+ assert (r.size () == 0);
+ for (result::iterator i (r.begin ()); i != r.end (); ++i) ;
+ assert (r.size () == 0);
+ }
+ }
+
+ // Test like.
+ //
+ cout << "test 020" << endl;
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<person> (query::first_name.like ("Jo%")));
+ print (r);
+
+ r = db->query<person> (!query::first_name.like ("Jo%"));
+ print (r);
+
+ r = db->query<person> (query::first_name.like ("Jo!%", "!"));
+ print (r);
+
+ // In Oracle one can only escape special characters (% and _).
+ //
+ string v;
+ if (db_id != odb::id_oracle)
+ v = "!Ja%";
+ else
+ v = "Ja%";
+
+ r = db->query<person> (query::first_name.like (query::_ref (v), "!"));
+ print (r);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/query/basics/test.hxx b/odb-tests/common/query/basics/test.hxx
new file mode 100644
index 0000000..239f6d6
--- /dev/null
+++ b/odb-tests/common/query/basics/test.hxx
@@ -0,0 +1,117 @@
+// file : common/query/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+#include <memory>
+#include <iostream>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_PGSQL)
+# define BLOB_TYPE "BYTEA"
+# elif defined(ODB_DATABASE_MSSQL)
+# define BLOB_TYPE "VARBINARY(max)"
+# else
+# define BLOB_TYPE "BLOB"
+# endif
+#endif
+
+typedef std::vector<char> buffer;
+typedef odb::nullable<buffer> nullable_buffer;
+
+#pragma db object
+struct person
+{
+ person (unsigned long id,
+ const std::string& fn,
+ const std::string& ln,
+ unsigned short age,
+ bool married,
+ const nullable_buffer& public_key = nullable_buffer ())
+ : id_ (id),
+ first_name_ (fn),
+ last_name_ (ln),
+ age_ (age),
+ married_ (married),
+ public_key_ (public_key)
+ {
+ }
+
+ person ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db column ("first")
+ std::string first_name_;
+
+ #pragma db column ("middle") null
+ std::unique_ptr<std::string> middle_name_;
+
+ #pragma db column ("last")
+ std::string last_name_;
+
+ unsigned short age_;
+ bool married_;
+
+ #pragma db column ("key") type(BLOB_TYPE) null
+ nullable_buffer public_key_;
+};
+
+inline std::ostream&
+operator<< (std::ostream& os, const person& p)
+{
+ os << p.first_name_;
+
+ if (p.middle_name_.get () != 0)
+ os << ' ' << *p.middle_name_;
+
+ os << ' ' << p.last_name_ << ' ' << p.age_ <<
+ (p.married_ ? " married" : " single");
+
+ return os;
+}
+
+// Test member name conflicts (compilation-only test).
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ int id;
+ };
+
+ #pragma db value
+ struct value
+ {
+ object* m_object;
+ };
+
+ #pragma db value
+ struct bar
+ {
+ value m_value;
+ };
+
+ #pragma db object
+ struct foo
+ {
+ #pragma db id
+ int id;
+
+ bar m_value;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/query/basics/testscript b/odb-tests/common/query/basics/testscript
new file mode 100644
index 0000000..9086b66
--- /dev/null
+++ b/odb-tests/common/query/basics/testscript
@@ -0,0 +1,150 @@
+# file : common/query/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
++cat <<EOI >=output
+ test 001
+ John Doe 30 married
+ Jane Doe 29 married
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+ test 002
+ Jane Doe 29 married
+ John Doe 30 married
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ test 003
+ John Doe 30 married
+
+ test 004
+ John Doe 30 married
+
+ test 005
+ John Doe 30 married
+
+ Joe Squeaky Dirt 31 single
+
+ test 006
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ test 007
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ test 008
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+
+ John Doe 30 married
+ Jane Doe 29 married
+
+ test 009
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ John Doe 30 married
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ test 010
+ Jane Doe 29 married
+
+ John Doe 30 married
+ Jane Doe 29 married
+ Joe Squeaky Dirt 31 single
+
+ Jane Doe 29 married
+
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ Jane Doe 29 married
+ John Doe 30 married
+
+ test 011
+ John Doe 30 married
+ Jane Doe 29 married
+
+ John Doe 30 married
+ Jane Doe 29 married
+ Joe Squeaky Dirt 31 single
+
+ test 012
+ Johansen J Johansen 32 single
+
+ test 013
+ Joe Squeaky Dirt 31 single
+
+ test 014
+ test 015
+ John Doe 30 married
+ Jane Doe 29 married
+
+ test 016
+ test 017
+ test 018
+ test 019
+ test 020
+ John Doe 30 married
+ Joe Squeaky Dirt 31 single
+ Johansen J Johansen 32 single
+
+ Jane Doe 29 married
+
+
+ Jane Doe 29 married
+
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/query/one/buildfile b/odb-tests/common/query/one/buildfile
new file mode 100644
index 0000000..76a36b0
--- /dev/null
+++ b/odb-tests/common/query/one/buildfile
@@ -0,0 +1,42 @@
+# file : common/query/one/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_query_one_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/query/one/driver.cxx b/odb-tests/common/query/one/driver.cxx
new file mode 100644
index 0000000..4c3dcdc
--- /dev/null
+++ b/odb-tests/common/query/one/driver.cxx
@@ -0,0 +1,205 @@
+// file : common/query/one/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test query one support.
+//
+// We assume that other tests in common/query/ exercise a variety of
+// different kinds of queries. Here we are concerned with what is
+// specific to query_one() and query_value().
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+ odb::database_id db_id (db->id ());
+
+ transaction t (db->begin ());
+
+ // query_one()
+ //
+ {
+ unique_ptr<object> o (db->query_one<object> ());
+ assert (o.get () == 0);
+ }
+
+ {
+ object o (4);
+ assert (!db->query_one<object> (o) && o.id_ == 4 && o.str_.empty ());
+ }
+
+ /*
+ {
+ object o (db->query_value<object> ());
+ assert (false);
+ }
+ */
+
+ object o (1);
+ o.str_ = "value 1";
+ db->persist (o);
+
+ {
+ unique_ptr<object> o (db->query_one<object> ());
+ assert (o.get () != 0 && o->str_ == "value 1");
+ }
+
+ {
+ object o;
+ assert (db->query_one<object> (o) && o.str_ == "value 1");
+ }
+
+ {
+ object o (db->query_value<object> ());
+ assert (o.str_ == "value 1");
+ }
+
+ // query_one(const char*)
+ //
+ const char* q1_c (db_id == odb::id_oracle ? "\"id\" = 1" : "id = 1");
+ const char* q0_c (db_id == odb::id_oracle ? "\"id\" = 2" : "id = 2");
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q1_c));
+ assert (o.get () != 0 && o->str_ == "value 1");
+ }
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q0_c));
+ assert (o.get () == 0);
+ }
+
+ {
+ object o;
+ assert (db->query_one<object> (q1_c, o) && o.str_ == "value 1");
+ }
+
+ {
+ object o (4);
+ assert (!db->query_one<object> (q0_c, o) &&
+ o.id_ == 4 && o.str_.empty ());
+ }
+
+ {
+ object o (db->query_value<object> (q1_c));
+ assert (o.str_ == "value 1");
+ }
+
+ // query_one(std::string)
+ //
+ string q1_s (q1_c);
+ string q0_s (q0_c);
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q1_s));
+ assert (o.get () != 0 && o->str_ == "value 1");
+ }
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q0_s));
+ assert (o.get () == 0);
+ }
+
+ {
+ object o;
+ assert (db->query_one<object> (q1_s, o) && o.str_ == "value 1");
+ }
+
+ {
+ object o (4);
+ assert (!db->query_one<object> (q0_s, o) &&
+ o.id_ == 4 && o.str_.empty ());
+ }
+
+ {
+ object o (db->query_value<object> (q1_s));
+ assert (o.str_ == "value 1");
+ }
+
+ // query_one(odb::query)
+ //
+ typedef odb::query<object> query;
+
+ query q1 (query::id == 1);
+ query q0 (query::id == 2);
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q1));
+ assert (o.get () != 0 && o->str_ == "value 1");
+ }
+
+ {
+ unique_ptr<object> o (db->query_one<object> (q0));
+ assert (o.get () == 0);
+ }
+
+ {
+ object o;
+ assert (db->query_one<object> (q1, o) && o.str_ == "value 1");
+ }
+
+ {
+ object o (4);
+ assert (!db->query_one<object> (q0, o) && o.id_ == 4 && o.str_.empty ());
+ }
+
+ {
+ object o (db->query_value<object> (q1));
+ assert (o.str_ == "value 1");
+ }
+
+ // Assertion on more than one element.
+ //
+ {
+ object o (2);
+ o.str_ = "value 2";
+ db->persist (o);
+ }
+
+ /*
+ {
+ unique_ptr<object> o (db->query_one<object> ());
+ assert (false);
+ }
+ */
+
+ /*
+ {
+ object o;
+ db->query_one<object> (o);
+ assert (false);
+ }
+ */
+
+ /*
+ {
+ object o (db->query_value<object> ());
+ assert (false);
+ }
+ */
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/query/one/test.hxx b/odb-tests/common/query/one/test.hxx
new file mode 100644
index 0000000..3008063
--- /dev/null
+++ b/odb-tests/common/query/one/test.hxx
@@ -0,0 +1,26 @@
+// file : common/query/one/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+ std::string str_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/query/one/testscript b/odb-tests/common/query/one/testscript
new file mode 100644
index 0000000..963a206
--- /dev/null
+++ b/odb-tests/common/query/one/testscript
@@ -0,0 +1,33 @@
+# file : common/query/one/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/readonly/buildfile b/odb-tests/common/readonly/buildfile
new file mode 100644
index 0000000..2d83cf1
--- /dev/null
+++ b/odb-tests/common/readonly/buildfile
@@ -0,0 +1,40 @@
+# file : common/readonly/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix readonly_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/readonly/driver.cxx b/odb-tests/common/readonly/driver.cxx
new file mode 100644
index 0000000..b207627
--- /dev/null
+++ b/odb-tests/common/readonly/driver.cxx
@@ -0,0 +1,324 @@
+// file : common/readonly/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test readonly members/objects. Also test that const members are
+// treated as readonly. For other const member tests, see the const-
+// member test.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/config.hxx> // DATABASE_*
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Simple.
+ //
+ {
+ simple o (1, 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.ro++;
+ const_cast<unsigned long&> (o.co)++;
+ o.rw++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load<simple> (1, o);
+ t.commit ();
+ }
+
+ assert (o.ro == 1 && o.co == 1 && o.rw == 2);
+ }
+
+ // Pointer.
+ //
+ {
+ pointer p (1, new pointer (2));
+ unique_ptr<pointer> p1 (new pointer (3));
+
+ {
+ transaction t (db->begin ());
+ db->persist (p);
+ db->persist (p.ro);
+ db->persist (*p1);
+ t.commit ();
+ }
+
+ delete p.ro;
+ p.ro = p1.release ();
+ const_cast<pointer*&> (p.co) = p.ro;
+ p.rw = p.ro;
+
+ {
+ transaction t (db->begin ());
+ db->update (p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<pointer> p (db->load<pointer> (1));
+ t.commit ();
+
+ assert (p->ro->id == 2 && p->co->id == 2 && p->rw->id == 3);
+ }
+ }
+
+ // Composite.
+ //
+ {
+ composite o (1, 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.ro.v++;
+ o.ro.ro++;
+ const_cast<unsigned long&> (o.ro.co)++;
+ o.ro.rw++;
+
+ value& co (const_cast<value&> (o.co));
+ co.v++;
+ co.ro++;
+ const_cast<unsigned long&> (co.co)++;
+ co.rw++;
+
+ o.rw.v++;
+ o.rw.ro++;
+ const_cast<unsigned long&> (o.rw.co)++;
+ o.rw.rw++;
+
+ o.v.v++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load<composite> (1, o);
+ t.commit ();
+ }
+
+ assert (o.ro.v == 1 &&
+ o.ro.ro == 1 &&
+ o.ro.co == 1 &&
+ o.ro.rw == 1 &&
+
+ o.co.v == 1 &&
+ o.co.ro == 1 &&
+ o.co.co == 1 &&
+ o.co.rw == 1 &&
+
+ o.rw.v == 1 &&
+ o.rw.ro == 1 &&
+ o.rw.co == 1 &&
+ o.rw.rw == 2 &&
+
+ o.v.v == 1);
+ }
+
+ // Container.
+ //
+ {
+ typedef vector<unsigned long> ulongs;
+
+ container o (1);
+
+ o.ro.push_back (1);
+ o.ro.push_back (2);
+
+ ulongs& co (const_cast<ulongs&> (o.co));
+ co.push_back (1);
+ co.push_back (2);
+
+ o.rw.push_back (1);
+ o.rw.push_back (2);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.ro[0]++;
+ o.ro.pop_back ();
+
+ co[0]++;
+ co.pop_back ();
+
+ o.rw[0]++;
+ o.rw.pop_back ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load<container> (1, o);
+ t.commit ();
+ }
+
+ assert (o.ro.size () == 2 && o.ro[0] == 1 && o.ro[1] == 2 &&
+ o.co.size () == 2 && o.co[0] == 1 && o.co[1] == 2 &&
+ o.rw.size () == 1 && o.rw[0] == 2);
+ }
+
+ // Readonly object.
+ //
+ {
+#ifndef MULTI_DATABASE
+ typedef odb::object_traits_impl<simple_object, odb::id_common> so_traits;
+ typedef odb::object_traits_impl<ro_object, odb::id_common> ro_traits;
+ typedef odb::object_traits_impl<rw_object, odb::id_common> rw_traits;
+
+ assert (so_traits::column_count ==
+ so_traits::id_column_count + so_traits::readonly_column_count);
+
+ assert (ro_traits::column_count ==
+ ro_traits::id_column_count + ro_traits::readonly_column_count);
+
+ assert (rw_traits::column_count !=
+ rw_traits::id_column_count + rw_traits::readonly_column_count);
+#endif
+
+ simple_object so (1, 1);
+ ro_object ro_o (1, 1);
+ rw_object rw_o (1, 1);
+
+ ro_o.cr.push_back (1);
+ ro_o.cr.push_back (2);
+
+ rw_o.cr.push_back (1);
+ rw_o.cr.push_back (2);
+
+ {
+ transaction t (db->begin ());
+ db->persist (so);
+ db->persist (ro_o);
+ db->persist (rw_o);
+ t.commit ();
+ }
+
+ rw_o.sv++;
+ rw_o.rw_sv++;
+
+ {
+ transaction t (db->begin ());
+ //db->update (so); // Compile error.
+ //db->update (ro_o); // Compile error.
+ db->update (rw_o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load (1, so);
+ db->load (1, ro_o);
+ db->load (1, rw_o);
+ t.commit ();
+ }
+
+ assert (rw_o.sv == 1 && rw_o.rw_sv == 2);
+ }
+
+ // Readonly object.
+ //
+ {
+ wrapper o (1, 1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ *o.pl = 2;
+ *o.cpl = 2;
+ o.pcl.reset (new unsigned long (2));
+ const_cast<unsigned long&> (*o.cpcl) = 2;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->load<wrapper> (1, o);
+ t.commit ();
+ }
+
+ assert (*o.pl == 2 && *o.cpl == 2 && *o.pcl == 2 && *o.cpcl == 1);
+ }
+
+ // Readonly object with auto id.
+ //
+ {
+ ro_auto o1 (1);
+ ro_auto o2 (2);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<ro_auto> p1 (db->load<ro_auto> (o1.id));
+ unique_ptr<ro_auto> p2 (db->load<ro_auto> (o2.id));
+ t.commit ();
+
+ assert (p1->num == o1.num);
+ assert (p2->num == o2.num);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/readonly/test.hxx b/odb-tests/common/readonly/test.hxx
new file mode 100644
index 0000000..45797b6
--- /dev/null
+++ b/odb-tests/common/readonly/test.hxx
@@ -0,0 +1,225 @@
+// file : common/readonly/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+#include <memory> // std::unique_ptr
+
+#include <odb/core.hxx>
+
+// Simple readonly object.
+//
+#pragma db object
+struct simple
+{
+ simple (unsigned long i, unsigned long x)
+ : id (i), ro (x), co (x), rw (x)
+ {
+ }
+
+ simple (): co (0) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db readonly
+ unsigned long ro;
+
+ const unsigned long co;
+
+ unsigned long rw;
+};
+
+// Readonly pointer.
+//
+#pragma db object
+struct pointer
+{
+ pointer (unsigned long i, pointer* p = 0): id (i), ro (p), co (p), rw (p) {}
+ pointer (): ro (0), co (0), rw (0) {}
+
+ ~pointer ()
+ {
+ delete ro;
+
+ if (co != ro)
+ delete co;
+
+ if (rw != ro && rw != co)
+ delete rw;
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db readonly
+ pointer* ro;
+
+ pointer* const co;
+
+ pointer* rw;
+};
+
+// Composite readonly value as well as simple readonly value inside
+// a composite.
+//
+#pragma db value readonly
+struct ro_value
+{
+ ro_value () {}
+ ro_value (unsigned long x): v (x) {}
+
+ unsigned long v;
+};
+
+#pragma db value
+struct value: ro_value
+{
+ value (): co (0) {}
+ value (unsigned long x): ro_value (x), ro (x), co (x), rw (x) {}
+
+ #pragma db readonly
+ unsigned long ro;
+
+ const unsigned long co;
+
+ unsigned long rw;
+};
+
+#pragma db object
+struct composite
+{
+ composite (unsigned long i, unsigned long x)
+ : id (i), ro (x), co (x), rw (x), v (x)
+ {
+ }
+
+ composite () {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db readonly
+ value ro;
+
+ const value co;
+
+ value rw;
+ ro_value v;
+};
+
+// Readonly container.
+//
+#pragma db object
+struct container
+{
+ container (unsigned long i): id (i) {}
+ container () {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db readonly
+ std::vector<unsigned long> ro;
+
+ const std::vector<unsigned long> co;
+
+ std::vector<unsigned long> rw;
+};
+
+// Readonly object.
+//
+#pragma db object readonly
+struct simple_object
+{
+ simple_object (unsigned long i, unsigned long x): id (i), sv (x) {}
+ simple_object () {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long sv;
+};
+
+#pragma db object
+struct object
+{
+ object (unsigned long i, unsigned long x): id (i), sv (x) {}
+ object () {}
+
+ #pragma db id
+ unsigned long id;
+
+ unsigned long sv;
+};
+
+#pragma db object readonly
+struct ro_object: object
+{
+ ro_object (unsigned long i, unsigned long x)
+ : object (i, x), cv (x)
+ {
+ }
+
+ ro_object () {}
+
+ value cv;
+ std::vector<unsigned long> cr;
+};
+
+#pragma db object
+struct rw_object: ro_object
+{
+ rw_object (unsigned long i, unsigned long x)
+ : ro_object (i, x), rw_sv (x)
+ {
+ }
+
+ rw_object () {}
+
+ unsigned long rw_sv;
+};
+
+// Readonly wrappers. Here we make sure that only const wrappers with
+// const wrapped types are automatically treated as readonly.
+//
+#pragma db object
+struct wrapper
+{
+ wrapper (unsigned long i, unsigned long x)
+ : id (i),
+ pl (new unsigned long (x)),
+ cpl (new unsigned long (x)),
+ pcl (new unsigned long (x)),
+ cpcl (new unsigned long (x))
+ {
+ }
+
+ wrapper () {}
+
+ #pragma db id
+ unsigned long id;
+
+ std::unique_ptr<unsigned long> pl;
+ const std::unique_ptr<unsigned long> cpl;
+ std::unique_ptr<const unsigned long> pcl;
+ const std::unique_ptr<const unsigned long> cpcl;
+};
+
+// Readonly object with auto id.
+//
+#pragma db object readonly
+struct ro_auto
+{
+ ro_auto (unsigned long n): num (n) {}
+ ro_auto () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ unsigned long num;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/readonly/testscript b/odb-tests/common/readonly/testscript
new file mode 100644
index 0000000..c798201
--- /dev/null
+++ b/odb-tests/common/readonly/testscript
@@ -0,0 +1,33 @@
+# file : common/readonly/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/relationship/basics/buildfile b/odb-tests/common/relationship/basics/buildfile
new file mode 100644
index 0000000..d7bbb7e
--- /dev/null
+++ b/odb-tests/common/relationship/basics/buildfile
@@ -0,0 +1,41 @@
+# file : common/relationship/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_rel_basics_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/relationship/basics/driver.cxx b/odb-tests/common/relationship/basics/driver.cxx
new file mode 100644
index 0000000..e27c127
--- /dev/null
+++ b/odb-tests/common/relationship/basics/driver.cxx
@@ -0,0 +1,150 @@
+// file : common/relationship/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test object relationships.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ aggr a ("aggr");
+ a.o1 = new obj1 ("o1", "obj1");
+ a.o2.reset (new obj2 ("obj2"));
+
+ a.v2.push_back (obj2_ptr (new obj2 ("v1 obj2 1")));
+ a.v2.push_back (0);
+ a.v2.push_back (obj2_ptr (new obj2 ("v1 obj2 2")));
+
+ a.o3.reset (new obj3 ("obj3"));
+
+ a.c.num = 123;
+ a.c.o3.reset (new obj3 ("c"));
+
+ a.cv.push_back (comp (234, obj3_ptr (new obj3 ("cv 0"))));
+ a.cv.push_back (comp (235, obj3_ptr ()));
+ a.cv.push_back (comp (236, obj3_ptr (new obj3 ("cv 2"))));
+
+ a.v1.push_back (new obj1 ("v1 0", "v1 0"));
+ a.v1.push_back (0);
+ a.v1.push_back (new obj1 ("v1 2", "v1 2"));
+
+ // Set cannot contain NULL pointers.
+ //
+ a.s1.insert (new obj1 ("s1 0", "s1 0"));
+ a.s1.insert (new obj1 ("s1 2", "s1 2"));
+
+ a.m1[0] = new obj1 ("m1 0", "m1 0");
+ a.m1[1] = 0;
+ a.m1[2] = new obj1 ("m1 2", "m1 2");
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (a.o1);
+ db->persist (a.o2);
+
+ for (obj2_vec::iterator i (a.v2.begin ()); i != a.v2.end (); ++i)
+ if (*i)
+ db->persist (*i);
+
+ db->persist (a.o3);
+
+ db->persist (a.c.o3);
+
+ for (comp_vec::iterator i (a.cv.begin ()); i != a.cv.end (); ++i)
+ if (i->o3)
+ db->persist (i->o3);
+
+ for (obj1_vec::iterator i (a.v1.begin ()); i != a.v1.end (); ++i)
+ if (*i)
+ db->persist (*i);
+
+ for (obj1_set::iterator i (a.s1.begin ()); i != a.s1.end (); ++i)
+ if (*i)
+ db->persist (*i);
+
+ for (obj1_map::iterator i (a.m1.begin ()); i != a.m1.end (); ++i)
+ if (i->second)
+ db->persist (i->second);
+
+ db->persist (a);
+ t.commit ();
+ }
+
+ // load & compare
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<aggr> a1 (db->load<aggr> (a.id));
+ t.commit ();
+
+ assert (*a1 == a);
+ }
+
+ // query
+ //
+ typedef odb::query<aggr> query;
+ typedef odb::result<aggr> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<aggr> (query::o1->str == "obj1"));
+ assert (!r.empty ());
+ assert (r.begin ()->o1->id == a.o1->id);
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+
+ // Test NULL pointer.
+ //
+ delete a.o1;
+ a.o1 = 0;
+ a.o2.reset ();
+ a.o3.reset ();
+
+ {
+ transaction t (db->begin ());
+ db->update (a);
+ t.commit ();
+ }
+
+ // load & compare
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<aggr> a1 (db->load<aggr> (a.id));
+ t.commit ();
+
+ assert (*a1 == a);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/relationship/basics/test.hxx b/odb-tests/common/relationship/basics/test.hxx
new file mode 100644
index 0000000..8a2742e
--- /dev/null
+++ b/odb-tests/common/relationship/basics/test.hxx
@@ -0,0 +1,260 @@
+// file : common/relationship/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <set>
+#include <map>
+#include <vector>
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+
+// Raw pointer.
+//
+#pragma db object pointer(obj1*)
+struct obj1
+{
+ obj1 () {}
+ obj1 (const std::string& i, const std::string& s): id (i), str (s) {}
+
+ #pragma db id
+ std::string id;
+ std::string str;
+};
+
+inline bool
+operator== (const obj1& x, const obj1& y)
+{
+ return x.id == y.id && x.str == y.str;
+}
+
+// vector
+//
+typedef std::vector<obj1*> obj1_vec;
+
+inline bool
+operator== (const obj1_vec& x, const obj1_vec& y)
+{
+ if (x.size () != y.size ())
+ return false;
+
+ for (obj1_vec::size_type i (0); i < x.size (); ++i)
+ if (!(x[i] ? (y[i] && *x[i] == *y[i]) : !y[i]))
+ return false;
+
+ return true;
+}
+
+// set
+//
+struct obj1_cmp
+{
+ bool
+ operator() (obj1* x, obj1* y) const
+ {
+ return (!x || !y) ? x < y : x->id < y->id;
+ }
+};
+
+typedef std::set<obj1*, obj1_cmp> obj1_set;
+
+inline bool
+operator== (const obj1_set& x, const obj1_set& y)
+{
+ if (x.size () != y.size ())
+ return false;
+
+ for (obj1_set::const_iterator i (x.begin ()); i != x.end (); ++i)
+ {
+ obj1_set::const_iterator j (y.find (*i));
+
+ if (j == y.end ())
+ return false;
+
+ obj1* x (*i);
+ obj1* y (*j);
+
+ if (!(x ? (y && *x == *y) : !y))
+ return false;
+ }
+
+ return true;
+}
+
+// map
+//
+typedef std::map<int, obj1*> obj1_map;
+
+inline bool
+operator== (const obj1_map& x, const obj1_map& y)
+{
+ if (x.size () != y.size ())
+ return false;
+
+ for (obj1_map::const_iterator i (x.begin ()); i != x.end (); ++i)
+ {
+ obj1_map::const_iterator j (y.find (i->first));
+
+ if (j == y.end ())
+ return false;
+
+ obj1* x (i->second);
+ obj1* y (j->second);
+
+ if (!(x ? (y && *x == *y) : !y))
+ return false;
+ }
+
+ return true;
+}
+
+// auto_ptr/unique_ptr
+//
+struct obj2;
+
+typedef std::unique_ptr<obj2> obj2_ptr;
+
+#pragma db object pointer(obj2_ptr)
+struct obj2
+{
+ obj2 () {}
+ obj2 (const std::string& s): str (s) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::string str;
+};
+
+inline bool
+operator== (const obj2& x, const obj2& y)
+{
+ return x.id == y.id && x.str == y.str;
+}
+
+typedef std::vector<obj2_ptr> obj2_vec;
+
+inline bool
+operator== (const obj2_vec& x, const obj2_vec& y)
+{
+ if (x.size () != y.size ())
+ return false;
+
+ for (obj2_vec::size_type i (0); i < x.size (); ++i)
+ if (!(x[i] ? (y[i] && *x[i] == *y[i]) : !y[i]))
+ return false;
+
+ return true;
+}
+
+// shared_ptr
+//
+struct obj3;
+
+typedef std::shared_ptr<obj3> obj3_ptr;
+
+#pragma db object pointer(obj3_ptr)
+struct obj3
+{
+ obj3 () {}
+ obj3 (const std::string& s): str (s) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ std::string str;
+};
+
+inline bool
+operator== (const obj3& x, const obj3& y)
+{
+ return x.id == y.id && x.str == y.str;
+}
+
+// composite
+//
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, obj3_ptr o): num (n), o3 (o) {}
+
+ int num;
+ obj3_ptr o3;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num &&
+ (x.o3 ? (y.o3 && *x.o3 == *y.o3) : !y.o3);
+}
+
+typedef std::vector<comp> comp_vec;
+
+//
+//
+#pragma db object
+struct aggr
+{
+ aggr (): o1 (0) {}
+ aggr (const std::string& s): o1 (0), str (s) {}
+
+ ~aggr ()
+ {
+ delete o1;
+
+ for (obj1_vec::iterator i (v1.begin ()); i != v1.end (); ++i)
+ delete *i;
+
+ for (obj1_set::iterator i (s1.begin ()); i != s1.end (); ++i)
+ delete *i;
+
+ for (obj1_map::iterator i (m1.begin ()); i != m1.end (); ++i)
+ delete i->second;
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ obj1* o1;
+
+ obj2_ptr o2; // std::auto_ptr or std::unique_ptr
+ obj2_vec v2;
+
+ obj3_ptr o3;
+ comp c;
+ comp_vec cv;
+
+ obj1_vec v1;
+ obj1_set s1;
+ obj1_map m1;
+
+ std::string str;
+
+private:
+ aggr (const aggr&);
+ aggr& operator= (const aggr&);
+};
+
+inline bool
+operator== (const aggr& x, const aggr& y)
+{
+ return
+ x.id == y.id &&
+ (x.o1 ? (y.o1 && *x.o1 == *y.o1) : !y.o1) &&
+ (x.o2.get () ? (y.o2.get () && *x.o2 == *y.o2) : !y.o2.get ()) &&
+ x.v2 == y.v2 &&
+ (x.o3.get () ? (y.o3.get () && *x.o3 == *y.o3) : !y.o3.get ()) &&
+ x.c == y.c &&
+ x.cv == y.cv &&
+ x.v1 == y.v1 &&
+ x.s1 == y.s1 &&
+ x.m1 == y.m1 &&
+ x.str == y.str;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/relationship/basics/testscript b/odb-tests/common/relationship/basics/testscript
new file mode 100644
index 0000000..b498bfa
--- /dev/null
+++ b/odb-tests/common/relationship/basics/testscript
@@ -0,0 +1,33 @@
+# file : common/relationship/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/relationship/on-delete/buildfile b/odb-tests/common/relationship/on-delete/buildfile
new file mode 100644
index 0000000..965a2eb
--- /dev/null
+++ b/odb-tests/common/relationship/on-delete/buildfile
@@ -0,0 +1,43 @@
+# file : common/relationship/on-delete/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_rel_on_d_ \
+ --generate-schema \
+ --fkeys-deferrable-mode mysql:not_deferrable \
+ --fkeys-deferrable-mode mssql:not_deferrable
+
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/relationship/on-delete/driver.cxx b/odb-tests/common/relationship/on-delete/driver.cxx
new file mode 100644
index 0000000..eec57cf
--- /dev/null
+++ b/odb-tests/common/relationship/on-delete/driver.cxx
@@ -0,0 +1,82 @@
+// file : common/relationship/on-delete/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test ON DELETE functionality.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ cascade c;
+ c.p = &o;
+
+ cascade_cont cc;
+ cc.p.push_back (&o);
+
+ set_null n;
+ n.p = &o;
+
+ set_null_cont nc;
+ nc.p.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (c);
+ db->persist (cc);
+ db->persist (n);
+ db->persist (nc);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ assert (db->find<cascade> (c.id) == 0);
+
+ unique_ptr<cascade_cont> pcc (db->load<cascade_cont> (cc.id));
+ assert (pcc->p.empty ());
+
+ unique_ptr<set_null> pn (db->load<set_null> (n.id));
+ assert (pn->p == 0);
+
+ unique_ptr<set_null_cont> pnc (db->load<set_null_cont> (nc.id));
+ assert (pnc->p.size () == 1 && pnc->p[0] == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/relationship/on-delete/test.hxx b/odb-tests/common/relationship/on-delete/test.hxx
new file mode 100644
index 0000000..841acd9
--- /dev/null
+++ b/odb-tests/common/relationship/on-delete/test.hxx
@@ -0,0 +1,58 @@
+// file : common/relationship/on-delete/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id;
+};
+
+#pragma db object
+struct cascade
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(cascade)
+ object* p;
+};
+
+#pragma db object
+struct cascade_cont
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(cascade)
+ std::vector<object*> p;
+};
+
+#pragma db object
+struct set_null
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(set_null)
+ object* p;
+};
+
+#pragma db object
+struct set_null_cont
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(set_null)
+ std::vector<object*> p;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/relationship/on-delete/testscript b/odb-tests/common/relationship/on-delete/testscript
new file mode 100644
index 0000000..8288ebc
--- /dev/null
+++ b/odb-tests/common/relationship/on-delete/testscript
@@ -0,0 +1,33 @@
+# file : common/relationship/on-delete/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/relationship/query/buildfile b/odb-tests/common/relationship/query/buildfile
new file mode 100644
index 0000000..b70edc4
--- /dev/null
+++ b/odb-tests/common/relationship/query/buildfile
@@ -0,0 +1,42 @@
+# file : common/relationship/query/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_rel_query_ \
+ --generate-schema \
+ --generate-query \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/relationship/query/driver.cxx b/odb-tests/common/relationship/query/driver.cxx
new file mode 100644
index 0000000..20d5370
--- /dev/null
+++ b/odb-tests/common/relationship/query/driver.cxx
@@ -0,0 +1,168 @@
+// file : common/relationship-query/query/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test relationship queries.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ //
+ //
+ {
+ shared_ptr<country> ca (new country ("CA", "Canada"));
+ shared_ptr<country> za (new country ("ZA", "South Africa"));
+ shared_ptr<country> us (new country ("US", "United States"));
+ shared_ptr<country> se (new country ("SE", "Sweden"));
+
+ shared_ptr<employer> st (new employer ("Simple Tech, Inc", ca));
+ shared_ptr<employer> ct (new employer ("Complex Tech, Inc", us));
+
+ // person
+ //
+ shared_ptr<person> p1 (
+ new person (1, "John", "Doe", 30, ca, true, za));
+
+ shared_ptr<person> p2 (
+ new person (2, "Jane", "Doe", 29, za, false, us));
+ p2->husband = p1;
+
+ shared_ptr<person> p3 (
+ new person (3, "Joe", "Dirt", 31, us, true, us));
+
+ shared_ptr<person> p4 (
+ new person (4, "Johan", "Johansen", 32, se, false, ca));
+
+ // employee
+ //
+ shared_ptr<employee> e1 (
+ new employee (1, "John", "Doe", 30, ca, true, za, st));
+
+ shared_ptr<employee> e2 (
+ new employee (2, "Jane", "Doe", 29, za, false, us, ct));
+ e2->husband = p1;
+
+ shared_ptr<employee> e3 (
+ new employee (3, "Joe", "Dirt", 31, us, true, us, st));
+
+ shared_ptr<employee> e4 (
+ new employee (4, "Johan", "Johansen", 32, se, false, ca, ct));
+
+ transaction t (db->begin ());
+ db->persist (ca);
+ db->persist (za);
+ db->persist (us);
+ db->persist (se);
+
+ db->persist (st);
+ db->persist (ct);
+
+ db->persist (p1);
+ db->persist (p2);
+ db->persist (p3);
+ db->persist (p4);
+
+ db->persist (e1);
+ db->persist (e2);
+ db->persist (e3);
+ db->persist (e4);
+ t.commit ();
+ }
+
+ typedef odb::query<person> p_query;
+ typedef odb::result<person> p_result;
+
+ typedef odb::query<employee> e_query;
+ typedef odb::result<employee> e_result;
+
+ // Make sure we have an independent JOIN for each relationship.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ p_result pr (db->query<person> (
+ p_query::residence.location->code == "ZA"));
+ assert (size (pr) == 1);
+
+ e_result er (db->query<employee> (
+ e_query::residence.location->code == "ZA"));
+ assert (size (er) == 1);
+
+ t.commit ();
+ }
+
+ // Test Self-JOIN.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ p_result pr (db->query<person> (p_query::husband->last_name == "Doe"));
+ assert (size (pr) == 1);
+
+ e_result er (db->query<employee> (e_query::husband->last_name == "Doe"));
+ assert (size (er) == 1);
+
+ t.commit ();
+ }
+
+ // Test query conditions from both base and derived.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ e_result r (
+ db->query<employee> (
+ e_query::employed_by->name == "Simple Tech, Inc" &&
+ e_query::nationality->code == "US"));
+
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+
+ // Test second-level pointers.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ p_result r (
+ db->query<person> (
+ p_query::husband->residence.location == "CA"));
+
+ assert (size (r) == 1);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/relationship/query/test.hxx b/odb-tests/common/relationship/query/test.hxx
new file mode 100644
index 0000000..c6e2d6d
--- /dev/null
+++ b/odb-tests/common/relationship/query/test.hxx
@@ -0,0 +1,140 @@
+// file : common/relationship-query/query/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <memory>
+
+#include <odb/core.hxx>
+
+using std::shared_ptr;
+
+struct country;
+
+#pragma db value
+struct residence_info
+{
+ residence_info (bool p, shared_ptr<country> l)
+ : permanent (p), location (l)
+ {
+ }
+
+ residence_info ()
+ {
+ }
+
+ bool permanent;
+
+ #pragma db not_null
+ shared_ptr<country> location;
+};
+
+#pragma db object pointer(shared_ptr)
+struct person
+{
+ person (unsigned long i,
+ const std::string& fn,
+ const std::string& ln,
+ unsigned short a,
+ shared_ptr<country> r,
+ bool p,
+ shared_ptr<country> n)
+ : id (i),
+ first_name (fn),
+ last_name (ln),
+ age (a),
+ residence (p, r),
+ nationality (n)
+ {
+ }
+
+ person ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db column ("first")
+ std::string first_name;
+
+ #pragma db column ("last")
+ std::string last_name;
+
+ unsigned short age;
+
+ residence_info residence;
+
+ #pragma db not_null
+ shared_ptr<country> nationality;
+
+ shared_ptr<person> husband; // Self-join.
+};
+
+struct employer;
+
+#pragma db object pointer(shared_ptr)
+struct employee: person
+{
+ employee (unsigned long i,
+ const std::string& fn,
+ const std::string& ln,
+ unsigned short a,
+ shared_ptr<country> r,
+ bool p,
+ shared_ptr<country> n,
+ shared_ptr<employer> e)
+ : person (i, fn, ln, a, r, p, n),
+ employed_by (e)
+ {
+ }
+
+ employee ()
+ {
+ }
+
+ shared_ptr<employer> employed_by;
+};
+
+#pragma db object pointer(shared_ptr)
+struct employer
+{
+ employer (const std::string& n, shared_ptr<country> nat)
+ : name (n), nationality (nat)
+ {
+ }
+
+ employer ()
+ {
+ }
+
+ #pragma db id
+ std::string name;
+
+ // The same member name and type as in person (test JOIN alias).
+ //
+ #pragma db not_null
+ shared_ptr<country> nationality;
+};
+
+#pragma db object pointer(shared_ptr)
+struct country
+{
+ country (const std::string& c, const std::string& n)
+ : code (c), name (n)
+ {
+ }
+
+ country ()
+ {
+ }
+
+ #pragma db id
+ std::string code; // ISO 2-letter country code.
+
+ std::string name;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/relationship/query/testscript b/odb-tests/common/relationship/query/testscript
new file mode 100644
index 0000000..d5ad419
--- /dev/null
+++ b/odb-tests/common/relationship/query/testscript
@@ -0,0 +1,33 @@
+# file : common/relationship/query/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/schema/embedded/basics/buildfile b/odb-tests/common/schema/embedded/basics/buildfile
new file mode 100644
index 0000000..0cfe85e
--- /dev/null
+++ b/odb-tests/common/schema/embedded/basics/buildfile
@@ -0,0 +1,42 @@
+# file : common/schema/embedded/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix schema_embd_bscs_ \
+ --generate-schema \
+ --schema-format embedded \
+ --schema-name test
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/schema/embedded/basics/driver.cxx b/odb-tests/common/schema/embedded/basics/driver.cxx
new file mode 100644
index 0000000..7ba2bce
--- /dev/null
+++ b/odb-tests/common/schema/embedded/basics/driver.cxx
@@ -0,0 +1,59 @@
+// file : common/schema/embedded/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic embedded schema functionality.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv, false));
+
+ // Create the database schema.
+ //
+ {
+ connection_ptr c (db->connection ());
+
+ // Temporarily disable foreign key constraints for SQLite.
+ //
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
+
+ assert (schema_catalog::exists (*db, "test"));
+ assert (!schema_catalog::exists (*db, "test1"));
+ assert (!schema_catalog::exists (*db, ""));
+
+ transaction t (c->begin ());
+ schema_catalog::create_schema (*db, "test");
+ t.commit ();
+
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/schema/embedded/basics/test.hxx b/odb-tests/common/schema/embedded/basics/test.hxx
new file mode 100644
index 0000000..43331f9
--- /dev/null
+++ b/odb-tests/common/schema/embedded/basics/test.hxx
@@ -0,0 +1,23 @@
+// file : common/schema/embedded/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db auto id
+ unsigned long id;
+
+ std::string str;
+
+ std::vector<int> nums;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/schema/embedded/basics/testscript b/odb-tests/common/schema/embedded/basics/testscript
new file mode 100644
index 0000000..24448c0
--- /dev/null
+++ b/odb-tests/common/schema/embedded/basics/testscript
@@ -0,0 +1,31 @@
+# file : common/schema/embedded/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/schema/embedded/order/.gitignore b/odb-tests/common/schema/embedded/order/.gitignore
new file mode 100644
index 0000000..5d39d39
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/.gitignore
@@ -0,0 +1,6 @@
+# ODB-generated files.
+#
+test1-odb.?xx
+test1-odb-*.?xx
+test2-odb.?xx
+test2-odb-*.?xx
diff --git a/odb-tests/common/schema/embedded/order/buildfile b/odb-tests/common/schema/embedded/order/buildfile
new file mode 100644
index 0000000..57ad7dd
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/buildfile
@@ -0,0 +1,48 @@
+# file : common/schema/embedded/order/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = test1 test2
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix schema_embd_ordr_ \
+ --generate-schema \
+ --schema-format embedded
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/schema/embedded/order/driver.cxx b/odb-tests/common/schema/embedded/order/driver.cxx
new file mode 100644
index 0000000..fde5e96
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/driver.cxx
@@ -0,0 +1,65 @@
+// file : common/schema/embedded/order/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test statement execution order in embedded schemas.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test1.hxx"
+#include "test2.hxx"
+
+#include "test1-odb.hxx"
+#include "test2-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv, false));
+ odb::database_id db_id (db->id ());
+
+ // Create the database schema.
+ //
+ {
+ connection_ptr c (db->connection ());
+
+ // Temporarily disable foreign key constraints for MySQL and SQLite.
+ // For MySQL we can actually create the tables in any order. It is
+ // dropping them that's the problem (there is no IF EXISTS).
+ //
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
+
+ transaction t (c->begin ());
+ schema_catalog::create_schema (*db);
+ t.commit ();
+
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/schema/embedded/order/test1.hxx b/odb-tests/common/schema/embedded/order/test1.hxx
new file mode 100644
index 0000000..b35074b
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/test1.hxx
@@ -0,0 +1,23 @@
+// file : common/schema/embedded/order/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object polymorphic
+struct base
+{
+ virtual
+ ~base () {}
+
+ #pragma db auto id
+ unsigned long id;
+
+ std::string str;
+};
+
+#endif // TEST1_HXX
diff --git a/odb-tests/common/schema/embedded/order/test2.hxx b/odb-tests/common/schema/embedded/order/test2.hxx
new file mode 100644
index 0000000..b4e6d20
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/test2.hxx
@@ -0,0 +1,17 @@
+// file : common/schema/embedded/order/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#include <odb/core.hxx>
+
+#include "test1.hxx"
+
+#pragma db object
+struct derived: base
+{
+ int num;
+};
+
+#endif // TEST2_HXX
diff --git a/odb-tests/common/schema/embedded/order/testscript b/odb-tests/common/schema/embedded/order/testscript
new file mode 100644
index 0000000..6dfe58c
--- /dev/null
+++ b/odb-tests/common/schema/embedded/order/testscript
@@ -0,0 +1,31 @@
+# file : common/schema/embedded/order/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/schema/namespace/buildfile b/odb-tests/common/schema/namespace/buildfile
new file mode 100644
index 0000000..fa496d7
--- /dev/null
+++ b/odb-tests/common/schema/namespace/buildfile
@@ -0,0 +1,41 @@
+# file : common/schema/namespace/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix schema_ns_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/schema/namespace/driver.cxx b/odb-tests/common/schema/namespace/driver.cxx
new file mode 100644
index 0000000..25515f2
--- /dev/null
+++ b/odb-tests/common/schema/namespace/driver.cxx
@@ -0,0 +1,113 @@
+// file : common/schema/namespace/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test database schemas (aka database namespaces).
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test database schema (aka database namespace).
+ //
+ using ns::object2;
+
+ object2 o2;
+ o2.id = "aaa";
+ o2.nums.push_back (1);
+ o2.nums.push_back (2);
+ o2.nums.push_back (3);
+ o2.obj1 = new object1;
+ o2.obj1->str = "aaa";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o2.obj1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> p2 (db->load<object2> ("aaa"));
+ t.commit ();
+
+ assert (o2 == *p2);
+ }
+
+ {
+ typedef odb::query<object2> query;
+ typedef odb::result<object2> result;
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object2> (query::id == "aaa"));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object2> (query::obj1->str == "aaa"));
+ assert (size (r) == 1);
+ }
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object_view> query;
+ typedef odb::result<object_view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object_view> (query::object2::id == "aaa"));
+
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->id2 == "aaa" && i->str == "aaa");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<table_view> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<table_view> ());
+
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->str == "aaa");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/schema/namespace/test.hxx b/odb-tests/common/schema/namespace/test.hxx
new file mode 100644
index 0000000..0b1844a
--- /dev/null
+++ b/odb-tests/common/schema/namespace/test.hxx
@@ -0,0 +1,158 @@
+// file : common/schema/namespace/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Table names.
+//
+#pragma db object table("TABLE_EXPLICIT")
+struct table_explicit
+{
+ #pragma db id
+ unsigned long id_;
+};
+
+#pragma db object
+struct table_implicit
+{
+ #pragma db id
+ unsigned long id_;
+};
+
+// Column names.
+//
+#pragma db object
+struct column
+{
+ #pragma db id
+ int m1;
+
+ #pragma db column("foo")
+ int m2;
+
+ int m_m3;
+ int _m4;
+ int m5_;
+ int m_;
+ int m__;
+};
+
+// Column types.
+//
+#pragma db object
+struct type
+{
+ #pragma db id
+ std::string id;
+
+ // Test default C++ to DB type mapping.
+ //
+ bool b;
+ char c;
+ signed char sc;
+ unsigned char uc;
+ short s;
+ unsigned short us;
+ int i;
+ unsigned int ui;
+ long l;
+ unsigned long ul;
+ long long ll;
+ unsigned long long ull;
+ float f;
+ double d;
+ std::string str;
+
+ #pragma db type("INTEGER")
+ bool m1;
+
+ #pragma db transient
+ char* m2;
+};
+
+// Test database schema (aka database namespace).
+//
+#ifdef ODB_COMPILER
+#if defined (ODB_DATABASE_MYSQL)
+//# define DB_SCHEMA "odb_test"
+# define DB_SCHEMA ""
+#elif defined (ODB_DATABASE_SQLITE)
+# define DB_SCHEMA "main"
+#elif defined (ODB_DATABASE_PGSQL)
+# define DB_SCHEMA "public"
+#elif defined (ODB_DATABASE_ORACLE)
+//# define DB_SCHEMA "ODB_TEST"
+# define DB_SCHEMA ""
+#elif defined(ODB_DATABASE_MSSQL)
+# define DB_SCHEMA "dbo"
+#elif defined(ODB_DATABASE_COMMON)
+# define DB_SCHEMA "dummy"
+#else
+# error unknown database
+#endif
+#endif
+
+namespace ns {typedef int my_int;} // Original.
+
+#pragma db object table(DB_SCHEMA."object_1")
+struct object1
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db column("str")
+ std::string str;
+};
+
+inline bool
+operator== (const object1& x, const object1& y)
+{
+ return x.id == y.id && x.str == y.str;
+}
+
+#pragma db namespace schema(DB_SCHEMA)
+namespace ns // Extension.
+{
+ #pragma db object
+ struct object2
+ {
+ object2 (): obj1 (0) {}
+ ~object2 () {delete obj1;}
+
+ #pragma db id
+ std::string id;
+
+ std::vector<unsigned int> nums;
+ object1* obj1;
+ };
+
+ inline bool
+ operator== (const object2& x, const object2& y)
+ {
+ return x.id == y.id && x.nums == y.nums && *x.obj1 == *y.obj1;
+ }
+}
+
+#pragma db view object(object1) object(ns::object2)
+struct object_view
+{
+ #pragma db column(ns::object2::id)
+ std::string id2;
+
+ std::string str;
+};
+
+#pragma db view table(DB_SCHEMA."schema_ns_object_1")
+struct table_view
+{
+ #pragma db column(DB_SCHEMA."schema_ns_object_1"."str")
+ std::string str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/schema/namespace/testscript b/odb-tests/common/schema/namespace/testscript
new file mode 100644
index 0000000..0fabe6e
--- /dev/null
+++ b/odb-tests/common/schema/namespace/testscript
@@ -0,0 +1,33 @@
+# file : common/schema/namespace/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/section/basics/buildfile b/odb-tests/common/section/basics/buildfile
new file mode 100644
index 0000000..5ccdd6b
--- /dev/null
+++ b/odb-tests/common/section/basics/buildfile
@@ -0,0 +1,41 @@
+# file : common/section/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_section_b_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/section/basics/driver.cxx b/odb-tests/common/section/basics/driver.cxx
new file mode 100644
index 0000000..53783a3
--- /dev/null
+++ b/odb-tests/common/section/basics/driver.cxx
@@ -0,0 +1,1735 @@
+// file : common/section/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test object section basics.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct failed {};
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test lazy-loaded, always updating section.
+ //
+ {
+ using namespace test1;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // We can also update just the section.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n != o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // Test updating unloaded section.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+ o.s.unload ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ t.commit ();
+ }
+
+ // Test reloading of loaded/unloaded sections.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+ o.s.unload ();
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ db->reload (o);
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ db->load (o, o.s);
+ t.commit ();
+ }
+
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ db->reload (o);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // Make sure we can access section members in queries.
+ //
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<object> (query::ss == o.ss));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end () && !i->s.loaded ());
+
+ db->load (*i, i->s);
+ assert (i->n == o.n &&
+ i->sn == o.sn && i->ss == o.ss && i->sv == o.sv);
+
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+
+ // Make sure we can load/update sections without messing up the
+ // loaded object's image.
+ //
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<object> (query::ss == o.ss));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+
+ object o1;
+ i.load (o1);
+ db->load (o1, o1.s);
+ assert (o1.n == o.n &&
+ o1.sn == o.sn && o1.ss == o.ss && o1.sv == o.sv);
+
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+ db->update (o, o.s);
+
+ object o2;
+ i.load (o2);
+ db->load (o2, o2.s);
+ assert (o2.n == o1.n &&
+ o2.sn == o.sn && o2.ss == o.ss && o2.sv == o.sv);
+
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+ }
+
+ // Test lazy-loaded, change-updated section.
+ //
+ {
+ using namespace test2;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update but don't mark as changed.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ t.commit ();
+ }
+
+ // Mark as changed.
+ //
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ assert (!o.s.changed ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // We can also update just the section manually.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ assert (!o.s.changed ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n != o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+ }
+
+ // Test lazy-loaded, manually-updated section.
+ //
+ {
+ using namespace test3;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update the object only.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ t.commit ();
+ }
+
+ // Update both the object and section.
+ //
+ o.n++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // We can also update just the section.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n != o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // Test detection of unloaded section update.
+ //
+ try
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->update (*p, p->s);
+ assert (false);
+ }
+ catch (const section_not_loaded&)
+ {
+ }
+ }
+
+ // Test eager-loaded, change-updated section.
+ //
+ {
+ using namespace test4;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update but don't mark as changed.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ t.commit ();
+ }
+
+ // Mark as changed.
+ //
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ assert (!o.s.changed ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+ }
+
+ // Test eager-loaded, manually-updated section.
+ //
+ {
+ using namespace test5;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update the object only.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+ t.commit ();
+ }
+
+ // Update both the object and section.
+ //
+ o.n++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // We can also update just the section.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ assert (p->n != o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+ }
+
+ // Test value-only and container-only section. Also multiple sections
+ // in an object.
+ //
+ {
+ using namespace test6;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s1.loaded ());
+ assert (o.s2.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s1.loaded ());
+ assert (!p->s2.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s1);
+ assert (p->s1.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s2);
+ assert (p->s2.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // We can also update just the section.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s1);
+ db->update (o, o.s2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+ assert (p->n != o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+ t.commit ();
+ }
+ }
+
+ // Test value-only and container-only section. Also multiple sections
+ // in an object.
+ //
+ {
+ using namespace test7;
+
+ object o (123, "abc", true);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s1.loaded ());
+ assert (o.s2.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s1.loaded ());
+ assert (!p->s2.loaded ());
+ assert (p->sn1 != o.sn1 && p->ss1 != o.ss1 &&
+ p->sn2 != o.sn2 && p->ss2 != o.ss2 && p->sb2 != o.sb2);
+
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+ assert (p->s1.loaded ());
+ assert (p->s2.loaded ());
+ assert (p->sn1 == o.sn1 && p->ss1 == o.ss1 &&
+ p->sn2 == o.sn2 && p->ss2 == o.ss2 && p->sb2 == o.sb2);
+
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.sn1++;
+ o.sn2++;
+ o.ss1 += 'd';
+ o.ss2 += 'd';
+ o.sb2 = !o.sb2;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+ assert (p->sn1 == o.sn1 && p->ss1 == o.ss1 &&
+ p->sn2 == o.sn2 && p->ss2 == o.ss2 && p->sb2 == o.sb2);
+ t.commit ();
+ }
+
+ // Manual update of just the section.
+ //
+ o.sn1++;
+ o.sn2++;
+ o.ss1 += 'd';
+ o.ss2 += 'd';
+ o.sb2 = !o.sb2;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+ assert (p->sn1 != o.sn1 && p->ss1 != o.ss1 &&
+ p->sn2 == o.sn2 && p->ss2 == o.ss2 && p->sb2 == o.sb2);
+ t.commit ();
+ }
+ }
+
+ // Test readonly and inverse section members.
+ //
+ {
+ using namespace test8;
+
+ object1 o1 (new object (123, "abc"));
+ object& o (*o1.p);
+ o.sp = &o1;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (o1);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ session s;
+
+ transaction t (db->begin ());
+ unique_ptr<object1> p1 (db->load<object1> (o1.id));
+ object* p (p1->p);
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sp == 0);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sp->id == o.sp->id);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ session s;
+
+ transaction t (db->begin ());
+ unique_ptr<object1> p1 (db->load<object1> (o1.id));
+ object* p (p1->p);
+
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss == o.ss && p->sp->id == o.sp->id);
+
+ t.commit ();
+ }
+ }
+
+ // Test object without any columns to load or update.
+ //
+ {
+ using namespace test9;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (o.id == o.id &&
+ p->sn != o.sn && p->ss != o.ss);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (o.id == o.id &&
+ p->sn == o.sn && p->ss == o.ss);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ o.sn++;
+ o.ss += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (o); // No-op.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (o.id == o.id &&
+ p->sn != o.sn && p->ss != o.ss);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (o.id == o.id &&
+ p->sn == o.sn && p->ss == o.ss);
+ t.commit ();
+ }
+ }
+
+ // Test section without any columns or containers to update.
+ //
+ {
+ using namespace test10;
+
+ object o (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n && p->sn != o.sn);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n && p->sn == o.sn);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ //db->update (o, o.s); // Error.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n && p->sn != o.sn);
+ t.commit ();
+ }
+ }
+
+ // Test section with composite member.
+ //
+ {
+ using namespace test11;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->sc.s != o.sc.s && p->sc.v != o.sc.v);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->sc.s == o.sc.s && p->sc.v == o.sc.v);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.sc.s += 'd';
+ o.sc.v[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->sc.s == o.sc.s && p->sc.v == o.sc.v);
+ t.commit ();
+ }
+ }
+
+ // Test change state restoration on transaction rollback.
+ //
+ {
+ using namespace test12;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+ o.s.change ();
+
+ try
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ assert (!o.s.changed ());
+ throw failed ();
+ }
+ catch (const failed&)
+ {
+ assert (o.s.changed ());
+ }
+
+ // Retry. Also test the object destruction before transaction
+ // termination case.
+ //
+ {
+ transaction t (db->begin ());
+ {
+ object c (o);
+ db->update (c);
+ assert (!c.s.changed ());
+ }
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n && p->sn == o.sn && p->ss == o.ss);
+ t.commit ();
+ }
+ }
+
+ // Test section accessor/modifier.
+ //
+ {
+ using namespace test13;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s ().loaded ());
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s ().loaded ());
+ assert (p->n == o.n && p->sn != o.sn && p->ss != o.ss);
+
+ db->load (*p, p->rw_s ());
+
+ assert (p->s ().loaded ());
+ assert (p->n == o.n && p->sn == o.sn && p->ss == o.ss);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.ss += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ db->update (o, o.s ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->rw_s ());
+ assert (p->n == o.n && p->sn == o.sn && p->ss == o.ss);
+ t.commit ();
+ }
+
+ // Test detection of section copy.
+ //
+ try
+ {
+ transaction t (db->begin ());
+ section c (o.s ());
+ db->update (o, c);
+ assert (false);
+ }
+ catch (const section_not_in_object&)
+ {
+ }
+ }
+
+ // Test LOB in section streaming, column re-ordering.
+ //
+ {
+ using namespace test14;
+
+ object o (1, 123, "\x01\x02\x03\x04\x05");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n && p->sn != o.sn && p->sb != o.sb);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n && p->sn == o.sn && p->sb == o.sb);
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.n++;
+ o.sn++;
+ o.sb.push_back ('\x06');
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n == o.n && p->sn == o.sn && p->sb == o.sb);
+ t.commit ();
+ }
+
+ // We can also update just the section.
+ //
+ o.n++;
+ o.sn++;
+ o.sb.push_back ('\x07');
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->n != o.n && p->sn == o.sn && p->sb == o.sb);
+ t.commit ();
+ }
+ }
+
+ // Test sections and optimistic concurrency.
+ //
+ {
+ using namespace test15;
+
+ object o (123, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn != o.sn && p->ss != o.ss && p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->n == o.n &&
+ p->sn == o.sn && p->ss == o.ss && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ object o1 (o);
+ o1.n++;
+ o1.sn++;
+ o1.ss += 'd';
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->update (o1);
+ assert (o.v != o1.v);
+
+ try
+ {
+ db->load (*p, p->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+ assert (!p->s.loaded ());
+ db->load (*p, p->s);
+
+ assert (p->n == o1.n &&
+ p->sn == o1.sn && p->ss == o1.ss && p->sv == o1.sv);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.n == o1.n &&
+ o.sn == o1.sn && o.ss == o1.ss && o.sv == o1.sv);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ o1.sn++;
+ o1.ss += 'd';
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->update (o1, o1.s);
+ assert (o.v != o1.v);
+
+ // Double-check object version was updated.
+ //
+ {
+ unique_ptr<object> p1 (db->load<object> (o.id));
+ assert (o1.v == p1->v);
+ }
+
+ try
+ {
+ db->load (*p, p->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+ assert (!p->s.loaded ());
+ db->load (*p, p->s);
+
+ assert (p->n == o1.n &&
+ p->sn == o1.sn && p->ss == o1.ss && p->sv == o1.sv);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.n == o1.n &&
+ o.sn == o1.sn && o.ss == o1.ss && o.sv == o1.sv);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ o1.sn++;
+ o1.ss += 'd';
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o1, o1.s);
+
+ try
+ {
+ db->update (o, o.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (o);
+ db->update (o, o.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test container-only sections and optimistic concurrency.
+ //
+ {
+ using namespace test16;
+
+ object o (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ object o1 (o);
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->update (o1);
+ assert (o.v != o1.v);
+
+ try
+ {
+ db->load (*p, p->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+ assert (!p->s.loaded ());
+ db->load (*p, p->s);
+
+ assert (p->sv == o1.sv);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.sv == o1.sv);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->update (o1, o1.s);
+ assert (o.v != o1.v);
+
+ // Double-check object version was updated.
+ //
+ {
+ unique_ptr<object> p1 (db->load<object> (o.id));
+ assert (o1.v == p1->v);
+ }
+
+ try
+ {
+ db->load (*p, p->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+ assert (!p->s.loaded ());
+ db->load (*p, p->s);
+
+ assert (p->sv == o1.sv);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.sv == o1.sv);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ o1.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o1, o1.s);
+
+ try
+ {
+ db->update (o, o.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (o);
+ db->update (o, o.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test reuse-inheritance, sections, and optimistic concurrency.
+ //
+ {
+ using namespace test17;
+
+ object o (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s1.loaded ());
+ assert (o.s2.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s1.loaded ());
+ assert (!p->s2.loaded ());
+ assert (p->s1n != o.s1n && p->s2v != o.s2v);
+
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+
+ assert (p->s1.loaded ());
+ assert (p->s2.loaded ());
+ assert (p->s1n == o.s1n && p->s2v == o.s2v);
+
+ t.commit ();
+ }
+
+ object o1 (o);
+
+ // Update object.
+ //
+ for (unsigned short s (1); s < 3; ++s)
+ {
+ o1.s1n++;
+ o1.s2v[0]++;
+
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->update (o1);
+ assert (o.v != o1.v);
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->load (*p, p->s1); break;
+ case 2: db->load (*p, p->s2); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+
+ assert (!p->s1.loaded ());
+ assert (!p->s2.loaded ());
+
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+
+ assert (p->s1n == o1.s1n && p->s2v == o1.s2v);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.s1n == o1.s1n && o.s2v == o1.s2v);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ for (unsigned short s (1); s < 3; ++s)
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ switch (s)
+ {
+ case 1:
+ o1.s1n++;
+ db->update (o1, o1.s1);
+ assert (o.v != o1.v);
+ break;
+ case 2:
+ o1.s2v[0]++;
+ db->update (o1, o1.s2);
+ assert (o.v != o1.v);
+ break;
+ default: break;
+ }
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->load (*p, p->s1); break;
+ case 2: db->load (*p, p->s2); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*p);
+
+ assert (!p->s1.loaded ());
+ assert (!p->s2.loaded ());
+
+ db->load (*p, p->s1);
+ db->load (*p, p->s2);
+
+ assert (p->s1n == o1.s1n && p->s2v == o1.s2v);
+ }
+
+ db->reload (o);
+ assert (o.v == o1.v);
+ assert (o.s1n == o1.s1n && o.s2v == o1.s2v);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ for (unsigned short s (1); s < 3; ++s)
+ {
+ transaction t (db->begin ());
+
+ switch (s)
+ {
+ case 1:
+ o1.s1n++;
+ db->update (o1, o1.s1);
+ break;
+ case 2:
+ o1.s2v[0]++;
+ db->update (o1, o1.s2);
+ break;
+ default: break;
+ }
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->update (o, o.s1); break;
+ case 2: db->update (o, o.s2); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (o);
+
+ switch (s)
+ {
+ case 1: db->update (o, o.s1); break;
+ case 2: db->update (o, o.s2); break;
+ default: break;
+ }
+ }
+
+ db->reload (o1);
+
+ t.commit ();
+ }
+ }
+
+ // Test change-updated section and change-tracking container.
+ //
+ {
+ using namespace test18;
+
+ object o (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+
+ assert (o.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ assert (!p->s.loaded ());
+ assert (p->sn != o.sn && p->sv != o.sv);
+
+ db->load (*p, p->s);
+
+ assert (p->s.loaded ());
+ assert (p->sn == o.sn && p->sv == o.sv);
+
+ t.commit ();
+ }
+
+ // Update but don't mark as changed.
+ //
+ o.sn++;
+ o.sv.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o); // Automatically marked as changed.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->sn == o.sn && p->sv == o.sv);
+ t.commit ();
+ }
+
+ // Test updating just the section manually.
+ //
+ o.sn++;
+ o.sv.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o, o.s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+ db->load (*p, p->s);
+ assert (p->sn == o.sn && p->sv == o.sv);
+ t.commit ();
+ }
+ }
+
+ // Regression: BLOB in a value type used as a map value that is in a
+ // section.
+ //
+ {
+ using namespace test19;
+
+ object o;
+ o.m[1].b.assign (560, 'x'); // Size greater than the default image.
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ // Hold "old" connection to force a new set of statements/image
+ // buffers.
+ //
+ connection_ptr c (db->connection ());
+
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ db->load (*p, p->s);
+ assert (p->m[1].b == o.m[1].b);
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/section/basics/test.hxx b/odb-tests/common/section/basics/test.hxx
new file mode 100644
index 0000000..702ef8b
--- /dev/null
+++ b/odb-tests/common/section/basics/test.hxx
@@ -0,0 +1,628 @@
+// file : common/section/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/section.hxx>
+#include <odb/vector.hxx>
+
+#ifdef ODB_COMPILER
+# if defined(ODB_DATABASE_PGSQL)
+# define BLOB_TYPE "BYTEA"
+# elif defined(ODB_DATABASE_MSSQL)
+# define BLOB_TYPE "VARBINARY(max)"
+# else
+# define BLOB_TYPE "BLOB"
+# endif
+#endif
+
+// Test lazy-loaded, always-updated section.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test lazy-loaded, change-updated section.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test lazy-loaded, manually-updated section.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(manual)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test eager-loaded, change-updated section.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db update(change)
+ odb::section s;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test eager-loaded, manually-updated section.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db update(manual)
+ odb::section s;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test value-only and container-only section. Also multiple sections
+// in an object.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : n (n_), sn (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ int n;
+
+ #pragma db load(lazy)
+ odb::section s1;
+
+ #pragma db load(lazy)
+ odb::section s2;
+
+ #pragma db section(s1)
+ int sn;
+
+ #pragma db section(s1)
+ std::string ss;
+
+ #pragma db section(s2)
+ std::vector<int> sv;
+ };
+}
+
+// Test sections and reuse inheritance.
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ #pragma db object abstract
+ struct base
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy)
+ odb::section s1; // Empty section.
+
+ #pragma db load(lazy)
+ odb::section s2;
+
+ #pragma db section(s2)
+ int sn2;
+ };
+
+ #pragma db object abstract
+ struct interm: base
+ {
+ // Section s1 is still empty.
+
+ #pragma db section(s2)
+ std::string ss2;
+ };
+
+ #pragma db object
+ struct derived: interm
+ {
+ #pragma db section(s1)
+ int sn1;
+ };
+
+ #pragma db object
+ struct object: derived
+ {
+ object (int n = 999, const std::string& s = "xxx", bool b = false)
+ {
+ sn1 = sn2 = n;
+ ss1 = ss2 = s;
+ sb2 = b;
+ }
+
+ #pragma db section(s1)
+ std::string ss1;
+
+ #pragma db section(s2)
+ bool sb2;
+ };
+}
+
+// Test readonly and inverse section members.
+//
+#pragma db namespace table("t8_")
+namespace test8
+{
+ struct object1;
+
+ #pragma db object session
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx", object1* p_ = 0)
+ : n (n_), sn (n_), ss (s_), sp (p_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ int n;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s) readonly
+ int sn;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db inverse(p) section(s)
+ object1* sp;
+ };
+
+ #pragma db object session
+ struct object1
+ {
+ object1 (object* p_ = 0): p (p_) {}
+ ~object1 () {delete p;}
+
+ #pragma db id auto
+ unsigned long id;
+
+ object* p;
+ };
+}
+
+// Test object without any columns to load or update.
+//
+#pragma db namespace table("t9_")
+namespace test9
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx"): sn (n_), ss (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(manual)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db section(s)
+ std::string ss;
+ };
+}
+
+// Test section without any columns or containers to update.
+//
+#pragma db namespace table("t10_")
+namespace test10
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999): n (n_), sn (n_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ int n;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s) readonly
+ int sn;
+ };
+}
+
+// Test section with composite member.
+//
+#pragma db namespace table("t11_")
+namespace test11
+{
+ #pragma db value
+ struct comp
+ {
+ comp (int n_, const std::string& s_): s (s_) {v.push_back (n_);}
+
+ std::string s;
+ std::vector<int> v;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : n (n_), sn (n_), sc (n_, s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ int n;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db section(s)
+ comp sc;
+ };
+}
+
+// Test change state restoration on transaction rollback.
+//
+#pragma db namespace table("t12_")
+namespace test12
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+ };
+}
+
+// Test section accessor/modifier.
+//
+#pragma db namespace table("t13_")
+namespace test13
+{
+ #pragma db object
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : n (n_), sn (n_), ss (s_) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ int n;
+
+ #pragma db section(s_)
+ int sn;
+
+ #pragma db section(s_)
+ std::string ss;
+
+ public:
+ const odb::section&
+ s () const {return s_;}
+
+ odb::section&
+ rw_s () {return s_;}
+
+ private:
+ #pragma db load(lazy) update(manual)
+ odb::section s_;
+ };
+}
+
+// Test LOB in section streaming, column re-ordering.
+//
+#pragma db namespace table("t14_")
+namespace test14
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id_ = 0, int n_ = 999, const std::string& s_ = "xxx")
+ : id (id_), sb (s_.begin (), s_.end ()), sn (n_), n (n_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s) type(BLOB_TYPE)
+ std::vector<char> sb; // Comes before sn.
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+ };
+}
+
+// Test sections and optimistic concurrency.
+//
+#pragma db namespace table("t15_")
+namespace test15
+{
+ #pragma db object optimistic
+ struct object
+ {
+ object (int n_ = 999, const std::string& s_ = "xxx")
+ : sn (n_), n (n_), ss (s_) {sv.push_back (n_);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version mssql:type("ROWVERSION")
+ unsigned long long v;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ int n;
+
+ #pragma db section(s)
+ std::string ss;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test container-only sections and optimistic concurrency.
+//
+#pragma db namespace table("t16_")
+namespace test16
+{
+ #pragma db object optimistic
+ struct object
+ {
+ object (int n = 999) {sv.push_back (n);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version // mssql:type("ROWVERSION")
+ unsigned long long v;
+
+ #pragma db load(lazy)
+ odb::section s;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test reuse-inheritance, sections, and optimistic concurrency.
+//
+#pragma db namespace table("t17_")
+namespace test17
+{
+ #pragma db object optimistic sectionable abstract
+ struct root
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (int n = 999): s1n (n) {s2v.push_back (n);}
+
+ #pragma db load(lazy)
+ odb::section s1;
+
+ #pragma db section(s1)
+ int s1n;
+
+ #pragma db load(lazy)
+ odb::section s2;
+
+ #pragma db section(s2)
+ std::vector<int> s2v;
+ };
+}
+
+// Test change-updated section and change-tracking container.
+//
+#pragma db namespace table("t18_")
+namespace test18
+{
+ #pragma db object
+ struct object
+ {
+ object (int n = 999): sn (n) {sv.push_back (n);}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db section(s)
+ odb::vector<int> sv;
+ };
+}
+
+// Regression: BLOB in a value type used as a map value that is in a section.
+//
+#include <map>
+#include <vector>
+
+#pragma db namespace table("t19_")
+namespace test19
+{
+ #pragma db value
+ struct value
+ {
+ #pragma db type(BLOB_TYPE)
+ std::vector<char> b;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(always)
+ odb::section s;
+
+ #pragma db section(s)
+ std::map<int, value> m;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/section/basics/testscript b/odb-tests/common/section/basics/testscript
new file mode 100644
index 0000000..c0c6617
--- /dev/null
+++ b/odb-tests/common/section/basics/testscript
@@ -0,0 +1,33 @@
+# file : common/section/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/section/polymorphism/buildfile b/odb-tests/common/section/polymorphism/buildfile
new file mode 100644
index 0000000..b9a7514
--- /dev/null
+++ b/odb-tests/common/section/polymorphism/buildfile
@@ -0,0 +1,41 @@
+# file : common/section/polymorphism/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_section_p_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/section/polymorphism/driver.cxx b/odb-tests/common/section/polymorphism/driver.cxx
new file mode 100644
index 0000000..c15d317
--- /dev/null
+++ b/odb-tests/common/section/polymorphism/driver.cxx
@@ -0,0 +1,1807 @@
+// file : common/section/polymorphism/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test sections in polymorphic objects.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct failed {};
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic polymorphic section functionality.
+ //
+ {
+ using namespace test1;
+
+ base b (123, "abc");
+ derived d (234, "bcd", true);
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+
+ assert (b.rs1.loaded ());
+ assert (b.rs2.loaded ());
+ assert (b.rs3.loaded ());
+ assert (b.rs4.loaded ());
+ assert (b.bs1.loaded ());
+
+ assert (d.rs1.loaded ());
+ assert (d.rs2.loaded ());
+ assert (d.rs3.loaded ());
+ assert (d.rs4.loaded ());
+ assert (d.bs1.loaded ());
+ assert (d.ds1.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pb->rs1.loaded ());
+ assert (!pb->rs2.loaded ());
+ assert (!pb->rs3.loaded ());
+ assert (!pb->rs4.loaded ());
+ assert (!pb->bs1.loaded ());
+
+ assert (!pd->rs1.loaded ());
+ assert (!pd->rs2.loaded ());
+ assert (!pd->rs3.loaded ());
+ assert (!pd->rs4.loaded ());
+ assert (!pd->bs1.loaded ());
+ assert (!pd->ds1.loaded ());
+
+ assert (pb->rs1n != b.rs1n && pb->rs1s != b.rs1s &&
+ pb->rs2n != b.rs2n && pb->rs2v != b.rs2v &&
+ pb->rs3v != b.rs3v &&
+ pb->rs4n != b.rs4n &&
+ pb->bs1n != b.bs1n);
+
+ assert (pd->rs1n != d.rs1n && pd->rs1s != d.rs1s &&
+ pd->rs1b != d.rs1b && pd->rs1v != d.rs1v &&
+ pd->rs2n != d.rs2n && pd->rs2v != d.rs2v &&
+ pd->rs3v != d.rs3v && pd->rs3n != d.rs3n &&
+ pd->rs4n != d.rs4n && pd->rs4s != d.rs4s &&
+ pd->bs1n != d.bs1n && pd->bs1s != d.bs1s &&
+ pd->ds1n != d.ds1n);
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1);
+
+ root* pr (pd.get ());
+ db->load (*pr, pr->rs1); // Via base.
+ db->load (*pd, pd->rs2);
+ db->load (*pr, pr->rs3); // Via base.
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ try
+ {
+ db->load (*pr, pd->bs1); // Object-section association is static.
+ assert (false);
+ }
+ catch (const section_not_in_object&) {}
+
+ assert (pb->rs1.loaded ());
+ assert (pb->rs2.loaded ());
+ assert (pb->rs3.loaded ());
+ assert (pb->rs4.loaded ());
+ assert (pb->bs1.loaded ());
+
+ assert (pd->rs1.loaded ());
+ assert (pd->rs2.loaded ());
+ assert (pd->rs3.loaded ());
+ assert (pd->rs4.loaded ());
+ assert (pd->bs1.loaded ());
+ assert (pd->ds1.loaded ());
+
+ assert (pb->rs1n == b.rs1n && pb->rs1s == b.rs1s &&
+ pb->rs2n == b.rs2n && pb->rs2v == b.rs2v &&
+ pb->rs3v == b.rs3v &&
+ pb->rs4n == b.rs4n &&
+ pb->bs1n == b.bs1n);
+
+ assert (pd->rs1n == d.rs1n && pd->rs1s == d.rs1s &&
+ pd->rs1b == d.rs1b && pd->rs1v == d.rs1v &&
+ pd->rs2n == d.rs2n && pd->rs2v == d.rs2v &&
+ pd->rs3v == d.rs3v && pd->rs3n == d.rs3n &&
+ pd->rs4n == d.rs4n && pd->rs4s == d.rs4s &&
+ pd->bs1n == d.bs1n && pd->bs1s == d.bs1s &&
+ pd->ds1n == d.ds1n);
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ b.rs1n++;
+ b.rs1s += 'd';
+ b.rs1.change ();
+ b.rs2n++;
+ b.rs2v[0]++;
+ b.rs3v[0]++;
+ b.rs4n++;
+ b.bs1n++;
+
+ d.rs1n++;
+ d.rs1s += 'e';
+ d.rs1b = !d.rs1b;
+ d.rs1v[0]++;
+ d.rs1.change ();
+ d.rs2n++;
+ d.rs2v[0]++;
+ d.rs3v[0]++;
+ d.rs3n++;
+ d.rs4n++;
+ d.rs4s += 'e';
+ d.bs1n++;
+ d.bs1s += 'e';
+ d.ds1n++;
+
+ {
+ transaction t (db->begin ());
+ db->update (b);
+ db->update (d);
+ t.commit ();
+
+ assert (!b.rs1.changed ());
+ assert (!d.rs1.changed ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1);
+
+ db->load (*pd, pd->rs1);
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ assert (pb->rs1n == b.rs1n && pb->rs1s == b.rs1s &&
+ pb->rs2n == b.rs2n && pb->rs2v == b.rs2v &&
+ pb->rs3v == b.rs3v &&
+ pb->rs4n == b.rs4n &&
+ pb->bs1n == b.bs1n);
+
+ assert (pd->rs1n == d.rs1n && pd->rs1s == d.rs1s &&
+ pd->rs1b == d.rs1b && pd->rs1v == d.rs1v &&
+ pd->rs2n == d.rs2n && pd->rs2v == d.rs2v &&
+ pd->rs3v == d.rs3v && pd->rs3n == d.rs3n &&
+ pd->rs4n == d.rs4n && pd->rs4s == d.rs4s &&
+ pd->bs1n == d.bs1n && pd->bs1s == d.bs1s &&
+ pd->ds1n == d.ds1n);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ b.rs1n++;
+ b.rs1s += 'd';
+ b.rs2n++;
+ b.rs2v[0]++;
+ b.rs3v[0]++;
+ b.rs4n++;
+ b.bs1n++;
+
+ d.rs1n++;
+ d.rs1s += 'e';
+ d.rs1b = !d.rs1b;
+ d.rs1v[0]++;
+ d.rs2n++;
+ d.rs2v[0]++;
+ d.rs3v[0]++;
+ d.rs3n++;
+ d.rs4n++;
+ d.rs4s += 'e';
+ d.bs1n++;
+ d.bs1s += 'e';
+ d.ds1n++;
+
+ {
+ transaction t (db->begin ());
+ db->update (b, b.rs1);
+ db->update (b, b.rs2);
+ db->update (b, b.rs3);
+ db->update (b, b.rs4);
+ db->update (b, b.bs1);
+
+ db->update (d, d.rs1);
+ db->update (d, d.rs2);
+ db->update (d, d.rs3);
+ db->update (d, d.rs4);
+ db->update (d, d.bs1);
+ db->update (d, d.ds1);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1);
+
+ db->load (*pd, pd->rs1);
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ assert (pb->rs1n == b.rs1n && pb->rs1s == b.rs1s &&
+ pb->rs2n == b.rs2n && pb->rs2v == b.rs2v &&
+ pb->rs3v == b.rs3v &&
+ pb->rs4n == b.rs4n &&
+ pb->bs1n == b.bs1n);
+
+ assert (pd->rs1n == d.rs1n && pd->rs1s == d.rs1s &&
+ pd->rs1b == d.rs1b && pd->rs1v == d.rs1v &&
+ pd->rs2n == d.rs2n && pd->rs2v == d.rs2v &&
+ pd->rs3v == d.rs3v && pd->rs3n == d.rs3n &&
+ pd->rs4n == d.rs4n && pd->rs4s == d.rs4s &&
+ pd->bs1n == d.bs1n && pd->bs1s == d.bs1s &&
+ pd->ds1n == d.ds1n);
+ t.commit ();
+ }
+
+ // Reload.
+ //
+ b.rs1n++;
+ b.rs1s += 'd';
+ b.rs1.change ();
+ b.rs2n++;
+ b.rs2v[0]++;
+ b.rs3v[0]++;
+ b.rs4n++;
+ b.bs1n++;
+
+ d.rs1n++;
+ d.rs1s += 'e';
+ d.rs1b = !d.rs1b;
+ d.rs1v[0]++;
+ d.rs1.change ();
+ d.rs2n++;
+ d.rs2v[0]++;
+ d.rs3v[0]++;
+ d.rs3n++;
+ d.rs4n++;
+ d.rs4s += 'e';
+ d.bs1n++;
+ d.bs1s += 'e';
+ d.ds1n++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1);
+
+ db->load (*pd, pd->rs1);
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ db->update (b);
+ db->update (d);
+
+ db->reload (*pb);
+ db->reload (*pd);
+
+ assert (pb->rs1n == b.rs1n && pb->rs1s == b.rs1s &&
+ pb->rs2n == b.rs2n && pb->rs2v == b.rs2v &&
+ pb->rs3v == b.rs3v &&
+ pb->rs4n == b.rs4n &&
+ pb->bs1n == b.bs1n);
+
+ assert (pd->rs1n == d.rs1n && pd->rs1s == d.rs1s &&
+ pd->rs1b == d.rs1b && pd->rs1v == d.rs1v &&
+ pd->rs2n == d.rs2n && pd->rs2v == d.rs2v &&
+ pd->rs3v == d.rs3v && pd->rs3n == d.rs3n &&
+ pd->rs4n == d.rs4n && pd->rs4s == d.rs4s &&
+ pd->bs1n == d.bs1n && pd->bs1s == d.bs1s &&
+ pd->ds1n == d.ds1n);
+
+ t.commit ();
+ }
+ }
+
+ // Test empty section and override "gap".
+ //
+ {
+ using namespace test2;
+
+ derived d (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (d);
+ t.commit ();
+
+ assert (d.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pd->s.loaded ());
+ assert (pd->sn != d.sn && pd->sv != d.sv);
+
+ root* pr (pd.get ());
+ db->load (*pr, pr->s); // Via root.
+
+ assert (pd->s.loaded ());
+ assert (pd->sn == d.sn && pd->sv == d.sv);
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ d.sn++;
+ d.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ root* pr (&d);
+ db->update (pr); // Via root.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ base* pb (pd.get ());
+ db->load (*pb, pb->s); // Via base.
+
+ assert (pd->sn == d.sn && pd->sv == d.sv);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ d.sn++;
+ d.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ root* pr (&d);
+ db->update (*pr, pr->s); // Via root.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pd, pd->s);
+
+ assert (pd->sn == d.sn && pd->sv == d.sv);
+ t.commit ();
+ }
+
+ // Reload.
+ //
+ d.sn++;
+ d.sv[0]++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pd, pd->s);
+
+ db->update (d);
+
+ root* pr (pd.get ());
+ db->reload (*pr);
+
+ assert (pd->sn == d.sn && pd->sv == d.sv);
+ t.commit ();
+ }
+ }
+
+ // Test value-only/container-only base/override combinations.
+ //
+ {
+ using namespace test3;
+
+ root r (123);
+ base b (234);
+ derived d (345, "abc");
+
+ {
+ transaction t (db->begin ());
+ db->persist (r);
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+
+ assert (r.s1.loaded ());
+ assert (r.s2.loaded ());
+ assert (r.s3.loaded ());
+ assert (r.s4.loaded ());
+
+ assert (b.s1.loaded ());
+ assert (b.s2.loaded ());
+ assert (b.s3.loaded ());
+ assert (b.s4.loaded ());
+
+ assert (d.s1.loaded ());
+ assert (d.s2.loaded ());
+ assert (d.s3.loaded ());
+ assert (d.s4.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pr->s1.loaded ());
+ assert (!pr->s2.loaded ());
+ assert (!pr->s3.loaded ());
+ assert (!pr->s4.loaded ());
+
+ assert (!pb->s1.loaded ());
+ assert (!pb->s2.loaded ());
+ assert (!pb->s3.loaded ());
+ assert (!pb->s4.loaded ());
+
+ assert (!pd->s1.loaded ());
+ assert (!pd->s2.loaded ());
+ assert (!pd->s3.loaded ());
+ assert (!pd->s4.loaded ());
+
+ assert (pr->s1n != r.s1n &&
+ pr->s2n != r.s2n &&
+ pr->s3v != r.s3v &&
+ pr->s4nv != r.s4nv);
+
+ assert (pb->s1n != b.s1n &&
+ pb->s2n != b.s2n &&
+ pb->s3v != b.s3v &&
+ pb->s4nv != b.s4nv);
+
+ assert (pd->s1n != d.s1n && pd->s1s != d.s1s &&
+ pd->s2n != d.s2n && pd->s2v != d.s2v &&
+ pd->s3v != d.s3v && pd->s3n != d.s3n &&
+ pd->s4nv != d.s4nv && pd->s4sv != d.s4sv);
+
+ db->load (*pr, pr->s1);
+ db->load (*pr, pr->s2);
+ db->load (*pr, pr->s3);
+ db->load (*pr, pr->s4);
+
+ db->load (*pb, pb->s1);
+ db->load (*pb, pb->s2);
+ db->load (*pb, pb->s3);
+ db->load (*pb, pb->s4);
+
+ root* pdr (pd.get ());
+ db->load (*pdr, pdr->s1);
+ db->load (*pdr, pdr->s2);
+ db->load (*pdr, pdr->s3);
+ db->load (*pdr, pdr->s4);
+
+ assert (pr->s1.loaded ());
+ assert (pr->s2.loaded ());
+ assert (pr->s3.loaded ());
+ assert (pr->s4.loaded ());
+
+ assert (pb->s1.loaded ());
+ assert (pb->s2.loaded ());
+ assert (pb->s3.loaded ());
+ assert (pb->s4.loaded ());
+
+ assert (pd->s1.loaded ());
+ assert (pd->s2.loaded ());
+ assert (pd->s3.loaded ());
+ assert (pd->s4.loaded ());
+
+ assert (pr->s1n == r.s1n &&
+ pr->s2n == r.s2n &&
+ pr->s3v == r.s3v &&
+ pr->s4nv == r.s4nv);
+
+ assert (pb->s1n == b.s1n &&
+ pb->s2n == b.s2n &&
+ pb->s3v == b.s3v &&
+ pb->s4nv == b.s4nv);
+
+ assert (pd->s1n == d.s1n && pd->s1s == d.s1s &&
+ pd->s2n == d.s2n && pd->s2v == d.s2v &&
+ pd->s3v == d.s3v && pd->s3n == d.s3n &&
+ pd->s4nv == d.s4nv && pd->s4sv == d.s4sv);
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ r.s1n++;
+ r.s2n++;
+ r.s3v[0]++;
+ r.s4nv[0]++;
+
+ b.s1n++;
+ b.s2n++;
+ b.s3v[0]++;
+ b.s4nv[0]++;
+
+ d.s1n++;
+ d.s1s += 'd';
+ d.s2n++;
+ d.s2v[0]++;
+ d.s3v[0]++;
+ d.s3n++;
+ d.s4nv[0]++;
+ d.s4sv[0] += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (r);
+ db->update (b);
+ db->update (d);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pr, pr->s1);
+ db->load (*pr, pr->s2);
+ db->load (*pr, pr->s3);
+ db->load (*pr, pr->s4);
+
+ db->load (*pb, pb->s1);
+ db->load (*pb, pb->s2);
+ db->load (*pb, pb->s3);
+ db->load (*pb, pb->s4);
+
+ db->load (*pd, pd->s1);
+ db->load (*pd, pd->s2);
+ db->load (*pd, pd->s3);
+ db->load (*pd, pd->s4);
+
+ assert (pr->s1n == r.s1n &&
+ pr->s2n == r.s2n &&
+ pr->s3v == r.s3v &&
+ pr->s4nv == r.s4nv);
+
+ assert (pb->s1n == b.s1n &&
+ pb->s2n == b.s2n &&
+ pb->s3v == b.s3v &&
+ pb->s4nv == b.s4nv);
+
+ assert (pd->s1n == d.s1n && pd->s1s == d.s1s &&
+ pd->s2n == d.s2n && pd->s2v == d.s2v &&
+ pd->s3v == d.s3v && pd->s3n == d.s3n &&
+ pd->s4nv == d.s4nv && pd->s4sv == d.s4sv);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ r.s1n++;
+ r.s2n++;
+ r.s3v[0]++;
+ r.s4nv[0]++;
+
+ b.s1n++;
+ b.s2n++;
+ b.s3v[0]++;
+ b.s4nv[0]++;
+
+ d.s1n++;
+ d.s1s += 'd';
+ d.s2n++;
+ d.s2v[0]++;
+ d.s3v[0]++;
+ d.s3n++;
+ d.s4nv[0]++;
+ d.s4sv[0] += 'd';
+
+ {
+ transaction t (db->begin ());
+ db->update (r, r.s1);
+ db->update (r, r.s2);
+ db->update (r, r.s3);
+ db->update (r, r.s4);
+
+ db->update (b, b.s1);
+ db->update (b, b.s2);
+ db->update (b, b.s3);
+ db->update (b, b.s4);
+
+ root& rr (d);
+ db->update (rr, rr.s1);
+ db->update (rr, rr.s2);
+ db->update (rr, rr.s3);
+ db->update (rr, rr.s4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pr, pr->s1);
+ db->load (*pr, pr->s2);
+ db->load (*pr, pr->s3);
+ db->load (*pr, pr->s4);
+
+ db->load (*pb, pb->s1);
+ db->load (*pb, pb->s2);
+ db->load (*pb, pb->s3);
+ db->load (*pb, pb->s4);
+
+ db->load (*pd, pd->s1);
+ db->load (*pd, pd->s2);
+ db->load (*pd, pd->s3);
+ db->load (*pd, pd->s4);
+
+ assert (pr->s1n == r.s1n &&
+ pr->s2n == r.s2n &&
+ pr->s3v == r.s3v &&
+ pr->s4nv == r.s4nv);
+
+ assert (pb->s1n == b.s1n &&
+ pb->s2n == b.s2n &&
+ pb->s3v == b.s3v &&
+ pb->s4nv == b.s4nv);
+
+ assert (pd->s1n == d.s1n && pd->s1s == d.s1s &&
+ pd->s2n == d.s2n && pd->s2v == d.s2v &&
+ pd->s3v == d.s3v && pd->s3n == d.s3n &&
+ pd->s4nv == d.s4nv && pd->s4sv == d.s4sv);
+ t.commit ();
+ }
+
+ // Reload.
+ //
+ r.s1n++;
+ r.s2n++;
+ r.s3v[0]++;
+ r.s4nv[0]++;
+
+ b.s1n++;
+ b.s2n++;
+ b.s3v[0]++;
+ b.s4nv[0]++;
+
+ d.s1n++;
+ d.s1s += 'd';
+ d.s2n++;
+ d.s2v[0]++;
+ d.s3v[0]++;
+ d.s3n++;
+ d.s4nv[0]++;
+ d.s4sv[0] += 'd';
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->load (*pr, pr->s1);
+ db->load (*pr, pr->s2);
+ db->load (*pr, pr->s3);
+ db->load (*pr, pr->s4);
+
+ db->load (*pb, pb->s1);
+ db->load (*pb, pb->s2);
+ db->load (*pb, pb->s3);
+ db->load (*pb, pb->s4);
+
+ db->load (*pd, pd->s1);
+ db->load (*pd, pd->s2);
+ db->load (*pd, pd->s3);
+ db->load (*pd, pd->s4);
+
+ db->update (r);
+ db->update (b);
+ db->update (d);
+
+ db->reload (*pr);
+ db->reload (*pb);
+ db->reload (*pd);
+
+ assert (pr->s1n == r.s1n &&
+ pr->s2n == r.s2n &&
+ pr->s3v == r.s3v &&
+ pr->s4nv == r.s4nv);
+
+ assert (pb->s1n == b.s1n &&
+ pb->s2n == b.s2n &&
+ pb->s3v == b.s3v &&
+ pb->s4nv == b.s4nv);
+
+ assert (pd->s1n == d.s1n && pd->s1s == d.s1s &&
+ pd->s2n == d.s2n && pd->s2v == d.s2v &&
+ pd->s3v == d.s3v && pd->s3n == d.s3n &&
+ pd->s4nv == d.s4nv && pd->s4sv == d.s4sv);
+ t.commit ();
+ }
+ }
+
+ // Test basic polymorphic optimistic section functionality.
+ //
+ {
+ using namespace test4;
+
+ base b (123, "abc");
+ derived d (234, "bcd", true);
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+
+ assert (b.rs1.loaded ());
+ assert (b.rs2.loaded ());
+ assert (b.rs3.loaded ());
+ assert (b.rs4.loaded ());
+ assert (b.bs1.loaded ());
+
+ assert (d.rs1.loaded ());
+ assert (d.rs2.loaded ());
+ assert (d.rs3.loaded ());
+ assert (d.rs4.loaded ());
+ assert (d.bs1.loaded ());
+ assert (d.ds1.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pb->rs1.loaded ());
+ assert (!pb->rs2.loaded ());
+ assert (!pb->rs3.loaded ());
+ assert (!pb->rs4.loaded ());
+ assert (!pb->bs1.loaded ());
+
+ assert (!pd->rs1.loaded ());
+ assert (!pd->rs2.loaded ());
+ assert (!pd->rs3.loaded ());
+ assert (!pd->rs4.loaded ());
+ assert (!pd->bs1.loaded ());
+ assert (!pd->ds1.loaded ());
+
+ assert (pb->rs1n != b.rs1n && pb->rs1s != b.rs1s &&
+ pb->rs2n != b.rs2n &&
+ pb->rs3n != b.rs3n &&
+ pb->rs4n != b.rs4n && pb->rs4s != b.rs4s);
+
+ assert (pd->rs1n != d.rs1n && pd->rs1s != d.rs1s &&
+ pd->rs1b != d.rs1b && pd->rs1v != d.rs1v &&
+ pd->rs2n != d.rs2n &&
+ pd->rs3n != d.rs3n && pd->rs3s != d.rs3s &&
+ pd->rs4n != d.rs4n && pd->rs4s != d.rs4s &&
+ pd->rs4v != d.rs4v &&
+ pd->bs1n != d.bs1n &&
+ pd->ds1v != d.ds1v);
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1); // No-op.
+
+ root* pr (pd.get ());
+ db->load (*pr, pr->rs1); // Via base.
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pr, pr->rs4); // Via base.
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ assert (pb->rs1.loaded ());
+ assert (pb->rs2.loaded ());
+ assert (pb->rs3.loaded ());
+ assert (pb->rs4.loaded ());
+ assert (pb->bs1.loaded ());
+
+ assert (pd->rs1.loaded ());
+ assert (pd->rs2.loaded ());
+ assert (pd->rs3.loaded ());
+ assert (pd->rs4.loaded ());
+ assert (pd->bs1.loaded ());
+ assert (pd->ds1.loaded ());
+
+ assert (pb->rs1n == b.rs1n && pb->rs1s == b.rs1s &&
+ pb->rs2n == b.rs2n &&
+ pb->rs3n == b.rs3n &&
+ pb->rs4n == b.rs4n && pb->rs4s == b.rs4s);
+
+ assert (pd->rs1n == d.rs1n && pd->rs1s == d.rs1s &&
+ pd->rs1b == d.rs1b && pd->rs1v == d.rs1v &&
+ pd->rs2n == d.rs2n &&
+ pd->rs3n == d.rs3n && pd->rs3s == d.rs3s &&
+ pd->rs4n == d.rs4n && pd->rs4s == d.rs4s &&
+ pd->rs4v == d.rs4v &&
+ pd->bs1n == d.bs1n &&
+ pd->ds1v == d.ds1v);
+ t.commit ();
+ }
+
+ base b1 (b);
+ derived d1 (d);
+
+ // Update object.
+ //
+ for (unsigned short s (1); s < 7; ++s)
+ {
+ b1.rs1n++;
+ b1.rs1s += 'd';
+ b1.rs1.change ();
+ b1.rs4s += 'd';
+
+ d1.rs1n++;
+ d1.rs1s += 'e';
+ d1.rs1b = !d.rs1b;
+ d1.rs1v[0]++;
+ d1.rs1.change ();
+ d1.rs4s += 'e';
+ d1.rs4v[0]++;
+ d1.bs1n++;
+ d1.ds1v[0]++;
+
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (b1);
+ db->update (d1);
+
+ assert (!b1.rs1.changed ());
+ assert (!d1.rs1.changed ());
+
+ assert (b.v != b1.v);
+ assert (d.v != d1.v);
+
+ try
+ {
+ bool a (false);
+ switch (s)
+ {
+ case 1: db->load (*pb, pb->rs1); break;
+ case 2: db->load (*pb, pb->rs2); break;
+ case 3: db->load (*pb, pb->rs3); break;
+ case 4: db->load (*pb, pb->rs4); break;
+ case 5:
+ case 6: a = true; break; // No-op.
+ default: break;
+ }
+ assert (a);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pb);
+
+ assert (!pb->rs1.loaded ());
+ assert (!pb->rs2.loaded ());
+ assert (!pb->rs3.loaded ());
+ assert (!pb->rs3.loaded ());
+ assert (!pb->bs1.loaded ());
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1); // No-op.
+
+ assert (pb->rs1n == b1.rs1n && pb->rs1s == b1.rs1s &&
+ pb->rs2n == b1.rs2n &&
+ pb->rs3n == b1.rs3n &&
+ pb->rs4n == b1.rs4n && pb->rs4s == b1.rs4s);
+ }
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->load (*pd, pd->rs1); break;
+ case 2: db->load (*pd, pd->rs2); break;
+ case 3: db->load (*pd, pd->rs3); break;
+ case 4: db->load (*pd, pd->rs4); break;
+ case 5: db->load (*pd, pd->bs1); break;
+ case 6: db->load (*pd, pd->ds1); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+
+ assert (!pd->rs1.loaded ());
+ assert (!pd->rs2.loaded ());
+ assert (!pd->rs3.loaded ());
+ assert (!pd->rs4.loaded ());
+ assert (!pd->bs1.loaded ());
+ assert (!pd->ds1.loaded ());
+
+ db->load (*pd, pd->rs1);
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ assert (pd->rs1n == d1.rs1n && pd->rs1s == d1.rs1s &&
+ pd->rs1b == d1.rs1b && pd->rs1v == d1.rs1v &&
+ pd->rs2n == d1.rs2n &&
+ pd->rs3n == d1.rs3n && pd->rs3s == d1.rs3s &&
+ pd->rs4n == d1.rs4n && pd->rs4s == d1.rs4s &&
+ pd->rs4v == d1.rs4v &&
+ pd->bs1n == d1.bs1n &&
+ pd->ds1v == d1.ds1v);
+ }
+
+ db->reload (b);
+ db->reload (d);
+
+ assert (b.v == b1.v);
+ assert (d.v == d1.v);
+
+ assert (b.rs1n == b1.rs1n && b.rs1s == b1.rs1s &&
+ b.rs2n == b1.rs2n &&
+ b.rs3n == b1.rs3n &&
+ b.rs4n == b1.rs4n && b.rs4s == b1.rs4s);
+
+ assert (d.rs1n == d1.rs1n && d.rs1s == d1.rs1s &&
+ d.rs1b == d1.rs1b && d.rs1v == d1.rs1v &&
+ d.rs2n == d1.rs2n &&
+ d.rs3n == d1.rs3n && d.rs3s == d1.rs3s &&
+ d.rs4n == d1.rs4n && d.rs4s == d1.rs4s &&
+ d.rs4v == d1.rs4v &&
+ d.bs1n == d1.bs1n &&
+ d.ds1v == d1.ds1v);
+
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ for (unsigned short s (1); s < 7; ++s)
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ switch (s)
+ {
+ case 1:
+ b1.rs1n++;
+ b1.rs1s += 'd';
+
+ d1.rs1n++;
+ d1.rs1s += 'e';
+ d1.rs1b = !d.rs1b;
+ d1.rs1v[0]++;
+
+ db->update (b1, b1.rs1);
+ db->update (d1, d1.rs1);
+
+ assert (b.v != b1.v);
+ assert (d.v != d1.v);
+ break;
+ case 2:
+ db->update (b1, b1.rs2); // No-op.
+ db->update (d1, d1.rs2); // No-op.
+
+ assert (b.v == b1.v);
+ assert (d.v == d1.v);
+ continue; // Object hasn't changed.
+ case 3:
+ db->update (b1, b1.rs3); // No-op.
+ db->update (d1, d1.rs3); // No-op.
+
+ assert (b.v == b1.v);
+ assert (d.v == d1.v);
+ continue; // Object hasn't changed.
+ case 4:
+ b1.rs4s += 'd';
+
+ d1.rs4s += 'e';
+ d1.rs4v[0]++;
+
+ db->update (b1, b1.rs4);
+ db->update (d1, d1.rs4);
+
+ assert (b.v != b1.v);
+ assert (d.v != d1.v);
+ break;
+ case 5:
+ d1.bs1n++;
+
+ db->update (b1, b1.bs1); // No-op.
+ db->update (d1, d1.bs1);
+
+ assert (b.v == b1.v);
+ assert (d.v != d1.v);
+ break;
+ case 6:
+ d1.ds1v[0]++;
+
+ db->update (d1, d1.ds1);
+
+ assert (d.v != d1.v);
+ break;
+ default: break;
+ }
+
+ try
+ {
+ bool a (false);
+ switch (s)
+ {
+ case 1: db->load (*pb, pb->rs1); break;
+ case 4: db->load (*pb, pb->rs4); break;
+ case 5:
+ case 6: a = true; break; // No-op.
+ default: break;
+ }
+ assert (a);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pb);
+
+ assert (!pb->rs1.loaded ());
+ assert (!pb->rs2.loaded ());
+ assert (!pb->rs3.loaded ());
+ assert (!pb->rs4.loaded ());
+ assert (!pb->bs1.loaded ());
+
+ db->load (*pb, pb->rs1);
+ db->load (*pb, pb->rs2);
+ db->load (*pb, pb->rs3);
+ db->load (*pb, pb->rs4);
+ db->load (*pb, pb->bs1); // No-op.
+
+ assert (pb->rs1n == b1.rs1n && pb->rs1s == b1.rs1s &&
+ pb->rs2n == b1.rs2n &&
+ pb->rs3n == b1.rs3n &&
+ pb->rs4n == b1.rs4n && pb->rs4s == b1.rs4s);
+ }
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->load (*pd, pd->rs1); break;
+ case 4: db->load (*pd, pd->rs4); break;
+ case 5: db->load (*pd, pd->bs1); break;
+ case 6: db->load (*pd, pd->ds1); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+
+ assert (!pd->rs1.loaded ());
+ assert (!pd->rs2.loaded ());
+ assert (!pd->rs3.loaded ());
+ assert (!pd->rs4.loaded ());
+ assert (!pd->bs1.loaded ());
+ assert (!pd->ds1.loaded ());
+
+ db->load (*pd, pd->rs1);
+ db->load (*pd, pd->rs2);
+ db->load (*pd, pd->rs3);
+ db->load (*pd, pd->rs4);
+ db->load (*pd, pd->bs1);
+ db->load (*pd, pd->ds1);
+
+ assert (pd->rs1n == d1.rs1n && pd->rs1s == d1.rs1s &&
+ pd->rs1b == d1.rs1b && pd->rs1v == d1.rs1v &&
+ pd->rs2n == d1.rs2n &&
+ pd->rs3n == d1.rs3n && pd->rs3s == d1.rs3s &&
+ pd->rs4n == d1.rs4n && pd->rs4s == d1.rs4s &&
+ pd->rs4v == d1.rs4v &&
+ pd->bs1n == d1.bs1n &&
+ pd->ds1v == d1.ds1v);
+ }
+
+ db->reload (b);
+ db->reload (d);
+
+ assert (b.v == b1.v);
+ assert (d.v == d1.v);
+
+ assert (b.rs1n == b1.rs1n && b.rs1s == b1.rs1s &&
+ b.rs2n == b1.rs2n &&
+ b.rs3n == b1.rs3n &&
+ b.rs4n == b1.rs4n && b.rs4s == b1.rs4s);
+
+ assert (d.rs1n == d1.rs1n && d.rs1s == d1.rs1s &&
+ d.rs1b == d1.rs1b && d.rs1v == d1.rs1v &&
+ d.rs2n == d1.rs2n &&
+ d.rs3n == d1.rs3n && d.rs3s == d1.rs3s &&
+ d.rs4n == d1.rs4n && d.rs4s == d1.rs4s &&
+ d.rs4v == d1.rs4v &&
+ d.bs1n == d1.bs1n &&
+ d.ds1v == d1.ds1v);
+
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ for (unsigned short s (1); s < 7; ++s)
+ {
+ if (s == 2 || s == 3) // Readonly sections.
+ continue;
+
+ transaction t (db->begin ());
+
+ switch (s)
+ {
+ case 1:
+ b1.rs1n++;
+ b1.rs1s += 'd';
+
+ d1.rs1n++;
+ d1.rs1s += 'e';
+ d1.rs1b = !d.rs1b;
+ d1.rs1v[0]++;
+
+ db->update (b1, b1.rs1);
+ db->update (d1, d1.rs1);
+ break;
+ case 4:
+ b1.rs4s += 'd';
+
+ d1.rs4s += 'e';
+ d1.rs4v[0]++;
+
+ db->update (b1, b1.rs4);
+ db->update (d1, d1.rs4);
+ break;
+ case 5:
+ d1.bs1n++;
+
+ db->update (b1, b1.bs1); // No-op.
+ db->update (d1, d1.bs1);
+ break;
+ case 6:
+ d1.ds1v[0]++;
+
+ db->update (d1, d1.bs1);
+ break;
+ default: break;
+ }
+
+ try
+ {
+ bool a (false);
+ switch (s)
+ {
+ case 1: db->update (b, b.rs1); break;
+ case 4: db->update (b, b.rs4); break;
+ case 5:
+ case 6: a = true; break; // No-op.
+ default: break;
+ }
+ assert (a);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (b);
+
+ switch (s)
+ {
+ case 1: db->update (b, b.rs1); break;
+ case 4: db->update (b, b.rs4); break;
+ default: break;
+ }
+ }
+
+ try
+ {
+ switch (s)
+ {
+ case 1: db->update (d, d.rs1); break;
+ case 4: db->update (d, d.rs4); break;
+ case 5: db->update (d, d.bs1); break;
+ case 6: db->update (d, d.ds1); break;
+ default: break;
+ }
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (d);
+
+ switch (s)
+ {
+ case 1: db->update (d, d.rs1); break;
+ case 4: db->update (d, d.rs4); break;
+ case 5: db->update (d, d.bs1); break;
+ case 6: db->update (d, d.ds1); break;
+ default: break;
+ }
+ }
+
+ db->reload (b1);
+ db->reload (d1);
+
+ t.commit ();
+ }
+ }
+
+ // Test polymorphic optimistic readonly/empty to readwrite section
+ // override.
+ //
+ {
+ using namespace test5;
+
+ base b;
+ derived d (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+
+ assert (b.s.loaded ());
+ assert (d.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pb->s.loaded ());
+ assert (!pd->s.loaded ());
+ assert (pd->sn != d.sn);
+
+ db->load (*pb, pb->s); // No-op.
+ db->load (*pd, pd->s);
+
+ assert (pb->s.loaded ());
+ assert (pd->s.loaded ());
+
+ assert (pd->sn == d.sn);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ base b1 (b);
+ derived d1 (d);
+ d1.sn++;
+ d1.s.change ();
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (d1);
+
+ assert (!d1.s.changed ());
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (b1, b1.s); // No-op.
+ db->update (d1, d1.s);
+
+ assert (b.v == b1.v);
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ db->update (d1, d1.s);
+
+ try
+ {
+ db->update (d, d.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (d);
+ db->update (d, d.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test polymorphic optimistic readonly/empty to readwrite section
+ // override, eager-loaded case.
+ //
+ {
+ using namespace test6;
+
+ derived d (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (d);
+ t.commit ();
+
+ assert (d.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (pd->s.loaded ());
+ assert (pd->sn == d.sn);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ derived d1 (d);
+ d1.sn++;
+ d1.s.change ();
+
+ {
+ transaction t (db->begin ());
+
+ db->update (d1);
+
+ assert (!d1.s.changed ());
+ assert (d.v != d1.v);
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+
+ db->update (d1, d1.s);
+ assert (d.v != d1.v);
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ db->update (d1, d1.s);
+
+ try
+ {
+ db->update (d, d.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (d);
+ db->update (d, d.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test polymorphic optimistic section added in derived.
+ //
+ {
+ using namespace test7;
+
+ base b;
+ derived d (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+
+ assert (b.s.loaded ());
+ assert (d.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pb->s.loaded ());
+ assert (!pd->s.loaded ());
+ assert (pd->sn != d.sn);
+
+ db->load (*pb, pb->s); // No-op.
+ db->load (*pd, pd->s);
+
+ assert (pb->s.loaded ());
+ assert (pd->s.loaded ());
+
+ assert (pd->sn == d.sn);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ base b1 (b);
+ derived d1 (d);
+ d1.sn++;
+ d1.s.change ();
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (d1);
+
+ assert (!d1.s.changed ());
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (b1, b1.s); // No-op.
+ db->update (d1, d1.s);
+
+ assert (b.v == b1.v);
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ db->update (d1, d1.s);
+
+ try
+ {
+ db->update (d, d.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (d);
+ db->update (d, d.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test reuse/polymorphic inheritance and optimistic mix.
+ //
+ {
+ using namespace test8;
+
+ derived d (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (d);
+ t.commit ();
+
+ assert (d.s.loaded ());
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ assert (!pd->s.loaded ());
+ assert (pd->sn != d.sn);
+
+ db->load (*pd, pd->s);
+
+ assert (pd->s.loaded ());
+ assert (pd->sn == d.sn);
+
+ t.commit ();
+ }
+
+ // Update object.
+ //
+ derived d1 (d);
+ d1.sn++;
+ d1.s.change ();
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (d1);
+
+ assert (!d1.s.changed ());
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+
+ db->update (d1, d1.s);
+ assert (d.v != d1.v);
+
+ try
+ {
+ db->load (*pd, pd->s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (*pd);
+ assert (!pd->s.loaded ());
+ db->load (*pd, pd->s);
+
+ assert (pd->sn == d1.sn);
+ }
+
+ db->reload (d);
+ assert (d.v == d1.v);
+ assert (d.sn == d1.sn);
+ t.commit ();
+ }
+
+ // Update changed section.
+ //
+ d1.sn++;
+
+ {
+ transaction t (db->begin ());
+ db->update (d1, d1.s);
+
+ try
+ {
+ db->update (d, d.s);
+ assert (false);
+ }
+ catch (const object_changed&)
+ {
+ db->reload (d);
+ db->update (d, d.s);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test reuse/polymorphic inheritance and optimistic mix.
+ //
+ {
+ using namespace test9;
+ using std::shared_ptr;
+
+ unsigned long long id;
+
+ {
+ container c (123);
+
+ c.e1.push_back (shared_ptr<element> (new element (11)));
+ c.e1.push_back (shared_ptr<element> (new element (12)));
+
+ c.e2.push_back (shared_ptr<element> (new element (21)));
+ c.e2.push_back (shared_ptr<element> (new element (22)));
+
+ transaction t (db->begin ());
+
+ db->persist (c.e1[0]);
+ db->persist (c.e1[1]);
+ db->persist (c.e2[0]);
+ db->persist (c.e2[1]);
+
+ id = db->persist (c);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ shared_ptr<container> c (db->load<container> (id));
+
+ assert (c->n == 123);
+ db->load (*c, c->s);
+ assert (c->e1.size () == 2 && c->e1[0]->n == 11 && c->e1[1]->n == 12);
+ assert (c->e2.size () == 2 && c->e2[0]->n == 21 && c->e2[1]->n == 22);
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/section/polymorphism/test.hxx b/odb-tests/common/section/polymorphism/test.hxx
new file mode 100644
index 0000000..6d524bd
--- /dev/null
+++ b/odb-tests/common/section/polymorphism/test.hxx
@@ -0,0 +1,542 @@
+// file : common/section/polymorphism/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#include <odb/core.hxx>
+#include <odb/section.hxx>
+
+// Test basic polymorphic section functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db object polymorphic abstract
+ struct root
+ {
+ root (int n): rs1n (n), rs2n (n), rs4n (n) {rs2v.push_back (n);}
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ // rs1: override in base and derived
+ //
+ #pragma db load(lazy) update(change)
+ odb::section rs1;
+
+ #pragma db section(rs1)
+ int rs1n;
+
+ // rs2: no override
+ //
+ #pragma db load(lazy)
+ odb::section rs2;
+
+ #pragma db section(rs2)
+ int rs2n;
+
+ #pragma db section(rs2)
+ std::vector<int> rs2v;
+
+ // rs3: empty
+ //
+ #pragma db load(lazy)
+ odb::section rs3;
+
+ // rs4: override "gap"
+ //
+ #pragma db load(lazy)
+ odb::section rs4;
+
+ #pragma db section(rs4)
+ int rs4n;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (int n = 999, const std::string& s = "xxx")
+ : root (n), rs1s (s), bs1n (n) {rs3v.push_back (n);}
+
+ // rs1
+ //
+ #pragma db section(rs1)
+ std::string rs1s;
+
+ // rs3
+ //
+ #pragma db section(rs3)
+ std::vector<int> rs3v;
+
+ // bs1: override in derived
+ //
+ #pragma db load(lazy)
+ odb::section bs1;
+
+ #pragma db section(bs1)
+ int bs1n;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999, const std::string& s = "xxx", bool b = false)
+ : base (n, s), rs1b (b), rs3n (n), rs4s (s), bs1s (s), ds1n (n)
+ {rs1v.push_back (n);}
+
+ // rs1
+ //
+ #pragma db section(rs1)
+ bool rs1b;
+
+ #pragma db section(rs1)
+ std::vector<int> rs1v;
+
+ // rs3
+ //
+ #pragma db section(rs3)
+ int rs3n;
+
+ // rs4
+ //
+ #pragma db section(rs4)
+ std::string rs4s;
+
+ // bs1
+ //
+ #pragma db section(bs1)
+ std::string bs1s;
+
+ // ds1: no override
+ //
+ #pragma db load(lazy)
+ odb::section ds1;
+
+ #pragma db section(ds1)
+ int ds1n;
+ };
+}
+
+// Test empty section and override "gap".
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object polymorphic abstract
+ struct root
+ {
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy)
+ odb::section s;
+ };
+
+ #pragma db object abstract
+ struct base: root
+ {
+ // The "gap".
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999): sn (n) {sv.push_back (n);}
+
+ #pragma db section(s)
+ int sn;
+
+ #pragma db section(s)
+ std::vector<int> sv;
+ };
+}
+
+// Test value-only/container-only base/override combinations.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db object polymorphic
+ struct root
+ {
+ root (int n = 999)
+ : s1n (n), s2n (n) {s3v.push_back (n); s4nv.push_back (n);}
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ // value/value
+ //
+ #pragma db load(lazy)
+ odb::section s1;
+
+ #pragma db section(s1)
+ int s1n;
+
+ // value/container
+ //
+ #pragma db load(lazy)
+ odb::section s2;
+
+ #pragma db section(s2)
+ int s2n;
+
+ // container/value
+ //
+ #pragma db load(lazy)
+ odb::section s3;
+
+ #pragma db section(s3)
+ std::vector<int> s3v;
+
+ // container/container
+ //
+ #pragma db load(lazy)
+ odb::section s4;
+
+ #pragma db section(s4)
+ std::vector<int> s4nv;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (int n = 999): root (n) {}
+
+ // The "gap".
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999, const std::string& s = "xxx")
+ : base (n), s1s (s), s3n (n) {s2v.push_back (n); s4sv.push_back (s);}
+
+ #pragma db section(s1)
+ std::string s1s;
+
+ #pragma db section(s2)
+ std::vector<int> s2v;
+
+ #pragma db section(s3)
+ int s3n;
+
+ #pragma db section(s4)
+ std::vector<std::string> s4sv;
+ };
+}
+
+// Test basic polymorphic optimistic section functionality.
+//
+#pragma db namespace table("t4_")
+namespace test4
+{
+ #pragma db object polymorphic optimistic abstract sectionable
+ struct root
+ {
+ root (int n): rs1n (n), rs2n (n), rs3n (n), rs4n (n) {}
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+
+ // rs1: readwrite, override
+ //
+ #pragma db load(lazy) update(change)
+ odb::section rs1;
+
+ #pragma db section(rs1)
+ int rs1n;
+
+ // rs2: readonly, no override
+ //
+ #pragma db load(lazy)
+ odb::section rs2;
+
+ #pragma db section(rs2)
+ const int rs2n;
+
+ // rs3: readonly, readonly override
+ //
+ #pragma db load(lazy)
+ odb::section rs3;
+
+ #pragma db section(rs3)
+ const int rs3n;
+
+ // rs4: readonly, readwrite override
+ //
+ #pragma db load(lazy)
+ odb::section rs4;
+
+ #pragma db section(rs4)
+ const int rs4n;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (int n = 999, const std::string& s = "xxx")
+ : root (n), rs1s (s), rs4s (s) {}
+
+ // rs1
+ //
+ #pragma db section(rs1)
+ std::string rs1s;
+
+ // rs4
+ //
+ #pragma db section(rs4)
+ std::string rs4s;
+
+ // bs2: empty, readwrite override
+ //
+ #pragma db load(lazy)
+ odb::section bs1;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999, const std::string& s = "xxx", bool b = false)
+ : base (n, s), rs1b (b), rs3s (s), bs1n (n)
+ {
+ rs1v.push_back (n);
+ rs4v.push_back (n);
+ ds1v.push_back (n);
+ }
+
+ // rs1
+ //
+ #pragma db section(rs1)
+ bool rs1b;
+
+ #pragma db section(rs1)
+ std::vector<int> rs1v;
+
+ // rs3
+ //
+ #pragma db section(rs3)
+ const std::string rs3s;
+
+ // rs4
+ //
+ #pragma db section(rs4)
+ std::vector<int> rs4v;
+
+ // bs1
+ //
+ #pragma db section(bs1)
+ int bs1n;
+
+ // ds1: readwrite
+ //
+ #pragma db load(lazy)
+ odb::section ds1;
+
+ #pragma db section(ds1)
+ std::vector<int> ds1v;
+ };
+}
+
+// Test polymorphic optimistic readonly/empty to readwrite section override.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db object polymorphic optimistic abstract
+ struct root
+ {
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ // The "gap".
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999): sn (n) {}
+
+ #pragma db section(s)
+ int sn;
+ };
+}
+
+// Test polymorphic optimistic readonly/empty to readwrite section override,
+// eager-loaded case.
+//
+#pragma db namespace table("t6_")
+namespace test6
+{
+ #pragma db object polymorphic optimistic abstract
+ struct root
+ {
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+
+ #pragma db update(change)
+ odb::section s;
+ };
+
+ #pragma db object abstract
+ struct base: root
+ {
+ // The "gap".
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999): sn (n) {}
+
+ #pragma db section(s)
+ int sn;
+ };
+}
+
+// Test polymorphic optimistic section added in derived.
+//
+#pragma db namespace table("t7_")
+namespace test7
+{
+ #pragma db object polymorphic optimistic sectionable
+ struct root
+ {
+ virtual ~root () {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ #pragma db load(lazy) update(change)
+ odb::section s;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999): sn (n) {}
+
+ #pragma db section(s)
+ int sn;
+ };
+}
+
+// Test reuse/polymorphic inheritance and optimistic mix.
+//
+#pragma db namespace table("t8_")
+namespace test8
+{
+ #pragma db object optimistic sectionable abstract
+ struct root
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db version
+ unsigned long long v;
+ };
+
+ #pragma db object polymorphic sectionable
+ struct base: root
+ {
+ virtual ~base () {}
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n = 999): sn (n) {}
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ int sn;
+ };
+}
+
+// Test id overwrite regression.
+//
+// The key here is the setup: the object that contains the containers in a
+// section and the pointers to objects stored in those containers. And these
+// objects derive polymorphically from the same base (and thus shared the id
+// bindind).
+//
+#pragma db namespace table("t9_")
+namespace test9
+{
+ #pragma db object polymorphic pointer(std::shared_ptr)
+ struct base
+ {
+ virtual ~base () {}
+
+ #pragma db id auto
+ unsigned long id;
+ };
+
+ #pragma db object
+ struct element: base
+ {
+ element (int n_ = 0): n (n_) {}
+
+ int n;
+ };
+
+ typedef std::vector<std::shared_ptr<element>> elements;
+
+ #pragma db object
+ struct container: base
+ {
+ container (int n_ = 0): n (n_) {}
+
+ int n;
+
+ #pragma db load(lazy) update(always)
+ odb::section s;
+
+ #pragma db section(s)
+ elements e1;
+
+ #pragma db section(s)
+ elements e2;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/section/polymorphism/testscript b/odb-tests/common/section/polymorphism/testscript
new file mode 100644
index 0000000..f2cd536
--- /dev/null
+++ b/odb-tests/common/section/polymorphism/testscript
@@ -0,0 +1,33 @@
+# file : common/section/polymorphism/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/session/cache/buildfile b/odb-tests/common/session/cache/buildfile
new file mode 100644
index 0000000..6d5b0bc
--- /dev/null
+++ b/odb-tests/common/session/cache/buildfile
@@ -0,0 +1,41 @@
+# file : common/session/cache/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix session_cache_ \
+ --generate-schema \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/session/cache/driver.cxx b/odb-tests/common/session/cache/driver.cxx
new file mode 100644
index 0000000..4b4ea12
--- /dev/null
+++ b/odb-tests/common/session/cache/driver.cxx
@@ -0,0 +1,83 @@
+// file : common/session/cache/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test session object cache.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test the session_required exception.
+ //
+ {
+ using namespace test1;
+
+ shared_ptr<obj1> o1a (new obj1 (1));
+ shared_ptr<obj1> o1b (new obj1 (2));
+ shared_ptr<obj2> o2 (new obj2 (1));
+
+ o1a->o2 = o2;
+ o1b->o2 = o2;
+
+ o2->o1.push_back (o1a);
+ o2->o1.push_back (o1b);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1a);
+ db->persist (o1b);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ shared_ptr<obj1> o1 (db->load<obj1> (1));
+ assert (false);
+ }
+ catch (const session_required&)
+ {
+ }
+
+ t.commit ();
+ }
+
+ {
+ session s;
+ transaction t (db->begin ());
+ shared_ptr<obj1> o1 (db->load<obj1> (1));
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/session/cache/test.hxx b/odb-tests/common/session/cache/test.hxx
new file mode 100644
index 0000000..d2b1b2b
--- /dev/null
+++ b/odb-tests/common/session/cache/test.hxx
@@ -0,0 +1,50 @@
+// file : common/session/cache/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <memory>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Test the session_required exception.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ using std::shared_ptr;
+ using std::weak_ptr;
+
+ #pragma db namespace(test1) pointer(shared_ptr)
+
+ struct obj2;
+
+ #pragma db object
+ struct obj1
+ {
+ obj1 () {}
+ obj1 (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ shared_ptr<obj2> o2;
+ };
+
+ #pragma db object
+ struct obj2
+ {
+ obj2 () {}
+ obj2 (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db inverse (o2)
+ std::vector< weak_ptr<obj1> > o1;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/session/cache/testscript b/odb-tests/common/session/cache/testscript
new file mode 100644
index 0000000..6d013eb
--- /dev/null
+++ b/odb-tests/common/session/cache/testscript
@@ -0,0 +1,33 @@
+# file : common/session/cache/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/session/custom/buildfile b/odb-tests/common/session/custom/buildfile
new file mode 100644
index 0000000..1b64de1
--- /dev/null
+++ b/odb-tests/common/session/custom/buildfile
@@ -0,0 +1,43 @@
+# file : common/session/custom/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx txx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix session_custom_ \
+ --generate-schema \
+ --generate-session \
+ --session-type ::session \
+ --hxx-prologue '#include "session.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/session/custom/driver.cxx b/odb-tests/common/session/custom/driver.cxx
new file mode 100644
index 0000000..3056fd6
--- /dev/null
+++ b/odb-tests/common/session/custom/driver.cxx
@@ -0,0 +1,231 @@
+// file : common/session/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom session (C++11 only).
+//
+
+#include <memory>
+#include <cstddef> // std::size_t
+#include <iostream>
+
+#include <odb/tracer.hxx>
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+#include <odb/details/config.hxx> // ODB_CXX11_*
+
+#include <libcommon/common.hxx>
+
+#include "session.hxx"
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+
+using odb::database;
+using odb::transaction;
+
+struct counting_tracer: odb::tracer
+{
+ virtual void
+ execute (odb::connection&, const char*) {count++;}
+ size_t count;
+};
+
+static counting_tracer tracer;
+
+struct failed {};
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Simple Tech Ltd.
+ //
+ {
+ shared_ptr<employer> er (new employer ("Simple Tech Ltd", "ST"));
+
+ shared_ptr<employee> john (new employee ("John", "Doe", er));
+ shared_ptr<employee> jane (new employee ("Jane", "Doe", er));
+
+ transaction t (db->begin ());
+
+ db->persist (er);
+ db->persist (john);
+ db->persist (jane);
+
+ t.commit ();
+ }
+
+ // Complex Systems Inc.
+ //
+ {
+ shared_ptr<employer> er (new employer ("Complex Systems Inc", "CS"));
+
+ shared_ptr<employee> john (new employee ("John", "Smith", er));
+ shared_ptr<employee> jane (new employee ("Jane", "Smith", er));
+
+ transaction t (db->begin ());
+
+ db->persist (er);
+ db->persist (john);
+ db->persist (jane);
+
+ t.commit ();
+ }
+
+ {
+ session s;
+ shared_ptr<employer> st, cs;
+ shared_ptr<employee> ste, cse;
+
+ {
+ transaction t (db->begin ());
+
+ st = db->load<employer> ("Simple Tech Ltd");
+#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
+ ste = db->load<employee> (st->employees ()[0].object_id ());
+#else
+ ste = db->load<employee> (st->employees ()[0].object_id<employee> ());
+#endif
+
+ // Test object cache.
+ //
+ shared_ptr<employee> e (st->employees ()[0].load ());
+ assert (ste->employer () == st);
+ assert (ste == e);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ cs = db->load<employer> ("Complex Systems Inc");
+#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
+ cse = db->load<employee> (cs->employees ()[0].object_id ());
+#else
+ cse = db->load<employee> (cs->employees ()[0].object_id<employee> ());
+#endif
+ cs->employees ()[0].load ();
+
+ t.commit ();
+ }
+
+ cs->symbol ("CSI");
+
+ // Swap employees.
+ //
+ ste->employer (cs);
+ cse->employer (st);
+ st->employees ()[0] = cse;
+ cs->employees ()[0] = ste;
+
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 0);
+ t.commit ();
+ }
+
+ cs->symbol ("COMP");
+ st->symbol ("SMPL");
+
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 0);
+ t.commit ();
+ }
+
+ // Explicit update.
+ //
+ cs->symbol ("CS");
+ st->symbol ("ST");
+
+ {
+ transaction t (db->begin ());
+ db->update (cs);
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 1);
+ t.commit ();
+ }
+
+ // Rollback after update.
+ //
+ cs->symbol ("CSI");
+
+ try
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 1);
+ throw failed ();
+ t.commit ();
+ }
+ catch (const failed&)
+ {
+ transaction t (db->begin ());
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 1);
+ t.commit ();
+ }
+ }
+
+ // Test session destruction before transaction is commited.
+ //
+ {
+ transaction t (db->begin ());
+ {
+ session s;
+ shared_ptr<employer> st (db->load<employer> ("Simple Tech Ltd"));
+ st->symbol ("STL");
+ tracer.count = 0;
+ t.tracer (tracer);
+ s.flush (*db);
+ assert (tracer.count == 1);
+ }
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/session/custom/session.cxx b/odb-tests/common/session/custom/session.cxx
new file mode 100644
index 0000000..1a08c79
--- /dev/null
+++ b/odb-tests/common/session/custom/session.cxx
@@ -0,0 +1,57 @@
+// file : common/session/custom/session.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cassert>
+
+#include "session.hxx"
+
+session* session::current;
+
+session::
+session ()
+ : tran_ (0)
+{
+ assert (current == 0);
+ current = this;
+}
+
+session::
+~session ()
+{
+ // Unregister from transaction.
+ //
+ if (tran_ != 0)
+ tran_->callback_unregister (this);
+
+ assert (current == this);
+ current = 0;
+}
+
+void session::
+flush (odb::database& db)
+{
+ bool flushed (false);
+
+ for (type_map::iterator i (map_.begin ()), e (map_.end ()); i != e; ++i)
+ {
+ bool r (i->second->flush (db));
+ flushed = flushed || r;
+ }
+
+ // If we flushed anything, then register the post-commit/rollback callback.
+ //
+ if (flushed)
+ {
+ tran_ = &odb::transaction::current ();
+ tran_->callback_register (
+ &mark, this, odb::transaction::event_all, 0, &tran_);
+ }
+}
+
+void session::
+mark (unsigned short event, void* key, unsigned long long)
+{
+ session& s (*static_cast<session*> (key));
+ for (type_map::iterator i (s.map_.begin ()), e (s.map_.end ()); i != e; ++i)
+ i->second->mark (event);
+}
diff --git a/odb-tests/common/session/custom/session.hxx b/odb-tests/common/session/custom/session.hxx
new file mode 100644
index 0000000..2d2f597
--- /dev/null
+++ b/odb-tests/common/session/custom/session.hxx
@@ -0,0 +1,191 @@
+// file : common/session/custom/session.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef SESSION_HXX
+#define SESSION_HXX
+
+#include <map>
+#include <memory>
+#include <typeinfo>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <odb/traits.hxx> // odb::object_traits
+#include <odb/details/type-info.hxx> // odb::details::type_info_comparator
+
+// This custom session implementation assumes we are working with
+// one database at a time.
+//
+class session
+{
+public:
+ session ();
+ ~session ();
+
+private:
+ session (const session&);
+ session& operator= (const session&);
+
+ // Session for the current thread. This can be implemented in pretty
+ // much any way that makes sense to the application. It can be a global
+ // session as we have here. In multi-threaded applications we could use
+ // TLS instead.
+ //
+public:
+ static session* current;
+
+ // Change tracking interface.
+ //
+public:
+ // Call flush() within a transaction to apply the changes to the
+ // database.
+ //
+ void
+ flush (odb::database&);
+
+private:
+ struct object_map_base
+ {
+ virtual
+ ~object_map_base () {}
+
+ // Return true if we flushed anything.
+ //
+ virtual bool
+ flush (odb::database&) = 0;
+
+ virtual void
+ mark (unsigned short event) = 0;
+ };
+
+ enum object_state
+ {
+ tracking, // Tracking any modifications by storing the original copy.
+ changed, // Known to be changed.
+ flushed // Flushed but not yet committed/rolled back.
+ };
+
+ template <typename T>
+ struct object_data
+ {
+ typedef typename odb::object_traits<T>::pointer_type pointer_type;
+
+ explicit
+ object_data (pointer_type o): obj (o), state (tracking) {}
+
+ pointer_type obj;
+ pointer_type orig;
+ object_state state;
+ };
+
+ template <typename T>
+ struct object_map: object_map_base,
+ std::map<typename odb::object_traits<T>::id_type,
+ object_data<T> >
+ {
+ virtual bool
+ flush (odb::database&);
+
+ virtual void
+ mark (unsigned short event);
+ };
+
+ // Object cache interface.
+ //
+public:
+ static bool
+ _has_cache () {return current != 0;}
+
+ template <typename T>
+ struct cache_position
+ {
+ typedef object_map<T> map;
+ typedef typename map::iterator iterator;
+
+ cache_position (): map_ (0) {}
+ cache_position (map& m, const iterator& p): map_ (&m), pos_ (p) {}
+
+ cache_position (const cache_position& p)
+ : map_ (p.map_)
+ {
+ // It might not be ok to use an uninitialized iterator.
+ //
+ if (p.map_ != 0)
+ pos_ = p.pos_;
+ }
+
+ cache_position&
+ operator= (const cache_position& p)
+ {
+ // It might not be ok to use an uninitialized iterator on the rhs.
+ //
+ if (p.map_ != 0)
+ pos_ = p.pos_;
+ map_ = p.map_;
+ return *this;
+ }
+
+ map* map_;
+ iterator pos_;
+ };
+
+ // Cache management.
+ //
+ template <typename T>
+ static cache_position<T>
+ _cache_insert (odb::database&,
+ const typename odb::object_traits<T>::id_type&,
+ const typename odb::object_traits<T>::pointer_type&);
+
+ template <typename T>
+ static typename odb::object_traits<T>::pointer_type
+ _cache_find (odb::database&, const typename odb::object_traits<T>::id_type&);
+
+ template <typename T>
+ static void
+ _cache_erase (const cache_position<T>& p)
+ {
+ if (p.map_ != 0)
+ p.map_->erase (p.pos_);
+ }
+
+ // Notifications.
+ //
+ template <typename T>
+ static void
+ _cache_persist (const cache_position<T>& p)
+ {
+ _cache_load (p);
+ }
+
+ template <typename T>
+ static void
+ _cache_load (const cache_position<T>&);
+
+ template <typename T>
+ static void
+ _cache_update (odb::database&, const T&);
+
+ template <typename T>
+ static void
+ _cache_erase (odb::database&,
+ const typename odb::object_traits<T>::id_type&);
+
+private:
+ // Post-commit/rollback callback.
+ //
+ static void
+ mark (unsigned short event, void* key, unsigned long long);
+
+private:
+ typedef std::map<const std::type_info*,
+ std::shared_ptr<object_map_base>,
+ odb::details::type_info_comparator> type_map;
+ type_map map_;
+ odb::transaction* tran_;
+};
+
+#include "session.txx"
+
+#endif // SESSION_HXX
diff --git a/odb-tests/common/session/custom/session.txx b/odb-tests/common/session/custom/session.txx
new file mode 100644
index 0000000..65ab933
--- /dev/null
+++ b/odb-tests/common/session/custom/session.txx
@@ -0,0 +1,159 @@
+// file : common/session/custom/session.txx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cassert>
+
+template <typename T>
+typename session::cache_position<T> session::
+_cache_insert (odb::database&,
+ const typename odb::object_traits<T>::id_type& id,
+ const typename odb::object_traits<T>::pointer_type& obj)
+{
+ if (current == 0)
+ return cache_position<T> (); // No session, return empty position.
+
+ std::shared_ptr<object_map_base>& pm (current->map_[&typeid (T)]);
+
+ if (!pm)
+ pm.reset (new object_map<T>);
+
+ object_map<T>& m (static_cast<object_map<T>&> (*pm));
+
+ typename object_map<T>::value_type vt (id, object_data<T> (obj));
+ std::pair<typename object_map<T>::iterator, bool> r (m.insert (vt));
+
+ // We shall never try to re-insert the same object into the cache.
+ //
+ assert (r.second);
+
+ return cache_position<T> (m, r.first);
+}
+
+template <typename T>
+typename odb::object_traits<T>::pointer_type session::
+_cache_find (odb::database&, const typename odb::object_traits<T>::id_type& id)
+{
+ typedef typename odb::object_traits<T>::pointer_type pointer_type;
+
+ if (current == 0)
+ return pointer_type (); // No session, return NULL pointer.
+
+ type_map::const_iterator ti (current->map_.find (&typeid (T)));
+
+ if (ti == current->map_.end ())
+ return pointer_type ();
+
+ const object_map<T>& m (static_cast<const object_map<T>&> (*ti->second));
+ typename object_map<T>::const_iterator oi (m.find (id));
+
+ if (oi == m.end ())
+ return pointer_type ();
+
+ return oi->second.obj;
+}
+
+template <typename T>
+void session::
+_cache_load (const cache_position<T>& p)
+{
+ typedef typename odb::object_traits<T>::pointer_type pointer_type;
+
+ if (p.map_ == 0)
+ return; // Empty position.
+
+ // Make a copy for change tracking. If our object model had a
+ // polymorphic hierarchy, then we would have had to use a
+ // virtual function-based mechanism (e.g., clone()) instead of
+ // the copy constructor since for a polymorphic hierarchy all
+ // the derived objects are stored as pointers to the root object.
+ //
+ p.pos_->second.orig = pointer_type (new T (*p.pos_->second.obj));
+}
+
+template <typename T>
+void session::
+_cache_update (odb::database&, const T& obj)
+{
+ typedef odb::object_traits<T> object_traits;
+ typedef typename object_traits::pointer_type pointer_type;
+
+ if (current == 0)
+ return; // No session.
+
+ // User explicitly updated the object by calling database::update().
+ // Change the state to flushed and reset the original copy (we are
+ // still tracking changes after the update).
+ //
+ type_map::iterator ti (current->map_.find (&typeid (T)));
+
+ if (ti == current->map_.end ())
+ return; // This object is not in the session.
+
+ object_map<T>& m (static_cast<object_map<T>&> (*ti->second));
+ typename object_map<T>::iterator oi (m.find (object_traits::id (obj)));
+
+ if (oi == m.end ())
+ return; // This object is not in the session.
+
+ object_data<T>& d (oi->second);
+ d.orig = pointer_type (new T (*d.obj));
+ d.state = flushed;
+}
+
+template <typename T>
+void session::
+_cache_erase (odb::database&,
+ const typename odb::object_traits<T>::id_type& id)
+{
+ if (current == 0)
+ return; // No session.
+
+ type_map::iterator ti (current->map_.find (&typeid (T)));
+
+ if (ti == current->map_.end ())
+ return;
+
+ object_map<T>& m (static_cast<object_map<T>&> (*ti->second));
+ typename object_map<T>::iterator oi (m.find (id));
+
+ if (oi == m.end ())
+ return;
+
+ m.erase (oi);
+
+ if (m.empty ())
+ current->map_.erase (ti);
+}
+
+template <typename T>
+bool session::object_map<T>::
+flush (odb::database& db)
+{
+ bool r (false);
+ for (typename object_map<T>::iterator i (this->begin ()), e (this->end ());
+ i != e; ++i)
+ {
+ object_data<T>& d (i->second);
+
+ if (d.state == changed || d.obj->changed (*d.orig))
+ db.update (d.obj); // State changed by the update() notification.
+
+ r = r || d.state == flushed;
+ }
+
+ return r;
+}
+
+template <typename T>
+void session::object_map<T>::
+mark (unsigned short event)
+{
+ for (typename object_map<T>::iterator i (this->begin ()), e (this->end ());
+ i != e; ++i)
+ {
+ object_data<T>& d (i->second);
+
+ if (d.state == flushed)
+ d.state = event == odb::transaction::event_commit ? tracking : changed;
+ }
+}
diff --git a/odb-tests/common/session/custom/test.hxx b/odb-tests/common/session/custom/test.hxx
new file mode 100644
index 0000000..3f2703f
--- /dev/null
+++ b/odb-tests/common/session/custom/test.hxx
@@ -0,0 +1,118 @@
+// file : common/session/custom/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <memory>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/lazy-ptr.hxx>
+
+class employee;
+
+#pragma db object pointer(std::shared_ptr) session
+class employer
+{
+public:
+ employer (const std::string& name, const std::string& symbol)
+ : name_ (name), symbol_ (symbol) {}
+
+ const std::string&
+ name () const {return name_;}
+
+ const std::string&
+ symbol () const {return symbol_;}
+
+ void
+ symbol (const std::string& symbol) {symbol_ = symbol;}
+
+ // Employees of this employer.
+ //
+ typedef std::vector<odb::lazy_weak_ptr<employee>> employees_type;
+
+ const employees_type&
+ employees () const {return employees_;}
+
+ employees_type&
+ employees () {return employees_;}
+
+ // Change tracking.
+ //
+public:
+ bool
+ changed (const employer& orig) const
+ {
+ // Note that we don't need to track object ids, inverse pointers, nor
+ // readonly/const data members.
+ //
+ return symbol_ != orig.symbol_;
+ }
+
+private:
+ friend class odb::access;
+ employer () {}
+
+ #pragma db id
+ std::string name_;
+
+ std::string symbol_;
+
+ #pragma db value_not_null inverse(employer_)
+ employees_type employees_;
+};
+
+#pragma db object pointer(std::shared_ptr) session
+class employee
+{
+public:
+ typedef ::employer employer_type;
+
+ employee (const std::string& first,
+ const std::string& last,
+ std::shared_ptr<employer_type> employer)
+ : first_ (first), last_ (last), employer_ (employer) {}
+
+ // Name.
+ //
+ const std::string&
+ first () const {return first_;}
+
+ const std::string&
+ last () const {return last_;}
+
+ // Employer.
+ //
+ std::shared_ptr<employer_type>
+ employer () const {return employer_;}
+
+ void
+ employer (std::shared_ptr<employer_type> e) {employer_ = e;}
+
+ // Change tracking.
+ //
+public:
+ bool
+ changed (const employee& orig) const
+ {
+ return first_ != orig.first_ || last_ != orig.last_ ||
+ employer_ != orig.employer_;
+ }
+
+private:
+ friend class odb::access;
+ employee () {}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ std::string first_;
+ std::string last_;
+
+ #pragma db not_null
+ std::shared_ptr<employer_type> employer_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/session/custom/testscript b/odb-tests/common/session/custom/testscript
new file mode 100644
index 0000000..39c281d
--- /dev/null
+++ b/odb-tests/common/session/custom/testscript
@@ -0,0 +1,33 @@
+# file : common/session/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/statement/processing/buildfile b/odb-tests/common/statement/processing/buildfile
new file mode 100644
index 0000000..97124e8
--- /dev/null
+++ b/odb-tests/common/statement/processing/buildfile
@@ -0,0 +1,8 @@
+# file : common/statement/processing/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb%lib{odb}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/common/statement/processing/driver.cxx b/odb-tests/common/statement/processing/driver.cxx
new file mode 100644
index 0000000..2d00107
--- /dev/null
+++ b/odb-tests/common/statement/processing/driver.cxx
@@ -0,0 +1,619 @@
+// file : common/statement/processing/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test internal statement processing machinery.
+//
+
+#include <string>
+#include <iostream>
+
+#include <odb/statement.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+
+static bool
+insert (const char* stmt,
+ const char* expected,
+ const void* const* bind,
+ size_t bind_size)
+{
+ string r;
+ odb::statement::process_insert (
+ r, stmt, bind, bind_size, sizeof (void*), '$');
+ return r == expected;
+}
+
+static bool
+update (const char* stmt,
+ const char* expected,
+ const void* const* bind,
+ size_t bind_size)
+{
+ string r;
+ odb::statement::process_update (
+ r, stmt, bind, bind_size, sizeof (void*), '$');
+ return r == expected;
+}
+
+static bool
+select (const char* stmt,
+ const char* expected,
+ const void* const* bind,
+ size_t bind_size)
+{
+ string r;
+ odb::statement::process_select (
+ r, stmt, bind, bind_size, sizeof (void*), '[', ']', true);
+ return r == expected;
+}
+
+int
+main (int, char* argv[])
+{
+ //
+ // INSERT
+ //
+
+ // Fast path.
+ //
+ {
+ void* b[] = {argv, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b])\n"
+ "VALUES\n"
+ "(DEFAULT,\n$1)",
+ "INSERT INTO [foo] ([a], [b]) VALUES (DEFAULT, $1)",
+ b, 2));
+ }
+
+ // Empty via statement.
+ //
+ /* LIBODB_DEBUG_STATEMENT_PROCESSING
+ {
+ assert (insert ("INSERT INTO [foo]\n"
+ "DEFAULT VALUES",
+ "INSERT INTO [foo] DEFAULT VALUES",
+ 0, 0));
+ }
+ */
+
+ // Empty via bind.
+ //
+ {
+ void* b[] = {0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a])\n"
+ "VALUES\n"
+ "($1)",
+ "INSERT INTO [foo] DEFAULT VALUES",
+ b, 1));
+ }
+
+ // Empty with OUTPUT.
+ //
+ {
+ void* b[] = {0, 0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b])\n"
+ "OUTPUT INSERTED.[id]\n"
+ "VALUES\n"
+ "($1,\n$2)",
+ "INSERT INTO [foo] OUTPUT INSERTED.[id] DEFAULT VALUES",
+ b, 2));
+ }
+
+ // Empty with RETURNING.
+ //
+ {
+ void* b[] = {0, 0, 0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\n$1,\n$2)\n"
+ "RETURNING [id]",
+ "INSERT INTO [foo] DEFAULT VALUES RETURNING [id]",
+ b, 3));
+ }
+
+ // Empty via bind, but not values.
+ //
+ {
+ void* b[] = {0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b])\n"
+ "VALUES\n"
+ "(1,\n$1)",
+ "INSERT INTO [foo] ([a]) VALUES (1)",
+ b, 1));
+ }
+
+ // Empty via bind, but not values.
+ //
+ {
+ void* b[] = {0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "(1,\n$1,\nDEFAULT)",
+ "INSERT INTO [foo] ([a], [c]) VALUES (1, DEFAULT)",
+ b, 1));
+ }
+
+ // First not present.
+ //
+ {
+ void* b[] = {0, argv, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3)",
+ "INSERT INTO [foo] ([b], [c]) VALUES ($2, $3)",
+ b, 3));
+ }
+
+ // Last not present.
+ //
+ {
+ void* b[] = {argv, argv, 0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3)",
+ "INSERT INTO [foo] ([a], [b]) VALUES ($1, $2)",
+ b, 3));
+ }
+
+ // Middle not present.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3)",
+ "INSERT INTO [foo] ([a], [c]) VALUES ($1, $3)",
+ b, 3));
+ }
+
+ // Multiple not present.
+ //
+ {
+ void* b[] = {0, argv, 0, argv, 0};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c],\n[d],\n[e])\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3,\n$4,\n$5)",
+ "INSERT INTO [foo] ([b], [d]) VALUES ($2, $4)",
+ b, 5));
+ }
+
+ // Not present and OUTPUT.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "OUTPUT INSERTED.[id]\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3)",
+ "INSERT INTO [foo] ([a], [c]) OUTPUT INSERTED.[id] "
+ "VALUES ($1, $3)",
+ b, 3));
+ }
+
+ // Not present and RETURNING.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\n$2,\n$3)\n"
+ "RETURNING [id]",
+ "INSERT INTO [foo] ([a], [c]) VALUES ($1, $3) "
+ "RETURNING [id]",
+ b, 3));
+ }
+
+ // Value expressions.
+ //
+ {
+ void* b[] = {argv, argv, argv};
+ assert (insert ("INSERT INTO [foo]\n"
+ "([a],\n[b],\n[c])\n"
+ "VALUES\n"
+ "($1,\nCAST($2, TEXT),\n$3)",
+ "INSERT INTO [foo] ([a], [b], [c]) "
+ "VALUES ($1, CAST($2, TEXT), $3)",
+ b, 3));
+ }
+
+ //
+ // UPDATE
+ //
+
+ // Fast path.
+ //
+ {
+ void* b[] = {argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "ver=ver+1,\n[a]=$1\n"
+ "WHERE [id]=$2",
+ "UPDATE [foo] SET ver=ver+1, [a]=$1 WHERE [id]=$2",
+ b, 2));
+ }
+
+ // Empty via bind.
+ //
+ {
+ void* b[] = {0, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1\n"
+ "WHERE [id]=$2",
+ "",
+ b, 2));
+ }
+
+ // Empty via bind, but not values.
+ //
+ {
+ void* b[] = {0, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "ver=ver+1,\n[a]=$1\n"
+ "WHERE [id]=$2",
+ "UPDATE [foo] SET ver=ver+1 WHERE [id]=$2",
+ b, 2));
+ }
+
+ // First not present.
+ //
+ {
+ void* b[] = {0, argv, argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3\n"
+ "WHERE [id]=$4",
+ "UPDATE [foo] SET [b]=$2, [c]=$3 WHERE [id]=$4",
+ b, 4));
+ }
+
+ // Last not present.
+ //
+ {
+ void* b[] = {argv, argv, 0, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3\n"
+ "WHERE [id]=$4",
+ "UPDATE [foo] SET [a]=$1, [b]=$2 WHERE [id]=$4",
+ b, 4));
+ }
+
+ // Middle not present.
+ //
+ {
+ void* b[] = {argv, 0, argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3\n"
+ "WHERE [id]=$4",
+ "UPDATE [foo] SET [a]=$1, [c]=$3 WHERE [id]=$4",
+ b, 4));
+ }
+
+ // Multiple not present.
+ //
+ {
+ void* b[] = {0, argv, 0, argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3,\n"
+ "[d]=$4\n"
+ "WHERE [id]=$5",
+ "UPDATE [foo] SET [b]=$2, [d]=$4 WHERE [id]=$5",
+ b, 5));
+ }
+
+ // Not present and OUTPUT.
+ //
+ {
+ void* b[] = {argv, 0, argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3\n"
+ "OUTPUT INSERTED.[ver] "
+ "WHERE [id]=$4",
+ "UPDATE [foo] SET [a]=$1, [c]=$3 OUTPUT INSERTED.[ver] "
+ "WHERE [id]=$4",
+ b, 4));
+ }
+
+ // Value expressions.
+ //
+ {
+ void* b[] = {argv, argv, argv, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=CAST($2, TEXT),\n"
+ "[c]=$3\n"
+ "WHERE [id]=$4",
+ "UPDATE [foo] SET [a]=$1, [b]=CAST($2, TEXT), [c]=$3 "
+ "WHERE [id]=$4",
+ b, 4));
+ }
+
+ // No OUTPUT/WHERE clause.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (update ("UPDATE [foo]\n"
+ "SET\n"
+ "[a]=$1,\n"
+ "[b]=$2,\n"
+ "[c]=$3",
+ "UPDATE [foo] SET [a]=$1, [c]=$3",
+ b, 4));
+ }
+
+ //
+ // SELECT
+ //
+
+ // Empty.
+ //
+ {
+ void* b[] = {0, 0, 0};
+ assert (select ("SELECT\n"
+ "[a].[x],\n"
+ "[t].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "",
+ b, 3));
+ }
+
+ // Fast path.
+ //
+ {
+ void* b[] = {argv, argv};
+ assert (select ("SELECT\n"
+ "[s].[t].[x],\n"
+ "[a].[y]\n"
+ "FROM [s].[t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[s].[t].[id]\n"
+ "WHERE [s].[t].[id]=$1",
+ "SELECT [s].[t].[x], [a].[y] FROM [s].[t] "
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[s].[t].[id] "
+ "WHERE [s].[t].[id]=$1",
+ b, 2));
+ }
+
+ // First not present.
+ //
+ {
+ void* b[] = {0, argv, argv};
+ assert (select ("SELECT\n"
+ "[a].[x],\n"
+ "[t].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[y], [t].[z] FROM [t] WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // Last not present.
+ //
+ {
+ void* b[] = {argv, argv, 0};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[t].[y],\n"
+ "[a].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], [t].[y] FROM [t] WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // Middle not present.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[a].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], [t].[z] FROM [t] WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // Multiple not present.
+ //
+ {
+ void* b[] = {0, argv, 0, argv};
+ assert (select ("SELECT\n"
+ "[a1].[w],\n"
+ "[t].[x],\n"
+ "[a2].[y],\n"
+ "[a3].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a1] ON [a1].[id]=[t].[id]\n"
+ "LEFT JOIN [t2] AS [a2] ON [a2].[id]=[t].[id]\n"
+ "LEFT JOIN [t3] AS [a3] ON [a3].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], [a3].[z] FROM [t] "
+ "LEFT JOIN [t3] AS [a3] ON [a3].[id]=[t].[id] "
+ "WHERE [t].[id]=$1",
+ b, 4));
+ }
+
+ // Column expression.
+ //
+ {
+ void* b[] = {argv, argv, 0};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "CAST([a].[y], TEXT),\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], CAST([a].[y], TEXT) FROM [t] "
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id] "
+ "WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // No WHERE.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[t].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]",
+ "SELECT [t].[x], [t].[z] FROM [t]",
+ b, 3));
+ }
+
+ // JOIN without WHERE.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[a].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]",
+ "SELECT [t].[x], [t].[z] FROM [t]",
+ b, 3));
+ }
+
+ // JOIN presence because of WHERE.
+ //
+ {
+ void* b[] = {argv, 0, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[a].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1 AND [a].[id]=$2",
+ "SELECT [t].[x], [t].[z] FROM [t] "
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id] "
+ "WHERE [t].[id]=$1 AND [a].[id]=$2",
+ b, 3));
+ }
+
+
+ // JOIN presence because of dependent JOIN.
+ //
+ {
+ void* b[] = {argv, argv, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[a_b].[y],\n"
+ "[t].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [d] AS [a_d] ON [a_d].[id]=[t].[id]\n"
+ "LEFT JOIN [b] AS [a_b] ON [a_b].[id]=[a_d].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], [a_b].[y], [t].[z] FROM [t] "
+ "LEFT JOIN [d] AS [a_d] ON [a_d].[id]=[t].[id] "
+ "LEFT JOIN [b] AS [a_b] ON [a_b].[id]=[a_d].[id] "
+ "WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // JOIN without alias and with schema.
+ //
+ {
+ void* b[] = {argv, argv, argv};
+ assert (select ("SELECT\n"
+ "[t].[x],\n"
+ "[s].[t1].[y],\n"
+ "[t2].[z]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [s].[t1] ON [s].[t1].[id]=[t].[id]\n"
+ "LEFT JOIN [t2] ON [t2].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [t].[x], [s].[t1].[y], [t2].[z] FROM [t] "
+ "LEFT JOIN [s].[t1] ON [s].[t1].[id]=[t].[id] "
+ "LEFT JOIN [t2] ON [t2].[id]=[t].[id] "
+ "WHERE [t].[id]=$1",
+ b, 3));
+ }
+
+ // JOIN alias top-level qualifer test.
+ //
+ {
+ void* b[] = {argv, 0};
+ assert (select ("SELECT\n"
+ "[s].[a].[x],\n"
+ "[a].[y]\n"
+ "FROM [s].[a]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[s].[a].[id]\n"
+ "WHERE [s].[a].[id]=$1",
+ "SELECT [s].[a].[x] FROM [s].[a] WHERE [s].[a].[id]=$1",
+ b, 2));
+ }
+
+ // JOIN alias bottom-level qualifer test (FROM case).
+ //
+ {
+ void* b[] = {argv, 0};
+ assert (select ("SELECT\n"
+ "[a].[t].[x],\n"
+ "[a].[y]\n"
+ "FROM [a].[t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[a].[t].[id]\n"
+ "WHERE [a].[t].[id]=$1",
+ "SELECT [a].[t].[x] FROM [a].[t] WHERE [a].[t].[id]=$1",
+ b, 2));
+ }
+
+ // JOIN alias bottom-level qualifer test (LEFT JOIN case).
+ //
+ {
+ void* b[] = {0, argv};
+ assert (select ("SELECT\n"
+ "[a].[y],\n"
+ "[a].[t2].[x]\n"
+ "FROM [t]\n"
+ "LEFT JOIN [t1] AS [a] ON [a].[id]=[t].[id]\n"
+ "LEFT JOIN [a].[t2] ON [a].[t2].[id]=[t].[id]\n"
+ "WHERE [t].[id]=$1",
+ "SELECT [a].[t2].[x] FROM [t] "
+ "LEFT JOIN [a].[t2] ON [a].[t2].[id]=[t].[id] "
+ "WHERE [t].[id]=$1",
+ b, 2));
+ }
+}
diff --git a/odb-tests/common/statement/processing/testscript b/odb-tests/common/statement/processing/testscript
new file mode 100644
index 0000000..2460dc6
--- /dev/null
+++ b/odb-tests/common/statement/processing/testscript
@@ -0,0 +1,6 @@
+# file : common/statement/processing/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basics
+:
+$*
diff --git a/odb-tests/common/threads/buildfile b/odb-tests/common/threads/buildfile
new file mode 100644
index 0000000..53b98ec
--- /dev/null
+++ b/odb-tests/common/threads/buildfile
@@ -0,0 +1,49 @@
+# file : common/threads/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix threads_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# While we don't call any pthread_*() functions, this appears to be needed for
+# some std::thread implementations (like libstdc++). Note that
+# odb::details::thread inlines some std::thread API calls.
+#
+if ($cxx.target.class != 'windows')
+ cxx.libs += -pthread
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/threads/driver.cxx b/odb-tests/common/threads/driver.cxx
new file mode 100644
index 0000000..1add011
--- /dev/null
+++ b/odb-tests/common/threads/driver.cxx
@@ -0,0 +1,236 @@
+// file : common/threads/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test operations in a multi-threaded environment.
+//
+
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <cstddef> // std::size_t
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <odb/details/shared-ptr.hxx>
+#include <odb/details/thread.hxx>
+
+#include <libcommon/config.hxx> // DATABASE_*
+#include <libcommon/common.hxx>
+
+#if defined(DATABASE_SQLITE)
+# include <odb/sqlite/database.hxx>
+#endif
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+namespace details = odb::details;
+
+const unsigned long thread_count = 24;
+const unsigned long iteration_count = 30;
+const unsigned long sub_iteration_count = 40;
+
+struct task
+{
+ task (database& db, unsigned long n)
+ : db_ (db), n_ (n)
+ {
+ }
+
+ void*
+ execute ()
+ {
+ try
+ {
+ for (unsigned long i (0); i < iteration_count; ++i)
+ {
+ unsigned long id ((n_ * iteration_count + i) * 3);
+
+ object o1 (id, "first object");
+ object o2 (id + 1, "second object");
+ object o3 (id + 2, "third object");
+
+ // The following transactions may lead to deadlocks.
+ //
+ while (true)
+ {
+ try
+ {
+ transaction t (db_.begin ());
+
+ db_.persist (o1);
+ db_.persist (o2);
+ db_.persist (o3);
+ t.commit ();
+ break;
+ }
+ catch (const deadlock&) {}
+ }
+
+ while (true)
+ {
+ try
+ {
+#if !defined(DATABASE_SQLITE)
+ transaction t (db_.begin ());
+#else
+ // SQLite has a peculiar table locking mode (shared cache)
+ // which can lead to any of the transactions in this test
+ // deadlocking even though they shouldn't from the user's
+ // perspective. One way to work around this problem is to
+ // start a "write" transaction as such right away.
+ //
+ transaction t;
+
+ if (db_.id () != odb::id_sqlite)
+ t.reset (db_.begin ());
+ else
+ {
+ t.reset (
+ static_cast<odb::sqlite::database&> (db_).begin_immediate ());
+ }
+#endif
+ unique_ptr<object> o (db_.load<object> (id));
+ assert (o->str_ == "first object");
+ o->str_ = "another value";
+ db_.update (*o);
+ t.commit ();
+ break;
+ }
+ catch (const deadlock&) {}
+ }
+
+ for (unsigned long j (0); j < sub_iteration_count; ++j)
+ {
+ typedef odb::query<object> query;
+ typedef odb::prepared_query<object> prep_query;
+ typedef odb::result<object> result;
+
+ while (true)
+ {
+ try
+ {
+ transaction t (db_.begin ());
+
+ prep_query pq (db_.lookup_query<object> ("object-query"));
+
+ if (!pq)
+ {
+ pq = db_.prepare_query<object> (
+ "object-query", query::str == "another value");
+ db_.cache_query (pq);
+ }
+
+ result r (pq.execute (false));
+
+ bool found (false);
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ if (i->id_ == id)
+ {
+ found = true;
+ break;
+ }
+ }
+ assert (found);
+ t.commit ();
+ break;
+ }
+ catch (const deadlock&) {}
+ }
+ }
+
+ while (true)
+ {
+ try
+ {
+ transaction t (db_.begin ());
+ db_.erase<object> (id);
+ t.commit ();
+ break;
+ }
+ catch (const deadlock&) {}
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return reinterpret_cast<void*> (1);
+ }
+
+ return 0;
+ }
+
+ static void*
+ execute (void* arg)
+ {
+ return static_cast<task*> (arg)->execute ();
+ }
+
+ database& db_;
+ unsigned long n_;
+};
+
+bool
+test (int argc, char* argv[], size_t max_connections)
+{
+ unique_ptr<database> db (create_database (argc, argv, true, max_connections));
+
+ vector<details::shared_ptr<details::thread> > threads;
+ vector<details::shared_ptr<task> > tasks;
+
+ for (unsigned long i (0); i < thread_count; ++i)
+ {
+ details::shared_ptr<task> t (new (details::shared) task (*db, i));
+ tasks.push_back (t);
+
+ threads.push_back (
+ details::shared_ptr<details::thread> (
+ new (details::shared) details::thread (&task::execute, t.get ())));
+ }
+
+ bool r (true);
+
+ for (unsigned long i (0); i < thread_count; ++i)
+ if (threads[i]->join () != 0)
+ r = false;
+
+ {
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> ());
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ db->erase<object> (i->id_);
+
+ t.commit ();
+ }
+
+ return r;
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ if (!(test (argc, argv, 0) &&
+ test (argc, argv, thread_count - 1) &&
+ test (argc, argv, thread_count / 2) &&
+ test (argc, argv, thread_count / 4)))
+ return 1;
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/threads/test.hxx b/odb-tests/common/threads/test.hxx
new file mode 100644
index 0000000..2ed6e67
--- /dev/null
+++ b/odb-tests/common/threads/test.hxx
@@ -0,0 +1,29 @@
+// file : common/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id, const std::string& str)
+ : id_ (id), str_ (str)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/threads/testscript b/odb-tests/common/threads/testscript
new file mode 100644
index 0000000..87e03e0
--- /dev/null
+++ b/odb-tests/common/threads/testscript
@@ -0,0 +1,50 @@
+# file : common/threads/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ # Note: this is quite slow:
+ #
+ # $ time ./driver --database ~/odb-test.db
+ # real 3m5.593s
+ # user 1m1.244s
+ # sys 0m26.793s
+ #
+ # $ time ./driver --database /tmp/odb-test.db
+ # real 0m13.909s
+ # user 0m16.724s
+ # sys 0m4.874s
+ #
+ # $ time ./driver --database "file::memory:"
+ # real 0m12.406s
+ # user 0m15.694s
+ # sys 0m4.207s
+ #
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/transaction/basics/buildfile b/odb-tests/common/transaction/basics/buildfile
new file mode 100644
index 0000000..f412235
--- /dev/null
+++ b/odb-tests/common/transaction/basics/buildfile
@@ -0,0 +1,13 @@
+# file : common/transaction/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb%lib{odb}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/transaction/basics/driver.cxx b/odb-tests/common/transaction/basics/driver.cxx
new file mode 100644
index 0000000..1833555
--- /dev/null
+++ b/odb-tests/common/transaction/basics/driver.cxx
@@ -0,0 +1,151 @@
+// file : common/transaction/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic transaction operations.
+//
+
+#include <string>
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/tracer.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/statement.hxx>
+#include <odb/exceptions.hxx>
+
+#include <libcommon/common.hxx>
+#include <libcommon/concrete.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct transaction_tracer: odb::tracer
+{
+ virtual void
+ execute (connection&, const char* s)
+ {
+ string str (s);
+
+ if (str == "BEGIN")
+ cout << "begin transaction" << endl;
+ else if (str == "COMMIT")
+ cout << "commit transaction" << endl;
+ else if (str == "ROLLBACK")
+ cout << "rollback transaction" << endl;
+ }
+
+ // Override the other version to get rid of a Sun CC warning.
+ //
+ virtual void
+ execute (connection& c, const statement& s)
+ {
+ execute (c, s.text ());
+ }
+};
+
+int
+main (int argc, char* argv[])
+{
+ {
+ transaction_tracer tracer;
+ unique_ptr<database> db (create_database (argc, argv, false));
+ db->tracer (tracer);
+
+ assert (!transaction::has_current ());
+
+ // Current and db accessors.
+ //
+ cout << "test 001" << endl;
+ {
+ transaction t (db->begin ());
+ assert (&t.database () == db.get ());
+ assert (transaction::has_current ());
+ assert (&transaction::current () == &t);
+
+ transaction::reset_current ();
+ assert (!transaction::has_current ());
+
+ transaction t2 (db->begin (), false);
+ assert (!transaction::has_current ());
+
+ transaction::current (t2);
+ assert (&transaction::current () == &t2);
+ }
+
+ // Commit.
+ //
+ cout << "test 002" << endl;
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+
+ // Rollback.
+ //
+ cout << "test 003" << endl;
+ {
+ transaction t (db->begin ());
+ t.rollback ();
+ }
+
+ // Auto rollback.
+ //
+ cout << "test 004" << endl;
+ {
+ transaction t (db->begin ());
+ }
+
+ // Nested transaction.
+ //
+ cout << "test 005" << endl;
+ {
+ transaction t (db->begin ());
+
+ try
+ {
+ transaction n (db->begin ());
+ }
+ catch (const already_in_transaction&)
+ {
+ cout << "already_in_transaction" << endl;
+ }
+ }
+
+ // Concrete transaction type.
+ //
+ cout << "test 006" << endl;
+ {
+ assert (sizeof (odb_db::transaction) == sizeof (transaction));
+
+ odb_db::transaction t (static_cast<odb_db::database&> (*db).begin ());
+ odb_db::transaction& r (odb_db::transaction::current ());
+ assert (&t == &r);
+ }
+
+ // Transaction restart.
+ //
+ cout << "test 007" << endl;
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ t.reset (db->begin ());
+ t.commit ();
+ }
+ }
+
+ // Test early connection release.
+ //
+ {
+ unique_ptr<database> db (create_database (argc, argv, false, 1));
+ transaction t1 (db->begin ());
+ t1.commit ();
+ transaction t2 (db->begin ());
+ t2.rollback ();
+ transaction t3 (db->begin ());
+ t3.commit ();
+ }
+}
diff --git a/odb-tests/common/transaction/basics/testscript b/odb-tests/common/transaction/basics/testscript
new file mode 100644
index 0000000..94c58b6
--- /dev/null
+++ b/odb-tests/common/transaction/basics/testscript
@@ -0,0 +1,62 @@
+# file : common/transaction/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
++cat <<EOI >=output
+ test 001
+ begin transaction
+ begin transaction
+ rollback transaction
+ rollback transaction
+ test 002
+ begin transaction
+ commit transaction
+ test 003
+ begin transaction
+ rollback transaction
+ test 004
+ begin transaction
+ rollback transaction
+ test 005
+ begin transaction
+ already_in_transaction
+ rollback transaction
+ test 006
+ begin transaction
+ rollback transaction
+ test 007
+ begin transaction
+ commit transaction
+ begin transaction
+ commit transaction
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/transaction/callback/buildfile b/odb-tests/common/transaction/callback/buildfile
new file mode 100644
index 0000000..78b1b03
--- /dev/null
+++ b/odb-tests/common/transaction/callback/buildfile
@@ -0,0 +1,13 @@
+# file : common/transaction/callback/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb%lib{odb}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/transaction/callback/driver.cxx b/odb-tests/common/transaction/callback/driver.cxx
new file mode 100644
index 0000000..d0af993
--- /dev/null
+++ b/odb-tests/common/transaction/callback/driver.cxx
@@ -0,0 +1,231 @@
+// file : common/transaction/callback/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test transaction callbacks.
+//
+
+#include <memory> // std::unique_ptr
+#include <cstddef> // std::size_t
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+struct callback
+{
+ callback (unsigned short v): v_ (v), t_ (0) {}
+ callback (unsigned short v, transaction& t): v_ (v), t_ (0) {register_ (t);}
+ ~callback () {if (t_ != 0) unregister ();}
+
+ void
+ register_ (transaction& t)
+ {
+ t_ = &t;
+ t.callback_register (&func, this, transaction::event_all, v_, &t_);
+ }
+
+ void
+ unregister ()
+ {
+ cout << " unregister callback " << v_ << endl;
+ t_->callback_unregister (this);
+ t_ = 0;
+ }
+
+ void
+ update (unsigned short v)
+ {
+ v_ = v;
+ t_->callback_update (this, transaction::event_all, v_, &t_);
+ }
+
+private:
+ static void
+ func (unsigned short event, void* key, unsigned long long data)
+ {
+ callback& c (*static_cast<callback*> (key));
+
+ const char* en;
+ switch (event)
+ {
+ case transaction::event_commit:
+ en = "commit";
+ break;
+ case transaction::event_rollback:
+ en = "rollback";
+ break;
+ default:
+ en = "unknown";
+ }
+
+ cout << " callback " << c.v_ << " " << en << endl;
+
+ assert (data == c.v_);
+ assert (c.t_ == 0);
+ }
+
+ unsigned short v_;
+ transaction* t_;
+};
+
+struct failed {};
+
+static void
+throw_func (unsigned short, void*, unsigned long long)
+{
+ throw failed ();
+}
+
+static void
+dummy_func (unsigned short, void* key, unsigned long long data)
+{
+ assert (reinterpret_cast<unsigned long long> (key) == data);
+}
+
+static void
+fill (transaction& t)
+{
+ // 20 is from odb/transaction.hxx.
+ //
+ for (size_t i (0); i < 20; ++i)
+ t.callback_register (&dummy_func,
+ reinterpret_cast<void*> (i),
+ transaction::event_all,
+ i);
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv, false));
+
+ // We want to test both stack and dynamic slots.
+ //
+ for (unsigned short i (1); i < 3; ++i)
+ {
+ // Test basic logic.
+ //
+ cout << "test " << i << "/001" << endl;
+
+ // Commit callback.
+ //
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ t.commit ();
+ }
+
+ // Rollback callback.
+ //
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ t.rollback ();
+ }
+
+ // Rollback via exception callback.
+ //
+ {
+ callback c1 (1);
+
+ try
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ c1.register_ (t);
+ throw failed ();
+ }
+ catch (const failed&)
+ {
+ }
+ }
+
+ // Unregister callback at the end.
+ //
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ c1.unregister ();
+ t.callback_unregister (&c1); // Test unregistering non-registered key.
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ c1.unregister ();
+ callback c2 (2, t);
+ t.commit ();
+ }
+
+ // Unregister callback in the middle.
+ //
+ cout << "test " << i << "/002" << endl;
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ callback c2 (2, t);
+ callback c3 (3, t);
+ c2.unregister ();
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ callback c2 (2, t);
+ callback c3 (3, t);
+ c2.unregister ();
+ callback c4 (4, t); // Using the free slot.
+ t.commit ();
+ }
+
+ // Test a callback in the middle that throws.
+ //
+ cout << "test " << i << "/003" << endl;
+ try
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c1 (1, t);
+ t.callback_register (&throw_func, 0);
+ callback c2 (2, t);
+ t.commit ();
+ }
+ catch (const failed&)
+ {
+ }
+
+ // Test callback_update().
+ //
+ {
+ transaction t (db->begin ());
+ if (i == 2) fill (t);
+ callback c (1, t);
+ c.update (2);
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/transaction/callback/testscript b/odb-tests/common/transaction/callback/testscript
new file mode 100644
index 0000000..7229ecd
--- /dev/null
+++ b/odb-tests/common/transaction/callback/testscript
@@ -0,0 +1,72 @@
+# file : common/transaction/callback/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
++cat <<EOI >=output
+ test 1/001
+ callback 1 commit
+ callback 1 rollback
+ callback 1 rollback
+ unregister callback 1
+ unregister callback 1
+ callback 2 commit
+ test 1/002
+ unregister callback 2
+ callback 1 commit
+ callback 3 commit
+ unregister callback 2
+ callback 1 commit
+ callback 4 commit
+ callback 3 commit
+ test 1/003
+ callback 1 commit
+ callback 2 commit
+ test 2/001
+ callback 1 commit
+ callback 1 rollback
+ callback 1 rollback
+ unregister callback 1
+ unregister callback 1
+ callback 2 commit
+ test 2/002
+ unregister callback 2
+ callback 1 commit
+ callback 3 commit
+ unregister callback 2
+ callback 1 commit
+ callback 4 commit
+ callback 3 commit
+ test 2/003
+ callback 1 commit
+ callback 2 commit
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $*
+}
diff --git a/odb-tests/common/types/buildfile b/odb-tests/common/types/buildfile
new file mode 100644
index 0000000..95fe5b6
--- /dev/null
+++ b/odb-tests/common/types/buildfile
@@ -0,0 +1,39 @@
+# file : common/types/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix types_
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/types/driver.cxx b/odb-tests/common/types/driver.cxx
new file mode 100644
index 0000000..bdc66b8
--- /dev/null
+++ b/odb-tests/common/types/driver.cxx
@@ -0,0 +1,37 @@
+// file : common/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test C++ type handling (anonymous types, aliasing).
+//
+
+#include <memory>
+#include <iostream>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+template <typename T1, typename T2>
+struct same_p
+{
+ static const bool result = false;
+};
+
+template <typename T>
+struct same_p<T, T>
+{
+ static const bool result = true;
+};
+
+int
+main ()
+{
+ assert ((same_p<odb::object_traits<object2>::id_type, int>::result));
+}
diff --git a/odb-tests/common/types/test.hxx b/odb-tests/common/types/test.hxx
new file mode 100644
index 0000000..a99b499
--- /dev/null
+++ b/odb-tests/common/types/test.hxx
@@ -0,0 +1,55 @@
+// file : common/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#ifdef ODB_COMPILER
+typedef int int_t;
+typedef short num_t;
+#else
+typedef int num_t;
+#endif
+
+typedef num_t num_type;
+
+#pragma db object
+struct object1
+{
+ typedef int int_type;
+
+ #pragma db id
+ int_type id_;
+};
+
+#pragma db object
+struct object2
+{
+ #pragma db id
+ num_type num_;
+};
+
+// Template-id with "inner" name (compilation test).
+//
+template <typename X>
+struct num_wrap
+{
+#ifdef ODB_COMPILER
+ typedef num_wrap this_type; // Name that we should not use.
+#endif
+
+ num_wrap () {}
+ num_wrap (X v): v_ (v) {}
+ operator X () const {return v_;}
+
+ X v_;
+};
+
+#pragma db object
+struct object3
+{
+ #pragma db id type("INTEGER")
+ num_wrap<long long> num_; // Use long long to avoid warnings.
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/types/testscript b/odb-tests/common/types/testscript
new file mode 100644
index 0000000..159972b
--- /dev/null
+++ b/odb-tests/common/types/testscript
@@ -0,0 +1,6 @@
+# file : common/types/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basic
+:
+$*
diff --git a/odb-tests/common/view/basics/buildfile b/odb-tests/common/view/basics/buildfile
new file mode 100644
index 0000000..d9738a4
--- /dev/null
+++ b/odb-tests/common/view/basics/buildfile
@@ -0,0 +1,42 @@
+# file : common/view/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_view_b_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/view/basics/driver.cxx b/odb-tests/common/view/basics/driver.cxx
new file mode 100644
index 0000000..e2f611a
--- /dev/null
+++ b/odb-tests/common/view/basics/driver.cxx
@@ -0,0 +1,846 @@
+// file : common/view/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test view basics.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+#include <libcommon/config.hxx> // DATABASE_XXX
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+template <typename V>
+void
+view1_check (odb::result<V>& r)
+{
+ typedef odb::result<V> result;
+
+ typename result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first == "Jane" && i->last == "Doe" && i->age == 29);
+
+ assert (++i != r.end ());
+ V v;
+ i.load (v);
+ assert (v.first == "John" && v.last == "Doe" && v.age == 30);
+
+ assert (++i == r.end ());
+}
+
+template <typename V>
+void
+view2_test (const unique_ptr<database>& db)
+{
+ typedef odb::query<V> query;
+ typedef odb::result<V> result;
+ typedef typename result::iterator iterator;
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<V> ());
+ iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->count == 4);
+ }
+
+ {
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ("age < 31");
+ else
+ r = db->query<V> ("\"age\" < 31");
+
+ iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->count == 2);
+ }
+
+ {
+ result r (db->query<V> (query::age < 31));
+ iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->count == 2);
+ }
+
+ {
+ unique_ptr<V> v (db->query_one<V> ());
+ assert (v->count == 4);
+ }
+
+ {
+ unique_ptr<V> v;
+ if (db->id () != odb::id_oracle)
+ v.reset (db->query_one<V> ("age < 31"));
+ else
+ v.reset (db->query_one<V> ("\"age\" < 31"));
+ assert (v->count == 2);
+ }
+
+ {
+ unique_ptr<V> v (db->query_one<V> (query::age < 31));
+ assert (v->count == 2);
+ }
+
+ t.commit ();
+}
+
+template <typename V>
+void
+view4_test (const unique_ptr<database>& db)
+{
+ typedef odb::query<V> query;
+ typedef odb::result<V> result;
+ typedef typename result::iterator iterator;
+
+ transaction t (db->begin ());
+
+ {
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY age");
+ else
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY \"age\"");
+
+ iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "Joe" && i->last_name == "Dirt" &&
+ i->name == "United States");
+
+ assert (++i != r.end ());
+ assert (i->first_name == "Johan" && i->last_name == "Johansen" &&
+ i->name == "Sweden");
+
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<V> (
+ (query::person::age > 30) +
+ "ORDER BY " + query::person::age));
+
+ iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "Joe" && i->last_name == "Dirt" &&
+ i->name == "United States");
+
+ assert (++i != r.end ());
+ assert (i->first_name == "Johan" && i->last_name == "Johansen" &&
+ i->name == "Sweden");
+
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<V> (query::residence::code == "US"));
+
+ iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "Joe" && i->last_name == "Dirt" &&
+ i->name == "United States");
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+}
+
+template <typename V>
+void
+view6_test (const unique_ptr<database>& db, const odb::query<V>& q)
+{
+ typedef odb::result<V> result;
+ typedef typename result::iterator iterator;
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<V> (q));
+
+ iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "John" && i->last_name == "Doe" &&
+ i->employer == "Simple Tech, Inc");
+
+ assert (++i != r.end ());
+ assert (i->first_name == "Joe" && i->last_name == "Dirt" &&
+ i->employer == "Simple Tech, Inc");
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ //
+ //
+ {
+ country ca ("CA", "Canada");
+ country za ("ZA", "South Africa");
+ country us ("US", "United States");
+ country se ("SE", "Sweden");
+
+ person p1 (1, "John", "Doe", 30, male, measures (60, 160), &ca, &ca);
+ person p2 (2, "Jane", "Doe", 29, female, measures (70, 170), &za, &us);
+ person p3 (3, "Joe", "Dirt", 31, male, measures (80, 180), &us, &za);
+ person p4 (4, "Johan", "Johansen", 32, male, measures (90, 190), &se,
+ &se);
+
+ p2.husband = &p1;
+
+ employer st ("Simple Tech, Inc");
+ employer ct ("Complex Tech, Inc");
+
+ p2.previous_employer = st.name;
+ p3.previous_employer = ct.name;
+
+ st.employees.push_back (&p1);
+ st.employees.push_back (&p3);
+ st.head_count = 2;
+
+ ct.employees.push_back (&p2);
+ ct.employees.push_back (&p4);
+ ct.head_count = 2;
+
+ transaction t (db->begin ());
+ db->persist (ca);
+ db->persist (za);
+ db->persist (us);
+ db->persist (se);
+
+ db->persist (p1);
+ db->persist (p2);
+ db->persist (p3);
+ db->persist (p4);
+
+ db->persist (st);
+ db->persist (ct);
+ t.commit ();
+ }
+
+ // view1
+ //
+ {
+ typedef odb::result<view1> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view1> ());
+ assert (size (r) == 4);
+ }
+
+ {
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("ORDER BY age");
+ else
+ r = db->query<view1> ("ORDER BY \"age\"");
+
+ assert (size (r) == 4);
+ }
+
+ {
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1> ("\"age\" < 31 ORDER BY \"age\"");
+
+ view1_check (r);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view1a
+ //
+ {
+ typedef odb::result<view1a> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<view1a> ());
+ view1_check (r);
+
+ t.commit ();
+ }
+ }
+
+ // view1b
+ //
+ {
+ typedef odb::result<view1b> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<view1b> ());
+ view1_check (r);
+
+ t.commit ();
+ }
+
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef MULTI_DATABASE
+ {
+ typedef odb::query<view1b> query;
+
+ transaction t (db->begin ());
+
+#ifndef DATABASE_ORACLE
+ result r (db->query<view1b> ("first = " + query::_val ("Jane")));
+#else
+ result r (db->query<view1b> ("\"first\" = " + query::_val ("Jane")));
+#endif
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first == "Jane" && i->last == "Doe");
+ assert (++i == r.end ());
+
+ t.commit ();
+ }
+#endif
+ }
+
+ // view1c
+ //
+ {
+ typedef odb::result<view1c> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1c> ("SELECT first, last, age "
+ "FROM t_view_b_person "
+ "WHERE age < 31 ORDER BY age");
+ else
+ r = db->query<view1c> ("SELECT \"first\", \"last\", \"age\" "
+ "FROM \"t_view_b_person\" "
+ "WHERE \"age\" < 31 ORDER BY \"age\"");
+ view1_check (r);
+
+ t.commit ();
+ }
+ }
+
+ // view1d
+ //
+ {
+ typedef odb::result<view1d> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1d> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1d> ("\"age\" < 31 ORDER BY \"age\"");
+
+ view1_check (r);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view2
+ //
+ view2_test<view2> (db);
+ view2_test<view2a> (db);
+ view2_test<view2b> (db);
+ view2_test<view2c> (db);
+
+ // view3
+ //
+ {
+ typedef odb::result<const view3> result; // Test const result.
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view3> ());
+
+ size_t count (0);
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ if (i->last_name == "Doe")
+ assert (i->count == 2);
+ else if (i->last_name == "Dirt" ||
+ i->last_name == "Johansen")
+ assert (i->count == 1);
+ else
+ assert (false);
+
+ count++;
+ }
+
+ assert (count == 3);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view3a
+ //
+ {
+ typedef odb::query<view3a> query;
+ typedef odb::result<view3a> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view3a> (query::last_name == "Doe"));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->last_name == "Doe" && i->count == 2);
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view4
+ //
+ view4_test<view4> (db);
+ view4_test<view4a> (db);
+
+ // view5
+ //
+ {
+ typedef odb::query<view5> query;
+ typedef odb::result<view5> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (
+ db->query<view5> (
+ query::residence::name == query::nationality::name));
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "John" && i->last_name == "Doe" &&
+ i->rname == "Canada" && i->rname == "Canada");
+
+ assert (++i != r.end ());
+ assert (i->first_name == "Johan" && i->last_name == "Johansen" &&
+ i->rname == "Sweden" && i->rname == "Sweden");
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view6
+ //
+ view6_test<view6> (
+ db, odb::query<view6>::employer::name == "Simple Tech, Inc");
+
+ view6_test<view6a> (
+ db, odb::query<view6a>::employer::name == "Simple Tech, Inc");
+
+ view6_test<view6b> (
+ db, odb::query<view6b>::employer::name == "Simple Tech, Inc");
+
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef MULTI_DATABASE
+ view6_test<view6c> (
+#ifndef DATABASE_ORACLE
+ db, "e.name = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
+#else
+ db, "\"e\".\"name\" = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
+#endif
+#endif
+
+ // view7
+ //
+ {
+ typedef odb::query<view7> query;
+ typedef odb::result<view7> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view7> (query::person::last_name == "Doe"));
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "Jane" && i->last_name == "Doe" &&
+ !i->head_count.null () && *i->head_count == 2);
+
+ assert (++i != r.end ());
+ assert (i->first_name == "John" && i->last_name == "Doe" &&
+ i->head_count.null ());
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view8
+ //
+ {
+ typedef odb::result<view8> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view8> ());
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->wife_name == "Jane" && i->husb_name == "John");
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view9
+ //
+ {
+ typedef odb::query<view9> query;
+ typedef odb::result<view9> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ // Test case-insensitive clause prefix detection.
+ //
+ result r (db->query<view9> ("where" + (query::gender == female)));
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->first_name == "Jane" && i->last_name == "Doe" &&
+ i->gender == female);
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view10
+ //
+ {
+ typedef odb::query<view10> query;
+ typedef odb::result<view10> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view10> (
+ query::measures.weight > 60 &&
+ query::measures.hight < 190));
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->last_name == "Doe" &&
+ i->measures.weight == 70 && i->measures.hight == 170);
+
+ assert (++i != r.end ());
+ assert (i->last_name == "Dirt" &&
+ i->measures.weight == 80 && i->measures.hight == 180);
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view11
+ //
+ {
+ typedef odb::result<view11> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view11> ());
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->last_name == "Doe" && i->hight == 170);
+
+ assert (++i != r.end ());
+ assert (i->last_name == "Dirt" && i->hight == 180);
+
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view12
+ //
+ {
+ typedef odb::query<view12> query;
+ typedef odb::result<view12> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view12> (query::last_name == "Dirt"));
+
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ assert (i->residence == "US");
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view13
+ //
+ {
+ typedef odb::query<view13> query;
+ typedef odb::result<view13> result;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<view13> (
+ (query::person::age < 32) +
+ "ORDER BY" + query::employer::name));
+
+ assert (size (r) == 2);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // view14
+ //
+ {
+ transaction t (db->begin ());
+ assert (size (db->query<view14> ()) == 2);
+ t.commit ();
+ }
+
+ // Test join types.
+ //
+ {
+ using namespace test2;
+
+ {
+ obj1 o11 (1, 1);
+ obj1 o12 (2, 2);
+
+ obj2 o21 (1, 1);
+ obj2 o22 (2, 1);
+ obj2 o23 (3, 3);
+
+ transaction t (db->begin ());
+ db->persist (o11);
+ db->persist (o12);
+ db->persist (o21);
+ db->persist (o22);
+ db->persist (o23);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<vleft> query;
+ typedef odb::result<vleft> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vleft> (
+ "ORDER BY" + query::o1::id1 + "," + query::o2::id2));
+ result::iterator i (r.begin ());
+ assert ( i != r.end () && i->id1 == 1 && *i->id2 == 1);
+ assert (++i != r.end () && i->id1 == 1 && *i->id2 == 2);
+ assert (++i != r.end () && i->id1 == 2 && i->id2.null ());
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ // @@ BUILD2 Also disable for DATABASE_MYSQL and DATABASE_PGSQL (see
+ // vright definition for details).
+ //
+#if !defined(DATABASE_MYSQL) && \
+ !defined(DATABASE_SQLITE) && \
+ !defined(DATABASE_PGSQL)
+ {
+ typedef odb::query<vright> query;
+ typedef odb::result<vright> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vright> (
+ "ORDER BY" + query::o1::id1 + "," + query::o2::id2));
+ result::iterator i (r.begin ());
+ assert ( i != r.end () && i->id1 == 1 && *i->id2 == 1);
+ assert (++i != r.end () && i->id1 == 1 && *i->id2 == 2);
+ assert (++i != r.end () && i->id1 == 2 && i->id2.null ());
+ assert (++i == r.end ());
+ t.commit ();
+ }
+#endif
+
+ // @@ BUILD2 Also disable for DATABASE_PGSQL (see vfull definition for
+ // details).
+ //
+#if !defined(DATABASE_MYSQL) && \
+ !defined(DATABASE_SQLITE) && \
+ !defined(DATABASE_PGSQL)
+ {
+ typedef odb::query<vfull> query;
+ typedef odb::result<vfull> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vfull> (
+ "ORDER BY" + query::o1::id1 + "," + query::o2::id2));
+ result::iterator i (r.begin ());
+
+ // SQL Server orders NULL values first. Got to be different.
+ //
+#ifdef DATABASE_MSSQL
+ assert ( i != r.end () && i->id1.null () && *i->id2 == 3);
+ assert (++i != r.end () && *i->id1 == 1 && *i->id2 == 1);
+ assert (++i != r.end () && *i->id1 == 1 && *i->id2 == 2);
+ assert (++i != r.end () && *i->id1 == 2 && i->id2.null ());
+#else
+ assert ( i != r.end () && *i->id1 == 1 && *i->id2 == 1);
+ assert (++i != r.end () && *i->id1 == 1 && *i->id2 == 2);
+ assert (++i != r.end () && *i->id1 == 2 && i->id2.null ());
+ assert (++i != r.end () && i->id1.null () && *i->id2 == 3);
+#endif
+ assert (++i == r.end ());
+ t.commit ();
+ }
+#endif
+
+ {
+ typedef odb::query<vinner> query;
+ typedef odb::result<vinner> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vinner> (
+ "ORDER BY" + query::o1::id1 + "," + query::o2::id2));
+ result::iterator i (r.begin ());
+ assert ( i != r.end () && i->id1 == 1 && i->id2 == 1);
+ assert (++i != r.end () && i->id1 == 1 && i->id2 == 2);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<vcross> query;
+ typedef odb::result<vcross> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vcross> (
+ "ORDER BY" + query::o1::id1 + "," + query::o2::id2));
+ result::iterator i (r.begin ());
+ assert ( i != r.end () && i->id1 == 1 && i->id2 == 1);
+ assert (++i != r.end () && i->id1 == 1 && i->id2 == 2);
+ assert (++i != r.end () && i->id1 == 1 && i->id2 == 3);
+ assert (++i != r.end () && i->id1 == 2 && i->id2 == 1);
+ assert (++i != r.end () && i->id1 == 2 && i->id2 == 2);
+ assert (++i != r.end () && i->id1 == 2 && i->id2 == 3);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ // Inner JOIN via relationship/container.
+ //
+ {
+ obj3 o31 (1, 1);
+ obj3 o32 (2, 2);
+
+ obj4 o41 (1, 1);
+ obj4 o42 (2, 2);
+ o42.o3.push_back (&o32);
+
+ transaction t (db->begin ());
+ db->persist (o31);
+ db->persist (o32);
+ db->persist (o41);
+ db->persist (o42);
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<vrel> result;
+
+ transaction t (db->begin ());
+ result r (db->query<vrel> ());
+ result::iterator i (r.begin ());
+ assert ( i != r.end () && i->id4 == 2);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/view/basics/test.hxx b/odb-tests/common/view/basics/test.hxx
new file mode 100644
index 0000000..130bcd4
--- /dev/null
+++ b/odb-tests/common/view/basics/test.hxx
@@ -0,0 +1,640 @@
+// file : common/view/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+#include <cstddef> // std::size_t
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+struct employer;
+
+#pragma db object
+struct country
+{
+ country (const std::string& c, const std::string& n)
+ : code (c), name (n)
+ {
+ }
+
+ country ()
+ {
+ }
+
+ #pragma db id
+ std::string code; // ISO 2-letter country code.
+
+ std::string name;
+};
+
+enum gender_type {male, female};
+
+#pragma db value
+struct measures
+{
+ measures (unsigned short w, unsigned short h) : weight (w), hight (h) {}
+ measures () {}
+
+ unsigned short weight;
+ unsigned short hight;
+};
+
+#pragma db object
+struct person
+{
+ typedef ::measures measures_type;
+
+ person (unsigned long i,
+ const std::string& fn,
+ const std::string& ln,
+ unsigned short a,
+ gender_type g,
+ const measures_type m,
+ country* r,
+ country* n)
+ : id (i),
+ first_name_ (fn),
+ last_name_ (ln),
+ age (a),
+ gender (g),
+ measures (m),
+ residence (r),
+ nationality (n),
+ husband (0)
+ {
+ }
+
+ person ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db column("first")
+ std::string first_name_;
+
+ #pragma db column("last")
+ std::string last_name_;
+
+ unsigned short age;
+
+ // #pragma db type("INT") - in MySQL test type pragma copying
+ gender_type gender;
+
+ measures_type measures;
+
+ #pragma db not_null
+ country* residence;
+
+ #pragma db not_null
+ country* nationality;
+
+ #pragma db inverse(employees)
+ employer* employed_by;
+
+ // A non-pointer relationship.
+ //
+ odb::nullable<std::string> previous_employer;
+
+ person* husband; // Self-reference.
+};
+
+#pragma db object
+struct employer
+{
+ employer (const std::string& n)
+ : name (n)
+ {
+ }
+
+ employer ()
+ {
+ }
+
+ #pragma db id
+ std::string name;
+ unsigned int head_count;
+ std::vector<person*> employees;
+};
+
+//
+// General view with no associated objects.
+//
+
+// Complete suffix query template.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view query("SELECT first, last, age FROM t_view_b_person")
+#else
+# pragma db view query("SELECT \"first\", \"last\", \"age\" " \
+ "FROM \"t_view_b_person\"")
+#endif
+struct view1
+{
+ std::string first;
+ std::string last;
+ unsigned short age;
+};
+
+// Complete query.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view query("SELECT first, last, age " \
+ "FROM t_view_b_person " \
+ "WHERE age < 31 ORDER BY age")
+#else
+# pragma db view query("SELECT \"first\", \"last\", \"age\" " \
+ "FROM \"t_view_b_person\" " \
+ "WHERE \"age\" < 31 ORDER BY \"age\"")
+#endif
+struct view1a
+{
+ std::string first;
+ std::string last;
+ unsigned short age;
+};
+
+// Complete placeholder query template.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view query("SELECT first, last, age " \
+ "FROM t_view_b_person " \
+ "WHERE age < 31 AND (?) ORDER BY age")
+#else
+# pragma db view query("SELECT \"first\", \"last\", \"age\" " \
+ "FROM \"t_view_b_person\" " \
+ "WHERE \"age\" < 31 AND (?) ORDER BY \"age\"")
+#endif
+struct view1b
+{
+ std::string first;
+ std::string last;
+ unsigned short age;
+};
+
+// Runtime query.
+//
+#pragma db view //query()
+struct view1c
+{
+ std::string first;
+ std::string last;
+ unsigned short age;
+};
+
+// Assembled SELECT and FROM-lists.
+//
+#pragma db view table("t_view_b_person")
+struct view1d
+{
+ #pragma db column("first")
+ std::string first;
+
+ #pragma db column("last")
+ std::string last;
+
+ #pragma db column("age")
+ unsigned short age;
+};
+
+//
+// Count view plus associated object.
+//
+
+// Complete suffix query.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view object(person) \
+ query("SELECT count(id) FROM t_view_b_person")
+#else
+# pragma db view object(person) \
+ query("SELECT count(\"id\") FROM \"t_view_b_person\"")
+#endif
+struct view2
+{
+ std::size_t count;
+};
+
+// Generated query, literal column.
+//
+#pragma db view object(person)
+struct view2a
+{
+#ifndef ODB_DATABASE_ORACLE
+ #pragma db column("count(id)")
+#else
+ #pragma db column("count(\"id\")")
+#endif
+ std::size_t count;
+};
+
+// Generated query, qualified literal column.
+//
+#pragma db view object(person)
+struct view2b
+{
+#ifndef ODB_DATABASE_ORACLE
+ #pragma db column("count(t_view_b_person.id)")
+#else
+ #pragma db column("count(\"t_view_b_person\".\"id\")")
+#endif
+ std::size_t count;
+};
+
+// Generated query, expression column.
+//
+#pragma db view object(person)
+struct view2c
+{
+ #pragma db column("count(" + person::id + ")")
+ std::size_t count;
+};
+
+//
+// Aggregate view plus associated object with a custom alias.
+//
+
+// Complete suffix query.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view object(person = test) \
+ query("SELECT last, count(last) " \
+ "FROM t_view_b_person " \
+ "GROUP BY last")
+#else
+# pragma db view object(person = test) \
+ query("SELECT \"last\", count(\"last\") " \
+ "FROM \"t_view_b_person\" " \
+ "GROUP BY \"last\"")
+#endif
+struct view3
+{
+ std::string last_name;
+ std::size_t count;
+};
+
+// Generated query with integrated query condition and placeholder.
+//
+#pragma db view object(person = test) \
+ query((?) + "GROUP BY" + test::last_name_)
+struct view3a
+{
+ // Automatically resolved to test::last_name_.
+ //
+ std::string last_name;
+
+ #pragma db column("count(" + test::last_name_ + ")")
+ std::size_t count;
+};
+
+//
+// JOIN view plus associated objects, some with custom aliases.
+//
+
+// Complete suffix query.
+//
+#ifndef ODB_DATABASE_ORACLE
+# pragma db view object(person) object(country = residence) \
+ query("SELECT first, last, residence.name " \
+ "FROM t_view_b_person " \
+ "LEFT JOIN t_view_b_country AS residence " \
+ "ON t_view_b_person.residence = residence.code")
+#else
+# pragma db view object(person) object(country = residence) \
+ query("SELECT \"first\", \"last\", \"residence\".\"name\" " \
+ "FROM \"t_view_b_person\" " \
+ "LEFT JOIN \"t_view_b_country\" \"residence\" " \
+ "ON \"t_view_b_person\".\"residence\" = \"residence\".\"code\"")
+#endif
+struct view4
+{
+ std::string first_name;
+ std::string last_name;
+ std::string name;
+};
+
+// Generated query.
+//
+#pragma db view object(person) \
+ object(country = residence: person::residence)
+struct view4a
+{
+ std::string first_name;
+ std::string last_name;
+ std::string name;
+};
+
+//
+// JOIN the same object twice.
+//
+#pragma db view object(person) \
+ object(country = residence: person::residence) \
+ object(country = nationality: person::nationality) \
+ query((?) + "ORDER BY" + person::age)
+struct view5
+{
+ std::string first_name;
+ std::string last_name;
+
+ #pragma db column(residence::name)
+ std::string rname;
+
+ #pragma db column(nationality::name)
+ std::string nname;
+};
+
+//
+// JOIN via one(i)-to-many relationship.
+//
+
+// Automatic relationship discovery.
+//
+#pragma db view object(person) object(employer)
+struct view6
+{
+ std::string first_name;
+ std::string last_name;
+
+ #pragma db column(::employer::name)
+ std::string employer;
+};
+
+// Manual relationship specification, left side.
+//
+#pragma db view object(person) object(employer: person::employed_by)
+struct view6a
+{
+ std::string first_name;
+ std::string last_name;
+
+ #pragma db column(::employer::name)
+ std::string employer;
+};
+
+// Manual relationship specification, right side.
+//
+#pragma db view object(person) object(employer: employer::employees)
+struct view6b
+{
+ std::string first_name;
+ std::string last_name;
+
+ #pragma db column(::employer::name)
+ std::string employer;
+};
+
+// The same using tables.
+//
+#if defined(ODB_DATABASE_ORACLE)
+#pragma db view table("t_view_b_person" = "p") \
+ table("t_view_b_employer_employees" = "ee": "\"ee\".\"value\" = \"p\".\"id\"")\
+ table("t_view_b_employer" = "e": "\"ee\".\"object_id\" = \"e\".\"name\"")
+#elif defined(ODB_DATABASE_MSSQL)
+#pragma db view table("t_view_b_person" = "p") \
+ table("t_view_b_employer_employees" = "ee": "ee.value = p.id") \
+ table("t_view_b_employer" = "e": "[ee].[object_id] = e.name")
+#elif defined(ODB_DATABASE_MYSQL)
+#pragma db view table("t_view_b_person" = "p") \
+ table("t_view_b_employer_employees" = "ee": "ee.value = p.id") \
+ table("t_view_b_employer" = "e": "`ee`.`object_id` = e.name")
+#else
+#pragma db view table("t_view_b_person" = "p") \
+ table("t_view_b_employer_employees" = "ee": "ee.value = p.id") \
+ table("t_view_b_employer" = "e": "\"ee\".\"object_id\" = e.name")
+#endif
+struct view6c
+{
+ #pragma db column("p.first")
+ std::string first_name;
+
+ #pragma db column("p.last")
+ std::string last_name;
+
+ #pragma db column("e"."name")
+ std::string employer;
+};
+
+//
+// JOIN via a custom condition.
+//
+#pragma db view object(person) \
+ object(employer: person::previous_employer == employer::name)\
+ query((?) + "ORDER BY" + person::age)
+struct view7
+{
+ std::string first_name;
+ std::string last_name;
+
+ odb::nullable<unsigned int> head_count;
+};
+
+//
+// Self-JOIN.
+//
+#pragma db view object(person = wife) object(person = husb) \
+ query (wife::husband.is_not_null ())
+struct view8
+{
+ #pragma db column(wife::first_name_)
+ std::string wife_name;
+
+ #pragma db column(husb::first_name_)
+ std::string husb_name;
+};
+
+//
+// Enum mapping.
+//
+#pragma db view object(person)
+struct view9
+{
+ std::string first_name;
+ std::string last_name;
+ gender_type gender;
+};
+
+//
+// Composite in view.
+//
+#pragma db view object(person) query((?) + "ORDER BY" + person::age)
+struct view10
+{
+ std::string last_name;
+ ::measures measures;
+};
+
+//
+// Composite in object.
+//
+#pragma db view object(person) \
+ query((person::measures.weight > 60 && person::measures.hight < 190 && (?)) \
+ + "ORDER BY" + person::age)
+struct view11
+{
+ std::string last_name;
+
+ #pragma db column(person::measures.hight)
+ unsigned short hight;
+};
+
+//
+// Extract object pointer as object id.
+//
+#pragma db view object(person)
+struct view12
+{
+ std::string residence;
+};
+
+//
+// Test 'distinct' result modifier.
+//
+#pragma db view object(employer) object(person) query(distinct)
+struct view13
+{
+ std::string name;
+};
+
+//
+// Test 'for_update' result modifier.
+//
+#pragma db view object(employer) query((?), for_update)
+struct view14
+{
+ std::string name;
+};
+
+// Test join types.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ #pragma db object
+ struct obj1
+ {
+ obj1 (int id = 0, int n_ = 0): id1 (id), n (n_) {}
+
+ #pragma db id
+ int id1;
+
+ int n;
+ };
+
+ #pragma db object no_id
+ struct obj2
+ {
+ obj2 (int id = 0, int n_ = 0): id2 (id), n (n_) {}
+
+ #pragma db id
+ int id2;
+
+ int n;
+ };
+
+ #pragma db view object(obj1 = o1) object(obj2 = o2 left: o1::n == o2::n)
+ struct vleft
+ {
+ int id1;
+ odb::nullable<int> id2;
+ };
+
+ // @@ BUILD2 Also disable for ODB_DATABASE_MYSQL and ODB_DATABASE_PGSQL,
+ // otherwise we end up with the following error:
+ //
+ // test-odb-mysql.hxx:3202:20: error: invalid use of incomplete type ‘class odb::access::view_traits<test2::vright>’
+ // 3202 | public access::view_traits< ::test2::vright >
+ // | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //
+//#if !defined(ODB_DATABASE_SQLITE) && !defined(ODB_DATABASE_COMMON)
+#if !defined(ODB_DATABASE_MYSQL) && \
+ !defined(ODB_DATABASE_SQLITE) && \
+ !defined(ODB_DATABASE_PGSQL) && \
+ !defined(ODB_DATABASE_COMMON)
+
+ #pragma db view object(obj2 = o2) object(obj1 = o1 right: o2::n == o1::n)
+ struct vright
+ {
+ int id1;
+ odb::nullable<int> id2;
+ };
+
+#endif
+
+ // @@ BUILD2 Also disable for ODB_DATABASE_PGSQL, otherwise we end up with the
+ // following error:
+ //
+ // test-odb-pgsql.hxx:3325:20: error: invalid use of incomplete type ‘class odb::access::view_traits<test2::vfull>’
+ // 3325 | public access::view_traits< ::test2::vfull >
+ // | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //
+/*
+#if !defined(ODB_DATABASE_MYSQL) && \
+ !defined(ODB_DATABASE_SQLITE) && \
+ !defined(ODB_DATABASE_COMMON)
+*/
+#if !defined(ODB_DATABASE_MYSQL) && \
+ !defined(ODB_DATABASE_SQLITE) && \
+ !defined(ODB_DATABASE_PGSQL) && \
+ !defined(ODB_DATABASE_COMMON)
+
+ #pragma db view object(obj1 = o1) object(obj2 = o2 full: o1::n == o2::n)
+ struct vfull
+ {
+ odb::nullable<int> id1;
+ odb::nullable<int> id2;
+ };
+
+#endif
+
+ #pragma db view object(obj1 = o1) object(obj2 = o2 inner: o1::n == o2::n)
+ struct vinner
+ {
+ int id1;
+ int id2;
+ };
+
+ #pragma db view object(obj1 = o1) object(obj2 = o2 cross)
+ struct vcross
+ {
+ int id1;
+ int id2;
+ };
+
+ // Inner JOIN via relationship/container.
+ //
+ #pragma db object
+ struct obj3
+ {
+ obj3 (int id = 0, int n_ = 0): id3 (id), n (n_) {}
+
+ #pragma db id
+ int id3;
+
+ int n;
+ };
+
+ #pragma db object no_id
+ struct obj4
+ {
+ obj4 (int id = 0, int n_ = 0): id4 (id), n (n_) {}
+
+ #pragma db id
+ int id4;
+
+ int n;
+ std::vector<obj3*> o3;
+ };
+
+ #pragma db view object(obj4) object(obj3 inner)
+ struct vrel
+ {
+ int id4;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/view/basics/testscript b/odb-tests/common/view/basics/testscript
new file mode 100644
index 0000000..faa8408
--- /dev/null
+++ b/odb-tests/common/view/basics/testscript
@@ -0,0 +1,33 @@
+# file : common/view/basics/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/view/olv/.gitignore b/odb-tests/common/view/olv/.gitignore
new file mode 100644
index 0000000..2b95165
--- /dev/null
+++ b/odb-tests/common/view/olv/.gitignore
@@ -0,0 +1,46 @@
+# ODB-generated files.
+#
+test1-odb.?xx
+test1-odb-*.?xx
+test1.sql
+test1-*.sql
+
+test2-odb.?xx
+test2-odb-*.?xx
+test2.sql
+test2-*.sql
+
+test3-odb.?xx
+test3-odb-*.?xx
+test3.sql
+test3-*.sql
+
+test4-odb.?xx
+test4-odb-*.?xx
+test4.sql
+test4-*.sql
+
+test5-odb.?xx
+test5-odb-*.?xx
+test5.sql
+test5-*.sql
+
+test6-odb.?xx
+test6-odb-*.?xx
+test6.sql
+test6-*.sql
+
+test7-odb.?xx
+test7-odb-*.?xx
+test7.sql
+test7-*.sql
+
+test8-odb.?xx
+test8-odb-*.?xx
+test8.sql
+test8-*.sql
+
+test9-odb.?xx
+test9-odb-*.?xx
+test9.sql
+test9-*.sql
diff --git a/odb-tests/common/view/olv/buildfile b/odb-tests/common/view/olv/buildfile
new file mode 100644
index 0000000..89ecbcf
--- /dev/null
+++ b/odb-tests/common/view/olv/buildfile
@@ -0,0 +1,50 @@
+# file : common/view/olv/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+hs = test1 test2 test3 test4 test5 test6 test7 test8 test9
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} libue{test-meta}
+ }
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix t_view_olv_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
+
+testscript@./: schemas = $hs
diff --git a/odb-tests/common/view/olv/driver.cxx b/odb-tests/common/view/olv/driver.cxx
new file mode 100644
index 0000000..c08015e
--- /dev/null
+++ b/odb-tests/common/view/olv/driver.cxx
@@ -0,0 +1,654 @@
+// file : common/view/olv/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test object loading views.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+#include <typeinfo>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test1.hxx"
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test4.hxx"
+#include "test5.hxx"
+#include "test6.hxx"
+#include "test7.hxx"
+#include "test8.hxx"
+#include "test9.hxx"
+
+#include "test1-odb.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+#include "test4-odb.hxx"
+#include "test5-odb.hxx"
+#include "test6-odb.hxx"
+#include "test7-odb.hxx"
+#include "test8-odb.hxx"
+#include "test9-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic object loading functionality.
+ //
+ {
+ using namespace test1;
+
+ {
+ object1 o1a (1, 123);
+ object2 o2 (1, "abc");
+
+ transaction t (db->begin ());
+ db->persist (o1a);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view1> query;
+
+ transaction t (db->begin ());
+ view1 v (db->query_value<view1> (query::object1::n == 123));
+ assert (v.o2->s == "abc");
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view2 v (db->query_value<view2> ());
+ assert (v.o1->n == 123 && v.o2->s == "abc");
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view3 v (db->query_value<view3> ());
+ assert (v.o1->n == 123 && v.o2->s == "abc");
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view4 v (db->query_value<view4> ());
+ assert (v.s == "abc" && v.o2->s == "abc" && v.id == 1 &&
+ v.o1->n == 123 && v.n == 123);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view4 v (db->query_value<view4> ());
+ assert (v.s == "abc" && v.o2->s == "abc" && v.id == 1 &&
+ v.o1->n == 123 && v.n == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view5> query;
+
+ object1 o1b (123, 1);
+
+ transaction t (db->begin ());
+ db->persist (o1b);
+ view5 v (db->query_value<view5> (query::o1b::n == 1));
+ assert (v.o1a->n == 123 && v.o2->s == "abc" && v.o1b->n == 1);
+ t.commit ();
+ }
+ }
+
+ // Test loading of object pointers inside objects.
+ //
+ {
+ using namespace test2;
+
+ shared_ptr<object1> o1 (new object1 (123));
+ shared_ptr<object2> o2 (new object2 ("abc", o1));
+
+ {
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1 v (db->query_value<view1> ());
+ assert (v.o2->s == "abc" && v.o2->o1->n == 123);
+ t.commit ();
+ }
+
+ {
+ // Check session interaction.
+ //
+ transaction t (db->begin ());
+ session s;
+ shared_ptr<object2> o2a (db->load<object2> (o2->id));
+ view1 v (db->query_value<view1> ());
+ assert (v.o2 == o2a);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ session s;
+ view2 v (db->query_value<view2> ());
+ assert (v.o1->n == 123 && v.o2->s == "abc" && v.o2->o1 == v.o1);
+ t.commit ();
+ }
+
+ shared_ptr<object3> o3 (new object3 (o2));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ session s;
+ view3 v (db->query_value<view3> ());
+ assert (v.o1->n == 123 && v.o3->o2->s == "abc" &&
+ v.o3->o2->o1 == v.o1);
+ t.commit ();
+ }
+
+ shared_ptr<object1> o1b (new object1 (234));
+ shared_ptr<object2> o2b (new object2 ("bcd", o1b));
+ shared_ptr<object4> o4 (new object4);
+ o4->o2.push_back (o2);
+ o4->o2.push_back (o2b);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1b);
+ db->persist (o2b);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view4 v (db->query_value<view4> ());
+ assert (v.o4->o2[0]->s == "abc" && v.o4->o2[0]->o1->n == 123 &&
+ v.o4->o2[1]->s == "bcd" && v.o4->o2[1]->o1->n == 234);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view5> query;
+ typedef odb::result<view5> result;
+
+ transaction t (db->begin ());
+ session s;
+ result r (db->query<view5> ("ORDER BY" + query::object1::id));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ {
+ const view5& v (*i);
+
+ assert (v.o4->o2[0]->s == "abc" && v.o4->o2[0]->o1->n == 123 &&
+ v.o4->o2[1]->s == "bcd" && v.o4->o2[1]->o1->n == 234 &&
+ v.o4->o2[0]->o1 == v.o1);
+ }
+ assert (++i != r.end ());
+ {
+ const view5& v (*i);
+
+ assert (v.o4->o2[0]->s == "abc" && v.o4->o2[0]->o1->n == 123 &&
+ v.o4->o2[1]->s == "bcd" && v.o4->o2[1]->o1->n == 234 &&
+ v.o4->o2[1]->o1 == v.o1);
+ }
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ shared_ptr<object5> o5 (new object5 (o1b, o2));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o5);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view6 v (db->query_value<view6> ());
+ assert (v.o1a->n == 123 && v.o1b->n == 234);
+ t.commit ();
+ }
+ }
+
+ // Test JOINs for pointed-to objects, existing and automatically added.
+ //
+ {
+ using namespace test3;
+
+ shared_ptr<object1> o1 (new object1 (123));
+ shared_ptr<object2> o2 (new object2 ("abc"));
+
+ o1->o2 = o2;
+ o2->o1 = o1;
+
+ {
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1a v (db->query_value<view1a> ());
+ // VC11
+ assert (v.o1->n == 123 && v.o1->o2.object_id<object2> () == o2->id);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1b v (db->query_value<view1b> ());
+ // VC11
+ assert (v.o1->n == 123 && v.o1->o2.object_id<object2> () == o2->id);
+ t.commit ();
+ }
+
+ // Container case.
+ //
+
+ shared_ptr<object3> o3 (new object3 (123));
+ shared_ptr<object4> o4 (new object4 ("abc"));
+
+ o3->o4 = o4;
+ o4->o3.push_back (o3);
+
+ {
+
+ transaction t (db->begin ());
+ db->persist (o3);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view2a v (db->query_value<view2a> ());
+ // VC11
+ assert (v.o3->n == 123 && v.o3->o4.object_id<object4> () == o4->id);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view2b v (db->query_value<view2b> ());
+ // VC11
+ assert (v.o3->n == 123 && v.o3->o4.object_id<object4> () == o4->id);
+ t.commit ();
+ }
+ }
+
+ // Test by-value load.
+ //
+ {
+ using namespace test4;
+
+ {
+ object1 o1 (1, 123);
+ object2 o2 (1, "abc", &o1);
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1 v (db->query_value<view1> ());
+ assert (v.o1.n == 123);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1a v (db->query_value<view1a> ());
+ assert (!v.o1_null && v.o1.n == 123);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1b v (db->query_value<view1b> ());
+ assert (/*v.o1_p == &v.o1 && */ v.o1.n == 123); // Copy ctor.
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<view1c> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view1c> ());
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+
+ object1 o1;
+ view1c v (o1);
+ i.load (v);
+
+ assert (v.o1_p == &o1 && o1.n == 123);
+
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ session s;
+ view2 v (db->query_value<view2> ());
+
+ // @@ BUILD2 As of cl 19.29.30136 (VS 2019 16.11.5) v.o2.o1 points to
+ // the address of o1 member of the object being returned by
+ // query_value<view2>() which v is a copy of, and thus the
+ // original assertion fails. Note that changing `view2 v` to
+ // `const view2& v` doesn't help.
+ //
+ //assert (v.o1.n == 123 && v.o2.s == "abc" && v.o2.o1 == &v.o1);
+ assert (v.o1.n == 123 && v.o2.s == "abc");
+ t.commit ();
+ }
+
+ object1 o1b (2, 234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1b);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view2a> query;
+
+ transaction t (db->begin ());
+ session s;
+ view2a v (db->query_value<view2a> (query::object1::id == 2));
+ assert (v.o1.n == 234 && v.o2_null);
+ t.commit ();
+ }
+
+ shared_ptr<object3> o3 (new object3 (1, 123));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ {
+ view3 v (db->query_value<view3> ());
+ assert (v.o3_p == &v.o3 && v.o3.n == 123); // Load into value.
+ }
+ session s; // Load into cache.
+ shared_ptr<object3> o3a (db->load<object3> (o3->id));
+ {
+ view3 v (db->query_value<view3> ());
+ assert (v.o3_p == o3a.get ()); // Load from cache.
+ }
+ t.commit ();
+ }
+ }
+
+ // Test NULL object pointers.
+ //
+ {
+ using namespace test5;
+
+ shared_ptr<object1> o1a (new object1 (123));
+ shared_ptr<object1> o1b (new object1 (234));
+ shared_ptr<object2> o2 (new object2 ("abc", o1a));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1a);
+ db->persist (o1b);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view1> query;
+ typedef odb::result<view1> result;
+
+ transaction t (db->begin ());
+ session s;
+ result r (db->query<view1> ("ORDER BY" + query::object1::id));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ {
+ const view1& v (*i);
+ assert (v.o1->n == 123 && v.o2->s == "abc" && v.o2->o1 == v.o1);
+ }
+ assert (++i != r.end ());
+ {
+ const view1& v (*i);
+ assert (v.o1->n == 234 && !v.o2);
+ }
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ shared_ptr<object3> o3a (new object3 (make_pair (1, 1), 123));
+ shared_ptr<object3> o3b (new object3 (make_pair (2, 2), 234));
+ shared_ptr<object4> o4 (new object4 ("abc", o3a));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o3a);
+ db->persist (o3b);
+ db->persist (o4);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view2> query;
+ typedef odb::result<view2> result;
+
+ transaction t (db->begin ());
+ session s;
+ result r (db->query<view2> ("ORDER BY" + query::object3::n));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ {
+ const view2& v (*i);
+ assert (v.o3->n == 123 && v.o4->s == "abc" && v.o4->o3 == v.o3);
+ }
+ assert (++i != r.end ());
+ {
+ const view2& v (*i);
+ assert (v.o3->n == 234 && !v.o4);
+ }
+ assert (++i == r.end ());
+ t.commit ();
+ }
+ }
+
+ // Test interaction with sections.
+ //
+ {
+ using namespace test6;
+
+ shared_ptr<object1> o1 (new object1 (123));
+ shared_ptr<object2> o2 (new object2 ("abc", o1));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ view1 v (db->query_value<view1> ());
+
+ assert (v.o1->n == 123 && v.o2->s == "abc" &&
+ !v.o2->r.loaded () && !v.o2->o1);
+
+ db->load (*v.o2, v.o2->r);
+ assert (v.o2->r.loaded () && v.o2->o1 && v.o2->o1->n == 123);
+
+ t.commit ();
+ }
+ }
+
+ // Test explicit conversion to smart pointer member.
+ //
+ {
+ using namespace test7;
+
+ object1 o1 (123);
+ object2 o2 ("abc", &o1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ session s;
+ view1 v (db->query_value<view1> ());
+ assert (v.o1->n == 123 && v.o2->s == "abc" && v.o2->o1 == v.o1.get ());
+ t.commit ();
+ }
+ }
+
+ // Test loading objects without id.
+ //
+ {
+ using namespace test8;
+
+ object1 o1 (123);
+ object2 o2 ("abc", &o1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ session s;
+ view1 v (db->query_value<view1> ());
+ assert (v.o1->n == 123 && v.o2->s == "abc" && v.o2->o1 == v.o1.get ());
+ t.commit ();
+ }
+ }
+
+ // Test loading polymorphic objects.
+ //
+ {
+ using namespace test9;
+
+ root r (1);
+ base b (2, "a");
+ derived d (3, "b", true);
+
+ {
+ transaction t (db->begin ());
+ db->persist (r);
+ db->persist (b);
+ db->persist (d);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ // Load via root.
+ //
+ {
+ view1r r (db->query_value<view1r> (query<view1r>::n == 1));
+ auto& o (*r.o);
+ assert (r.n == 1 && r.o->n == 1 && typeid (o) == typeid (root));
+ }
+
+ {
+ view1r r (db->query_value<view1r> (query<view1r>::n == 2));
+ auto& o (*r.o);
+ assert (r.n == 2 && r.o->n == 2 && typeid (o) == typeid (base));
+ base& b (dynamic_cast<base&> (*r.o));
+ assert (b.s == "a");
+ }
+
+ {
+ view1r r (db->query_value<view1r> (query<view1r>::n == 3));
+ auto& o (*r.o);
+ assert (r.n == 3 && r.o->n == 3 && typeid (o) == typeid (derived));
+ derived& d (dynamic_cast<derived&> (o));
+ assert (d.s == "b" && d.b);
+ }
+
+ // Load via base.
+ //
+ {
+ view1b r (db->query_value<view1b> (query<view1b>::n == 2));
+ assert (r.s == "a" && r.n == 2 && r.o->n == 2 && b.s == "a");
+ }
+
+ {
+ view1b r (db->query_value<view1b> (query<view1b>::n == 3));
+ auto& o (*r.o);
+ assert (r.s == "b" && r.n == 3 && r.o->n == 3 &&
+ typeid (o) == typeid (derived));
+ derived& d (dynamic_cast<derived&> (o));
+ assert (d.s == "b" && d.b);
+ }
+
+ // Load via derived.
+ //
+ {
+ view1d r (db->query_value<view1d> ());
+ assert (r.s == "b" && r.n == 3 &&
+ r.o->n == 3 && r.o->s == "b" && r.o->b);
+ }
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/view/olv/test1.hxx b/odb-tests/common/view/olv/test1.hxx
new file mode 100644
index 0000000..0de9483
--- /dev/null
+++ b/odb-tests/common/view/olv/test1.hxx
@@ -0,0 +1,116 @@
+// file : common/view/olv/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#include <string>
+#include <memory> // unique_ptr
+#include <utility> // std::move
+
+#include <odb/core.hxx>
+
+// Test basic object loading functionality.
+//
+#pragma db namespace table("t1_") pointer(std::unique_ptr)
+namespace test1
+{
+ #pragma db object
+ struct object1
+ {
+ object1 (int id_ = 0, int n_ = 0): id (id_), n (n_) {}
+
+ #pragma db id
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (int id_ = 0, const char* s_ = ""): id (id_), s (s_) {}
+
+ #pragma db id
+ int id;
+
+ std::string s;
+ };
+
+ #pragma db view object(object1) object(object2: object1::id == object2::id)
+ struct view1
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view1 () {}
+ view1 (view1&& x): o2 (std::move (x.o2)) {}
+
+ std::unique_ptr<object2> o2;
+ };
+
+ #pragma db view object(object1) object(object2: object1::id == object2::id)
+ struct view2
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view2 () {}
+ view2 (view2&& x): o2 (std::move (x.o2)), o1 (std::move (x.o1)) {}
+
+ std::unique_ptr<object2> o2;
+ std::unique_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1 = o1) object(object2 = o2: o1::id == o2::id)
+ struct view3
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view3 () {}
+ view3 (view3&& x): o1 (std::move (x.o1)), o2 (std::move (x.o2)) {}
+
+ std::unique_ptr<object1> o1;
+ std::unique_ptr<object2> o2;
+ };
+
+ #pragma db view object(object1 = o1) object(object2 = o2: o1::id == o2::id)
+ struct view4
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view4 () {}
+ view4 (view4&& x): s (std::move (x.s)),
+ o2 (std::move (x.o2)),
+ id (x.id),
+ o1 (std::move (x.o1)),
+ n (x.n) {}
+
+ std::string s;
+ std::unique_ptr<object2> o2;
+
+ #pragma db column(o1::id)
+ int id;
+
+ std::unique_ptr<object1> o1;
+ int n;
+ };
+
+ #pragma db view \
+ object(object1) \
+ object(object2: object1::id == object2::id) \
+ object(object1 = o1b: object1::id == o1b::n)
+ struct view5
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view5 () {}
+ view5 (view5&& x): o1a (std::move (x.o1a)),
+ o2 (std::move (x.o2)),
+ o1b (std::move (x.o1b)) {}
+
+ std::unique_ptr<object1> o1a;
+ std::unique_ptr<object2> o2;
+ std::unique_ptr<object1> o1b;
+ };
+}
+
+#endif // TEST1_HXX
diff --git a/odb-tests/common/view/olv/test2.hxx b/odb-tests/common/view/olv/test2.hxx
new file mode 100644
index 0000000..a769daa
--- /dev/null
+++ b/odb-tests/common/view/olv/test2.hxx
@@ -0,0 +1,122 @@
+// file : common/view/olv/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#include <string>
+#include <vector>
+#include <memory> // shared_ptr
+
+#include <odb/core.hxx>
+
+// Test loading of object pointers inside objects.
+//
+#pragma db namespace table("t2_") pointer(std::shared_ptr) session
+namespace test2
+{
+ using std::shared_ptr;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const char* s_, shared_ptr<object1> o1_): s (s_), o1 (o1_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ shared_ptr<object2> o2;
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view2
+ {
+ shared_ptr<object2> o2; // "Unfortunate" order.
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db object
+ struct object3
+ {
+ object3 () {}
+ object3 (shared_ptr<object2> o2_): o2 (o2_) {}
+
+ #pragma db id auto
+ int id;
+
+ shared_ptr<object2> o2;
+ };
+
+ #pragma db view object(object1) object(object2) object(object3)
+ struct view3
+ {
+ shared_ptr<object3> o3; // "Unfortunate" order.
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db object
+ struct object4
+ {
+ #pragma db id auto
+ int id;
+
+ std::vector<shared_ptr<object2>> o2;
+ };
+
+ #pragma db view object(object4)
+ struct view4
+ {
+ shared_ptr<object4> o4;
+ };
+
+ #pragma db view object(object4) object (object2) object(object1)
+ struct view5
+ {
+ shared_ptr<object4> o4; // "Unfortunate" order.
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db object
+ struct object5
+ {
+ object5 () {}
+ object5 (shared_ptr<object1> o1_, shared_ptr<object2> o2_)
+ : o1 (o1_), o2 (o2_) {}
+
+ #pragma db id auto
+ int id;
+
+ shared_ptr<object1> o1;
+ shared_ptr<object2> o2;
+ };
+
+ #pragma db view object(object5) object (object2) \
+ object(object1 = o1a: object2::o1) \
+ object(object1 = o1b: object5::o1)
+ struct view6
+ {
+ shared_ptr<object1> o1a;
+ shared_ptr<object1> o1b;
+ };
+}
+
+#endif // TEST2_HXX
diff --git a/odb-tests/common/view/olv/test3.hxx b/odb-tests/common/view/olv/test3.hxx
new file mode 100644
index 0000000..8cf4344
--- /dev/null
+++ b/odb-tests/common/view/olv/test3.hxx
@@ -0,0 +1,106 @@
+// file : common/view/olv/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#include <string>
+#include <vector>
+#include <memory> // shared_ptr
+
+#include <odb/core.hxx>
+#include <odb/lazy-ptr.hxx>
+
+// Test JOINs for pointed-to objects, existing and automatically added.
+//
+#pragma db namespace table("t3_") pointer(std::shared_ptr) session
+namespace test3
+{
+ using std::shared_ptr;
+
+ struct object2;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+
+ #pragma db inverse(o1)
+ odb::lazy_weak_ptr<object2> o2;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (const char* s_ = ""): s (s_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1a // Existing JOIN.
+ {
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1)
+ struct view1b // Automatic JOIN.
+ {
+ shared_ptr<object1> o1;
+ };
+
+ // Container case.
+ //
+ struct object4;
+
+ #pragma db object
+ struct object3
+ {
+ object3 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+
+ #pragma db inverse(o3)
+ odb::lazy_weak_ptr<object4> o4;
+ };
+
+ #pragma db object
+ struct object4
+ {
+ object4 (const char* s_ = ""): s (s_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+
+ std::vector<shared_ptr<object3>> o3;
+ };
+
+ #pragma db view object(object3) object(object4 = o4)
+ struct view2a // Existing JOIN.
+ {
+ shared_ptr<object3> o3;
+ };
+
+ #pragma db view object(object3)
+ struct view2b // Automatic JOIN.
+ {
+ shared_ptr<object3> o3;
+ };
+}
+
+#endif // TEST3_HXX
diff --git a/odb-tests/common/view/olv/test4.hxx b/odb-tests/common/view/olv/test4.hxx
new file mode 100644
index 0000000..f2af5fd
--- /dev/null
+++ b/odb-tests/common/view/olv/test4.hxx
@@ -0,0 +1,151 @@
+// file : common/view/olv/test4.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST4_HXX
+#define TEST4_HXX
+
+#include <string>
+#include <memory> // shared_ptr
+
+#include <odb/core.hxx>
+
+// Test by-value load.
+//
+#pragma db namespace table("t4_") session
+namespace test4
+{
+ #pragma db object
+ struct object1
+ {
+ object1 (int id_ = 0, int n_ = 0): id (id_), n (n_) {}
+
+ #pragma db id
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (int id_ = 0, const char* s_ = "", object1* o1_ = 0)
+ : id (id_), s (s_), o1 (o1_) {}
+
+ #pragma db id
+ int id;
+
+ std::string s;
+ object1* o1; // Shallow copy.
+ };
+
+ typedef object1* object1_ptr;
+ typedef object2* object2_ptr;
+
+ #pragma db view object(object1)
+ struct view1
+ {
+ #pragma db member(o1_) virtual(object1_ptr) get(&this.o1) set()
+
+ #pragma db transient
+ object1 o1;
+ };
+
+ #pragma db view object(object1) transient
+ struct view1a
+ {
+ view1a (): o1_null (true) {}
+
+ #pragma db member(o1_) virtual(object1_ptr) get(&this.o1) \
+ set(this.o1_null = !(?))
+
+ object1 o1;
+ bool o1_null;
+ };
+
+ #pragma db view object(object1)
+ struct view1b
+ {
+ view1b (): o1_p (0) {}
+
+ #pragma db transient
+ object1 o1;
+
+ #pragma db get(&this.o1) set(o1_p = (?))
+ object1* o1_p;
+ };
+
+ #pragma db view object(object1)
+ struct view1c
+ {
+ view1c (object1& o1): o1_p (&o1) {}
+
+ object1* o1_p;
+ };
+
+ #pragma db view object(object1) object(object2) transient
+ struct view2
+ {
+ #pragma db member(o2_) virtual(object2_ptr) get(&this.o2) set()
+ #pragma db member(o1_) virtual(object1_ptr) get(&this.o1) set()
+
+ object1 o1;
+ object2 o2;
+ };
+
+ #pragma db view object(object1) object(object2) transient
+ struct view2a
+ {
+ #pragma db member(o2_) virtual(object2_ptr) get(&this.o2) \
+ set(o2_null = !(?))
+ #pragma db member(o1_) virtual(object1_ptr) get(&this.o1) set()
+
+ object1 o1;
+ object2 o2;
+ bool o2_null;
+ };
+
+ // Test loading into raw pointer with non-raw object pointer.
+ //
+ using std::shared_ptr;
+
+ #pragma db object pointer(shared_ptr)
+ struct object3
+ {
+ object3 (int id_ = 0, int n_ = 0): id (id_), n (n_) {}
+
+ #pragma db id
+ int id;
+
+ int n;
+ };
+
+ #pragma db view object(object3)
+ struct view3
+ {
+ // This view implements the following slightly twisted logic: if the
+ // object is already in the cache, then set o3_p to that. Otherwise,
+ // load it into the by-value instance. We can also check whether o3_p
+ // points to o3 to distinguish between the two outcomes.
+ //
+
+ // Since we may be getting the pointer as both smart and raw, we
+ // need to create a bit of support code to use in the modifier
+ // expression.
+ //
+ void set_o3 (object3* p) {o3_p = p;} // &o3 or NULL.
+ void set_o3 (shared_ptr<object3> p) {o3_p = p.get ();} // From cache.
+
+ #pragma db get(&this.o3) set(set_o3(?))
+ object3* o3_p;
+
+ #pragma db transient
+ object3 o3;
+
+ // Return-by-value support (query_value()).
+ //
+ view3 (): o3_p (0) {}
+ view3 (const view3& x): o3_p (x.o3_p == &x.o3 ? &o3 : x.o3_p), o3 (x.o3) {}
+ };
+}
+
+#endif // TEST4_HXX
diff --git a/odb-tests/common/view/olv/test5.hxx b/odb-tests/common/view/olv/test5.hxx
new file mode 100644
index 0000000..e3a671b
--- /dev/null
+++ b/odb-tests/common/view/olv/test5.hxx
@@ -0,0 +1,86 @@
+// file : common/view/olv/test5.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST5_HXX
+#define TEST5_HXX
+
+#include <string>
+#include <memory> // shared_ptr
+#include <utility> // pair
+
+#include <odb/core.hxx>
+
+// Test NULL object pointers.
+//
+#pragma db namespace table("t5_") pointer(std::shared_ptr) session
+namespace test5
+{
+ using std::shared_ptr;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const char* s_, shared_ptr<object1> o1_): s (s_), o1 (o1_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ shared_ptr<object1> o1;
+ shared_ptr<object2> o2;
+ };
+
+ typedef std::pair<int, int> comp_id;
+ #pragma db value(comp_id)
+
+ #pragma db object
+ struct object3
+ {
+ object3 (comp_id id_ = comp_id (), int n_ = 0): id (id_), n (n_) {}
+
+ #pragma db id
+ comp_id id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object4
+ {
+ object4 () {}
+ object4 (const char* s_, shared_ptr<object3> o3_): s (s_), o3 (o3_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+ shared_ptr<object3> o3;
+ };
+
+ #pragma db view object(object3) object(object4)
+ struct view2
+ {
+ shared_ptr<object4> o4;
+ shared_ptr<object3> o3;
+ };
+}
+
+#endif // TEST5_HXX
diff --git a/odb-tests/common/view/olv/test6.hxx b/odb-tests/common/view/olv/test6.hxx
new file mode 100644
index 0000000..5336fa6
--- /dev/null
+++ b/odb-tests/common/view/olv/test6.hxx
@@ -0,0 +1,57 @@
+// file : common/view/olv/test6.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST6_HXX
+#define TEST6_HXX
+
+#include <string>
+#include <memory> // shared_ptr
+
+#include <odb/core.hxx>
+#include <odb/section.hxx>
+
+// Test interaction with sections.
+//
+#pragma db namespace table("t6_") pointer(std::shared_ptr)
+namespace test6
+{
+ using std::shared_ptr;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const char* s_, shared_ptr<object1> o1_): s (s_), o1 (o1_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+
+ #pragma db load(lazy)
+ odb::section r;
+
+ #pragma db section(r)
+ shared_ptr<object1> o1;
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ shared_ptr<object1> o1;
+ shared_ptr<object2> o2;
+ };
+}
+
+#endif // TEST6_HXX
diff --git a/odb-tests/common/view/olv/test7.hxx b/odb-tests/common/view/olv/test7.hxx
new file mode 100644
index 0000000..dbdc663
--- /dev/null
+++ b/odb-tests/common/view/olv/test7.hxx
@@ -0,0 +1,57 @@
+// file : common/view/olv/test7.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST7_HXX
+#define TEST7_HXX
+
+#include <string>
+#include <memory> // unique_ptr
+#include <utility> // std::move
+
+#include <odb/core.hxx>
+
+// Test explicit conversion to smart pointer member.
+//
+#pragma db namespace table("t7_") pointer(*) session
+namespace test7
+{
+ using std::unique_ptr;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 () {}
+ object2 (const char* s_, object1* o1_): s (s_), o1 (o1_) {}
+
+ #pragma db id auto
+ int id;
+
+ std::string s;
+ object1* o1; // Shallow.
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view1 () {}
+ view1 (view1&& x): o2 (std::move (x.o2)), o1 (std::move (x.o1)) {}
+
+ unique_ptr<object2> o2;
+ unique_ptr<object1> o1;
+ };
+}
+
+#endif // TEST7_HXX
diff --git a/odb-tests/common/view/olv/test8.hxx b/odb-tests/common/view/olv/test8.hxx
new file mode 100644
index 0000000..607d222
--- /dev/null
+++ b/odb-tests/common/view/olv/test8.hxx
@@ -0,0 +1,54 @@
+// file : common/view/olv/test8.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST8_HXX
+#define TEST8_HXX
+
+#include <string>
+#include <memory> // unique_ptr
+#include <utility> // std::move
+
+#include <odb/core.hxx>
+
+// Test loading objects without id.
+//
+#pragma db namespace table("t8_") pointer(*) session
+namespace test8
+{
+ using std::unique_ptr;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object no_id
+ struct object2
+ {
+ object2 () {}
+ object2 (const char* s_, object1* o1_): s (s_), o1 (o1_) {}
+
+ std::string s;
+ object1* o1; // Shallow.
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ // VC12 workaround (no default move constructor generation).
+ //
+ view1 () {}
+ view1 (view1&& x): o2 (std::move (x.o2)), o1 (std::move (x.o1)) {}
+
+ unique_ptr<object2> o2;
+ unique_ptr<object1> o1;
+ };
+}
+
+#endif // TEST8_HXX
diff --git a/odb-tests/common/view/olv/test9.hxx b/odb-tests/common/view/olv/test9.hxx
new file mode 100644
index 0000000..b109de3
--- /dev/null
+++ b/odb-tests/common/view/olv/test9.hxx
@@ -0,0 +1,78 @@
+// file : common/view/olv/test9.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST9_HXX
+#define TEST9_HXX
+
+#include <string>
+#include <memory> // shared_ptr
+
+#include <odb/core.hxx>
+
+// Test loading polymorphic objects.
+//
+#pragma db namespace table("t9_") session
+namespace test9
+{
+ using std::shared_ptr;
+
+ #pragma db object polymorphic pointer(shared_ptr)
+ struct root
+ {
+ virtual ~root () {}
+ root (int n_ = 0): n (n_) {}
+
+ #pragma db id auto
+ int id;
+
+ int n;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (int n_ = 0, const char* s_ = ""): root (n_), s (s_) {}
+
+ std::string s;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (int n_ = 0, const char* s_ = "", bool b_ = false)
+ : base (n_, s_), b (b_) {}
+
+ bool b;
+ };
+
+ // Load via root.
+ //
+ #pragma db view object(root)
+ struct view1r
+ {
+ shared_ptr<root> o;
+ int n;
+ };
+
+ // Load via base.
+ //
+ #pragma db view object(base)
+ struct view1b
+ {
+ std::string s;
+ shared_ptr<base> o;
+ int n;
+ };
+
+ // Load via derived.
+ //
+ #pragma db view object(derived)
+ struct view1d
+ {
+ std::string s;
+ shared_ptr<derived> o;
+ int n;
+ };
+}
+
+#endif // TEST9_HXX
diff --git a/odb-tests/common/view/olv/testscript b/odb-tests/common/view/olv/testscript
new file mode 100644
index 0000000..160426d
--- /dev/null
+++ b/odb-tests/common/view/olv/testscript
@@ -0,0 +1,39 @@
+# file : common/view/olv/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql-schema.testscript
+
+ for s: $schemas
+ cat $out_base/"$s"($multi ? '-mysql' : '').sql | $create_schema_cmd
+ end;
+
+ $* ($multi ? 'mysql' : ) $mysql_options
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql-schema.testscript
+
+ for s: $schemas
+ $create_schema_cmd -f $out_base/"$s"($multi ? '-pgsql' : '').sql
+ end;
+
+ $* ($multi ? 'pgsql' : ) $pgsql_options
+}
diff --git a/odb-tests/common/virtual/buildfile b/odb-tests/common/virtual/buildfile
new file mode 100644
index 0000000..96d062e
--- /dev/null
+++ b/odb-tests/common/virtual/buildfile
@@ -0,0 +1,42 @@
+# file : common/virtual/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix virtual_ \
+ --generate-schema \
+ --generate-query \
+ --generate-session
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/virtual/driver.cxx b/odb-tests/common/virtual/driver.cxx
new file mode 100644
index 0000000..f96f543
--- /dev/null
+++ b/odb-tests/common/virtual/driver.cxx
@@ -0,0 +1,154 @@
+// file : common/virtual/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test virtual data members.
+//
+
+#include <memory> // std::auto_ptr
+#include <iostream>
+
+#include <odb/session.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test basic virtual data member functionality.
+ //
+ {
+ using namespace test1;
+
+ object o;
+ o.i (123);
+ o.c1.i = 123;
+ o.c1.s = "abc";
+ o.v1.push_back ("abc");
+ o.v1.push_back ("abd");
+ o.v1.push_back ("abe");
+ o.p1 = new object;
+
+ {
+ transaction t (db->begin ());
+ db->persist (*o.p1);
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id1.v));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+
+ // Test pragma resolution to virtual data member.
+ //
+ {
+ using namespace test2;
+
+ object1 o1 (1);
+ o1.o2 = new object2 (1);
+ o1.o2->o1 = &o1;
+
+ {
+ transaction t (db->begin ());
+ db->persist (*o1.o2);
+ o1.n1 = o1.o2->id;
+ db->persist (o1);
+ t.commit ();
+ }
+
+ {
+ session s;
+ transaction t (db->begin ());
+ unique_ptr<object1> p (db->load<object1> (o1.id));
+ t.commit ();
+
+ assert (p->o2->id == o1.o2->id);
+ }
+
+ {
+ typedef odb::query<view1> query;
+ typedef odb::result<view1> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view1> (query::object2::id == o1.o2->id));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->i == o1.n1);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view2> query;
+ typedef odb::result<view2> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view2> (query::o2::id == o1.o2->id));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->i == o1.n1);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::result<view3> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view3> ());
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->i == o1.n1);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+ }
+
+ // Use virtual data members to implement multi-member composite object id.
+ //
+ {
+ using namespace test3;
+
+ person o;
+ o.first_ = "John";
+ o.last_ = "Doe";
+
+ name id;
+ {
+ transaction t (db->begin ());
+ id = db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<person> p (db->load<person> (id));
+ t.commit ();
+
+ assert (o.first_ == p->first_ && o.last_ == p->last_);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/virtual/test.hxx b/odb-tests/common/virtual/test.hxx
new file mode 100644
index 0000000..2654d09
--- /dev/null
+++ b/odb-tests/common/virtual/test.hxx
@@ -0,0 +1,171 @@
+// file : common/virtual/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Test basic virtual data member functionality.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ #pragma db value
+ struct comp
+ {
+ int i;
+
+ #pragma db transient
+ std::string s;
+ #pragma db member(s_) virtual(std::string) access(s)
+
+ bool operator== (const comp& v) const
+ {
+ return i == v.i && s == v.s;
+ }
+ };
+
+ #pragma db object transient
+ struct object
+ {
+ object (): p1 (0) {}
+ ~object () {delete p1;}
+
+ struct {unsigned long v;} id1;
+
+ #pragma db id
+ #pragma db member(id) get(id1.v) virtual(unsigned long) set(id1.v)
+ #pragma db member(id) auto
+
+ int i () const {return i1;}
+ void i (int i) {i1 = i;}
+ int i1;
+
+ comp c1;
+ #pragma db member(c) virtual(comp) access(c1)
+
+ typedef std::vector<std::string> strings;
+ strings v1;
+ #pragma db member(v) virtual(strings) access(v1)
+
+ typedef object* object_ptr;
+ object_ptr p1;
+ #pragma db member(p) virtual(object_ptr) access(p1)
+
+ bool operator== (const object& o) const
+ {
+ return id1.v == o.id1.v &&
+ i1 == o.i1 &&
+ c1 == o.c1 &&
+ v1 == o.v1 &&
+ (p1 != 0 ? o.p1 != 0 && *p1 == *o.p1 : o.p1 == 0);
+ }
+ };
+
+ #pragma db member(object::i) virtual(int)
+}
+
+#pragma db member(test1::object::id) column("oid")
+
+// Test pragma resolution to virtual data member.
+//
+#pragma db namespace table("t2_")
+namespace test2
+{
+ struct object1;
+ struct object2;
+
+ typedef object1* object1_ptr;
+ typedef object2* object2_ptr;
+
+ #pragma db object
+ struct object2
+ {
+ object2 (unsigned long i = 0): id (i) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db inverse(o)
+ object1_ptr o1;
+ };
+
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long i = 0): id (i), o2 (0) {}
+ ~object1 () {delete o2;}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db transient
+ object2_ptr o2;
+ #pragma db member(o) virtual(object2_ptr) access(o2)
+
+ #pragma db transient
+ unsigned long n1;
+ #pragma db member(n) virtual(unsigned long) access(n1)
+ #pragma db index member(n)
+ };
+
+ #pragma db view object(object1) object(object2)
+ struct view1
+ {
+ #pragma db column(object1::n)
+ unsigned long i;
+ };
+
+ #pragma db view object(object1 = o1) object(object2 = o2: o1::n == o2::id)
+ struct view2
+ {
+ #pragma db column(o1::n)
+ unsigned long i;
+ };
+
+ #pragma db view object(object1: object1::n != 0)
+ struct view3
+ {
+ #pragma db column(test2::object1::n)
+ unsigned long i;
+ };
+}
+
+// Use virtual data members to implement multi-member composite object id.
+//
+#pragma db namespace table("t3_")
+namespace test3
+{
+ #pragma db value
+ struct name
+ {
+ name () {}
+ name (const std::string& f, const std::string& l)
+ : first (f), last(l) {}
+
+ std::string first;
+ std::string last;
+
+ bool operator< (const name& x) const
+ {
+ return first < x.first || (first == x.first && last < x.last);
+ }
+ };
+
+ #pragma db object transient
+ struct person
+ {
+ std::string first_;
+ std::string last_;
+
+ #pragma db member(name) virtual(name) id \
+ get(::test3::name (this.first_, this.last_)) \
+ set(this.first_ = (?).first; this.last_ = (?).last)
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/virtual/testscript b/odb-tests/common/virtual/testscript
new file mode 100644
index 0000000..769c7f9
--- /dev/null
+++ b/odb-tests/common/virtual/testscript
@@ -0,0 +1,33 @@
+# file : common/virtual/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/common/wrapper/buildfile b/odb-tests/common/wrapper/buildfile
new file mode 100644
index 0000000..57f43f2
--- /dev/null
+++ b/odb-tests/common/wrapper/buildfile
@@ -0,0 +1,40 @@
+# file : common/wrapper/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libodb = libodb%lib{odb}
+
+libs =
+
+for db: $databases
+ import libs += libodb-$db%lib{odb-$db}
+
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+for db: $databases
+{
+ exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi
+ <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta}
+}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix wrapper_ \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{database-client}: include = adhoc
diff --git a/odb-tests/common/wrapper/driver.cxx b/odb-tests/common/wrapper/driver.cxx
new file mode 100644
index 0000000..9c352fc
--- /dev/null
+++ b/odb-tests/common/wrapper/driver.cxx
@@ -0,0 +1,216 @@
+// file : common/wrapper/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test wrapper machinery.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_database (argc, argv));
+
+ // Test 1: simple values.
+ //
+ {
+ using namespace test1;
+
+ unsigned long id1, id2;
+ {
+ object1 o1;
+ object2 o2;
+
+ o1.num.reset (new int (123));
+ o1.nstrs.push_back (nullable_string ());
+ o1.nstrs.push_back (nullable_string ("123"));
+
+ o2.sstrs.push_back (str_sptr ());
+ o2.sstrs.push_back (str_sptr (new string ("123")));
+
+ transaction t (db->begin ());
+ id1 = db->persist (o1);
+ id2 = db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object1> o1 (db->load<object1> (id1));
+ unique_ptr<object2> o2 (db->load<object2> (id2));
+ t.commit ();
+
+ assert (*o1->num == 123);
+ assert (o1->str.get () == 0);
+ assert (o1->nstr.null ());
+ assert (o1->nstrs[0].null ());
+ assert (o1->nstrs[1].get () == "123");
+
+ assert (!o2->sstr);
+ assert (!o2->sstrs[0]);
+ assert (*o2->sstrs[1] == "123");
+ }
+ }
+
+ //
+ // Composite values.
+ //
+ unsigned long id;
+ {
+ comp_object co;
+
+ co.c1.reset (new comp1 ("123", 123));
+ co.vc1.push_back (comp1 ("1", 1));
+ co.vc1.push_back (comp1 ("2", 2));
+ co.vc1.push_back (comp1 ("3", 3));
+
+ co.c2.reset (new comp2 ("123", 123));
+ co.c2->strs.push_back ("1");
+ co.c2->strs.push_back ("2");
+ co.c2->strs.push_back ("3");
+
+ {
+ transaction t (db->begin ());
+ id = db->persist (co);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<comp_object> o (db->load<comp_object> (id));
+ t.commit ();
+
+ assert (*o->c1 == *co.c1);
+ assert (o->vc1 == co.vc1);
+ assert (*o->c2 == *co.c2);
+ }
+ }
+
+ //
+ // Containers.
+ //
+ {
+ cont_object co;
+
+ co.nums.reset (new vector<int>);
+ co.nums->push_back (1);
+ co.nums->push_back (2);
+ co.nums->push_back (3);
+
+ co.c.num = 123;
+ co.c.strs.reset (new vector<string>);
+ co.c.strs->push_back ("1");
+ co.c.strs->push_back ("2");
+ co.c.strs->push_back ("3");
+
+ {
+ transaction t (db->begin ());
+ id = db->persist (co);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<cont_object> o (db->load<cont_object> (id));
+ t.commit ();
+
+ assert (*o->nums == *co.nums);
+ assert (o->c == co.c);
+ }
+ }
+
+ // Test 5: composite NULL values.
+ //
+ {
+ using namespace test5;
+
+ object o1, o2;
+
+ o1.v.push_back (nullable<comp> ());
+
+ o2.p.reset (new comp (1, "a"));
+ o2.n = comp (2, "b");
+ o2.v.push_back (comp (3, "c"));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (p1->p.get () == 0);
+ assert (!p1->n);
+ assert (!p1->v[0]);
+
+ assert (p2->p.get () != 0 && *p2->p == *o2.p);
+ assert (p2->n && *p2->n == *o2.n);
+ assert (p2->v[0] && *p2->v[0] == *o2.v[0]);
+ }
+
+ // Update.
+ //
+ {
+ o1.p.reset (new comp (1, "a"));
+ o1.n = comp (2, "b");
+ o1.v[0] = comp (3, "c");
+
+ o2.p.reset ();
+ o2.n.reset ();
+ o2.v[0].reset ();
+
+ transaction t (db->begin ());
+ db->update (o1);
+ db->update (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> p1 (db->load<object> (o1.id));
+ unique_ptr<object> p2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (p1->p.get () != 0 && *p1->p == *o1.p);
+ assert (p1->n && *p1->n == *o1.n);
+ assert (p1->v[0] && *p1->v[0] == *o1.v[0]);
+
+ assert (p2->p.get () == 0);
+ assert (!p2->n);
+ assert (!p2->v[0]);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/common/wrapper/test.hxx b/odb-tests/common/wrapper/test.hxx
new file mode 100644
index 0000000..3ae4151
--- /dev/null
+++ b/odb-tests/common/wrapper/test.hxx
@@ -0,0 +1,214 @@
+// file : common/wrapper/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <memory> // std::unique_ptr
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+using odb::nullable;
+
+// Test 1: simple values.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ typedef nullable<std::string> nullable_string;
+
+ typedef std::unique_ptr<int> num_uptr;
+ typedef std::unique_ptr<std::string> str_uptr;
+ typedef std::shared_ptr<std::string> str_sptr;
+
+ #pragma db object table("obj1")
+ struct object1
+ {
+ #pragma db id auto
+ unsigned long id_;
+
+ num_uptr num;
+
+ #pragma db null
+ str_uptr str;
+
+ nullable_string nstr;
+ std::vector<nullable_string> nstrs;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ #pragma db id auto
+ unsigned long id_;
+
+ #pragma db null
+ str_sptr sstr;
+
+ #pragma db value_null
+ std::vector<str_sptr> sstrs;
+ };
+}
+
+//
+// Composite values.
+//
+
+#pragma db value
+struct comp1
+{
+ comp1 () {}
+ comp1 (const std::string& s, int n): str (s), num (n) {}
+
+ std::string str;
+ int num;
+};
+
+inline bool
+operator== (const comp1& x, const comp1& y)
+{
+ return x.str == y.str && x.num == y.num;
+}
+
+
+#pragma db value
+struct comp2
+{
+ comp2 () {}
+ comp2 (const std::string& s, int n): str (s), num (n) {}
+
+ std::string str;
+ int num;
+
+ std::vector<std::string> strs;
+};
+
+inline bool
+operator== (const comp2& x, const comp2& y)
+{
+ return x.str == y.str && x.num == y.num && x.strs == y.strs;
+}
+
+struct comp3;
+
+typedef std::unique_ptr<comp1> comp1_uptr;
+typedef std::unique_ptr<comp2> comp2_uptr;
+typedef std::unique_ptr<comp3> comp3_uptr;
+
+#pragma db object
+struct comp_object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ comp1_uptr c1; // Wrapped comp value.
+ std::vector<nullable<comp1> > vc1; // Container of wrapped comp values.
+ comp2_uptr c2; // Container inside wrapped comp value.
+};
+
+// This one is just a compilation test to cover more convolute cases.
+//
+#pragma db value
+struct comp3: comp2
+{
+ comp1_uptr c1;
+ std::vector<nullable<comp1> > vc1;
+};
+
+#pragma db object
+struct comp_object2
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ comp3_uptr c3;
+};
+
+//
+// Containers.
+//
+
+typedef std::unique_ptr<std::vector<int>> nums_uptr;
+typedef std::unique_ptr<std::vector<std::string>> strs_uptr;
+
+#pragma db value
+struct cont_comp
+{
+ int num;
+ strs_uptr strs;
+};
+
+inline bool
+operator== (const cont_comp& x, const cont_comp& y)
+{
+ return x.num == y.num && *x.strs == *y.strs;
+}
+
+#pragma db object
+struct cont_object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ nums_uptr nums; // Wrapped container.
+ cont_comp c; // Wrapped container in comp value.
+};
+
+// Test composite NULL values.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db value
+ struct base
+ {
+ base () {}
+ base (int n): num (n) {}
+
+ int num = 0;
+ };
+
+ inline bool
+ operator== (const base& x, const base& y)
+ {
+ return x.num == y.num;
+ }
+
+ #pragma db value
+ struct comp: base
+ {
+ comp () {}
+ comp (int n, const std::string s): base (n), str (s), extra (n + 1) {}
+
+ std::string str;
+ base extra;
+
+ odb::nullable<int> always_null;
+ };
+
+ inline bool
+ operator== (const comp& x, const comp& y)
+ {
+ return static_cast<const base&> (x) == y &&
+ x.str == y.str && x.extra == y.extra;
+ }
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db null
+ std::unique_ptr<comp> p;
+
+ odb::nullable<comp> n;
+
+ std::vector< odb::nullable<comp> > v;
+ };
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/common/wrapper/testscript b/odb-tests/common/wrapper/testscript
new file mode 100644
index 0000000..6630813
--- /dev/null
+++ b/odb-tests/common/wrapper/testscript
@@ -0,0 +1,33 @@
+# file : common/wrapper/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+
+: mysql
+:
+if $mysql
+{
+ .include ../../mysql.testscript
+
+ $create_schema;
+ $*
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../pgsql.testscript
+
+ $create_schema;
+ $*
+}
diff --git a/odb-tests/database-options.testscript b/odb-tests/database-options.testscript
new file mode 100644
index 0000000..2c0ee82
--- /dev/null
+++ b/odb-tests/database-options.testscript
@@ -0,0 +1,75 @@
+# file : database-options.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# For the enabled databases create the test driver option lists (*_options)
+# for subsequent use in the tests. Also create the database-specific client
+# option lists (*_client_options) and command lines (*_client_cmd) which can
+# be used as a base for the data manipulation commands.
+#
++if $mysql
+ mysql_options = --user $config.odb_tests.pgsql.user \
+ --database $config.odb_tests.pgsql.database
+
+ mysql_client_options = --user $config.odb_tests.pgsql.user \
+ --database $config.odb_tests.pgsql.database
+
+ if $defined(config.odb_tests.mysql.passwd)
+ mysql_options += --password $config.odb_tests.mysql.passwd
+ mysql_client_options += --password=$config.odb_tests.mysql.passwd
+ end
+
+ if $defined(config.odb_tests.mysql.host)
+ mysql_options += --host $config.odb_tests.mysql.host
+ mysql_client_options += --host $config.odb_tests.mysql.host
+ end
+
+ if $defined(config.odb_tests.mysql.port)
+ mysql_options += --port $config.odb_tests.mysql.port
+ mysql_client_options += --port $config.odb_tests.mysql.port
+ end
+
+ if $defined(config.odb_tests.mysql.socket)
+ mysql_options += --socket $config.odb_tests.mysql.socket
+ mysql_client_options += --socket $config.odb_tests.mysql.socket
+ end
+
+ mysql_client_cmd = $path($mysql_client) $mysql_client_options
+end
+
++if $sqlite
+ sqlite_options = --database odb-test.db
+
+ # Note that we currently don't manipulate the data using the sqlite3
+ # utility. Thus, we don't create the sqlite client option list and command
+ # line.
+ #
+end
+
++if $pgsql
+ pgsql_options = --user $config.odb_tests.pgsql.user \
+ --database $config.odb_tests.pgsql.database
+
+ pgsql_client_options = --quiet \
+ --set ON_ERROR_STOP=1 \
+ --username $config.odb_tests.pgsql.user \
+ --dbname $config.odb_tests.pgsql.database
+
+ if $defined(config.odb_tests.pgsql.host)
+ pgsql_options += --host $config.odb_tests.pgsql.host
+ pgsql_client_options += --host $config.odb_tests.pgsql.host
+ end
+
+ if $defined(config.odb_tests.pgsql.port)
+ pgsql_options += --port $config.odb_tests.pgsql.port
+ pgsql_client_options += --port $config.odb_tests.pgsql.port
+ end
+
+ pgsql_client_cmd = $path($pgsql_client) $pgsql_client_options
+
+ export PGOPTIONS=--client-min-messages=warning
+end
+
+# Set the default schema file name, which can be overridden by the subsequent
+# tests in their own scopes.
+#
+schema = test
diff --git a/odb-tests/evolution/add-column/driver.cxx b/odb-tests/evolution/add-column/driver.cxx
new file mode 100644
index 0000000..d4eb396
--- /dev/null
+++ b/odb-tests/evolution/add-column/driver.cxx
@@ -0,0 +1,125 @@
+// file : evolution/add-column/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test adding a new column.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (!p->str);
+ assert (p->num == 999);
+
+ // Migration.
+ //
+ p->str = "abc";
+ p->num = 123;
+ db->update (*p);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (p->str && *p->str == "abc");
+ assert (p->num == 123);
+
+ t.commit ();
+ }
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/add-column/model.hxx b/odb-tests/evolution/add-column/model.hxx
new file mode 100644
index 0000000..6ac9160
--- /dev/null
+++ b/odb-tests/evolution/add-column/model.hxx
@@ -0,0 +1,38 @@
+// file : evolution/add-column/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 3
+ odb::nullable<std::string> str;
+
+ #pragma db default(999)
+ unsigned long num;
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/add-column/test1.hxx b/odb-tests/evolution/add-column/test1.hxx
new file mode 100644
index 0000000..b0d7fda
--- /dev/null
+++ b/odb-tests/evolution/add-column/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/add-column/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/add-column/test2.hxx b/odb-tests/evolution/add-column/test2.hxx
new file mode 100644
index 0000000..b62530a
--- /dev/null
+++ b/odb-tests/evolution/add-column/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-column/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/add-column/test3.hxx b/odb-tests/evolution/add-column/test3.hxx
new file mode 100644
index 0000000..b24dba1
--- /dev/null
+++ b/odb-tests/evolution/add-column/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-column/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/add-foreign-key/driver.cxx b/odb-tests/evolution/add-foreign-key/driver.cxx
new file mode 100644
index 0000000..177b615
--- /dev/null
+++ b/odb-tests/evolution/add-foreign-key/driver.cxx
@@ -0,0 +1,173 @@
+// file : evolution/add-foreign-key/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test adding a foreign key.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+#ifdef DATABASE_SQLITE
+ // In SQLite we can only add foreign keys inline in the column
+ // definition.
+ //
+ db->connection ()->execute ("PRAGMA foreign_keys=OFF");
+#endif
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Both pointers are now NULL.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (p->o1 == 0 && p->o2 == 0);
+
+ // Migration. The foreign key constraint is not yet there.
+ //
+ p->o1 = new object1 (1);
+ p->o2 = new object2 (1);
+ db->update (*p);
+
+ t.commit ();
+ }
+
+ // Migration. Add the missing objects.
+ //
+ object1 o1 (1);
+ object2 o2 (1);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->o1->id_ == 1);
+ assert (p->o2->id_ == 1);
+ t.commit ();
+ }
+
+ // Now the foreign key constraint is there.
+ //
+ try
+ {
+ object o (2);
+ o.o1 = new object1 (2);
+ o.o2 = new object2 (2);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
+ // As well as the NOT NULL.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ object o (3);
+ o.o2 = 0;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+#endif
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/add-foreign-key/model.hxx b/odb-tests/evolution/add-foreign-key/model.hxx
new file mode 100644
index 0000000..f5fe26d
--- /dev/null
+++ b/odb-tests/evolution/add-foreign-key/model.hxx
@@ -0,0 +1,66 @@
+// file : evolution/add-foreign-key/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object2
+ {
+ object2 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+#endif
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 2
+ object (unsigned long id = 0): id_ (id) {}
+#else
+ object1* o1;
+
+ // There is no support for changing a column to NOT NULL in SQLite.
+ //
+#ifndef ODB_DATABASE_SQLITE
+ #pragma db not_null
+#endif
+ object2* o2;
+
+ object (unsigned long id = 0): id_ (id), o1 (0), o2 (0) {}
+ ~object () {delete o1; delete o2;}
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/add-foreign-key/test1.hxx b/odb-tests/evolution/add-foreign-key/test1.hxx
new file mode 100644
index 0000000..05c78c3
--- /dev/null
+++ b/odb-tests/evolution/add-foreign-key/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/add-foreign-key/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/add-foreign-key/test2.hxx b/odb-tests/evolution/add-foreign-key/test2.hxx
new file mode 100644
index 0000000..c57d9a1
--- /dev/null
+++ b/odb-tests/evolution/add-foreign-key/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-foreign-key/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/add-foreign-key/test3.hxx b/odb-tests/evolution/add-foreign-key/test3.hxx
new file mode 100644
index 0000000..c844469
--- /dev/null
+++ b/odb-tests/evolution/add-foreign-key/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-foreign-key/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/add-index/driver.cxx b/odb-tests/evolution/add-index/driver.cxx
new file mode 100644
index 0000000..689504e
--- /dev/null
+++ b/odb-tests/evolution/add-index/driver.cxx
@@ -0,0 +1,165 @@
+// file : evolution/add-index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test adding a new index.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o0 (0);
+ o0.num = 123;
+
+ object o1 (1);
+ o1.num = 234;
+
+ object o2 (2);
+ o2.num = 234;
+
+ // Duplicates are ok.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o0);
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ object o3 (3);
+ o3.num = 234;
+
+ // Duplicates are still ok but we need to remove them before the
+ // post migration step.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (
+ "ORDER BY" + query::num + "," + query::id));
+
+ unsigned long prev (0);
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ {
+ if (i->num == prev)
+ db->erase (*i);
+
+ prev = i->num;
+ }
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p0 (db->load<object> (0));
+ auto_ptr<object> p1 (db->load<object> (1));
+
+ assert (p0->num == 123);
+ assert (p1->num == 234);
+
+ t.commit ();
+ }
+
+ try
+ {
+ object o2 (2);
+ o2.num = 234;
+
+ transaction t (db->begin ());
+ db->persist (o2);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/add-index/model.hxx b/odb-tests/evolution/add-index/model.hxx
new file mode 100644
index 0000000..fec75cc
--- /dev/null
+++ b/odb-tests/evolution/add-index/model.hxx
@@ -0,0 +1,33 @@
+// file : evolution/add-index/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 3
+ #pragma db unique
+#endif
+ unsigned long num;
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/add-index/test1.hxx b/odb-tests/evolution/add-index/test1.hxx
new file mode 100644
index 0000000..1be2b5b
--- /dev/null
+++ b/odb-tests/evolution/add-index/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/add-index/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/add-index/test2.hxx b/odb-tests/evolution/add-index/test2.hxx
new file mode 100644
index 0000000..a0faca9
--- /dev/null
+++ b/odb-tests/evolution/add-index/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-index/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/add-index/test3.hxx b/odb-tests/evolution/add-index/test3.hxx
new file mode 100644
index 0000000..aab9c86
--- /dev/null
+++ b/odb-tests/evolution/add-index/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-index/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/add-table/driver.cxx b/odb-tests/evolution/add-table/driver.cxx
new file mode 100644
index 0000000..67b0f0e
--- /dev/null
+++ b/odb-tests/evolution/add-table/driver.cxx
@@ -0,0 +1,140 @@
+// file : evolution/add-table/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test adding a new table (object, container).
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ // SQLite has broken foreign keys when it comes to DDL.
+ //
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=OFF");
+#endif
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=ON");
+#endif
+ }
+
+ object o (1);
+ o.str = "abc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ object1 o1;
+ o1.nums.push_back (1);
+ o1.nums.push_back (2);
+ o1.nums.push_back (3);
+
+ {
+ transaction t (db->begin ());
+ o1.o = db->load<object> (1);
+ db->persist (o1);
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ typedef odb::query<object1> query;
+ typedef odb::result<object1> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::o->str == "abc"));
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e &&
+ i->o->id_ == 1 &&
+ i->nums[0] == 1 && i->nums[1] == 2 && i->nums[2] == 3);
+ assert (++i == e);
+
+ t.commit ();
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/add-table/model.hxx b/odb-tests/evolution/add-table/model.hxx
new file mode 100644
index 0000000..208a156
--- /dev/null
+++ b/odb-tests/evolution/add-table/model.hxx
@@ -0,0 +1,48 @@
+// file : evolution/add-table/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <vector>
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object1
+ {
+ object1 (): o (0) {}
+ ~object1 () {delete o;}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ object* o;
+ std::vector<int> nums;
+ };
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/add-table/test1.hxx b/odb-tests/evolution/add-table/test1.hxx
new file mode 100644
index 0000000..adc51a1
--- /dev/null
+++ b/odb-tests/evolution/add-table/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/add-table/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/add-table/test2.hxx b/odb-tests/evolution/add-table/test2.hxx
new file mode 100644
index 0000000..ca03cef
--- /dev/null
+++ b/odb-tests/evolution/add-table/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-table/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/add-table/test3.hxx b/odb-tests/evolution/add-table/test3.hxx
new file mode 100644
index 0000000..39406a2
--- /dev/null
+++ b/odb-tests/evolution/add-table/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/add-table/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/alter-column/driver.cxx b/odb-tests/evolution/alter-column/driver.cxx
new file mode 100644
index 0000000..be63f05
--- /dev/null
+++ b/odb-tests/evolution/alter-column/driver.cxx
@@ -0,0 +1,160 @@
+// file : evolution/alter-column/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test altering a column.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+
+ // SQLite doesn't support altering of columns.
+ //
+#ifndef DATABASE_SQLITE
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o (1);
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // NULL is already in effect; NOT NULL is not yet.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (!p->str);
+ assert (p->num && *p->num == 123);
+ assert (!p->num1);
+
+ // Migration.
+ //
+ p->str = "abc";
+ p->num.reset ();
+ p->num1 = 123;
+ db->update (*p);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (p->str && *p->str == "abc");
+ assert (!p->num);
+
+ t.commit ();
+ }
+
+ // NOT NULL is now in effect.
+ //
+ try
+ {
+ object o2 (2);
+ o2.num1 = 234; // str is NULL
+
+ transaction t (db->begin ());
+ db->persist (o2);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
+ try
+ {
+ object o3 (3);
+ o3.str = "bcd"; // num1 is NULL
+
+ transaction t (db->begin ());
+ db->persist (o3);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+#endif // DATABASE_SQLITE
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/alter-column/model.hxx b/odb-tests/evolution/alter-column/model.hxx
new file mode 100644
index 0000000..fc6661c
--- /dev/null
+++ b/odb-tests/evolution/alter-column/model.hxx
@@ -0,0 +1,56 @@
+// file : evolution/alter-column/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ // SQLite doesn't support altering of columns.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+ odb::nullable<std::string> str;
+
+ unsigned long num;
+#else
+ // Use nullable to be able to access during migration.
+ //
+ #pragma db not_null
+ odb::nullable<std::string> str;
+
+ odb::nullable<unsigned long> num;
+
+ // Test adding NOT NULL column. It should be added NULL in pre
+ // and then converted to NOT NULL in post.
+ //
+ #pragma db not_null
+ odb::nullable<unsigned long> num1;
+#endif
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/alter-column/test1.hxx b/odb-tests/evolution/alter-column/test1.hxx
new file mode 100644
index 0000000..9353558
--- /dev/null
+++ b/odb-tests/evolution/alter-column/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/alter-column/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/alter-column/test2.hxx b/odb-tests/evolution/alter-column/test2.hxx
new file mode 100644
index 0000000..e2dbed3
--- /dev/null
+++ b/odb-tests/evolution/alter-column/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/alter-column/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/alter-column/test3.hxx b/odb-tests/evolution/alter-column/test3.hxx
new file mode 100644
index 0000000..ac08e2f
--- /dev/null
+++ b/odb-tests/evolution/alter-column/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/alter-column/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/combined/driver.cxx b/odb-tests/evolution/combined/driver.cxx
new file mode 100644
index 0000000..88453c3
--- /dev/null
+++ b/odb-tests/evolution/combined/driver.cxx
@@ -0,0 +1,157 @@
+// file : evolution/combined/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Combined schema evolution test.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o ("1");
+ o.dui = 1;
+ o.anui = 1;
+ o.dnui = 1;
+ o.dc = 1;
+ o.dt.push_back (1);
+ o.aui = 1;
+
+#ifndef DATABASE_SQLITE
+ o.dfk = new object1 (1);
+ o.acn = 1;
+ o.acnn.reset ();
+ o.afk = 1;
+#endif
+
+ {
+ transaction t (db->begin ());
+#ifndef DATABASE_SQLITE
+ db->persist (o.dfk);
+#endif
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> ("1"));
+
+ assert (p->ac1 == 999);
+ assert (!p->ac2);
+
+#ifndef DATABASE_SQLITE
+ assert (!p->ac3);
+#endif
+ // Migrate.
+ //
+ p->at.push_back ("abc");
+
+#ifndef DATABASE_SQLITE
+ p->dfk = 999;
+ p->ac3 = 1;
+ p->acn.reset ();
+ p->acnn = 1;
+#endif
+ db->update (*p);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> ("1"));
+
+ // Check post-migration.
+ //
+ assert (p->at[0] == "abc");
+
+#ifndef DATABASE_SQLITE
+ assert (p->dfk == 999);
+ assert (*p->ac3 == 1);
+ assert (!p->acn);
+ assert (*p->acnn == 1);
+#endif
+ t.commit ();
+ }
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/combined/model.hxx b/odb-tests/evolution/combined/model.hxx
new file mode 100644
index 0000000..e924943
--- /dev/null
+++ b/odb-tests/evolution/combined/model.hxx
@@ -0,0 +1,174 @@
+// file : evolution/combined/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ std::string id_;
+
+ //
+ // Pre pass 1.
+ //
+
+ // Drop unique index.
+ //
+#if MODEL_VERSION == 2
+ #pragma db unique
+#endif
+ unsigned long dui;
+
+ // Alter table drop foreign key. Not supported by SQLite.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+ object1* dfk;
+#else
+ #pragma db null
+ unsigned long dfk;
+#endif
+#endif
+
+ // Add table.
+ //
+#if MODEL_VERSION == 3
+ std::vector<std::string> at;
+#endif
+
+ // Add column.
+ //
+#if MODEL_VERSION == 3
+ #pragma db default(999)
+ unsigned long ac1;
+
+ odb::nullable<unsigned long> ac2;
+
+ // Initially added as NULL, converted to NOT NULL. Not supported by SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ #pragma db not_null
+ odb::nullable<unsigned long> ac3;
+#endif
+#endif
+
+ // Alter column NULL. Not supported by SQLite.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+ unsigned long acn;
+#else
+ odb::nullable<unsigned long> acn;
+#endif
+#endif
+
+ //
+ // Pre pass 2.
+ //
+
+ // Add non-unique indexes.
+ //
+#if MODEL_VERSION == 3
+ #pragma db index
+#endif
+ unsigned long anui;
+
+ //
+ // Post pass 1.
+ //
+
+ // Drop non-unique indexes.
+ //
+#if MODEL_VERSION == 2
+ #pragma db index
+#endif
+ unsigned long dnui;
+
+ //
+ // Post pass 2.
+ //
+
+ // Drop table.
+ //
+#if MODEL_VERSION == 2
+ std::vector<unsigned long> dt;
+#endif
+
+ // Drop column. Logical drop (set NULL) in SQLite.
+ //
+#if MODEL_VERSION == 2
+ unsigned long dc;
+#endif
+
+ // Alter column NOT NULL. Not supported by SQLite.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 3
+ #pragma db not_null
+#endif
+ odb::nullable<unsigned long> acnn;
+#endif
+
+ // Alter table add foreign key. Not supported by SQLite.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+ #pragma db null
+ unsigned long afk;
+#else
+ object1* afk;
+#endif
+#endif
+
+ // Add unique index.
+ //
+#if MODEL_VERSION == 3
+ #pragma db unique
+#endif
+ unsigned long aui;
+
+ public:
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+
+ object (std::string id = ""): id_ (id), dfk (0) {}
+ ~object () {delete dfk;}
+#else
+ object (std::string id = ""): id_ (id), afk (0) {}
+ ~object () {delete afk;}
+#endif
+#else
+ object (std::string id = ""): id_ (id) {}
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/combined/test1.hxx b/odb-tests/evolution/combined/test1.hxx
new file mode 100644
index 0000000..1a18aff
--- /dev/null
+++ b/odb-tests/evolution/combined/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/combined/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/combined/test2.hxx b/odb-tests/evolution/combined/test2.hxx
new file mode 100644
index 0000000..8eb7ac8
--- /dev/null
+++ b/odb-tests/evolution/combined/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/combined/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/combined/test3.hxx b/odb-tests/evolution/combined/test3.hxx
new file mode 100644
index 0000000..05a052f
--- /dev/null
+++ b/odb-tests/evolution/combined/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/combined/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/data/driver.cxx b/odb-tests/evolution/data/driver.cxx
new file mode 100644
index 0000000..73cc852
--- /dev/null
+++ b/odb-tests/evolution/data/driver.cxx
@@ -0,0 +1,178 @@
+// file : evolution/data/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test data migration support.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX, HAVE_CXX11
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+void
+migrate1 (database& db)
+{
+ using namespace v2;
+ using namespace v3;
+
+ auto_ptr<object1> o1 (db.load<object1> (1));
+ object2 o2 (1);
+ o2.num = o1->num;
+ db.persist (o2);
+}
+
+void
+migrate2 (database& db)
+{
+ using namespace v2;
+ using namespace v3;
+
+ auto_ptr<object1> o1 (db.load<object1> (2));
+ object2 o2 (2);
+ o2.num = o1->num;
+ db.persist (o2);
+}
+
+static const data_migration_entry<3, 1> migrate2_entry (&migrate2);
+
+int
+main (int argc, char* argv[])
+{
+ schema_catalog::data_migration_function<3, 1> (&migrate1);
+
+#ifdef HAVE_CXX11
+ schema_catalog::data_migration_function<3, 1> (
+ [] (database& db)
+ {
+ using namespace v2;
+ using namespace v3;
+
+ auto_ptr<object1> o1 (db.load<object1> (11));
+ object2 o2 (11);
+ o2.num = o1->num;
+ db.persist (o2);
+ });
+#endif
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+
+ {
+ object1 o1 (1);
+ o1.num = 123;
+ db->persist (o1);
+ }
+
+ {
+ object1 o1 (2);
+ o1.num = 123;
+ db->persist (o1);
+ }
+
+#ifdef HAVE_CXX11
+ {
+ object1 o1 (11);
+ o1.num = 123;
+ db->persist (o1);
+ }
+#endif
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ {
+ transaction t (db->begin ());
+
+ if (embedded)
+ schema_catalog::migrate (*db);
+ else
+ schema_catalog::migrate_data (*db);
+
+ t.commit ();
+ }
+
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+
+ {
+ auto_ptr<object2> o2 (db->load<object2> (1));
+ assert (o2->num == 123);
+ }
+
+ {
+ auto_ptr<object2> o2 (db->load<object2> (2));
+ assert (o2->num == 123);
+ }
+
+#ifdef HAVE_CXX11
+ {
+ auto_ptr<object2> o2 (db->load<object2> (11));
+ assert (o2->num == 123);
+ }
+#endif
+ t.commit ();
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/data/model.hxx b/odb-tests/evolution/data/model.hxx
new file mode 100644
index 0000000..680bc55
--- /dev/null
+++ b/odb-tests/evolution/data/model.hxx
@@ -0,0 +1,45 @@
+// file : evolution/data/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+#if MODEL_VERSION == 2
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object2
+ {
+ object2 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/data/test1.hxx b/odb-tests/evolution/data/test1.hxx
new file mode 100644
index 0000000..976ed04
--- /dev/null
+++ b/odb-tests/evolution/data/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/data/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/data/test2.hxx b/odb-tests/evolution/data/test2.hxx
new file mode 100644
index 0000000..bd72940
--- /dev/null
+++ b/odb-tests/evolution/data/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/data/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/data/test3.hxx b/odb-tests/evolution/data/test3.hxx
new file mode 100644
index 0000000..0f47099
--- /dev/null
+++ b/odb-tests/evolution/data/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/data/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/drop-column/driver.cxx b/odb-tests/evolution/drop-column/driver.cxx
new file mode 100644
index 0000000..7f0c253
--- /dev/null
+++ b/odb-tests/evolution/drop-column/driver.cxx
@@ -0,0 +1,126 @@
+// file : evolution/drop-column/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test dropping a column.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.ptr = new object1 (1, 2);
+
+ {
+ transaction t (db->begin ());
+ db->persist (*o.ptr);
+ db->persist (o);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Things are still there.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (p->str == "abc");
+ assert (p->num == 123);
+ assert (p->ptr->id.x == 1 && p->ptr->id.y == 2);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // Now they are gone.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "" && p->ptr == 0);
+ db->erase<object1> (value (1, 2)); // SQLite logical delete test.
+ t.commit ();
+ }
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/drop-column/model.hxx b/odb-tests/evolution/drop-column/model.hxx
new file mode 100644
index 0000000..09b63b9
--- /dev/null
+++ b/odb-tests/evolution/drop-column/model.hxx
@@ -0,0 +1,59 @@
+// file : evolution/drop-column/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db value
+ struct value
+ {
+ value (int x_ = 0, int y_ = 0): x (x_), y (y_) {}
+ int x;
+ int y;
+ };
+
+ #pragma db object
+ struct object1
+ {
+ object1 (int x = 0, int y = 0): id (x, y) {}
+
+ #pragma db id
+ value id;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id), ptr (0) {}
+ ~object () {delete ptr;}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ unsigned long num;
+ object1* ptr;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+ #pragma db member(object::num) deleted(3)
+ #pragma db member(object::ptr) deleted(3)
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/drop-column/test1.hxx b/odb-tests/evolution/drop-column/test1.hxx
new file mode 100644
index 0000000..1efb1fa
--- /dev/null
+++ b/odb-tests/evolution/drop-column/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/drop-column/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/drop-column/test2.hxx b/odb-tests/evolution/drop-column/test2.hxx
new file mode 100644
index 0000000..2842cd3
--- /dev/null
+++ b/odb-tests/evolution/drop-column/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-column/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/drop-column/test3.hxx b/odb-tests/evolution/drop-column/test3.hxx
new file mode 100644
index 0000000..d1ce616
--- /dev/null
+++ b/odb-tests/evolution/drop-column/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-column/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/drop-foreign-key/driver.cxx b/odb-tests/evolution/drop-foreign-key/driver.cxx
new file mode 100644
index 0000000..f829562
--- /dev/null
+++ b/odb-tests/evolution/drop-foreign-key/driver.cxx
@@ -0,0 +1,145 @@
+// file : evolution/drop-foreign-key/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test dropping a foreign key.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+
+ // SQLite doesn't support dropping of foreign keys.
+ //
+#ifndef DATABASE_SQLITE
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o (1);
+ o.o1 = new object (2);
+ o.o2 = new object (3);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o.o1);
+ db->persist (o.o2);
+ db->persist (o);
+ t.commit ();
+ }
+
+ // The foreign key constraint is there.
+ //
+ try
+ {
+ object o (11);
+ o.o1 = new object (12);
+ o.o2 = new object (13);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // The data is still there but the constraints are gone.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ assert (p->o1 == 2);
+ assert (p->o2 == 3);
+
+ db->erase<object> (p->o1);
+ db->erase<object> (p->o2);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->o1 == 2);
+ assert (p->o2 == 3);
+ t.commit ();
+ }
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+#endif // DATABASE_SQLITE
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/drop-foreign-key/model.hxx b/odb-tests/evolution/drop-foreign-key/model.hxx
new file mode 100644
index 0000000..eed8c46
--- /dev/null
+++ b/odb-tests/evolution/drop-foreign-key/model.hxx
@@ -0,0 +1,50 @@
+// file : evolution/drop-foreign-key/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ #pragma db id
+ unsigned long id_;
+
+ // SQLite doesn't support dropping of foreign keys.
+ //
+#ifndef DATABASE_SQLITE
+#if MODEL_VERSION == 2
+ object* o1;
+ object* o2;
+
+ object (unsigned long id = 0): id_ (id), o1 (0), o2 (0) {}
+ ~object () {delete o1; delete o2;}
+#else
+ #pragma db null
+ unsigned long o1;
+
+ #pragma db null
+ unsigned long o2;
+
+ object (unsigned long id = 0): id_ (id) {}
+#endif
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/drop-foreign-key/test1.hxx b/odb-tests/evolution/drop-foreign-key/test1.hxx
new file mode 100644
index 0000000..5476796
--- /dev/null
+++ b/odb-tests/evolution/drop-foreign-key/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/drop-foreign-key/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/drop-foreign-key/test2.hxx b/odb-tests/evolution/drop-foreign-key/test2.hxx
new file mode 100644
index 0000000..f091a25
--- /dev/null
+++ b/odb-tests/evolution/drop-foreign-key/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-foreign-key/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/drop-foreign-key/test3.hxx b/odb-tests/evolution/drop-foreign-key/test3.hxx
new file mode 100644
index 0000000..beb8c42
--- /dev/null
+++ b/odb-tests/evolution/drop-foreign-key/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-foreign-key/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/drop-index/driver.cxx b/odb-tests/evolution/drop-index/driver.cxx
new file mode 100644
index 0000000..5ad1cd4
--- /dev/null
+++ b/odb-tests/evolution/drop-index/driver.cxx
@@ -0,0 +1,154 @@
+// file : evolution/drop-index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test dropping an index.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ object o0 (0);
+ o0.num = 123;
+
+ object o1 (1);
+ o1.num = 234;
+
+ object o2 (2);
+ o2.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o0);
+ db->persist (o1);
+ t.commit ();
+ }
+
+ // Duplicates are not ok.
+ //
+ try
+ {
+ transaction t (db->begin ());
+ db->persist (o2);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Duplicates are now ok.
+ //
+ object o2 (2);
+ o2.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o2);
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p0 (db->load<object> (0));
+ auto_ptr<object> p1 (db->load<object> (1));
+ auto_ptr<object> p2 (db->load<object> (2));
+
+ assert (p0->num == 123);
+ assert (p1->num == 234);
+ assert (p2->num == 234);
+
+ t.commit ();
+ }
+
+ // Duplicates are still ok.
+ //
+ object o3 (3);
+ o3.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o3);
+ t.commit ();
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/drop-index/model.hxx b/odb-tests/evolution/drop-index/model.hxx
new file mode 100644
index 0000000..5e163ca
--- /dev/null
+++ b/odb-tests/evolution/drop-index/model.hxx
@@ -0,0 +1,33 @@
+// file : evolution/drop-index/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 2
+ #pragma db unique
+#endif
+ unsigned long num;
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/drop-index/test1.hxx b/odb-tests/evolution/drop-index/test1.hxx
new file mode 100644
index 0000000..5a279bb
--- /dev/null
+++ b/odb-tests/evolution/drop-index/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/drop-index/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/drop-index/test2.hxx b/odb-tests/evolution/drop-index/test2.hxx
new file mode 100644
index 0000000..78b89f2
--- /dev/null
+++ b/odb-tests/evolution/drop-index/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-index/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/drop-index/test3.hxx b/odb-tests/evolution/drop-index/test3.hxx
new file mode 100644
index 0000000..17b670d
--- /dev/null
+++ b/odb-tests/evolution/drop-index/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-index/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/drop-table/driver.cxx b/odb-tests/evolution/drop-table/driver.cxx
new file mode 100644
index 0000000..81cec55
--- /dev/null
+++ b/odb-tests/evolution/drop-table/driver.cxx
@@ -0,0 +1,168 @@
+// file : evolution/drop-table/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test dropping a table (object, container).
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ {
+ using namespace v2;
+
+ object1 o1;
+ o1.o = new object (1);
+ o1.o->str = "abc";
+ o1.nums.push_back (1);
+ o1.nums.push_back (2);
+ o1.nums.push_back (3);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1.o);
+ db->persist (o1);
+ t.commit ();
+ }
+ }
+
+ // Polymorphism test.
+ //
+ {
+ // We have to use v3 here because the discriminator includes
+ // the namespace.
+ //
+ using namespace v3;
+
+ base b (123, "abc");
+ derived d1 (234, "bcd");
+ derived d2 (345, "cde");
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ db->persist (d1);
+ db->persist (d2);
+ t.commit ();
+ }
+ }
+
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Both object and object1 are still there so we can migrate the data.
+ //
+ typedef odb::query<object1> query;
+ typedef odb::result<object1> result;
+
+ {
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::o->str == "abc"));
+ result::iterator i (r.begin ()), e (r.end ());
+
+ assert (i != e &&
+ i->o->id_ == 1 &&
+ i->nums[0] == 1 && i->nums[1] == 2 && i->nums[2] == 3);
+ assert (++i == e);
+
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // Only object is still there.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc");
+ t.commit ();
+ }
+
+ // Polymorphism test.
+ //
+ {
+ transaction t (db->begin ());
+ assert (size (db->query<root> ()) == 1);
+ assert (size (db->query<base> ()) == 1);
+ t.commit ();
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/drop-table/model.hxx b/odb-tests/evolution/drop-table/model.hxx
new file mode 100644
index 0000000..2c02d09
--- /dev/null
+++ b/odb-tests/evolution/drop-table/model.hxx
@@ -0,0 +1,94 @@
+// file : evolution/drop-table/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <vector>
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ };
+
+ #pragma db object
+ struct object1
+ {
+ object1 (): o (0) {}
+ ~object1 () {delete o;}
+
+ #pragma db id auto
+ unsigned long id_;
+
+ object* o;
+ std::vector<int> nums;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db object(object1) deleted(3)
+#endif
+
+ // Make sure we also clean up base tables when dropping a
+ // table corresponding to the polymorphic derived object.
+ //
+ #pragma db value
+ struct value
+ {
+ value (unsigned long n = 0, const std::string& s = ""): num (n), str (s) {}
+
+ unsigned long num;
+ std::string str;
+ };
+
+ #pragma db object polymorphic
+ struct root
+ {
+ root (unsigned long n = 0, const std::string& s = ""): id (n, s) {}
+ virtual ~root () {}
+
+ #pragma db id
+ value id;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (unsigned long n = 0, const std::string& s = "")
+ : root (n, s), num (n) {}
+
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (unsigned long n = 0, const std::string& s = "")
+ : base (n, s), str (s) {}
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db object(derived) deleted(3)
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/drop-table/test1.hxx b/odb-tests/evolution/drop-table/test1.hxx
new file mode 100644
index 0000000..a9ec64c
--- /dev/null
+++ b/odb-tests/evolution/drop-table/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/drop-table/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/drop-table/test2.hxx b/odb-tests/evolution/drop-table/test2.hxx
new file mode 100644
index 0000000..c9ec149
--- /dev/null
+++ b/odb-tests/evolution/drop-table/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-table/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/drop-table/test3.hxx b/odb-tests/evolution/drop-table/test3.hxx
new file mode 100644
index 0000000..8d3f17b
--- /dev/null
+++ b/odb-tests/evolution/drop-table/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/drop-table/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/embedded/driver.cxx b/odb-tests/evolution/embedded/driver.cxx
new file mode 100644
index 0000000..1816a5c
--- /dev/null
+++ b/odb-tests/evolution/embedded/driver.cxx
@@ -0,0 +1,181 @@
+// file : evolution/embedded/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test embedded schema migration.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#ifdef DATABASE_PGSQL
+# include <odb/pgsql/connection.hxx>
+#endif
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ t.commit ();
+ }
+
+ // PostgreSQL cannot continue a transaction after a query failed. We
+ // have a workaround but only for 9.4+.
+ //
+#ifdef DATABASE_PGSQL
+ {
+ odb::connection_ptr c (db->connection ());
+ int v (static_cast<odb::pgsql::connection&> (*c).server_version ());
+ if (v < 90400)
+ assert (db->schema_version () == 0);
+ }
+#endif
+
+ {
+ transaction t (db->begin ());
+ assert (db->schema_version () == 0);
+
+ schema_catalog::create_schema (*db, "", false);
+
+ assert (db->schema_version () == 1 && !db->schema_migration ());
+
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 2 && !db->schema_migration ());
+
+ {
+ transaction t (db->begin ());
+ object1 o1 (1);
+ o1.num = 123;
+ db->persist (o1);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v2;
+ using namespace v3;
+
+ // Check version information correctness.
+ //
+ assert (schema_catalog::base_version (*db) == 1);
+ assert (schema_catalog::current_version (*db) == 3);
+ assert (schema_catalog::next_version (*db, 0) == 3);
+ assert (schema_catalog::next_version (*db, 1) == 2);
+ assert (schema_catalog::next_version (*db) == 3);
+ assert (schema_catalog::next_version (*db, 3) == 4);
+
+ {
+ assert (db->schema_version () == 2 && !db->schema_migration ());
+
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 3 && db->schema_migration ());
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object1> o1 (db->load<object1> (1));
+ object2 o2 (1);
+ o2.num = o1->num;
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+
+ assert (db->schema_version () == 3 && !db->schema_migration ());
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // In transaction.
+ //
+ {
+ transaction t (db->begin ());
+ assert (db->schema_version () == 3 && !db->schema_migration ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object2> o2 (db->load<object2> (1));
+ assert (o2->num == 123);
+ t.commit ();
+ }
+
+ // Test the case where there is still no version table.
+ //
+ db->schema_version_migration (0, false);
+
+ {
+ transaction t (db->begin ());
+
+#ifdef DATABASE_ORACLE
+ db->execute ("DROP TABLE \"schema_version\"");
+#else
+ db->execute ("DROP TABLE schema_version");
+#endif
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 0);
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/embedded/model.hxx b/odb-tests/evolution/embedded/model.hxx
new file mode 100644
index 0000000..f3aa7a4
--- /dev/null
+++ b/odb-tests/evolution/embedded/model.hxx
@@ -0,0 +1,45 @@
+// file : evolution/embedded/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+#if MODEL_VERSION == 2
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object2
+ {
+ object2 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/embedded/test1.hxx b/odb-tests/evolution/embedded/test1.hxx
new file mode 100644
index 0000000..32903a1
--- /dev/null
+++ b/odb-tests/evolution/embedded/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/embedded/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/embedded/test2.hxx b/odb-tests/evolution/embedded/test2.hxx
new file mode 100644
index 0000000..fce8760
--- /dev/null
+++ b/odb-tests/evolution/embedded/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/embedded/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/embedded/test3.hxx b/odb-tests/evolution/embedded/test3.hxx
new file mode 100644
index 0000000..d49ecc5
--- /dev/null
+++ b/odb-tests/evolution/embedded/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/embedded/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/soft-add/driver.cxx b/odb-tests/evolution/soft-add/driver.cxx
new file mode 100644
index 0000000..c70edcb
--- /dev/null
+++ b/odb-tests/evolution/soft-add/driver.cxx
@@ -0,0 +1,2219 @@
+// file : evolution/soft-add/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test soft-add functionality.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v3; // NOTE: not v2.
+
+ if (embedded)
+ {
+ // SQLite has broken foreign keys when it comes to DDL.
+ //
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=OFF");
+#endif
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=ON");
+#endif
+ }
+
+ // Test basic soft-added member logic.
+ //
+ {
+ using namespace test2;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+ o.ptr = new object1 (1);
+ o.ptr->ptrs.push_back (&o);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "" && p->num == 123 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->str == "" && i->num == 123 &&
+ i->vec.empty () && i->ptr == 0);
+
+ try
+ {
+ db->query<object> (query::str.is_null ()); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+ o.ptr = new object1 (2);
+ o.ptr->ptrs.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 234 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ delete o.ptr;
+ o.ptr = 0;
+
+ {
+ transaction t (db->begin ());
+ db->erase<object1> (2);
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 235 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test empty statement handling (INSERT, UPDATE).
+ //
+ {
+ using namespace test3;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ object o;
+ o.str = "bcd";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "");
+ t.commit ();
+ }
+
+ o.str += 'e';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "");
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test empty statement handling (SELECT in polymorphic loader).
+ //
+ {
+ using namespace test4;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ object o (1);
+ o.str = "abc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<base> p (db->load<base> (1));
+ assert (static_cast<object&> (*p).str == "");
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-added value member.
+ //
+ {
+ using namespace test5;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.vec.push_back (value ("abc", 123));
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->vec[0].str == "" && p->vec[0].num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.vec.push_back (value ("bcd", 234));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "" && p->vec[0].num == 234);
+ t.commit ();
+ }
+
+ o.vec.modify (0).str += 'e';
+ o.vec.modify (0).num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "" && p->vec[0].num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-added member.
+ //
+ {
+ using namespace test6;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member.
+ //
+ {
+ using namespace test7;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ try
+ {
+ db->load (*p, p->s); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section.
+ //
+ {
+ using namespace test8;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "" && i->num == 123 && i->vec.empty ());
+
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // No longer automatically marked as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-added member logic in polymorphic classes.
+ //
+ {
+ using namespace test9;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (static_cast<object*> (db->load<base> (1)));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::id == 1));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+
+ try
+ {
+ db->query<base> (query::bstr == "ab"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->bstr == "" && i->dstr == "" && i->num);
+
+ try
+ {
+ db->query<object> (query::dstr == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member in polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+
+ try
+ {
+ db->load (*p, p->s); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section in polymorphic classes.
+ //
+ {
+ using namespace test11;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::id == 1));
+ result::iterator i (r.begin ());
+ db->load (*i, i->s);
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+
+ try
+ {
+ db->query<base> (query::bstr == "ab"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ db->load (*i, i->s);
+ assert (i != r.end () &&
+ i->bstr == "" && i->dstr == "" && i->num);
+
+ try
+ {
+ db->query<object> (query::dstr == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "" && p->dstr == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "" && p->dstr == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+
+ // Test empty statement detection in sections.
+ //
+ base b (3);
+ b.bstr = "bc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ auto_ptr<base> p (db->load<base> (3));
+ db->load (*p, p->s);
+ assert (p->bstr == "");
+ t.commit ();
+ }
+
+ b.bstr += 'd';
+ b.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (b);
+ auto_ptr<base> p (db->load<base> (3));
+ db->load (*p, p->s);
+ assert (p->bstr == "");
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (b);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ unsigned long long v (o.v_);
+ db->update (o);
+ assert (o.v_ != v);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 235 && p->v_ == o.v_);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o;
+ o.str = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+
+ result r (db->query<object> (query::num == 234));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 234);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase_query<object> (query::num == 234);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ unsigned long id;
+ {
+ object o;
+ o.str = "abc";
+ o.num = 123;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ id = o.id;
+ t.commit ();
+ }
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (id));
+ assert (p->str == "" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (o.id);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.num = 123;
+ o.vec.push_back (123);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->num == 123 && i->vec.empty ());
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ // None of the database operations should yet include the
+ // added members.
+ //
+ {
+ object o (1);
+ o.num = 123;
+ o.vec.push_back (123);
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->num == 123 && i->vec.empty ());
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++; // No longer automatically marks as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Test basic soft-added member logic.
+ //
+ {
+ using namespace test2;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->str = "abc";
+ p->vec.push_back (123);
+ delete p->ptr;
+ p->ptr = new object1 (1);
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123 &&
+ p->vec[0] == 123 && p->ptr->id_ == 1);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str.is_not_null () &&
+ query::ptr->id == 1));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->str == "abc" && i->num == 123 &&
+ i->vec[0] == 123 && i->ptr->id_ == 1);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+ o.ptr = new object1 (2);
+ o.ptr->ptrs.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcd" && p->num == 234 &&
+ p->vec[0] == 234 && p->ptr->id_ == 2);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ delete o.ptr;
+ o.ptr = 0;
+
+ {
+ transaction t (db->begin ());
+ db->erase<object1> (2);
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcde" && p->num == 235 &&
+ p->vec[0] == 235 && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-added value member.
+ //
+ {
+ using namespace test5;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->vec.modify (0).str = "abc";
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->vec[0].str == "abc" && p->vec[0].num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.vec.push_back (value ("bcd", 234));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "bcd" && p->vec[0].num == 234);
+ t.commit ();
+ }
+
+ o.vec.modify (0).str += 'e';
+ o.vec.modify (0).num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "bcde" && p->vec[0].num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-added member.
+ //
+ {
+ using namespace test6;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->str = "abc";
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member.
+ //
+ {
+ using namespace test7;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ p->str = "abc";
+ p->vec.push_back (123);
+ db->update (*p, p->s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "abc" && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as updated.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section.
+ //
+ {
+ using namespace test8;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ p->str = "abc";
+ p->vec.push_back (123);
+ db->update (*p, p->s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "abc" && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as updated.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-added member logic in polymorphic classes.
+ //
+ {
+ using namespace test9;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->bstr = "ab";
+ p->dstr = "abc";
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (static_cast<object*> (db->load<base> (1)));
+ assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member in polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ p->bstr = "ab";
+ p->dstr = "abc";
+ db->update (*p, p->s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section in polymorphic classes.
+ //
+ {
+ using namespace test11;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ p->bstr = "ab";
+ p->dstr = "abc";
+ db->update (*p, p->s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->str = "abc";
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ unsigned long long v (o.v_);
+ db->update (o);
+ assert (o.v_ != v);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcde" && p->num == 235 && p->v_ == o.v_);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+
+ result r (db->query<object> (query::str == "bcd"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "bcd" && i->num == 234);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase_query<object> (query::str == "bcd");
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ unsigned long id;
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ i->str = "abc";
+ db->update (*i);
+ id = i->id;
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (id));
+ assert (p->str == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ p->vec.push_back (123);
+ db->update (*p);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ // All the database operations should now include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ p->vec.push_back (123);
+ db->update (*p, p->s);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // Test basic soft-added member logic.
+ //
+ {
+ using namespace test2;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123 &&
+ p->vec[0] == 123 && p->ptr->id_ == 1);
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-added value member.
+ //
+ {
+ using namespace test5;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->vec[0].str == "abc" && p->vec[0].num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-added member.
+ //
+ {
+ using namespace test6;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member.
+ //
+ {
+ using namespace test7;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section.
+ //
+ {
+ using namespace test8;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-added member logic in polymorphic classes.
+ //
+ {
+ using namespace test9;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (static_cast<object*> (db->load<base> (1)));
+ assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added section member in polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added members of a section in polymorphic classes.
+ //
+ {
+ using namespace test11;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-added container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ // All the database operations should still include the added
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/soft-add/model.hxx b/odb-tests/evolution/soft-add/model.hxx
new file mode 100644
index 0000000..39d63c4
--- /dev/null
+++ b/odb-tests/evolution/soft-add/model.hxx
@@ -0,0 +1,504 @@
+// file : evolution/soft-add/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <string>
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+#include <odb/section.hxx>
+#include <odb/lazy-ptr.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ // The test numbers are made to correspond to the soft-delete ones.
+ //
+
+ // Test basic soft-added member logic.
+ //
+ #pragma db namespace table("t2_")
+ namespace test2
+ {
+ struct object;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<odb::lazy_ptr<object> > ptrs;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id), ptr (0) {}
+ ~object () {delete ptr;}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ unsigned long num;
+ odb::vector<int> vec;
+
+ #pragma db inverse(ptrs)
+ object1* ptr;
+ };
+
+#if MODEL_VERSION == 3
+ // Make it a LOB for Oracle and long data for SQL Server.
+ //
+ #pragma db member(object::str) added(3) \
+ oracle:type("CLOB") \
+ mssql:type("VARCHAR(max)")
+ #pragma db member(object::vec) added(3)
+ #pragma db member(object::ptr) added(3)
+#else
+ #pragma db member(object::str) transient
+ #pragma db member(object::vec) transient
+ #pragma db member(object::ptr) transient
+#endif
+ }
+
+ // Test empty statement handling (INSERT, UPDATE).
+ //
+ #pragma db namespace table("t3_")
+ namespace test3
+ {
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3)
+#else
+ #pragma db member(object::str) transient
+#endif
+ }
+
+ // Test empty statement handling (SELECT in polymorphic loader).
+ //
+ #pragma db namespace table("t4_")
+ namespace test4
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3)
+#else
+ #pragma db member(object::str) transient
+#endif
+ }
+
+ // Test container with soft-added value member.
+ //
+ #pragma db namespace table("t5_")
+ namespace test5
+ {
+ #pragma db value
+ struct value
+ {
+ value () {}
+ value (const std::string& s, unsigned long n): str (s), num (n) {}
+
+ std::string str;
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<value> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(value::str) added(3)
+#else
+ #pragma db member(value::str) transient
+#endif
+ }
+
+ // Test view with soft-added member.
+ //
+ #pragma db namespace table("t6_")
+ namespace test6
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ unsigned long num;
+ };
+
+ #pragma db view object(object)
+ struct view
+ {
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3)
+ #pragma db member(view::str) added(3)
+#else
+ #pragma db member(object::str) transient
+ #pragma db member(view::str) transient
+#endif
+ }
+
+ // Test soft-added section member.
+ //
+ #pragma db namespace table("t7_")
+ namespace test7
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 3
+ #pragma db load(lazy) update(change) added(3)
+ odb::section s;
+#endif
+
+ #pragma db section(s)
+ std::string str;
+
+ unsigned long num;
+
+ #pragma db section(s)
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) section(s)
+ #pragma db member(object::vec) section(s)
+#else
+ #pragma db member(object::str) transient
+ #pragma db member(object::vec) transient
+#endif
+ }
+
+ // Test soft-added members of a section.
+ //
+ #pragma db namespace table("t8_")
+ namespace test8
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ std::string str;
+
+ #pragma db section(s)
+ unsigned long num;
+
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3) section(s)
+ #pragma db member(object::vec) added(3) section(s)
+#else
+ #pragma db member(object::str) transient
+ #pragma db member(object::vec) transient
+#endif
+ }
+
+ // Test basic soft-added member logic in polymorphic classes.
+ //
+ #pragma db namespace table("t9_")
+ namespace test9
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string dstr;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::bstr) added(3)
+ #pragma db member(object::dstr) added(3)
+#else
+ #pragma db member(base::bstr) transient
+ #pragma db member(object::dstr) transient
+#endif
+ }
+
+ // Test soft-added section member in polymorphic classes.
+ //
+ #pragma db namespace table("t10_")
+ namespace test10
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 3
+ #pragma db load(lazy) update(change) added(3)
+ odb::section s;
+#endif
+
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string dstr;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::bstr) section(s)
+ #pragma db member(object::dstr) section(s)
+#else
+ #pragma db member(base::bstr) transient
+ #pragma db member(object::dstr) transient
+#endif
+ }
+
+ // Test soft-added members of a section in polymorphic classes.
+ //
+ #pragma db namespace table("t11_")
+ namespace test11
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string dstr;
+
+ #pragma db section(s)
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::bstr) added(3) section(s)
+ #pragma db member(object::dstr) added(3) section(s)
+#else
+ #pragma db member(base::bstr) transient
+ #pragma db member(object::dstr) transient
+#endif
+ }
+
+ // Test soft-added member and optimistic concurrency.
+ //
+ #pragma db namespace table("t12_")
+ namespace test12
+ {
+ #pragma db object optimistic
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db version mssql:type("ROWVERSION")
+ unsigned long long v_;
+
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3)
+#else
+ #pragma db member(object::str) transient
+#endif
+ }
+
+ // Test soft-added member in an object without id.
+ //
+ #pragma db namespace table("t13_")
+ namespace test13
+ {
+ #pragma db object no_id
+ struct object
+ {
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3) default("abc") \
+ mysql:type("VARCHAR(255)")
+#else
+ #pragma db member(object::str) transient
+#endif
+ }
+
+ // Test soft-added member in an object with auto id.
+ //
+ #pragma db namespace table("t14_")
+ namespace test14
+ {
+ #pragma db object
+ struct object
+ {
+ std::string str;
+ unsigned long num;
+
+ #pragma db id auto
+ unsigned long id;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) added(3)
+#else
+ #pragma db member(object::str) transient
+#endif
+ }
+
+ // Test soft-added container member in a non-versioned object.
+ //
+ #pragma db namespace table("t21_")
+ namespace test21
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ unsigned long num;
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::vec) added(3)
+#else
+ #pragma db member(object::vec) transient
+#endif
+ }
+
+ // Test soft-added container member in a non-versioned section.
+ //
+ #pragma db namespace table("t22_")
+ namespace test22
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ unsigned long num;
+
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::vec) added(3) section(s)
+#else
+ #pragma db member(object::vec) transient
+#endif
+ }
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/soft-add/test1.hxx b/odb-tests/evolution/soft-add/test1.hxx
new file mode 100644
index 0000000..461d663
--- /dev/null
+++ b/odb-tests/evolution/soft-add/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/soft-add/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/soft-add/test2.hxx b/odb-tests/evolution/soft-add/test2.hxx
new file mode 100644
index 0000000..746da4b
--- /dev/null
+++ b/odb-tests/evolution/soft-add/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/soft-add/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/soft-add/test3.hxx b/odb-tests/evolution/soft-add/test3.hxx
new file mode 100644
index 0000000..f2990d0
--- /dev/null
+++ b/odb-tests/evolution/soft-add/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/soft-add/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/soft-delete/driver.cxx b/odb-tests/evolution/soft-delete/driver.cxx
new file mode 100644
index 0000000..e41a70c
--- /dev/null
+++ b/odb-tests/evolution/soft-delete/driver.cxx
@@ -0,0 +1,2202 @@
+// file : evolution/soft-delete/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test soft-delete functionality.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ // SQLite has broken foreign keys when it comes to DDL.
+ //
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=OFF");
+#endif
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+
+#ifdef DATABASE_SQLITE
+ db->connection ()->execute ("PRAGMA foreign_keys=ON");
+#endif
+ }
+
+ // Test soft-deleted objects.
+ //
+ {
+ using namespace test1;
+
+ object o (1);
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-deleted member logic.
+ //
+ {
+ using namespace test2;
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+ o.ptr = new object1 (1);
+ o.ptr->ptrs.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-deleted value member.
+ //
+ {
+ using namespace test5;
+
+ object o (1);
+ o.vec.push_back (value ("abc", 123));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-deleted member.
+ //
+ {
+ using namespace test6;
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member.
+ //
+ {
+ using namespace test7;
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section.
+ //
+ {
+ using namespace test8;
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+ o.vec.push_back (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-deleted member logic in polymorphic classes.
+ //
+ {
+ // We have to use v3 here because the discriminator includes
+ // the namespace.
+ //
+ using namespace v3::test9;
+
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member in polymorphic classes.
+ //
+ {
+ // We have to use v3 here because the discriminator includes
+ // the namespace.
+ //
+ using namespace v3::test10;
+
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section in polymorphic classes.
+ //
+ {
+ // We have to use v3 here because the discriminator includes
+ // the namespace.
+ //
+ using namespace v3::test11;
+
+ object o (1);
+ o.bstr = "ab";
+ o.dstr = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ object o (1);
+ o.str = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ object o;
+ o.str = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ object o;
+ o.str = "abc";
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test summarily deleted composite values.
+ //
+ {
+ using namespace test15;
+
+ object o (1);
+ o.v.reset (new value);
+ o.v->str = "abc";
+ o.v->vec.push_back (123);
+ o.num = 123;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ object o (1);
+ o.num = 123;
+ o.vec.push_back (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ object o (1);
+ o.num = 123;
+ o.vec.push_back (123);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+ }
+
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ // Test soft-deleted objects.
+ //
+ {
+ using namespace test1;
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-deleted member logic.
+ //
+ {
+ using namespace test2;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123 &&
+ p->vec[0] == 123 && p->ptr->id_ == 1);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc" &&
+ query::ptr->id == 1));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->str == "abc" && i->num == 123 &&
+ i->vec[0] == 123 && i->ptr->id_ == 1);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+ o.ptr = new object1 (2);
+ o.ptr->ptrs.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcd" && p->num == 234 &&
+ p->vec[0] == 234 && p->ptr->id_ == 2);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ delete o.ptr;
+ o.ptr = 0;
+
+ {
+ transaction t (db->begin ());
+ db->erase<object1> (2);
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcde" && p->num == 235 &&
+ p->vec[0] == 235 && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-deleted value member.
+ //
+ {
+ using namespace test5;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->vec[0].str == "abc" && p->vec[0].num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.vec.push_back (value ("bcd", 234));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "bcd" && p->vec[0].num == 234);
+ t.commit ();
+ }
+
+ o.vec.modify (0).str += 'e';
+ o.vec.modify (0).num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "bcde" && p->vec[0].num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-deleted member.
+ //
+ {
+ using namespace test6;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member.
+ //
+ {
+ using namespace test7;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "abc" && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as updated.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section.
+ //
+ {
+ using namespace test8;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "abc" && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as updated.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-deleted member logic in polymorphic classes.
+ //
+ {
+ using namespace test9;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (static_cast<object*> (db->load<base> (1)));
+ assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member in polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section in polymorphic classes.
+ //
+ {
+ using namespace test11;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::bstr == "ab"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (static_cast<base&> (o));
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ unsigned long long v (o.v_);
+ db->update (o);
+ assert (o.v_ != v);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "bcde" && p->num == 235 && p->v_ == o.v_);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+
+ result r (db->query<object> (query::str == "bcd"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "bcd" && i->num == 234);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase_query<object> (query::str == "bcd");
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ unsigned long id;
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "abc" && i->num == 123);
+ id = i->id;
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (id));
+ assert (p->str == "abc" && p->num == 123);
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "bcd" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "bcde" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test summarily deleted composite values.
+ //
+ {
+ using namespace test15;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->v->str == "abc" && p->num == 123 &&
+ p->v->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::v.str == "abc"));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->v->str == "abc" && i->num == 123 &&
+ i->v->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.v.reset (new value);
+ o.v->str = "bcd";
+ o.num = 234;
+ o.v->vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->v->str == "bcd" && p->num == 234 &&
+ p->v->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.v->str += 'e';
+ o.num++;
+ o.v->vec.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->v->str == "bcde" && p->num == 235 &&
+ p->v->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ // All the database operations should still include the deleted
+ // members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->num == 123 && p->vec[0] == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->num == 123 && i->vec[0] == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec[0] == 234);
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++; // Automatically marks section as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 235 && p->vec[0] == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // Test soft-deleted objects.
+ //
+ {
+ using namespace test1;
+
+ try
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1)); // No such table.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+ }
+
+ // Test basic soft-deleted member logic.
+ //
+ {
+ using namespace test2;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "" && p->num == 123 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->str == "" && i->num == 123 &&
+ i->vec.empty () && i->ptr == 0);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+ o.ptr = new object1 (2);
+ o.ptr->ptrs.push_back (&o);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ db->persist (*o.ptr);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 234 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ delete o.ptr;
+ o.ptr = 0;
+
+ {
+ transaction t (db->begin ());
+ db->erase<object1> (2);
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 235 &&
+ p->vec.empty () && p->ptr == 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test empty statement handling (INSERT, UPDATE).
+ //
+ {
+ using namespace test3;
+
+ // Now none of the database operations should include the
+ // deleted member.
+ //
+ object o;
+ o.str = "bcd";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "");
+ t.commit ();
+ }
+
+ o.str += 'e';
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "");
+ t.commit ();
+ }
+ }
+
+ // Test empty statement handling (SELECT in polymorphic loader).
+ //
+ {
+ using namespace test4;
+
+ // Now none of the database operations should include the
+ // deleted member.
+ //
+ object o (1);
+ o.str = "abc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<base> p (db->load<base> (1));
+ assert (static_cast<object&> (*p).str == "");
+ t.commit ();
+ }
+ }
+
+ // Test container with soft-deleted value member.
+ //
+ {
+ using namespace test5;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->vec[0].str == "" && p->vec[0].num == 123);
+ t.commit ();
+ }
+
+ object o (2);
+ o.vec.push_back (value ("bcd", 234));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "" && p->vec[0].num == 234);
+ t.commit ();
+ }
+
+ o.vec.modify (0).str += 'e';
+ o.vec.modify (0).num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->vec[0].str == "" && p->vec[0].num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test view with soft-deleted member.
+ //
+ {
+ using namespace test6;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ typedef odb::query<view> query;
+ typedef odb::result<view> result;
+
+ transaction t (db->begin ());
+ result r (db->query<view> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member.
+ //
+ {
+ using namespace test7;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->load (*p, p->s); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section.
+ //
+ {
+ using namespace test8;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->str == "" && i->num == 123 && i->vec.empty ());
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+ o.vec.modify (0)++; // No longer automatically marked as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->str == "" && p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test basic soft-deleted member logic in polymorphic classes.
+ //
+ {
+ using namespace test9;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (static_cast<object*> (db->load<base> (1)));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::id == 1));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<base> (query::bstr == "ab"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<base> (query::bstr.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () &&
+ i->bstr == "" && i->dstr == "" && i->num);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::dstr == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::dstr.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->bstr == "" && p->dstr == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted section member in polymorphic classes.
+ //
+ {
+ using namespace test10;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->load (*p, p->s); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted members of a section in polymorphic classes.
+ //
+ {
+ using namespace test11;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<base> p (db->load<base> (1));
+ db->load (*p, p->s);
+ object& o (static_cast<object&> (*p));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<base> query;
+ typedef odb::result<base> result;
+
+ transaction t (db->begin ());
+ result r (db->query<base> (query::id == 1));
+ result::iterator i (r.begin ());
+ db->load (*i, i->s);
+ assert (i != r.end ());
+ object& o (static_cast<object&> (*i));
+ assert (o.bstr == "" && o.dstr == "" && o.num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<base> (query::bstr == "ab"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<base> (query::bstr.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ db->load (*i, i->s);
+ assert (i != r.end () &&
+ i->bstr == "" && i->dstr == "" && i->num);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::dstr == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::dstr.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.bstr = "bc";
+ o.dstr = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "" && p->dstr == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.bstr += 'd';
+ o.dstr += 'e';
+ o.num++;
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (static_cast<base&> (o));
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->bstr == "" && p->dstr == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<base> (2);
+ t.commit ();
+ }
+
+ // Test empty statement detection in sections.
+ //
+ base b (3);
+ b.bstr = "bc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (b);
+ auto_ptr<base> p (db->load<base> (3));
+ db->load (*p, p->s);
+ assert (p->bstr == "");
+ t.commit ();
+ }
+
+ b.bstr += 'd';
+ b.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (b);
+ auto_ptr<base> p (db->load<base> (3));
+ db->load (*p, p->s);
+ assert (p->bstr == "");
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member and optimistic concurrency.
+ //
+ {
+ using namespace test12;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->str == "" && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ unsigned long long v (o.v_);
+ db->update (o);
+ assert (o.v_ != v);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->str == "" && p->num == 235 && p->v_ == o.v_);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object without id.
+ //
+ {
+ using namespace test13;
+
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+
+ result r (db->query<object> (query::num == 234));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 234);
+
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase_query<object> (query::num == 234);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted member in an object with auto id.
+ //
+ {
+ using namespace test14;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ unsigned long id;
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->str == "" && i->num == 123);
+ id = i->id;
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (id));
+ assert (p->str == "" && p->num == 123);
+ t.commit ();
+ }
+
+ object o;
+ o.str = "bcd";
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "" && p->num == 234);
+ t.commit ();
+ }
+
+ o.str += 'e';
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (o.id));
+ assert (p->str == "" && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (o.id);
+ t.commit ();
+ }
+ }
+
+ // Test summarily deleted composite values.
+ //
+ {
+ using namespace test15;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->v.get () == 0 && p->num == 123);
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->v.get () == 0 && i->num == 123);
+
+ // Logical delete in SQLite.
+ //
+#ifndef DATABASE_SQLITE
+ try
+ {
+ db->query<object> (query::v.str == "abc"); // No such column.
+ assert (false);
+ }
+ catch (const odb::exception&) {}
+#else
+ assert (size (db->query<object> (query::v.str.is_null ())) == 1);
+#endif
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->v.get () == 0 && p->num == 234);
+ t.commit ();
+ }
+
+ o.num++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->v.get () == 0 && p->num == 235);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned object.
+ //
+ {
+ using namespace test21;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ assert (p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->num == 123 && i->vec.empty ());
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ assert (p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ // Test soft-deleted container member in a non-versioned section.
+ //
+ {
+ using namespace test22;
+
+ // Now none of the database operations should include the
+ // deleted members.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (1));
+ db->load (*p, p->s);
+ assert (p->num == 123 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::num == 123));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ db->load (*i, i->s);
+ assert (i->num == 123 && i->vec.empty ());
+ t.commit ();
+ }
+
+ object o (2);
+ o.num = 234;
+ o.vec.push_back (234);
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.num++;
+ o.vec.modify (0)++; // No longer automatically marks as changed.
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 234 && p->vec.empty ());
+ t.commit ();
+ }
+
+ o.s.change ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ auto_ptr<object> p (db->load<object> (2));
+ db->load (*p, p->s);
+ assert (p->num == 235 && p->vec.empty ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ db->erase<object> (2);
+ t.commit ();
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/soft-delete/model.hxx b/odb-tests/evolution/soft-delete/model.hxx
new file mode 100644
index 0000000..65083dd
--- /dev/null
+++ b/odb-tests/evolution/soft-delete/model.hxx
@@ -0,0 +1,518 @@
+// file : evolution/soft-delete/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <common/config.hxx> // HAVE_CXX11
+
+#include <string>
+#include <memory> // std::auto_ptr/unique_ptr
+
+#include <odb/core.hxx>
+#include <odb/vector.hxx>
+#include <odb/section.hxx>
+#include <odb/lazy-ptr.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+ // Test soft-deleted objects.
+ //
+ #pragma db namespace table("t1_")
+ namespace test1
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db object(object) deleted(3)
+#endif
+ }
+
+ // Test basic soft-deleted member logic.
+ //
+ #pragma db namespace table("t2_")
+ namespace test2
+ {
+ struct object;
+
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<odb::lazy_ptr<object> > ptrs;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id), ptr (0) {}
+ ~object () {delete ptr;}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ unsigned long num;
+ odb::vector<int> vec;
+
+ #pragma db inverse(ptrs)
+ object1* ptr;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+ #pragma db member(object::vec) deleted(3)
+ #pragma db member(object::ptr) deleted(3)
+#endif
+ }
+
+ // Test empty statement handling (INSERT, UPDATE).
+ //
+ #pragma db namespace table("t3_")
+ namespace test3
+ {
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+#endif
+ }
+
+ // Test empty statement handling (SELECT in polymorphic loader).
+ //
+ #pragma db namespace table("t4_")
+ namespace test4
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+#endif
+ }
+
+ // Test container with soft-deleted value member.
+ //
+ #pragma db namespace table("t5_")
+ namespace test5
+ {
+ #pragma db value
+ struct value
+ {
+ value () {}
+ value (const std::string& s, unsigned long n): str (s), num (n) {}
+
+ std::string str;
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ odb::vector<value> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(value::str) deleted(3)
+#endif
+ }
+
+ // Test view with soft-deleted member.
+ //
+ #pragma db namespace table("t6_")
+ namespace test6
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str;
+ unsigned long num;
+ };
+
+ #pragma db view object(object)
+ struct view
+ {
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+ #pragma db member(view::str) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted section member.
+ //
+ #pragma db namespace table("t7_")
+ namespace test7
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ std::string str;
+
+ unsigned long num;
+
+ #pragma db section(s)
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::s) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted members of a section.
+ //
+ #pragma db namespace table("t8_")
+ namespace test8
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ std::string str;
+
+ #pragma db section(s)
+ unsigned long num;
+
+ #pragma db section(s)
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+ #pragma db member(object::vec) deleted(3)
+#endif
+ }
+
+ // Test basic soft-deleted member logic in polymorphic classes.
+ //
+ #pragma db namespace table("t9_")
+ namespace test9
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ std::string dstr;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::bstr) deleted(3)
+ #pragma db member(object::dstr) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted section member in polymorphic classes.
+ //
+ #pragma db namespace table("t10_")
+ namespace test10
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ #pragma db section(s)
+ std::string dstr;
+
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::s) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted members of a section in polymorphic classes.
+ //
+ #pragma db namespace table("t11_")
+ namespace test11
+ {
+ #pragma db object polymorphic
+ struct base
+ {
+ virtual
+ ~base () {}
+ base (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ std::string bstr;
+ };
+
+ #pragma db object
+ struct object: base
+ {
+ object (unsigned long id = 0): base (id) {}
+
+ #pragma db section(s)
+ std::string dstr;
+
+ #pragma db section(s)
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(base::bstr) deleted(3)
+ #pragma db member(object::dstr) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted member and optimistic concurrency.
+ //
+ #pragma db namespace table("t12_")
+ namespace test12
+ {
+ #pragma db object optimistic
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db version mssql:type("ROWVERSION")
+ unsigned long long v_;
+
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted member in an object without id.
+ //
+ #pragma db namespace table("t13_")
+ namespace test13
+ {
+ #pragma db object no_id
+ struct object
+ {
+ std::string str;
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted member in an object with auto id.
+ //
+ #pragma db namespace table("t14_")
+ namespace test14
+ {
+ #pragma db object
+ struct object
+ {
+ std::string str;
+ unsigned long num;
+
+ #pragma db id auto
+ unsigned long id;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::str) deleted(3)
+#endif
+ }
+
+ // Test summarily deleted composite values.
+ //
+ #pragma db namespace table("t15_")
+ namespace test15
+ {
+ #pragma db value
+ struct value
+ {
+ std::string str;
+ odb::vector<int> vec;
+ };
+
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#ifdef HAVE_CXX11
+ std::unique_ptr<value> v;
+#else
+ std::auto_ptr<value> v;
+#endif
+ unsigned long num;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(value::str) deleted(3)
+ #pragma db member(value::vec) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted container member in a non-versioned object.
+ //
+ #pragma db namespace table("t21_")
+ namespace test21
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ unsigned long num;
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::vec) deleted(3)
+#endif
+ }
+
+ // Test soft-deleted container member in a non-versioned section.
+ //
+ #pragma db namespace table("t22_")
+ namespace test22
+ {
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db load(lazy) update(change)
+ odb::section s;
+
+ #pragma db section(s)
+ unsigned long num;
+
+ #pragma db section(s)
+ odb::vector<int> vec;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db member(object::vec) deleted(3)
+#endif
+ }
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/soft-delete/test1.hxx b/odb-tests/evolution/soft-delete/test1.hxx
new file mode 100644
index 0000000..d4df90f
--- /dev/null
+++ b/odb-tests/evolution/soft-delete/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/soft-delete/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/soft-delete/test2.hxx b/odb-tests/evolution/soft-delete/test2.hxx
new file mode 100644
index 0000000..3b2b5b4
--- /dev/null
+++ b/odb-tests/evolution/soft-delete/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/soft-delete/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/soft-delete/test3.hxx b/odb-tests/evolution/soft-delete/test3.hxx
new file mode 100644
index 0000000..5a90ab2
--- /dev/null
+++ b/odb-tests/evolution/soft-delete/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/soft-delete/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/template/driver.cxx b/odb-tests/evolution/template/driver.cxx
new file mode 100644
index 0000000..b278acd
--- /dev/null
+++ b/odb-tests/evolution/template/driver.cxx
@@ -0,0 +1,124 @@
+// file : evolution/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+ schema_catalog::create_schema (*db, "", false);
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ dummy d (1);
+ db->persist (d);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v3;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<dummy> p (db->load<dummy> (1));
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ object o;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<dummy> p (db->load<dummy> (1));
+ t.commit ();
+ }
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/template/model.hxx b/odb-tests/evolution/template/model.hxx
new file mode 100644
index 0000000..182c81f
--- /dev/null
+++ b/odb-tests/evolution/template/model.hxx
@@ -0,0 +1,40 @@
+// file : evolution/template/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id_;
+ };
+#endif
+
+ // The presence of this object makes sure that there are no empty
+ // changesets and we get the complete set of migration files.
+ //
+ #pragma db object
+ struct dummy
+ {
+ dummy (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/template/template-vc10.vcxproj b/odb-tests/evolution/template/template-vc10.vcxproj
new file mode 100644
index 0000000..c0ebe18
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc10.vcxproj
@@ -0,0 +1,196 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test1.hxx,
+odb test1.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx,
+test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml,
+model.hxx)
+__custom_build_entry__(
+test2.hxx,
+odb test2.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx,
+test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml,
+test1-odb.hxx;model.hxx)
+__custom_build_entry__(
+test3.hxx,
+odb test3.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx,
+test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql,
+test2-odb.hxx;model.hxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test1-odb.hxx)
+__header_entry__(test1-odb.ixx)
+__header_entry__(test2-odb.hxx)
+__header_entry__(test2-odb.ixx)
+__header_entry__(test3-odb.hxx)
+__header_entry__(test3-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test1-odb.cxx)
+__source_entry__(test2-odb.cxx)
+__source_entry__(test3-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc10.vcxproj.filters b/odb-tests/evolution/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..d6ac66e
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc10.vcxproj.filters
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test1.hxx)
+__header_filter_entry__(test1-odb.hxx)
+__header_filter_entry__(test1-odb.ixx)
+__header_filter_entry__(test2.hxx)
+__header_filter_entry__(test2-odb.hxx)
+__header_filter_entry__(test2-odb.ixx)
+__header_filter_entry__(test3.hxx)
+__header_filter_entry__(test3-odb.hxx)
+__header_filter_entry__(test3-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test1-odb.cxx)
+__source_filter_entry__(test2-odb.cxx)
+__source_filter_entry__(test3-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc11.vcxproj b/odb-tests/evolution/template/template-vc11.vcxproj
new file mode 100644
index 0000000..f51fd0c
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc11.vcxproj
@@ -0,0 +1,200 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test1.hxx,
+odb test1.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx,
+test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml,
+model.hxx)
+__custom_build_entry__(
+test2.hxx,
+odb test2.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx,
+test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml,
+test1-odb.hxx;model.hxx)
+__custom_build_entry__(
+test3.hxx,
+odb test3.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx,
+test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql,
+test2-odb.hxx;model.hxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test1-odb.hxx)
+__header_entry__(test1-odb.ixx)
+__header_entry__(test2-odb.hxx)
+__header_entry__(test2-odb.ixx)
+__header_entry__(test3-odb.hxx)
+__header_entry__(test3-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test1-odb.cxx)
+__source_entry__(test2-odb.cxx)
+__source_entry__(test3-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc11.vcxproj.filters b/odb-tests/evolution/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..d6ac66e
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc11.vcxproj.filters
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test1.hxx)
+__header_filter_entry__(test1-odb.hxx)
+__header_filter_entry__(test1-odb.ixx)
+__header_filter_entry__(test2.hxx)
+__header_filter_entry__(test2-odb.hxx)
+__header_filter_entry__(test2-odb.ixx)
+__header_filter_entry__(test3.hxx)
+__header_filter_entry__(test3-odb.hxx)
+__header_filter_entry__(test3-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test1-odb.cxx)
+__source_filter_entry__(test2-odb.cxx)
+__source_filter_entry__(test3-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc12.vcxproj b/odb-tests/evolution/template/template-vc12.vcxproj
new file mode 100644
index 0000000..9562323
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc12.vcxproj
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test1.hxx,
+odb test1.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx,
+test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml,
+model.hxx)
+__custom_build_entry__(
+test2.hxx,
+odb test2.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx,
+test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml,
+test1-odb.hxx;model.hxx)
+__custom_build_entry__(
+test3.hxx,
+odb test3.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx,
+test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql,
+test2-odb.hxx;model.hxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test1-odb.hxx)
+__header_entry__(test1-odb.ixx)
+__header_entry__(test2-odb.hxx)
+__header_entry__(test2-odb.ixx)
+__header_entry__(test3-odb.hxx)
+__header_entry__(test3-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test1-odb.cxx)
+__source_entry__(test2-odb.cxx)
+__source_entry__(test3-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc12.vcxproj.filters b/odb-tests/evolution/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..d6ac66e
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc12.vcxproj.filters
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test1.hxx)
+__header_filter_entry__(test1-odb.hxx)
+__header_filter_entry__(test1-odb.ixx)
+__header_filter_entry__(test2.hxx)
+__header_filter_entry__(test2-odb.hxx)
+__header_filter_entry__(test2-odb.ixx)
+__header_filter_entry__(test3.hxx)
+__header_filter_entry__(test3-odb.hxx)
+__header_filter_entry__(test3-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test1-odb.cxx)
+__source_filter_entry__(test2-odb.cxx)
+__source_filter_entry__(test3-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project>
diff --git a/odb-tests/evolution/template/template-vc8.vcproj b/odb-tests/evolution/template/template-vc8.vcproj
new file mode 100644
index 0000000..d6c5f15
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc8.vcproj
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-__value__(database).lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-__value__(database).lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test1-odb.cxx)
+__source_entry__(test2-odb.cxx)
+__source_entry__(test3-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test1.hxx,
+odb test1.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx,
+test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml,
+model.hxx)
+__file_entry__(test1-odb.hxx)
+__file_entry__(test1-odb.ixx)
+__file_entry_custom_build__(
+test2.hxx,
+odb test2.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx,
+test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml,
+test1-odb.hxx;model.hxx)
+__file_entry__(test2-odb.hxx)
+__file_entry__(test2-odb.ixx)
+__file_entry_custom_build__(
+test3.hxx,
+odb test3.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx,
+test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql,
+test2-odb.hxx;model.hxx)
+__file_entry__(test3-odb.hxx)
+__file_entry__(test3-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/evolution/template/template-vc9.vcproj b/odb-tests/evolution/template/template-vc9.vcproj
new file mode 100644
index 0000000..9177928
--- /dev/null
+++ b/odb-tests/evolution/template/template-vc9.vcproj
@@ -0,0 +1,379 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-__value__(database).lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-__value__(database).lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test1-odb.cxx)
+__source_entry__(test2-odb.cxx)
+__source_entry__(test3-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test1.hxx,
+odb test1.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx,
+test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml,
+model.hxx)
+__file_entry__(test1-odb.hxx)
+__file_entry__(test1-odb.ixx)
+__file_entry_custom_build__(
+test2.hxx,
+odb test2.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx,
+test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml,
+test1-odb.hxx;model.hxx)
+__file_entry__(test2-odb.hxx)
+__file_entry__(test2-odb.ixx)
+__file_entry_custom_build__(
+test3.hxx,
+odb test3.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx,
+test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql,
+test2-odb.hxx;model.hxx)
+__file_entry__(test3-odb.hxx)
+__file_entry__(test3-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/evolution/template/test1.hxx b/odb-tests/evolution/template/test1.hxx
new file mode 100644
index 0000000..238b686
--- /dev/null
+++ b/odb-tests/evolution/template/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/template/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/template/test2.hxx b/odb-tests/evolution/template/test2.hxx
new file mode 100644
index 0000000..ec982f5
--- /dev/null
+++ b/odb-tests/evolution/template/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/template/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/template/test3.hxx b/odb-tests/evolution/template/test3.hxx
new file mode 100644
index 0000000..50f3882
--- /dev/null
+++ b/odb-tests/evolution/template/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/template/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/evolution/version/driver.cxx b/odb-tests/evolution/version/driver.cxx
new file mode 100644
index 0000000..236c9b4
--- /dev/null
+++ b/odb-tests/evolution/version/driver.cxx
@@ -0,0 +1,156 @@
+// file : evolution/version/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test schema version access via the database instance.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
+#include <common/config.hxx> // DATABASE_XXX
+#include <common/common.hxx>
+
+#include "test2.hxx"
+#include "test3.hxx"
+#include "test2-odb.hxx"
+#include "test3-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db));
+
+ // 1 - base version
+ // 2 - migration
+ // 3 - current version
+ //
+ unsigned short pass (*argv[argc - 1] - '0');
+
+ switch (pass)
+ {
+ case 1:
+ {
+ using namespace v2;
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::drop_schema (*db);
+
+ assert (db->schema_version () == 0);
+
+ schema_catalog::create_schema (*db, "", false);
+
+ assert (db->schema_version () == 1 && !db->schema_migration ());
+
+ schema_catalog::migrate_schema (*db, 2);
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 2 && !db->schema_migration ());
+
+ {
+ transaction t (db->begin ());
+ object1 o1 (1);
+ o1.num = 123;
+ db->persist (o1);
+ t.commit ();
+ }
+ break;
+ }
+ case 2:
+ {
+ using namespace v2;
+ using namespace v3;
+
+ if (embedded)
+ {
+ assert (db->schema_version () == 2 && !db->schema_migration ());
+
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3);
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 3 && db->schema_migration ());
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object1> o1 (db->load<object1> (1));
+ object2 o2 (1);
+ o2.num = o1->num;
+ db->persist (o2);
+ t.commit ();
+ }
+
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3);
+ t.commit ();
+
+ assert (db->schema_version () == 3 && !db->schema_migration ());
+ }
+ break;
+ }
+ case 3:
+ {
+ using namespace v3;
+
+ // In transaction.
+ //
+ {
+ transaction t (db->begin ());
+ assert (db->schema_version () == 3 && !db->schema_migration ());
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object2> o2 (db->load<object2> (1));
+ assert (o2->num == 123);
+ t.commit ();
+ }
+
+ // Test the case where there is still no version table.
+ //
+ db->schema_version_migration (0, false);
+
+ {
+ transaction t (db->begin ());
+
+#ifdef DATABASE_ORACLE
+ db->execute ("DROP TABLE \"schema_version\"");
+#else
+ db->execute ("DROP TABLE schema_version");
+#endif
+ t.commit ();
+ }
+
+ assert (db->schema_version () == 0);
+ break;
+ }
+ default:
+ {
+ cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl;
+ return 1;
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/evolution/version/model.hxx b/odb-tests/evolution/version/model.hxx
new file mode 100644
index 0000000..cdda00e
--- /dev/null
+++ b/odb-tests/evolution/version/model.hxx
@@ -0,0 +1,45 @@
+// file : evolution/version/model.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef MODEL_VERSION
+# error model.hxx included directly
+#endif
+
+#include <odb/core.hxx>
+
+#pragma db model version(1, MODEL_VERSION)
+
+#define MODEL_NAMESPACE_IMPL(V) v##V
+#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)
+
+namespace MODEL_NAMESPACE(MODEL_VERSION)
+{
+#if MODEL_VERSION == 2
+ #pragma db object
+ struct object1
+ {
+ object1 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+
+#if MODEL_VERSION == 3
+ #pragma db object
+ struct object2
+ {
+ object2 (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ int num;
+ };
+#endif
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL
diff --git a/odb-tests/evolution/version/test1.hxx b/odb-tests/evolution/version/test1.hxx
new file mode 100644
index 0000000..a50e54c
--- /dev/null
+++ b/odb-tests/evolution/version/test1.hxx
@@ -0,0 +1,9 @@
+// file : evolution/version/test1.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST1_HXX
+#define TEST1_HXX
+
+#pragma db model version(1, 1)
+
+#endif // TEST1_HXX
diff --git a/odb-tests/evolution/version/test2.hxx b/odb-tests/evolution/version/test2.hxx
new file mode 100644
index 0000000..f7fc1b7
--- /dev/null
+++ b/odb-tests/evolution/version/test2.hxx
@@ -0,0 +1,11 @@
+// file : evolution/version/test2.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST2_HXX
+#define TEST2_HXX
+
+#define MODEL_VERSION 2
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST2_HXX
diff --git a/odb-tests/evolution/version/test3.hxx b/odb-tests/evolution/version/test3.hxx
new file mode 100644
index 0000000..364ee31
--- /dev/null
+++ b/odb-tests/evolution/version/test3.hxx
@@ -0,0 +1,11 @@
+// file : evolution/version/test3.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST3_HXX
+#define TEST3_HXX
+
+#define MODEL_VERSION 3
+#include "model.hxx"
+#undef MODEL_VERSION
+
+#endif // TEST3_HXX
diff --git a/odb-tests/libcommon/.gitignore b/odb-tests/libcommon/.gitignore
new file mode 100644
index 0000000..a994ddc
--- /dev/null
+++ b/odb-tests/libcommon/.gitignore
@@ -0,0 +1,3 @@
+# Generated config header.
+#
+config.hxx
diff --git a/odb-tests/libcommon/buffer.hxx b/odb-tests/libcommon/buffer.hxx
new file mode 100644
index 0000000..41b7e46
--- /dev/null
+++ b/odb-tests/libcommon/buffer.hxx
@@ -0,0 +1,104 @@
+// file : libcommon/buffer.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBCOMMON_BUFFER_HXX
+#define LIBCOMMON_BUFFER_HXX
+
+#include <new>
+#include <cstddef> // std::size_t
+#include <cstring> // std::{memcmp,memcpy}
+
+struct basic_buffer_base
+{
+ ~basic_buffer_base ()
+ {
+ operator delete (data_);
+ }
+
+ basic_buffer_base ()
+ : data_ (0), size_ (0)
+ {
+ }
+
+ basic_buffer_base (const void* data, std::size_t size)
+ : data_ (0), size_ (size)
+ {
+ data_ = operator new (size_);
+ std::memcpy (data_, data, size_);
+ }
+
+ basic_buffer_base (const basic_buffer_base& y)
+ : data_ (0), size_ (0)
+ {
+ assign (y.data_, y.size_);
+ }
+
+ basic_buffer_base&
+ operator= (const basic_buffer_base& y)
+ {
+ if (this != &y)
+ assign (y.data_, y.size_);
+
+ return *this;
+ }
+
+ void
+ assign (const void* data, std::size_t size)
+ {
+ if (size_ < size)
+ {
+ void *p (operator new (size));
+ operator delete (data_);
+ data_ = p;
+ }
+
+ std::memcpy (data_, data, size);
+ size_ = size;
+ }
+
+ std::size_t
+ size () const
+ {
+ return size_;
+ }
+
+ bool
+ operator== (const basic_buffer_base& y) const
+ {
+ return size_ == y.size_ && std::memcmp (data_, y.data_, size_) == 0;
+ }
+
+protected:
+ void* data_;
+ std::size_t size_;
+};
+
+template <typename T>
+struct basic_buffer: basic_buffer_base
+{
+ basic_buffer ()
+ {
+ }
+
+ basic_buffer (const T* data, std::size_t size)
+ : basic_buffer_base (data, size)
+ {
+ }
+
+ T*
+ data ()
+ {
+ return static_cast<T*> (data_);
+ }
+
+ const T*
+ data () const
+ {
+ return static_cast<const T*> (data_);
+ }
+};
+
+typedef basic_buffer<char> buffer;
+typedef basic_buffer<unsigned char> ubuffer;
+
+#endif // LIBCOMMON_BUFFER_HXX
diff --git a/odb-tests/libcommon/buildfile b/odb-tests/libcommon/buildfile
new file mode 100644
index 0000000..eb61455
--- /dev/null
+++ b/odb-tests/libcommon/buildfile
@@ -0,0 +1,50 @@
+# file : libcommon/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import intf_libs = libodb%lib{odb}
+
+for db: $databases
+ import intf_libs += libodb-$db%lib{odb-$db}
+
+lib{common}: {hxx ixx txx cxx}{** -config} hxx{config} $intf_libs
+
+# Generated config file.
+#
+using autoconf
+
+hxx{config}: in{config}
+{
+ DATABASE_MYSQL = $mysql
+ DATABASE_SQLITE = $sqlite
+ DATABASE_PGSQL = $pgsql
+ DATABASE_ORACLE = $oracle
+ DATABASE_MSSQL = $mssql
+ MULTI_DATABASE = $multi
+}
+
+# Build options.
+#
+cxx.poptions =+ "-I$out_root" "-I$src_root"
+
+{hbmia obja}{*}: cxx.poptions += -DLIBCOMMON_STATIC_BUILD
+{hbmis objs}{*}: cxx.poptions += -DLIBCOMMON_SHARED_BUILD
+
+# Export options.
+#
+lib{common}:
+{
+ cxx.export.poptions = "-I$out_root" "-I$src_root"
+ cxx.export.libs = $intf_libs
+}
+
+liba{common}: cxx.export.poptions += -DLIBCOMMON_STATIC
+libs{common}: cxx.export.poptions += -DLIBCOMMON_SHARED
+
+# For pre-releases use the complete version to make sure they cannot
+# be used in place of another pre-release or the final version. See
+# the version module for details on the version.* variable values.
+#
+if $version.pre_release
+ lib{common}: bin.lib.version = "-$version.project_id"
+else
+ lib{common}: bin.lib.version = "-$version.major.$version.minor"
diff --git a/odb-tests/libcommon/common.cxx b/odb-tests/libcommon/common.cxx
new file mode 100644
index 0000000..b3e4cfd
--- /dev/null
+++ b/odb-tests/libcommon/common.cxx
@@ -0,0 +1,355 @@
+// file : libcommon/common.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cstdlib> // std::exit
+#include <utility> // std::move
+#include <iostream>
+
+#include <odb/database.hxx>
+
+#include <libcommon/config.hxx>
+#include <libcommon/common.hxx>
+
+using namespace std;
+using namespace odb::core;
+
+
+// MySQL.
+//
+#if defined(DATABASE_MYSQL)
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/connection-factory.hxx>
+
+static unique_ptr<database>
+create_mysql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace mysql = odb::mysql;
+
+ unique_ptr<mysql::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new mysql::connection_pool_factory (max_connections));
+
+ return unique_ptr<database> (
+ new mysql::database (argc, argv, false, "", 0, move (f)));
+}
+#endif // MySQL
+
+
+// SQLite.
+//
+#if defined(DATABASE_SQLITE)
+
+#include <odb/connection.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/connection-factory.hxx>
+
+static unique_ptr<database>
+create_sqlite_database (int& argc,
+ char* argv[],
+ bool schema,
+ size_t max_connections)
+{
+ namespace sqlite = odb::sqlite;
+
+ unique_ptr<sqlite::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new sqlite::connection_pool_factory (max_connections));
+
+ unique_ptr<database> db (
+ new sqlite::database (
+ argc, argv, false,
+ SQLITE_OPEN_READWRITE
+ | SQLITE_OPEN_CREATE
+#ifdef SQLITE_OPEN_URI
+ | SQLITE_OPEN_URI
+#endif
+ ,
+ true,
+ "",
+ move (f)));
+
+ // Create the database schema. Due to bugs in SQLite foreign key
+ // support for DDL statements, we need to temporarily disable
+ // foreign keys.
+ //
+ if (schema)
+ {
+ connection_ptr c (db->connection ());
+
+ c->execute ("PRAGMA foreign_keys=OFF");
+
+ transaction t (c->begin ());
+ schema_catalog::create_schema (*db);
+ t.commit ();
+
+ c->execute ("PRAGMA foreign_keys=ON");
+ }
+
+ return db;
+}
+#endif // SQLite
+
+
+// PostgreSQL.
+//
+#if defined(DATABASE_PGSQL)
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/connection-factory.hxx>
+
+static unique_ptr<database>
+create_pgsql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace pgsql = odb::pgsql;
+
+ unique_ptr<pgsql::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new pgsql::connection_pool_factory (max_connections));
+
+ return unique_ptr<database> (
+ new pgsql::database (argc, argv, false, "", move (f)));
+}
+#endif // PostgreSQL
+
+
+// Oracle.
+//
+#if defined(DATABASE_ORACLE)
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/connection-factory.hxx>
+
+static unique_ptr<database>
+create_oracle_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace oracle = odb::oracle;
+
+ unique_ptr<oracle::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new oracle::connection_pool_factory (max_connections));
+
+ // Set client database character set and client national character set
+ // to UTF-8.
+ //
+ return unique_ptr<database> (
+ new oracle::database (argc, argv, false, 873, 873, 0, move (f)));
+}
+#endif // Oracle
+
+// SQL Server.
+//
+#if defined(DATABASE_MSSQL)
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/connection-factory.hxx>
+
+static unique_ptr<database>
+create_mssql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace mssql = odb::mssql;
+
+ unique_ptr<mssql::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new mssql::connection_pool_factory (max_connections));
+
+ return unique_ptr<database> (
+ new mssql::database (argc, argv, false, "",
+ mssql::isolation_read_committed, 0, move (f)));
+}
+#endif // SQL Server
+
+//
+//
+unique_ptr<database>
+create_database (int argc,
+ char* argv[],
+ bool schema,
+ size_t max_connections,
+#if defined(MULTI_DATABASE)
+ odb::database_id db
+#else
+ odb::database_id
+#endif
+)
+{
+ char** argp = argv + 1; // Position of the next argument. Assignment for VC8.
+ int argn (argc - 1); // Number of arguments left.
+
+#if defined(MULTI_DATABASE)
+ // Figure out which database we are creating. We may be given the
+ // database name as a program argument or as an id.
+ //
+ if (db == odb::id_common && argn != 0)
+ {
+ string s (*argp);
+
+ if (s == "mysql")
+ db = odb::id_mysql;
+ else if (s == "sqlite")
+ db = odb::id_sqlite;
+ else if (s == "pgsql")
+ db = odb::id_pgsql;
+ else if (s == "oracle")
+ db = odb::id_oracle;
+ else if (s == "mssql")
+ db = odb::id_mssql;
+
+ if (db != odb::id_common)
+ {
+ argp++;
+ argn--;
+ }
+ }
+
+ if (db == odb::id_common)
+ {
+ cerr << "Usage: " << argv[0] << " <db> [options]" << endl;
+ exit (1);
+ }
+#endif
+
+ if (argn != 0 && *argp == string ("--help"))
+ {
+#if defined(MULTI_DATABASE)
+ cout << "Usage: " << argv[0] << " <db> [options]" << endl;
+#else
+ cout << "Usage: " << argv[0] << " [options]" << endl;
+#endif
+
+ cout << "Options:" << endl;
+
+#if defined(MULTI_DATABASE)
+ switch (db)
+ {
+ case odb::id_mysql:
+#if defined(DATABASE_MYSQL)
+ odb::mysql::database::print_usage (cout);
+#else
+ assert (false);
+#endif
+ break;
+ case odb::id_sqlite:
+#if defined(DATABASE_SQLITE)
+ odb::sqlite::database::print_usage (cout);
+#else
+ assert (false);
+#endif
+ break;
+ case odb::id_pgsql:
+#if defined(DATABASE_PGSQL)
+ odb::pgsql::database::print_usage (cout);
+#else
+ assert (false);
+#endif
+ break;
+ case odb::id_oracle:
+#if defined(DATABASE_ORACLE)
+ odb::oracle::database::print_usage (cout);
+#else
+ assert (false);
+#endif
+ break;
+ case odb::id_mssql:
+#if defined(DATABASE_MSSQL)
+ odb::mssql::database::print_usage (cout);
+#else
+ assert (false);
+#endif
+ break;
+ case odb::id_common:
+ assert (false);
+ }
+#elif defined(DATABASE_MYSQL)
+ odb::mysql::database::print_usage (cout);
+#elif defined(DATABASE_SQLITE)
+ odb::sqlite::database::print_usage (cout);
+#elif defined(DATABASE_PGSQL)
+ odb::pgsql::database::print_usage (cout);
+#elif defined(DATABASE_ORACLE)
+ odb::oracle::database::print_usage (cout);
+#elif defined(DATABASE_MSSQL)
+ odb::mssql::database::print_usage (cout);
+#else
+# error unknown database
+#endif
+
+ exit (0);
+ }
+
+#if defined(MULTI_DATABASE)
+ switch (db)
+ {
+ case odb::id_mysql:
+#if defined(DATABASE_MYSQL)
+ return create_mysql_database (argc, argv, schema, max_connections);
+#else
+ assert (false);
+ break;
+#endif
+ case odb::id_sqlite:
+#if defined(DATABASE_SQLITE)
+ return create_sqlite_database (argc, argv, schema, max_connections);
+#else
+ assert (false);
+ break;
+#endif
+ case odb::id_pgsql:
+#if defined(DATABASE_PGSQL)
+ return create_pgsql_database (argc, argv, schema, max_connections);
+#else
+ assert (false);
+ break;
+#endif
+ case odb::id_oracle:
+#if defined(DATABASE_ORACLE)
+ return create_oracle_database (argc, argv, schema, max_connections);
+#else
+ assert (false);
+ break;
+#endif
+ case odb::id_mssql:
+#if defined(DATABASE_MSSQL)
+ return create_mssql_database (argc, argv, schema, max_connections);
+#else
+ assert (false);
+ break;
+#endif
+ case odb::id_common:
+ assert (false);
+ }
+ return unique_ptr<database> ();
+#elif defined(DATABASE_MYSQL)
+ return create_mysql_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_SQLITE)
+ return create_sqlite_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_PGSQL)
+ return create_pgsql_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_ORACLE)
+ return create_oracle_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_MSSQL)
+ return create_mssql_database (argc, argv, schema, max_connections);
+#else
+# error unknown database
+#endif
+}
+
+bool
+size_available ()
+{
+#if defined(MULTI_DATABASE) || \
+ defined(DATABASE_SQLITE) || \
+ defined(DATABASE_ORACLE) || \
+ defined(DATABASE_MSSQL)
+ return false;
+#else
+ return true;
+#endif
+}
diff --git a/odb-tests/libcommon/common.hxx b/odb-tests/libcommon/common.hxx
new file mode 100644
index 0000000..9ab978d
--- /dev/null
+++ b/odb-tests/libcommon/common.hxx
@@ -0,0 +1,47 @@
+// file : libcommon/common.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBCOMMON_COMMON_HXX
+#define LIBCOMMON_COMMON_HXX
+
+#include <memory> // std::unique_ptr
+#include <cstddef> // std::size_t
+
+#include <odb/result.hxx>
+#include <odb/database.hxx>
+
+#include <libcommon/export.hxx>
+
+LIBCOMMON_SYMEXPORT std::unique_ptr<odb::database>
+create_database (int argc,
+ char* argv[],
+ bool create_schema = true,
+ std::size_t max_connections = 0,
+ odb::database_id db = odb::id_common);
+
+template <typename T>
+std::unique_ptr<T>
+create_specific_database (int argc,
+ char* argv[],
+ bool create_schema = true,
+ std::size_t max_connections = 0)
+{
+ std::unique_ptr<odb::database> r (
+ create_database (argc, argv,
+ create_schema,
+ max_connections,
+ T::database_id));
+
+ return std::unique_ptr<T> (&dynamic_cast<T&> (*r.release ()));
+}
+
+// This function returns an accurate result only if the result iterator
+// hasn't been advanced and after the call the result is no longer valid.
+//
+template <typename T>
+std::size_t
+size (odb::result<T>);
+
+#include <libcommon/common.txx>
+
+#endif // LIBCOMMON_COMMON_HXX
diff --git a/odb-tests/libcommon/common.txx b/odb-tests/libcommon/common.txx
new file mode 100644
index 0000000..caa7481
--- /dev/null
+++ b/odb-tests/libcommon/common.txx
@@ -0,0 +1,24 @@
+// file : libcommon/common.txx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// We have to use this helper function instead of just checking which
+// database is used because the DATABASE_* macro may not be defined
+// in a project that includes this header.
+//
+LIBCOMMON_SYMEXPORT bool
+size_available ();
+
+template <typename T>
+std::size_t
+size (odb::result<T> r)
+{
+ if (size_available ())
+ return r.size ();
+ else
+ {
+ std::size_t n (0);
+ for (typename odb::result<T>::iterator i (r.begin ()); i != r.end (); ++i)
+ n++;
+ return n;
+ }
+}
diff --git a/odb-tests/libcommon/concrete.hxx b/odb-tests/libcommon/concrete.hxx
new file mode 100644
index 0000000..e0f64a5
--- /dev/null
+++ b/odb-tests/libcommon/concrete.hxx
@@ -0,0 +1,57 @@
+// file : libcommon/concrete.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBCOMMON_CONCRETE_HXX
+#define LIBCOMMON_CONCRETE_HXX
+
+#include <libcommon/config.hxx>
+
+// Namespace alias for the concrete database namespace.
+//
+#if defined(MULTI_DATABASE)
+
+// Fallback to common interface.
+//
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+namespace odb_db = odb;
+
+#elif defined(DATABASE_MYSQL)
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+namespace odb_db = odb::mysql;
+
+#elif defined(DATABASE_SQLITE)
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+namespace odb_db = odb::sqlite;
+
+#elif defined(DATABASE_PGSQL)
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+namespace odb_db = odb::pgsql;
+
+#elif defined(DATABASE_ORACLE)
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+namespace odb_db = odb::oracle;
+
+#elif defined(DATABASE_MSSQL)
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+namespace odb_db = odb::mssql;
+
+#endif
+
+#endif // LIBCOMMON_CONCRETE_HXX
diff --git a/odb-tests/libcommon/config.hxx.in b/odb-tests/libcommon/config.hxx.in
new file mode 100644
index 0000000..ff90e61
--- /dev/null
+++ b/odb-tests/libcommon/config.hxx.in
@@ -0,0 +1,14 @@
+// file : libcommon/config.hxx.in
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBCOMMON_CONFIG_HXX
+#define LIBCOMMON_CONFIG_HXX
+
+#undef DATABASE_MYSQL
+#undef DATABASE_SQLITE
+#undef DATABASE_PGSQL
+#undef DATABASE_ORACLE
+#undef DATABASE_MSSQL
+#undef MULTI_DATABASE
+
+#endif // LIBCOMMON_CONFIG_HXX
diff --git a/odb-tests/libcommon/export.hxx b/odb-tests/libcommon/export.hxx
new file mode 100644
index 0000000..0de4565
--- /dev/null
+++ b/odb-tests/libcommon/export.hxx
@@ -0,0 +1,39 @@
+#pragma once
+
+// Normally we don't export class templates (but do complete specializations),
+// inline functions, and classes with only inline member functions. Exporting
+// classes that inherit from non-exported/imported bases (e.g., std::string)
+// will end up badly. The only known workarounds are to not inherit or to not
+// export. Also, MinGW GCC doesn't like seeing non-exported functions being
+// used before their inline definition. The workaround is to reorder code. In
+// the end it's all trial and error.
+
+#if defined(LIBCOMMON_STATIC) // Using static.
+# define LIBCOMMON_SYMEXPORT
+#elif defined(LIBCOMMON_STATIC_BUILD) // Building static.
+# define LIBCOMMON_SYMEXPORT
+#elif defined(LIBCOMMON_SHARED) // Using shared.
+# ifdef _WIN32
+# define LIBCOMMON_SYMEXPORT __declspec(dllimport)
+# else
+# define LIBCOMMON_SYMEXPORT
+# endif
+#elif defined(LIBCOMMON_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define LIBCOMMON_SYMEXPORT __declspec(dllexport)
+# else
+# define LIBCOMMON_SYMEXPORT
+# endif
+#else
+// If none of the above macros are defined, then we assume we are being used
+// by some third-party build system that cannot/doesn't signal the library
+// type. Note that this fallback works for both static and shared libraries
+// provided the library only exports functions (in other words, no global
+// exported data) and for the shared case the result will be sub-optimal
+// compared to having dllimport. If, however, your library does export data,
+// then you will probably want to replace the fallback with the (commented
+// out) error since it won't work for the shared case.
+//
+# define LIBCOMMON_SYMEXPORT // Using static or shared.
+//# error define LIBCOMMON_STATIC or LIBCOMMON_SHARED preprocessor macro to signal libcommon library type being linked
+#endif
diff --git a/odb-tests/manifest b/odb-tests/manifest
new file mode 100644
index 0000000..858baa7
--- /dev/null
+++ b/odb-tests/manifest
@@ -0,0 +1,48 @@
+: 1
+name: odb-tests
+version: 2.5.0-b.26.z
+project: odb
+type: tests
+language: c++
+summary: ODB compiler tests
+license: GPL-2.0-only
+description-file: README.md
+url: https://www.codesynthesis.com/products/odb/
+doc-url: https://www.codesynthesis.com/products/odb/doc/manual.xhtml
+src-url: https://git.codesynthesis.com/cgit/odb/odb/
+email: odb-users@codesynthesis.com ; Mailing list
+
+# @@ BUILD2 The odb dependency can only be built with GCC. However, shouldn't
+# we test that the odb-generated mappings can be compiled by other
+# compilers and properly run afterwards?
+#
+builds: default
+builds: -( +windows -gcc ) ; Requires MinGW GCC.
+builds: &gcc ; Requires GCC with plugin support enabled.
+builds: &gcc-5+ ; Requires GCC 5 or later.
+builds: -static ; Implementation uses plugins and requires -fPIC.
+
+depends: * build2 >= 0.16.0
+depends: * bpkg >= 0.16.0
+
+depends: * odb [2.5.0-b.26.1 2.5.0-b.27)
+
+depends: libodb [2.5.0-b.26.1 2.5.0-b.27)
+depends: libodb-mysql [2.5.0-b.26.1 2.5.0-b.27) ? ($mysql)
+depends: libodb-sqlite [2.5.0-b.26.1 2.5.0-b.27) ? ($sqlite)
+depends: libodb-pgsql [2.5.0-b.26.1 2.5.0-b.27) ? ($pgsql)
+depends: libodb-oracle [2.5.0-b.26.1 2.5.0-b.27) ? ($oracle)
+depends: libodb-mssql [2.5.0-b.26.1 2.5.0-b.27) ? ($mssql)
+
+# Reflect whether libodb-pgsql is likely to support bulk operations. This is
+# normally the case on POSIX platforms if libodb-pgsql is linked against libpq
+# of the version 14 or above.
+#
+depends: libpq >= 14.0.0 ? ($pgsql) config.odb_tests.pgsql.bulk_default=true | \
+ libpq >= 7.4.0 ? ($pgsql) config.odb_tests.pgsql.bulk_default=false
+
+# @@ TODO/LATER: use an alternative to automatically detect whether we are
+# using MySQL or MariaDB? But maybe we don't need to know?
+
+depends: mysql >= 5.0.3 ? ($mysql)
+depends: psql >= 7.4.0 ? ($pgsql)
diff --git a/odb-tests/mssql/custom/custom.sql b/odb-tests/mssql/custom/custom.sql
new file mode 100644
index 0000000..44ef512
--- /dev/null
+++ b/odb-tests/mssql/custom/custom.sql
@@ -0,0 +1,42 @@
+/* This file contains helper functions.
+ */
+
+IF OBJECT_ID('dbo.variant_to_string', 'FN') IS NOT NULL
+ DROP FUNCTION dbo.variant_to_string;
+GO
+
+IF OBJECT_ID('dbo.string_to_variant', 'FN') IS NOT NULL
+ DROP FUNCTION dbo.string_to_variant;
+GO
+
+CREATE FUNCTION dbo.variant_to_string (@val SQL_VARIANT) RETURNS VARCHAR(max)
+AS
+BEGIN
+ RETURN CAST(SQL_VARIANT_PROPERTY(@val, 'BaseType') AS SYSNAME) + ' ' +
+ CAST(@val AS VARCHAR(max))
+END;
+GO
+
+CREATE FUNCTION dbo.string_to_variant (@val VARCHAR(max)) RETURNS SQL_VARIANT
+AS
+BEGIN
+ DECLARE @ret SQL_VARIANT
+
+ DECLARE @pos BIGINT
+ DECLARE @vtype SYSNAME
+ DECLARE @vtext VARCHAR(max)
+
+ SET @pos = CHARINDEX(' ', @val)
+ SET @vtype = SUBSTRING(@val, 1, @pos - 1)
+ SET @vtext = SUBSTRING(@val, @pos + 1, LEN(@val))
+
+ IF @vtype = 'tinyint' SET @ret = CAST(@vtext AS TINYINT)
+ ELSE IF @vtype = 'smallint' SET @ret = CAST(@vtext AS SMALLINT)
+ ELSE IF @vtype = 'int' SET @ret = CAST(@vtext AS INT)
+ ELSE IF @vtype = 'bigint' SET @ret = CAST(@vtext AS BIGINT)
+ ELSE IF @vtype = 'char' SET @ret = CAST(@vtext AS CHAR(8000))
+ ELSE IF @vtype = 'varchar' SET @ret = CAST(@vtext AS VARCHAR(8000))
+
+ RETURN @ret
+END;
+GO
diff --git a/odb-tests/mssql/custom/driver.cxx b/odb-tests/mssql/custom/driver.cxx
new file mode 100644
index 0000000..bde7eb6
--- /dev/null
+++ b/odb-tests/mssql/custom/driver.cxx
@@ -0,0 +1,135 @@
+// file : mssql/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom database type mapping in SQL Server.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+
+ o.v = variant (123);
+ o.vv.push_back (variant (string (1024, 'a')));
+ o.vv.push_back (variant (123));
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.p = point (1.1111, 2222222222.2);
+ o.pv.push_back (point (1.1234, 2.2345));
+ o.pv.push_back (point (3.3456, 4.4567));
+ o.pv.push_back (point (0.0000001, 0.000000001)); // Scientific notation.
+#endif
+
+ o.xml = "<root x=\"1\"><a>AAA</a><b>BBB</b><c>CCC</c></root>";
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Query.
+ //
+ typedef mssql::query<object> query;
+ typedef odb::result<object> result;
+
+ {
+ transaction t (db->begin ());
+
+ // Variant comparison.
+ //
+ {
+ result r (db->query<object> (query::v == o.v));
+ assert (!r.empty ());
+ }
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ // Point comparison.
+ //
+ {
+ result r (db->query<object> (query::p == o.p));
+ assert (!r.empty ());
+ }
+
+ // Point comparison using native query.
+ //
+ {
+ result r (db->query<object> (
+ query::p + ".STEquals(" + query::_val (o.p) + ") = 1"));
+ assert (!r.empty ());
+ }
+
+ // Access to individual members.
+ //
+ {
+ result r (db->query<object> (query::p.x == o.p.x));
+ assert (!r.empty ());
+ }
+#endif
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.p.x++;
+ o.p.y--;
+ o.pv[1].x--;
+ o.pv[1].y++;
+#endif
+
+ o.xml = "<root x=\"2\"><a>BBB</a><b>CCC</b><c>DDD</c></root>";
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/custom/query.hxx b/odb-tests/mssql/custom/query.hxx
new file mode 100644
index 0000000..fc63378
--- /dev/null
+++ b/odb-tests/mssql/custom/query.hxx
@@ -0,0 +1,183 @@
+// file : mssql/custom/query.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef QUERY_HXX
+#define QUERY_HXX
+
+#include <string>
+
+#include <odb/mssql/query.hxx>
+
+#include "test.hxx" // point
+
+namespace odb
+{
+ namespace mssql
+ {
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ template <>
+ struct query_column<point, id_string>
+ {
+ private:
+ const char* table_;
+ const char* column_;
+ const char* conversion_;
+
+ unsigned short prec_;
+ unsigned short scale_;
+
+ std::string x_column_;
+ std::string y_column_;
+
+ // Sub-columns for individual members.
+ //
+ public:
+ query_column<double, id_float8> x, y;
+
+ // is_null, is_not_null
+ //
+ public:
+ query_base
+ is_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NULL";
+ return q;
+ }
+
+ query_base
+ is_not_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NOT NULL";
+ return q;
+ }
+
+ // =
+ //
+ public:
+ query_base
+ equal (const point& v) const
+ {
+ return equal (val_bind<point> (v));
+ }
+
+ query_base
+ equal (val_bind<point> v) const
+ {
+ query_base q (table_, column_);
+ q += ".STEquals(";
+ q.append<point, id_string> (v, conversion_);
+ q += ") = 1";
+ return q;
+ }
+
+ query_base
+ equal (ref_bind<point> r) const
+ {
+ query_base q (table_, column_);
+ q += ".STEquals(";
+ q.append<point, id_string> (r, conversion_);
+ q += ") = 1";
+ return q;
+ }
+
+ friend query_base
+ operator== (const query_column& c, const point& v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const point& v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, val_bind<point> v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (val_bind<point> v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, ref_bind<point> r)
+ {
+ return c.equal (r);
+ }
+
+ friend query_base
+ operator== (ref_bind<point> r, const query_column& c)
+ {
+ return c.equal (r);
+ }
+
+ // Column comparison.
+ //
+ public:
+ query_base
+ operator== (const query_column<point, id_string>& c) const
+ {
+ query_base q (table_, column_);
+ q += ".STEquals(";
+ q.append (c.table (), c.column ());
+ q += ") = 1";
+ return q;
+ }
+
+ public:
+ query_column (const char* table,
+ const char* column,
+ const char* conv,
+ unsigned short prec = 0,
+ unsigned short scale = 0xFFFF)
+ : table_ (table), column_ (column), conversion_ (conv),
+ prec_ (prec), scale_ (scale),
+ x_column_ (std::string (column) + ".STX"),
+ y_column_ (std::string (column) + ".STY"),
+ x (table, x_column_.c_str (), 0),
+ y (table, y_column_.c_str (), 0)
+ {
+ }
+
+ const char*
+ table () const
+ {
+ return table_;
+ }
+
+ const char*
+ column () const
+ {
+ return column_;
+ }
+
+ const char*
+ conversion () const
+ {
+ return conversion_;
+ }
+
+ unsigned short
+ prec () const
+ {
+ return prec_;
+ }
+
+ unsigned short
+ scale () const
+ {
+ return scale_;
+ }
+ };
+#endif // SQL Server > 2005
+ }
+}
+
+#endif // QUERY_HXX
diff --git a/odb-tests/mssql/custom/test.hxx b/odb-tests/mssql/custom/test.hxx
new file mode 100644
index 0000000..4b8a5d7
--- /dev/null
+++ b/odb-tests/mssql/custom/test.hxx
@@ -0,0 +1,121 @@
+// file : mssql/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Map SQL Server SQL_VARIANT type to our variant C++ class that is capable
+// of storing either an integer or a string (QVariant and boost::variant
+// would be natural alternatives to our own type). The SQL Server functions
+// that are used in the 'to' and 'from' expressions below are defined in
+// the custom.sql file. The other half of this mapping is in traits.hxx
+// (value_traits<variant, id_long_string>).
+//
+#pragma db map type("SQL_VARIANT") \
+ as("VARCHAR(max)") \
+ to("dbo.string_to_variant((?))") \
+ from("dbo.variant_to_string((?))")
+
+#pragma db value type("SQL_VARIANT")
+struct variant
+{
+ variant (unsigned long v = 0): val_type (type_int), int_val (v) {}
+ variant (const std::string& v): val_type (type_str), str_val (v) {}
+
+ enum {type_int, type_str} val_type;
+ unsigned long int_val;
+ std::string str_val;
+};
+
+inline bool
+operator== (const variant& a, const variant& b)
+{
+ if (a.val_type != b.val_type)
+ return false;
+
+ switch (a.val_type)
+ {
+ case variant::type_int:
+ return a.int_val == b.int_val;
+ case variant::type_str:
+ return a.str_val == b.str_val;
+ }
+
+ return false;
+}
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+// Map GEOMETRY SQL Server type to the point C++ struct. The other half
+// of this mapping is in traits.hxx (value_traits<point, id_string>).
+// Note that GEOMETRY is not available in SQL Server 2005.
+//
+#pragma db map type("GEOMETRY") \
+ as("VARCHAR(256)") \
+ to("GEOMETRY::STGeomFromText((?), 0)") \
+ from("(?).STAsText()")
+
+#pragma db value type("GEOMETRY")
+struct point
+{
+ point () {}
+ point (double x_, double y_): x (x_), y (y_) {}
+
+ double x;
+ double y;
+};
+
+inline bool
+operator== (const point& a, const point& b)
+{
+ return a.x == b.x && a.y == b.y;
+}
+#endif // SQL Server > 2005
+
+// Map XML SQL Server type to std::string (or any other type that provides
+// the value_traits<?, id_long_string> specialization). Note also that
+// another alternative would be to interface with the XML data type using
+// VARBINARY or NVARCHAR. Here we use implicit string to/from XML conversion,
+// however, CAST/CONVERT can be used instead for greater control over
+// whitespace handling, etc.
+//
+#pragma db map type("XML *(\\(.+\\))?") as("VARCHAR(max)")
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id_) : id (id_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ variant v;
+ std::vector<variant> vv;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ point p;
+ std::vector<point> pv;
+#endif
+
+ #pragma db type("XML")
+ std::string xml;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id == y.id
+ && vv == y.vv
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && p == y.p
+ && pv == y.pv
+#endif
+ && xml == y.xml;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mssql/custom/traits.cxx b/odb-tests/mssql/custom/traits.cxx
new file mode 100644
index 0000000..3f14ae7
--- /dev/null
+++ b/odb-tests/mssql/custom/traits.cxx
@@ -0,0 +1,128 @@
+// file : mssql/types/traits.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include "traits.hxx"
+
+using namespace std;
+
+namespace odb
+{
+ namespace mssql
+ {
+ void value_traits<variant, id_long_string>::
+ param_callback (const void* context,
+ size_t*,
+ const void** buffer,
+ size_t* size,
+ chunk_type* chunk,
+ void* tmp_buf,
+ size_t tmp_capacity)
+ {
+ const variant& v (*static_cast<const variant*> (context));
+ string str;
+
+ switch (v.val_type)
+ {
+ case variant::type_int:
+ {
+ ostringstream os;
+ os << v.int_val;
+
+ str = "bigint ";
+ str += os.str ();
+ break;
+ }
+ case variant::type_str:
+ {
+ str = "varchar ";
+ str += v.str_val;
+ break;
+ }
+ }
+
+ // Here we assume that the temoprary buffer is large enough to fit
+ // the whole string in one go. If that were not the case, then we
+ // would have had to chunk it.
+ //
+ assert (tmp_capacity >= str.size ());
+ memcpy (tmp_buf, str.c_str (), str.size ());
+
+ *buffer = tmp_buf;
+ *size = str.size ();
+ *chunk = chunk_one;
+ }
+
+ void value_traits<variant, id_long_string>::
+ result_callback (void* context,
+ size_t*,
+ void** buffer,
+ size_t* size,
+ chunk_type chunk,
+ size_t,
+ void* tmp_buf,
+ size_t tmp_capacity)
+ {
+ variant& v (*static_cast<variant*> (context));
+
+ switch (chunk)
+ {
+ case chunk_null:
+ case chunk_one:
+ {
+ assert (false); // The value cannot be NULL or empty.
+ break;
+ }
+ case chunk_first:
+ {
+ // Use the variant's string value as a temporary buffer. If this
+ // were not possible, we could have allocated one as part of
+ // context.
+ //
+ v.str_val.clear ();
+
+ *buffer = tmp_buf;
+ *size = tmp_capacity;
+ break;
+ }
+ case chunk_next:
+ {
+ v.str_val.append (static_cast<char*> (tmp_buf), *size);
+
+ *buffer = tmp_buf;
+ *size = tmp_capacity;
+ break;
+ }
+ case chunk_last:
+ {
+ v.str_val.append (static_cast<char*> (tmp_buf), *size);
+
+ // Figure out what we've got.
+ //
+ string::size_type p (v.str_val.find (' '));
+ assert (p != string::npos); // Must have type followed by value.
+ string type (v.str_val, 0, p);
+ string text (v.str_val, p + 1, string::npos);
+
+ if (type == "tinyint" ||
+ type == "smallint" ||
+ type == "int" ||
+ type == "bigint")
+ {
+ istringstream is (text);
+ is >> v.int_val;
+ v.val_type = variant::type_int;
+ }
+ else if (type == "char" || type == "varchar")
+ {
+ v.str_val = text;
+ v.val_type = variant::type_str;
+ }
+ else
+ assert (false); // Unknown type.
+
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/odb-tests/mssql/custom/traits.hxx b/odb-tests/mssql/custom/traits.hxx
new file mode 100644
index 0000000..2bd99cb
--- /dev/null
+++ b/odb-tests/mssql/custom/traits.hxx
@@ -0,0 +1,148 @@
+// file : mssql/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <limits> // std::numeric_limits
+#include <sstream>
+#include <cstring> // std::memcpy
+#include <cassert>
+
+#include <odb/mssql/traits.hxx>
+
+#include "test.hxx" // variant, point
+
+namespace odb
+{
+ namespace mssql
+ {
+ template <>
+ class value_traits<variant, id_long_string>
+ {
+ public:
+ typedef variant value_type;
+ typedef variant query_type;
+ typedef long_callback image_type;
+
+ static void
+ set_value (variant& v,
+ result_callback_type& cb,
+ void*& context)
+ {
+ cb = &result_callback;
+ context = &v;
+ }
+
+ static void
+ set_image (param_callback_type& cb,
+ const void*& context,
+ bool& is_null,
+ const variant& v)
+ {
+ is_null = false;
+ cb = &param_callback;
+ context = &v;
+ }
+
+ static void
+ param_callback (const void* context,
+ std::size_t* position,
+ const void** buffer,
+ std::size_t* size,
+ chunk_type* chunk,
+ void* tmp_buffer,
+ std::size_t tmp_capacity);
+
+ static void
+ result_callback (void* context,
+ std::size_t* position,
+ void** buffer,
+ std::size_t* size,
+ chunk_type chunk,
+ std::size_t size_left,
+ void* tmp_buffer,
+ std::size_t tmp_capacity);
+ };
+
+ template <>
+ struct type_traits<variant>
+ {
+ static const database_type_id db_type_id = id_long_string;
+
+ struct conversion
+ {
+ static const char* to () {return "dbo.string_to_variant((?))";}
+ };
+ };
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ template <>
+ class value_traits<point, id_string>
+ {
+ public:
+ typedef point value_type;
+ typedef point query_type;
+
+ typedef char* image_type;
+
+ static void
+ set_value (point& v,
+ const char* b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = point ();
+ else
+ {
+ // Point format is "POINT (x y)".
+ //
+ std::istringstream is (std::string (b + 7, n - 7));
+
+ is >> v.x;
+ is >> v.y;
+ }
+ }
+
+ static void
+ set_image (char* b,
+ std::size_t c,
+ std::size_t& n,
+ bool& is_null,
+ const point& v)
+ {
+ is_null = false;
+ std::ostringstream os;
+
+ // The formula for the number of decimla digits required is given in:
+ //
+ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
+ //
+ os.precision (std::numeric_limits<double>::digits10);
+ // os.precision (2 + std::numeric_limits<double>::digits * 301/1000);
+
+ os << "POINT (" << v.x << ' ' << v.y << ')';
+
+ const std::string& s (os.str ());
+ n = s.size ();
+ assert (n <= c);
+ std::memcpy (b, s.c_str (), n);
+ }
+ };
+
+ template <>
+ struct type_traits<point>
+ {
+ static const database_type_id db_type_id = id_string;
+
+ struct conversion
+ {
+ static const char* to () {return "GEOMETRY::STGeomFromText((?), 0)";}
+ };
+ };
+#endif // SQL Server > 2005
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/mssql/database/driver.cxx b/odb-tests/mssql/database/driver.cxx
new file mode 100644
index 0000000..08ad34f
--- /dev/null
+++ b/odb-tests/mssql/database/driver.cxx
@@ -0,0 +1,105 @@
+// file : mssql/database/driver.cxx
+// license : GNU GPL; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous (compilation only).
+//
+
+#include <string>
+#include <cassert>
+
+#include <odb/mssql/database.hxx>
+
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+static const char* isolation_map[] = {"1", "2", "3", "5", "4"};
+
+static bool
+check_isolation (connection& c, transaction_isolation i)
+{
+ std::string s ("SELECT 1 FROM sys.dm_exec_sessions WHERE session_id = @@SPID"
+ " AND transaction_isolation_level = ");
+ s += isolation_map[i];
+ return c.execute (s) == 1;
+}
+
+int
+main (int argc, char* argv[])
+{
+ // This code should not execute.
+ //
+ if (argc == 0)
+ {
+ {
+ database d1 ("bob", "secret", "db1", "server1");
+ database d2 ("bob", "secret", "db1", "server1", "driver1");
+ database d3 ("bob", "secret", "db1", "server1", "driver1", "extra");
+ database d4 ("bob", "secret", "db1", "server1", "driver1", "extra",
+ isolation_read_uncommitted);
+ }
+
+ {
+ database d1 ("bob", "secret", "db1", protocol_auto);
+ database d2 ("bob", "secret", "db1", protocol_auto, "server1");
+ database d3 ("bob", "secret", "db1", protocol_auto, "server1", "inst1");
+ database d4 ("bob", "secret", "db1", protocol_auto, "server1", "inst1",
+ "driver1");
+ database d5 ("bob", "secret", "db1", protocol_auto, "server1", "inst1",
+ "driver1", "extra");
+ database d6 ("bob", "secret", "db1", protocol_auto, "server1", "inst1",
+ "driver1", "extra", isolation_read_uncommitted);
+ }
+
+ {
+ database d1 ("bob", "secret", "db1", "server1", 0);
+ database d2 ("bob", "secret", "db1", "server1", 999, "driver1");
+ database d3 ("bob", "secret", "db1", "server1", 999, "driver1", "extra");
+ database d4 ("bob", "secret", "db1", "server1", 999, "driver1", "extra",
+ isolation_read_uncommitted);
+ }
+
+ {
+ database d1 ("conn1");
+ database d2 ("conn1", isolation_read_uncommitted);
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ database d3 (argc, argv, true, "extra");
+ database d4 (argc, argv, false, "extra", isolation_read_uncommitted);
+ }
+ }
+
+ // Test transaction isolation levels.
+ //
+ {
+ database d (argc, argv, false, "", isolation_read_uncommitted);
+ connection_ptr c (d.connection ());
+ assert (check_isolation (*c, isolation_read_uncommitted));
+ }
+
+ {
+ database d (argc, argv, false, "");
+ connection_ptr c (d.connection ());
+ assert (check_isolation (*c, isolation_read_committed));
+ }
+
+ {
+ database d (argc, argv, false, "", isolation_repeatable_read);
+ connection_ptr c (d.connection ());
+ assert (check_isolation (*c, isolation_repeatable_read));
+ }
+
+ {
+ database d (argc, argv, false, "", isolation_snapshot);
+ connection_ptr c (d.connection ());
+ assert (check_isolation (*c, isolation_snapshot));
+ }
+
+ {
+ database d (argc, argv, false, "", isolation_serializable);
+ connection_ptr c (d.connection ());
+ assert (check_isolation (*c, isolation_serializable));
+ }
+}
diff --git a/odb-tests/mssql/native/driver.cxx b/odb-tests/mssql/native/driver.cxx
new file mode 100644
index 0000000..f4b4fd7
--- /dev/null
+++ b/odb-tests/mssql/native/driver.cxx
@@ -0,0 +1,73 @@
+// file : mssql/native/driver.cxx
+// license : GNU GPL; see accompanying LICENSE file
+
+// Test native SQL execution.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Create the database schema.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->execute ("IF OBJECT_ID('mssql_native_test', 'U') IS NOT NULL\n"
+ " DROP TABLE mssql_native_test");
+
+ db->execute ("CREATE TABLE mssql_native_test (n int)");
+
+ t.commit ();
+ }
+
+ // Insert a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("INSERT INTO mssql_native_test (n) VALUES (1)") == 1);
+
+ assert (
+ db->execute ("INSERT INTO mssql_native_test (n) VALUES (2)") == 1);
+
+ t.commit ();
+ }
+
+ // Select a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("SELECT n FROM mssql_native_test WHERE n < 3") == 2);
+
+ assert (
+ db->execute ("SELECT n FROM mssql_native_test WHERE n > 3") == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/query/driver.cxx b/odb-tests/mssql/query/driver.cxx
new file mode 100644
index 0000000..5600c81
--- /dev/null
+++ b/odb-tests/mssql/query/driver.cxx
@@ -0,0 +1,188 @@
+// file : mssql/query/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test SQL Server-specific query support aspects.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ object o1;
+ object o2;
+ object o3;
+
+ o1.num = 1;
+ o1.str = "aaa";
+ o1.nstr = L"aaa";
+ o1.lstr.assign (1024, 'a');
+ o1.lnstr.assign (1024, L'a');
+ o1.smoney = 11000;
+ o1.money = 1.1;
+
+ o2.num = 2;
+ o2.str = "bbb";
+ o2.nstr = L"bbb";
+ o2.lstr.assign (1024, 'b');
+ o2.lnstr.assign (1024, L'b');
+ o2.smoney = 22000;
+ o2.money = 2.2;
+
+ o3.num = 3;
+ o3.str = "ccc";
+ o3.nstr = L"ccc";
+ o3.lstr.assign (1024, 'c');
+ o3.lnstr.assign (1024, L'c');
+ o3.smoney = 33000;
+ o3.money = 3.3;
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ typedef mssql::query<object> query;
+ typedef odb::result<object> result;
+
+ {
+ transaction t (db->begin ());
+
+ // Money and small money.
+ //
+ {
+ result r (db->query<object> (query::smoney < 22000));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->smoney == 11000);
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> ("smoney < " + query::_val (2.1F)));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->smoney == 11000);
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> (query::money < 2.2));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->money == 1.1);
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> ("money < " + query::_val (2.2)));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->money == 1.1);
+ assert (++i == r.end ());
+ }
+
+ // Short/long string.
+ //
+ {
+ result r (db->query<object> (query::str < "bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->str == "aaa");
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> ("str < " + query::_val ("bbb", 3)));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->str == "aaa");
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> (query::nstr < L"bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->nstr == L"aaa");
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> (query::lstr < string (1024, 'b')));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->lstr == string (1024, 'a'));
+ assert (++i == r.end ());
+ }
+
+ {
+ string v (1024, 'b');
+ result r (db->query<object> (query::lstr < query::_ref (v)));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->lstr == string (1024, 'a'));
+ assert (++i == r.end ());
+ }
+
+ {
+ result r (db->query<object> (query::lnstr < wstring (1024, L'b')));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->lnstr == wstring (1024, L'a'));
+ assert (++i == r.end ());
+ }
+
+ // Test image copying with long data.
+ //
+ {
+ result r (db->query<object> (query::str < "ccc"));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+ ++i;
+ assert (i != r.end ());
+
+ {
+ result r (db->query<object> (query::str < "bbb"));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (i->str == "aaa");
+ assert (++i == r.end ());
+ }
+
+ assert (i->str == "bbb"); // Load from copy.
+ assert (++i == r.end ());
+ }
+
+ t.commit ();
+ }
+
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/query/test.hxx b/odb-tests/mssql/query/test.hxx
new file mode 100644
index 0000000..85c644e
--- /dev/null
+++ b/odb-tests/mssql/query/test.hxx
@@ -0,0 +1,38 @@
+// file : mssql/query/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ unsigned int num;
+
+ #pragma db type ("SMALLMONEY")
+ int smoney;
+
+ #pragma db type ("MONEY")
+ double money;
+
+ #pragma db type ("VARCHAR(256)")
+ std::string str;
+
+ #pragma db type ("NVARCHAR(128)")
+ std::wstring nstr;
+
+ #pragma db type ("VARCHAR(max)")
+ std::string lstr;
+
+ #pragma db type ("NVARCHAR(max)")
+ std::wstring lnstr;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mssql/stored-proc/driver.cxx b/odb-tests/mssql/stored-proc/driver.cxx
new file mode 100644
index 0000000..2389798
--- /dev/null
+++ b/odb-tests/mssql/stored-proc/driver.cxx
@@ -0,0 +1,231 @@
+// file : mssql/stored-proc/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test SQL Server stored procedure support.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+void
+create_procedure (database& db, const string& name, const string& body)
+{
+ transaction t (db.begin ());
+
+ string s (db.query_value<default_schema> ().name);
+
+ db.execute (
+ "IF EXISTS ("
+ " SELECT * FROM sysobjects"
+ " WHERE name = '" + name + "' AND user_name(uid) = '" + s +"')"
+ " DROP PROCEDURE [" + s + "].[" + name + "]");
+
+ db.execute ("CREATE PROCEDURE [" + s + "].[" + name + "] " + body);
+
+ t.commit ();
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o1 (1, "a");
+ object o2 (2, "b");
+ object o3 (3, "c");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ create_procedure (
+ *db, "select_all_objects",
+ "AS"
+ " SELECT num, str FROM mssql_stored_proc_object ORDER BY id;");
+
+ typedef odb::result<select_all_objects> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<select_all_objects> ());
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ cout << i->num << " " << i->str << endl;
+ cout << endl;
+
+ t.commit ();
+ }
+
+ {
+ create_procedure (
+ *db, "select_objects",
+ "(@id INT, @n VARCHAR(512))"
+ "AS"
+ " SELECT str FROM mssql_stored_proc_object "
+ " WHERE [id] = @id OR [num] = @n ORDER BY id;");
+
+ typedef mssql::query<select_objects> query;
+ typedef odb::result<select_objects> result;
+
+ transaction t (db->begin ());
+
+ result r (db->query<select_objects> (
+ query::_val (o1.id) + "," + query::_val (o2.num)));
+
+ for (result::iterator i (r.begin ()); i != r.end (); ++i)
+ cout << i->str << endl;
+ cout << endl;
+
+ t.commit ();
+ }
+
+ {
+ create_procedure (
+ *db, "objects_min_max",
+ "(@min INT = NULL OUTPUT, @max INT = NULL OUTPUT)"
+ "AS"
+ " SELECT @min = MIN(num), @max = MAX(num)"
+ " FROM mssql_stored_proc_object;");
+
+ create_procedure (
+ *db, "objects_min_max_odb",
+ "AS"
+ " DECLARE @min INT, @max INT;"
+ " EXEC objects_min_max @min OUTPUT, @max OUTPUT;"
+ " SELECT @min, @max;");
+
+ transaction t (db->begin ());
+
+ objects_min_max omm (db->query_value<objects_min_max> ());
+ cout << omm.num_min << " " << omm.num_max << endl
+ << endl;
+
+ t.commit ();
+ }
+
+ {
+ create_procedure (
+ *db, "insert_object_id",
+ "(@n INT, @s VARCHAR(512))"
+ "AS"
+ " INSERT INTO mssql_stored_proc_object([num], [str])"
+ " VALUES(@n, @s);");
+
+ {
+ typedef mssql::query<insert_object> query;
+
+ transaction t (db->begin ());
+
+ db->query_one<insert_object> (
+ query::_val (4) + "," + query::_val ("d"));
+
+ auto_ptr<object> o (db->load<object> (4));
+ cout << o->num << " " << o->str << endl
+ << endl;
+
+ t.commit ();
+ }
+
+ {
+ typedef mssql::query<no_result> query;
+
+ transaction t (db->begin ());
+
+ db->query_one<no_result> (
+ "EXEC insert_object_id" + query::_val (5) + "," + query::_val ("e"));
+
+ auto_ptr<object> o (db->load<object> (5));
+ cout << o->num << " " << o->str << endl
+ << endl;
+
+ t.commit ();
+ }
+ }
+
+ {
+ create_procedure (
+ *db, "insert_object_id",
+ "(@n INT, @s VARCHAR(512), @id INT = NULL OUTPUT)"
+ "AS"
+ " INSERT INTO mssql_stored_proc_object([num], [str])"
+ " VALUES(@n, @s);"
+ " SET @id = SCOPE_IDENTITY();"
+ " RETURN 123;");
+
+ typedef mssql::query<insert_object_id> query;
+
+ {
+ create_procedure (
+ *db, "insert_object_id_odb",
+ "(@n INT, @s VARCHAR(512))"
+ "AS"
+ " DECLARE @id INT;"
+ " DECLARE @ret INT;"
+ " EXEC @ret = insert_object_id @n, @s, @id OUTPUT;"
+ " SELECT @ret, @id;");
+
+ transaction t (db->begin ());
+
+ insert_object_id io (
+ db->query_value<insert_object_id> (
+ query::_val (6) + "," + query::_val ("f")));
+
+ cout << io.ret << " " << io.id << endl
+ << endl;
+
+ t.commit ();
+ }
+
+ // An alternative implementation that produces a different
+ // result set configuration at the ODBC level.
+ //
+ {
+ create_procedure (
+ *db, "insert_object_id_odb",
+ "(@n INT, @s VARCHAR(512))"
+ "AS"
+ " DECLARE @id INT;"
+ " DECLARE @ret INT;"
+ " DECLARE @tbl TABLE(dummy INT);"
+ " INSERT INTO @tbl EXEC @ret = insert_object_id @n, @s, @id OUTPUT;"
+ " SELECT @ret, @id;");
+
+ transaction t (db->begin ());
+
+ insert_object_id io (
+ db->query_value<insert_object_id> (
+ query::_val (7) + "," + query::_val ("g")));
+
+ cout << io.ret << " " << io.id << endl
+ << endl;
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/stored-proc/test.hxx b/odb-tests/mssql/stored-proc/test.hxx
new file mode 100644
index 0000000..5958ea3
--- /dev/null
+++ b/odb-tests/mssql/stored-proc/test.hxx
@@ -0,0 +1,63 @@
+// file : mssql/stored-proc/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db view query("SELECT SCHEMA_NAME()")
+struct default_schema
+{
+ std::string name;
+};
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned int n, std::string s): num (n), str (s) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ unsigned int num;
+ std::string str;
+};
+
+#pragma db view
+struct no_result {};
+
+#pragma db view query("EXEC select_all_objects")
+struct select_all_objects
+{
+ unsigned int num;
+ std::string str;
+};
+
+#pragma db view query("EXEC select_objects (?)")
+struct select_objects
+{
+ std::string str;
+};
+
+#pragma db view query("EXEC objects_min_max_odb")
+struct objects_min_max
+{
+ unsigned int num_min;
+ unsigned int num_max;
+};
+
+#pragma db view query("EXEC insert_object_id (?)")
+struct insert_object {};
+
+#pragma db view query("EXEC insert_object_id_odb (?)")
+struct insert_object_id
+{
+ unsigned int ret;
+ unsigned long id;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mssql/template/driver.cxx b/odb-tests/mssql/template/driver.cxx
new file mode 100644
index 0000000..ded03f1
--- /dev/null
+++ b/odb-tests/mssql/template/driver.cxx
@@ -0,0 +1,40 @@
+// file : mssql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/template/template-vc10.vcxproj b/odb-tests/mssql/template/template-vc10.vcxproj
new file mode 100644
index 0000000..5875d9b
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/mssql/template/template-vc10.vcxproj.filters b/odb-tests/mssql/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/mssql/template/template-vc11.vcxproj b/odb-tests/mssql/template/template-vc11.vcxproj
new file mode 100644
index 0000000..0bee18f
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/mssql/template/template-vc11.vcxproj.filters b/odb-tests/mssql/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/mssql/template/template-vc12.vcxproj b/odb-tests/mssql/template/template-vc12.vcxproj
new file mode 100644
index 0000000..35ffb0f
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-mssql.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/mssql/template/template-vc12.vcxproj.filters b/odb-tests/mssql/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/mssql/template/template-vc8.vcproj b/odb-tests/mssql/template/template-vc8.vcproj
new file mode 100644
index 0000000..cfd697f
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-mssql.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-mssql.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/mssql/template/template-vc9.vcproj b/odb-tests/mssql/template/template-vc9.vcproj
new file mode 100644
index 0000000..72a95d9
--- /dev/null
+++ b/odb-tests/mssql/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-mssql.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-mssql.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/mssql/template/test.hxx b/odb-tests/mssql/template/test.hxx
new file mode 100644
index 0000000..0bc1f95
--- /dev/null
+++ b/odb-tests/mssql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : mssql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mssql/types/driver.cxx b/odb-tests/mssql/types/driver.cxx
new file mode 100644
index 0000000..d900a95
--- /dev/null
+++ b/odb-tests/mssql/types/driver.cxx
@@ -0,0 +1,381 @@
+// file : mssql/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test SQL Server type conversion.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/exceptions.hxx>
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace mssql = odb::mssql;
+using namespace mssql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ object o (1);
+
+ o.bit_ = 1;
+ o.utint_ = 222;
+ o.stint_ = -123;
+ o.usint_ = 65000;
+ o.ssint_ = -12345;
+ o.uint_ = 4294967290U;
+ o.sint_ = -1234567890;
+ o.ubint_ = 18446744073709551610ULL;
+ o.sbint_ = -1234567890123456789LL;
+
+ o.fsm_ = -214748.3648F;
+ o.dsm_ = 214748.3647;
+ o.ism_ = -2147483647 -1;
+
+ o.dm1_ = -922337203685477.5808;
+ o.dm2_ = 922337203685476.3520; // 922337203685477.5807
+ o.im_ = 9223372036854775807LL;
+
+ o.f4_ = 123.123F;
+ o.f8_ = 123.1234567;
+
+ o.schar_ = "short data char ";
+ o.svchar_ = "short data varchar";
+
+ o.lchar_.assign (1025, 'a');
+ o.lvchar_ = "long data varchar"; // Test the short string optimization.
+ o.mvchar_.assign (70000, 'm');
+ o.text_.assign (70000, 't');
+
+ o.snchar_ = L"short data nchar\x1FFF\xD7FF ";
+ o.snvchar_ = L"short data nvarchar \x1FFF\xD7FF";
+
+ o.lnchar_.assign (513, L'\x1234');
+ o.lnvchar_ = L""; // Test empty string.
+ o.mnvchar_.assign (70000, L'\x2345');
+ o.ntext_.assign (70000, L'\x4356');
+
+ const char sdata[] = "abc""\x00\x01""def";
+ memcpy (o.sbin_, sdata, sizeof (sdata));
+ o.svbin_.assign (sdata, sdata + sizeof (sdata));
+
+ string ldata (256 * 1024, '\x01');
+ memset (o.lbin_, 2, sizeof (o.lbin_));
+ o.lvbin_.assign (50, '\x03');
+ o.mvbin_.assign (ldata.begin (), ldata.end ());
+ o.image_.assign (ldata.begin (), ldata.end ());
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.date_ = date_time (2011, 12, 20, 0, 0, 0, 0, 0, 0);
+ o.time7_ = date_time (0, 0, 0, 13, 34, 39, 123456789, 0, 0);
+ o.time4_ = date_time (0, 0, 0, 13, 34, 39, 123456700, 0, 0);
+#endif
+ o.sdt_ = date_time (2011, 12, 20, 15, 44, 29, 123456700, 0, 0);
+ o.dt_ = date_time (2011, 12, 20, 15, 44, 29, 123456700, 0, 0);
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.dt2_ = date_time (2011, 12, 20, 15, 44, 29, 123456700, 0, 0);
+ o.dto7_ = date_time (2011, 12, 20, 15, 44, 29, 123456700, 2, 0);
+ o.dto0_ = date_time (2011, 12, 20, 15, 44, 29, 123456700, 2, 0);
+#endif
+
+#ifdef _WIN32
+ // 6F846D41-C89A-4E4D-B22F-56443CFA543F
+ o.guid_.Data1 = 0x6F846D41;
+ o.guid_.Data2 = 0xC89A;
+ o.guid_.Data3 = 0x4E4D;
+ memcpy (&o.guid_.Data4, "\xB2\x2F\x56\x44\x3C\xFA\x54\x3F", 8);
+#endif
+ memcpy (o.uuid_, "\x6F\x84\x6D\x41\xC8\x9A\x4E\x4D\xB2\x2F"
+ "\x56\x44\x3C\xFA\x54\x3F", 16);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.time7_ = date_time (0, 0, 0, 13, 34, 39, 123456700, 0, 0);
+ o.time4_ = date_time (0, 0, 0, 13, 34, 39, 123400000, 0, 0);
+#endif
+ o.sdt_ = date_time (2011, 12, 20, 15, 44, 0, 0, 0, 0);
+ o.dt_ = date_time (2011, 12, 20, 15, 44, 29, 123000000, 0, 0);
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.dto0_ = date_time (2011, 12, 20, 15, 44, 29, 0, 2, 0);
+#endif
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ typedef mssql::query<object> query;
+ typedef odb::result<object> result;
+
+ // Test UUID in queries.
+ //
+ {
+ char uuid[16];
+ memcpy (uuid, o.uuid_, 16);
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> (query::uuid == uuid));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::uuid == query::_val (uuid)));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::uuid == query::_ref (uuid)));
+ assert (size (r) == 1);
+ }
+
+ {
+ const char* d (uuid);
+ result r (db->query<object> (query::uuid == d));
+ assert (size (r) == 1);
+ }
+
+ t.commit ();
+ }
+
+ // Test short/long data in queries.
+ //
+ {
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> (query::svchar == o.svchar_));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::snvchar == o.snvchar_));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::mvchar == o.mvchar_));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::mnvchar == o.mnvchar_));
+ assert (size (r) == 1);
+ }
+
+ t.commit ();
+ }
+ }
+
+ // Test long NULL data.
+ //
+ {
+ long_null o1 (1);
+ long_null o2 (2);
+ o2.str_.reset (new string);
+ o2.str_->assign (70000, 'x');
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<long_null> p1 (db->load<long_null> (1));
+ auto_ptr<long_null> p2 (db->load<long_null> (2));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ }
+ }
+
+ // Test long data in containers.
+ //
+ {
+ long_cont o (1);
+ o.v.push_back (long_comp ("aaa", 123));
+ o.v.push_back (long_comp (string (500, 'b'), 234));
+ o.v.push_back (long_comp (string (70000, 'c'), 345));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<long_cont> p (db->load<long_cont> (1));
+ t.commit ();
+
+ assert (o == *p);
+ }
+ }
+
+ // Test char/wchar_t arrays.
+ //
+ {
+ char_array o1 (1, "", L"");
+ char_array o2 (2, "1234567890", L"12345678\x1FFF\xD7FF");
+ char_array o3 (3, "1234567890123456", L"12345678901234\x1FFF\xD7FF");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ // SQL Server returns padded values for CHAR(N)/NCHAR(N).
+ //
+ memcpy (o1.s2, " ", 16);
+ o1.s3[0] = o1.c1 = ' ';
+ memcpy (o2.s2, "1234567890 ", 16);
+
+ memset (o1.ls2, ' ', 1025);
+ memset (o2.ls2 + 10, ' ', 1025 - 10);
+
+ memcpy (o1.ws2, L" ", 16 * sizeof (wchar_t));
+ o1.ws3[0] = o1.wc1 = L' ';
+ memcpy (o2.ws2, L"12345678\x1FFF\xD7FF ", 16 * sizeof (wchar_t));
+
+ for (size_t i (0); i < 257; ++i)
+ o1.lws2[i] = L' ';
+
+ for (size_t i (10); i < 257; ++i)
+ o2.lws2[i] = L' ';
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<char_array> p1 (db->load<char_array> (1));
+ auto_ptr<char_array> p2 (db->load<char_array> (2));
+ auto_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
+
+ // Test optimistic concurrency using ROWVERSION.
+ //
+ {
+ rowversion o (123);
+ o.str = "abc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (o.ver != 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<rowversion> p (db->load<rowversion> (o.id_));
+ assert (p->ver == o.ver);
+ p->str += 'd';
+ db->update (*p);
+ assert (p->ver > o.ver);
+
+ // Double-check object version was updated.
+ //
+ {
+ auto_ptr<rowversion> p1 (db->load<rowversion> (o.id_));
+ assert (p->ver == p1->ver);
+ }
+
+ o.str += 'D';
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+ db->reload (o);
+ assert (o.ver == p->ver);
+ o.str += 'D';
+ db->update (o);
+ t.commit ();
+ }
+ }
+
+ {
+ rowversion_auto o;
+ o.str = "abc";
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ assert (o.ver != 0);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<rowversion_auto> p (db->load<rowversion_auto> (o.id_));
+ assert (p->ver == o.ver);
+ p->str += 'd';
+ db->update (*p);
+ assert (p->ver > o.ver);
+ o.str += 'D';
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
+ db->reload (o);
+ assert (o.ver == p->ver);
+ o.str += 'D';
+ db->update (o);
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mssql/types/test.hxx b/odb-tests/mssql/types/test.hxx
new file mode 100644
index 0000000..5d651a8
--- /dev/null
+++ b/odb-tests/mssql/types/test.hxx
@@ -0,0 +1,517 @@
+// file : mssql/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#ifdef _WIN32
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h> // GUID
+#elif defined(HOST_WIN32)
+typedef struct _GUID
+{
+ unsigned int Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+#endif
+
+#include <common/config.hxx> // HAVE_CXX11
+
+#include <string>
+#include <vector>
+#include <memory> // std::auto_ptr
+#include <cstring> // std::memcmp, std::memcpy, std::str[n]cmp, std::strlen
+#include <cwchar> // std::wcslen, std::wcs[n]cmp
+
+#include <odb/core.hxx>
+
+struct date_time
+{
+ date_time ()
+ {
+ }
+
+ date_time (short y,
+ unsigned short m,
+ unsigned short d,
+ unsigned short h,
+ unsigned short min,
+ unsigned short sec,
+ unsigned int f,
+ short tzh,
+ short tzm)
+ : year (y),
+ month (m),
+ day (d),
+ hour (h),
+ minute (min),
+ second (sec),
+ fraction (f),
+ timezone_hour (tzh),
+ timezone_minute (tzm)
+ {
+ }
+
+ bool
+ operator== (const date_time& y) const
+ {
+ return
+ year == y.year &&
+ month == y.month &&
+ day == y.day &&
+ hour == y.hour &&
+ minute == y.minute &&
+ second == y.second &&
+ fraction == y.fraction &&
+ timezone_hour == y.timezone_hour &&
+ timezone_minute == y.timezone_minute;
+ }
+
+ short year;
+ unsigned short month;
+ unsigned short day;
+ unsigned short hour;
+ unsigned short minute;
+ unsigned short second;
+ unsigned int fraction;
+ short timezone_hour;
+ short timezone_minute;
+};
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned int id): id_ (id) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ // Integer types.
+ //
+ #pragma db type ("BIT")
+ unsigned char bit_;
+
+ #pragma db type ("TINYINT")
+ unsigned char utint_;
+
+ #pragma db type ("TINYINT")
+ unsigned char stint_;
+
+ #pragma db type ("SMALLINT")
+ unsigned short usint_;
+
+ #pragma db type ("SMALLINT")
+ short ssint_;
+
+ #pragma db type ("INT")
+ unsigned int uint_;
+
+ #pragma db type ("INTEGER")
+ int sint_;
+
+ #pragma db type ("BIGINT")
+ unsigned long long ubint_;
+
+ #pragma db type ("BIGINT")
+ long long sbint_;
+
+ // Floating/fixed point types.
+ //
+ #pragma db type ("SMALLMONEY")
+ float fsm_;
+
+ #pragma db type ("SMALLMONEY")
+ double dsm_;
+
+ #pragma db type ("SMALLMONEY")
+ int ism_;
+
+ #pragma db type ("MONEY")
+ double dm1_;
+
+ #pragma db type ("MONEY")
+ double dm2_;
+
+ #pragma db type ("MONEY")
+ long long im_;
+
+ #pragma db type ("REAL")
+ float f4_;
+
+ #pragma db type ("FLOAT")
+ double f8_;
+
+ // Strings.
+ //
+ #pragma db type ("CHAR(20)")
+ std::string schar_;
+
+ #pragma db type ("VARCHAR(128)")
+ std::string svchar_;
+
+ #pragma db type ("CHAR(1025)")
+ std::string lchar_;
+
+ #pragma db type ("CHARACTER VARYING(8000)")
+ std::string lvchar_;
+
+ #pragma db type ("VARCHAR(max)")
+ std::string mvchar_;
+
+ #pragma db type ("TEXT")
+ std::string text_;
+
+ // National strings.
+ //
+ #pragma db type ("NCHAR(20)")
+ std::wstring snchar_;
+
+ #pragma db type ("NVARCHAR(128)")
+ std::wstring snvchar_;
+
+ #pragma db type ("NCHAR(513)")
+ std::wstring lnchar_;
+
+ #pragma db type ("NATIONAL CHARACTER VARYING(4000)")
+ std::wstring lnvchar_;
+
+ #pragma db type ("NVARCHAR(max)")
+ std::wstring mnvchar_;
+
+ #pragma db type ("NTEXT")
+ std::wstring ntext_;
+
+ // Binary.
+ //
+ #pragma db type ("BINARY(9)")
+ unsigned char sbin_[9];
+
+ #pragma db type ("VARBINARY(256)")
+ std::vector<char> svbin_;
+
+ #pragma db type ("BINARY(1025)")
+ char lbin_[1025];
+
+ #pragma db type ("BINARY VARYING(8000)")
+ std::vector<char> lvbin_;
+
+ #pragma db type ("VARBINARY(max)")
+ std::vector<unsigned char> mvbin_;
+
+ #pragma db type ("IMAGE")
+ std::vector<char> image_;
+
+ // Date-time. SQL Server 2005 (9.0) only has DATETIME and SMALLDATETIME.
+ //
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ #pragma db type ("DATE")
+ date_time date_;
+
+ #pragma db type ("TIME")
+ date_time time7_;
+
+ #pragma db type ("TIME(4)")
+ date_time time4_;
+#endif
+
+ #pragma db type ("SMALLDATETIME")
+ date_time sdt_;
+
+ #pragma db type ("DATETIME")
+ date_time dt_;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ #pragma db type ("DATETIME2")
+ date_time dt2_;
+
+ #pragma db type ("DATETIMEOFFSET")
+ date_time dto7_;
+
+ #pragma db type ("DATETIMEOFFSET(0)")
+ date_time dto0_;
+#endif
+
+ // Other types.
+ //
+#if defined(_WIN32) || defined(HOST_WIN32)
+ //#pragma db type ("UNIQUEIDENTIFIER")
+ GUID guid_;
+#endif
+
+ #pragma db type ("UNIQUEIDENTIFIER")
+ char uuid_[16];
+
+ bool
+ operator== (const object& y) const
+ {
+ return
+ id_ == y.id_ &&
+ bit_ == y.bit_ &&
+ utint_ == y.utint_ &&
+ stint_ == y.stint_ &&
+ usint_ == y.usint_ &&
+ ssint_ == y.ssint_ &&
+ uint_ == y.uint_ &&
+ sint_ == y.sint_ &&
+ ubint_ == y.ubint_ &&
+ sbint_ == y.sbint_ &&
+ fsm_ == y.fsm_ &&
+ dsm_ == y.dsm_ &&
+ ism_ == y.ism_ &&
+ dm1_ == y.dm1_ &&
+ dm2_ == y.dm2_ &&
+ im_ == y.im_ &&
+ f4_ == y.f4_ &&
+ f8_ == y.f8_ &&
+
+ schar_ == y.schar_ &&
+ svchar_ == y.svchar_ &&
+ lchar_ == y.lchar_ &&
+ lvchar_ == y.lvchar_ &&
+ mvchar_ == y.mvchar_ &&
+ text_ == y.text_ &&
+
+ snchar_ == y.snchar_ &&
+ snvchar_ == y.snvchar_ &&
+ lnchar_ == y.lnchar_ &&
+ lnvchar_ == y.lnvchar_ &&
+ mnvchar_ == y.mnvchar_ &&
+ ntext_ == y.ntext_ &&
+
+ std::memcmp (sbin_, y.sbin_, sizeof (sbin_)) == 0 &&
+ svbin_ == y.svbin_ &&
+ std::memcmp (lbin_, y.lbin_, sizeof (lbin_)) == 0 &&
+ lvbin_ == y.lvbin_ &&
+ mvbin_ == y.mvbin_ &&
+ image_ == y.image_
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && date_ == y.date_
+ && time7_ == y.time7_
+ && time4_ == y.time4_
+#endif
+ && sdt_ == y.sdt_
+ && dt_ == y.dt_
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && dt2_ == y.dt2_
+ && dto7_ == y.dto7_
+ && dto0_ == y.dto0_
+#endif
+
+#ifdef _WIN32
+ && std::memcmp (&guid_, &y.guid_, sizeof (guid_)) == 0
+#endif
+ && std::memcmp (uuid_, y.uuid_, sizeof (uuid_)) == 0;
+ }
+};
+
+// Test long NULL data.
+//
+#pragma db object
+struct long_null
+{
+ long_null () {}
+ long_null (unsigned int id): id_ (id) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ #pragma db type ("VARCHAR(max)") null
+#ifdef HAVE_CXX11
+ std::unique_ptr<std::string> str_;
+#else
+ std::auto_ptr<std::string> str_;
+#endif
+
+ bool
+ operator== (const long_null& y) const
+ {
+ return
+ id_ == y.id_ &&
+ ((str_.get () == 0 && y.str_.get () == 0) || *str_ == *y.str_);
+ }
+};
+
+// Test long data in containers, in particular column re-arrangement.
+//
+#pragma db value
+struct long_comp
+{
+ long_comp () {}
+ long_comp (std::string s, unsigned int n): str (s), num (n) {}
+
+ #pragma db type ("VARCHAR(max)")
+ std::string str;
+
+ unsigned int num;
+
+ bool
+ operator== (const long_comp& y) const
+ {
+ return str == y.str && num == y.num;
+ }
+};
+
+#pragma db object
+struct long_cont
+{
+ long_cont () {}
+ long_cont (unsigned int id): id_ (id) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ std::vector<long_comp> v;
+
+ bool
+ operator== (const long_cont& y) const
+ {
+ return id_ == y.id_ && v == y.v;
+ }
+};
+
+// Test char/wchar_t arrays.
+//
+#pragma db object
+struct char_array
+{
+ char_array () {}
+ char_array (unsigned long id, const char* s, const wchar_t* ws)
+ : id_ (id)
+ {
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ std::memcpy (s2, s, std::strlen (s) + 1);
+ s3[0] = c1 = *s;
+
+ std::memcpy (ws1, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
+ std::memcpy (ws2, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
+ ws3[0] = wc1 = *ws;
+
+ if (std::strlen (s) == sizeof (s2))
+ {
+ std::memset (ls1, '1', 1025);
+ ls1[1025] = '\0';
+ std::memset (ls2, '2', 1025);
+
+ for (std::size_t i (0); i < 257; ++i)
+ {
+ lws1[i] = L'1';
+ lws2[i] = L'2';
+ }
+ lws1[257] = L'\0';
+ }
+ else
+ {
+ std::memcpy (ls1, s, std::strlen (s) + 1); // VC++ strcpy deprecation.
+ std::memcpy (ls2, s, std::strlen (s) + 1);
+
+ std::memcpy (lws1, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
+ std::memcpy (lws2, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
+ }
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ //
+ //
+ char s1[17];
+
+ #pragma db type("CHAR(16)")
+ char s2[16];
+
+ char s3[1];
+ char c1;
+
+ // Long data.
+ //
+ char ls1[1026];
+
+ #pragma db type("CHAR(1025)")
+ char ls2[1025];
+
+ //
+ //
+ wchar_t ws1[17];
+
+ #pragma db type("NCHAR(16)")
+ wchar_t ws2[16];
+
+ wchar_t ws3[1];
+ wchar_t wc1;
+
+ // Long data.
+ //
+ wchar_t lws1[258];
+
+ #pragma db type("NCHAR(257)")
+ wchar_t lws2[257];
+
+ bool
+ operator== (const char_array& y) const
+ {
+ return id_ == y.id_ &&
+
+ std::strcmp (s1, y.s1) == 0 &&
+ std::strncmp (s2, y.s2, sizeof (s2)) == 0 &&
+ s3[0] == y.s3[0] &&
+ c1 == y.c1 &&
+
+ std::strcmp (ls1, y.ls1) == 0 &&
+ std::strncmp (ls2, y.ls2, sizeof (ls2)) == 0 &&
+
+ std::wcscmp (ws1, y.ws1) == 0 &&
+ std::wcsncmp (ws2, y.ws2, sizeof (ws2) / sizeof (wchar_t)) == 0 &&
+ ws3[0] == y.ws3[0] &&
+ wc1 == y.wc1 &&
+
+ std::wcscmp (lws1, y.lws1) == 0 &&
+ std::wcsncmp (lws2, y.lws2, sizeof (lws2) / sizeof (wchar_t)) == 0;
+ }
+};
+
+// Test optimistic concurrency using ROWVERSION, both with auto and
+// manually-assigned ids.
+//
+#pragma db object optimistic
+struct rowversion
+{
+ rowversion (unsigned int id = 0): id_ (id), ver (0) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ #pragma db version type("ROWVERSION")
+#ifdef _WIN32
+ unsigned __int64 ver;
+#else
+ unsigned long long ver;
+#endif
+
+ std::string str;
+};
+
+#pragma db object optimistic
+struct rowversion_auto
+{
+ rowversion_auto (): ver (0) {}
+
+ #pragma db id auto
+ unsigned int id_;
+
+ #pragma db version type("ROWVERSION")
+#ifdef _WIN32
+ unsigned __int64 ver;
+#else
+ unsigned long long ver;
+#endif
+
+ std::string str;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mssql/types/traits.hxx b/odb-tests/mssql/types/traits.hxx
new file mode 100644
index 0000000..5881f50
--- /dev/null
+++ b/odb-tests/mssql/types/traits.hxx
@@ -0,0 +1,223 @@
+// file : mssql/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <odb/mssql/mssql-fwd.hxx> // date, time, datetime, datetimeoffset
+#include <odb/mssql/traits.hxx>
+
+#include "test.hxx" // date_time
+
+namespace odb
+{
+ namespace mssql
+ {
+ template <>
+ class value_traits<date_time, id_date>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef date image_type;
+
+ static void
+ set_value (date_time& v, const date& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ v.year = i.year;
+ v.month = i.month;
+ v.day = i.day;
+ v.hour = 0;
+ v.minute = 0;
+ v.second = 0;
+ v.fraction = 0;
+ v.timezone_hour = 0;
+ v.timezone_minute = 0;
+ }
+ }
+
+ static void
+ set_image (date& i, bool& is_null, const date_time& v)
+ {
+ is_null = false;
+ i.year = v.year;
+ i.month = v.month;
+ i.day = v.day;
+ }
+ };
+
+ template <>
+ class value_traits<date_time, id_time>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef time image_type;
+
+ static void
+ set_value (date_time& v, const time& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ v.year = 0;
+ v.month = 0;
+ v.day = 0;
+ v.hour = i.hour;
+ v.minute = i.minute;
+ v.second = i.second;
+ v.fraction = i.fraction;
+ v.timezone_hour = 0;
+ v.timezone_minute = 0;
+ }
+ }
+
+ static void
+ set_image (time& i, unsigned short s, bool& is_null, const date_time& v)
+ {
+ const unsigned int divider[8] =
+ {
+ 1000000000,
+ 100000000,
+ 10000000,
+ 1000000,
+ 100000,
+ 10000,
+ 1000,
+ 100
+ };
+
+ is_null = false;
+ i.hour = v.hour;
+ i.minute = v.minute;
+ i.second = v.second;
+ i.fraction = v.fraction - v.fraction % divider[s];
+ }
+ };
+
+ template <>
+ class value_traits<date_time, id_datetime>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef datetime image_type;
+
+ static void
+ set_value (date_time& v, const datetime& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ v.year = i.year;
+ v.month = i.month;
+ v.day = i.day;
+ v.hour = i.hour;
+ v.minute = i.minute;
+ v.second = i.second;
+ v.fraction = i.fraction;
+ v.timezone_hour = 0;
+ v.timezone_minute = 0;
+ }
+ }
+
+ static void
+ set_image (datetime& i,
+ unsigned short s,
+ bool& is_null,
+ const date_time& v)
+ {
+ const unsigned int divider[8] =
+ {
+ 1000000000,
+ 100000000,
+ 10000000,
+ 1000000,
+ 100000,
+ 10000,
+ 1000,
+ 100
+ };
+
+ is_null = false;
+ i.year = v.year;
+ i.month = v.month;
+ i.day = v.day;
+ i.hour = v.hour;
+ i.minute = v.minute;
+
+ // Scale value 8 indicates we are dealing with SMALLDATETIME
+ // which has the minutes precision.
+ //
+ if (s != 8)
+ {
+ i.second = v.second;
+ i.fraction = v.fraction - v.fraction % divider[s];
+ }
+ else
+ {
+ i.second = 0;
+ i.fraction = 0;
+ }
+ }
+ };
+
+ template <>
+ class value_traits<date_time, id_datetimeoffset>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef datetimeoffset image_type;
+
+ static void
+ set_value (date_time& v, const datetimeoffset& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ v.year = i.year;
+ v.month = i.month;
+ v.day = i.day;
+ v.hour = i.hour;
+ v.minute = i.minute;
+ v.second = i.second;
+ v.fraction = i.fraction;
+ v.timezone_hour = i.timezone_hour;
+ v.timezone_minute = i.timezone_minute;
+ }
+ }
+
+ static void
+ set_image (datetimeoffset& i,
+ unsigned short s,
+ bool& is_null,
+ const date_time& v)
+ {
+ const unsigned int divider[8] =
+ {
+ 1000000000,
+ 100000000,
+ 10000000,
+ 1000000,
+ 100000,
+ 10000,
+ 1000,
+ 100
+ };
+
+ is_null = false;
+ i.year = v.year;
+ i.month = v.month;
+ i.day = v.day;
+ i.hour = v.hour;
+ i.minute = v.minute;
+ i.second = v.second;
+ i.fraction = v.fraction - v.fraction % divider[s];
+ i.timezone_hour = v.timezone_hour;
+ i.timezone_minute = v.timezone_minute;
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/mysql-schema.testscript b/odb-tests/mysql-schema.testscript
new file mode 100644
index 0000000..dfa7852
--- /dev/null
+++ b/odb-tests/mysql-schema.testscript
@@ -0,0 +1,9 @@
+# file : mysql-schema.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# Create the MySQL database schema creation canned command base.
+#
+create_schema_cmd = [cmdline] \
+ $mysql_client_cmd 2>&1 | \
+ sed -e "'"'s/^mysql: \[Warning\] Using a password on the command .*//'"'" | \
+ sed -n -e "'"'s/(.+)/\1/p'"'" >&2
diff --git a/odb-tests/mysql.testscript b/odb-tests/mysql.testscript
new file mode 100644
index 0000000..e218ece
--- /dev/null
+++ b/odb-tests/mysql.testscript
@@ -0,0 +1,12 @@
+# file : mysql.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# Create the MySQL database schema creation canned command and setup the test
+# driver command line for the subsequent tests.
+#
+.include mysql-schema.testscript
+
+schema_file = [path] $out_base/"$schema"($multi ? '-mysql' : '').sql
+create_schema = [cmdline] cat "'""$schema_file""'" | $create_schema_cmd
+
+test.arguments += ($multi ? 'mysql' : ) $mysql_options
diff --git a/odb-tests/mysql/custom/buildfile b/odb-tests/mysql/custom/buildfile
new file mode 100644
index 0000000..4934e7c
--- /dev/null
+++ b/odb-tests/mysql/custom/buildfile
@@ -0,0 +1,37 @@
+# file : mysql/custom/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-mysql%lib{odb-mysql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix mysql_custom_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --hxx-prologue '#include "traits.hxx"' \
+ --hxx-prologue '#include "query.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{mysql-client}: include = adhoc
diff --git a/odb-tests/mysql/custom/driver.cxx b/odb-tests/mysql/custom/driver.cxx
new file mode 100644
index 0000000..526dbdc
--- /dev/null
+++ b/odb-tests/mysql/custom/driver.cxx
@@ -0,0 +1,117 @@
+// file : mysql/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom database type mapping in MySQL.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+ o.p = point (1.1111, 2222222222.2);
+ o.pv.push_back (point (1.1234, 2.2345));
+ o.pv.push_back (point (3.3456, 4.4567));
+ // VC just cannot roundtrip this.
+#ifndef _MSC_VER
+ o.pv.push_back (point (0.0000001, 0.000000001)); // Scientific notation.
+#endif
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Query.
+ //
+ typedef mysql::query<object> query;
+ typedef odb::result<object> result;
+
+ {
+ transaction t (db->begin ());
+
+ // Point comparison.
+ //
+ {
+ result r (db->query<object> (query::p == o.p));
+ assert (!r.empty ());
+ }
+
+ // Point comparison using native query.
+ //
+ {
+ result r (db->query<object> (query::p + "=" + query::_val (o.p)));
+ assert (!r.empty ());
+ }
+
+ // Access to individual members.
+ //
+ {
+ result r (db->query<object> (query::p.x == o.p.x));
+ assert (!r.empty ());
+ }
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.p.x++;
+ o.p.y--;
+ o.pv[1].x--;
+ o.pv[1].y++;
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mysql/custom/query.hxx b/odb-tests/mysql/custom/query.hxx
new file mode 100644
index 0000000..2fa8f73
--- /dev/null
+++ b/odb-tests/mysql/custom/query.hxx
@@ -0,0 +1,160 @@
+// file : mysql/custom/query.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef QUERY_HXX
+#define QUERY_HXX
+
+#include <string>
+
+#include <odb/mysql/query.hxx>
+
+#include "test.hxx" // point
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ struct query_column<point, id_string>
+ {
+ private:
+ const char* table_;
+ const char* column_;
+ const char* conversion_;
+
+ std::string x_table_;
+ std::string y_table_;
+ std::string s_column_;
+
+ // Sub-columns for individual members.
+ //
+ public:
+ query_column<double, id_double> x, y;
+
+ // is_null, is_not_null
+ //
+ public:
+ query_base
+ is_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NULL";
+ return q;
+ }
+
+ query_base
+ is_not_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NOT NULL";
+ return q;
+ }
+
+ // =
+ //
+ public:
+ query_base
+ equal (const point& v) const
+ {
+ return equal (val_bind<point> (v));
+ }
+
+ query_base
+ equal (val_bind<point> v) const
+ {
+ query_base q (table_, column_);
+ q += "=";
+ q.append<point, id_string> (v, conversion_);
+ return q;
+ }
+
+ query_base
+ equal (ref_bind<point> r) const
+ {
+ query_base q (table_, column_);
+ q += "=";
+ q.append<point, id_string> (r, conversion_);
+ return q;
+ }
+
+ friend query_base
+ operator== (const query_column& c, const point& v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const point& v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, val_bind<point> v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (val_bind<point> v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, ref_bind<point> r)
+ {
+ return c.equal (r);
+ }
+
+ friend query_base
+ operator== (ref_bind<point> r, const query_column& c)
+ {
+ return c.equal (r);
+ }
+
+ // Column comparison.
+ //
+ public:
+ query_base
+ operator== (const query_column<point, id_string>& c) const
+ {
+ query_base q (table_, column_);
+ q += "=";
+ q.append (c.table (), c.column ());
+ return q;
+ }
+
+ public:
+ query_column (const char* table, const char* column, const char* conv)
+ : table_ (table), column_ (column), conversion_ (conv),
+ x_table_ ("ST_X(" + std::string (table)), // @@ Not very clean.
+ y_table_ ("ST_Y(" + std::string (table)),
+ s_column_ (std::string (column) + ")"), // X & Y column suffix.
+ x (x_table_.c_str (), s_column_.c_str (), 0),
+ y (y_table_.c_str (), s_column_.c_str (), 0)
+ {
+ }
+
+ const char*
+ table () const
+ {
+ return table_;
+ }
+
+ const char*
+ column () const
+ {
+ return column_;
+ }
+
+ const char*
+ conversion () const
+ {
+ return conversion_;
+ }
+ };
+ }
+}
+
+#endif // QUERY_HXX
diff --git a/odb-tests/mysql/custom/test.hxx b/odb-tests/mysql/custom/test.hxx
new file mode 100644
index 0000000..82cc59d
--- /dev/null
+++ b/odb-tests/mysql/custom/test.hxx
@@ -0,0 +1,54 @@
+// file : mysql/custom/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Map GEOMETRY MySQL type to the point C++ struct. The other half
+// of this mapping is in traits.hxx (value_traits<point, id_string>).
+//
+#pragma db map type("GEOMETRY") \
+ as("VARCHAR(256)") \
+ to("ST_GeomFromText((?))") \
+ from("ST_AsText((?))")
+
+#pragma db value type("GEOMETRY")
+struct point
+{
+ point () {}
+ point (double x_, double y_): x (x_), y (y_) {}
+
+ double x;
+ double y;
+};
+
+inline bool
+operator== (const point& a, const point& b)
+{
+ return a.x == b.x && a.y == b.y;
+}
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id_) : id (id_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ point p;
+ std::vector<point> pv;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id == y.id && p == y.p && pv == y.pv;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mysql/custom/testscript b/odb-tests/mysql/custom/testscript
new file mode 100644
index 0000000..9bc8839
--- /dev/null
+++ b/odb-tests/mysql/custom/testscript
@@ -0,0 +1,11 @@
+# file : mysql/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../mysql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/custom/traits.hxx b/odb-tests/mysql/custom/traits.hxx
new file mode 100644
index 0000000..5386d86
--- /dev/null
+++ b/odb-tests/mysql/custom/traits.hxx
@@ -0,0 +1,88 @@
+// file : mysql/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <limits> // std::numeric_limits
+#include <sstream>
+#include <cstring> // std::memcpy
+
+#include <odb/mysql/traits.hxx>
+
+#include "test.hxx" // point
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ class value_traits<point, id_string>
+ {
+ public:
+ typedef point value_type;
+ typedef point query_type;
+
+ typedef char* image_type;
+
+ static void
+ set_value (point& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = point ();
+ else
+ {
+ // Point format is "POINT(x y)".
+ //
+ std::istringstream is (std::string (b.data () + 6, n - 6));
+
+ is >> v.x;
+ is >> v.y;
+ }
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const point& v)
+ {
+ is_null = false;
+ std::ostringstream os;
+
+ // The formula for the number of decimla digits required is given in:
+ //
+ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
+ //
+ os.precision (std::numeric_limits<double>::digits10);
+ // os.precision (2 + std::numeric_limits<double>::digits * 301/1000);
+
+ os << "POINT(" << v.x << ' ' << v.y << ')';
+
+ const std::string& s (os.str ());
+ n = s.size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ std::memcpy (b.data (), s.c_str (), n);
+ }
+ };
+
+ template <>
+ struct type_traits<point>
+ {
+ static const database_type_id db_type_id = id_string;
+
+ struct conversion
+ {
+ static const char* to () {return "ST_GeomFromText((?))";}
+ };
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/mysql/database/buildfile b/odb-tests/mysql/database/buildfile
new file mode 100644
index 0000000..304034e
--- /dev/null
+++ b/odb-tests/mysql/database/buildfile
@@ -0,0 +1,11 @@
+# file : mysql/database/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-mysql%lib{odb-mysql}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/mysql/database/driver.cxx b/odb-tests/mysql/database/driver.cxx
new file mode 100644
index 0000000..525ee87
--- /dev/null
+++ b/odb-tests/mysql/database/driver.cxx
@@ -0,0 +1,72 @@
+// file : mysql/database/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous (compilation only).
+//
+
+#include <string>
+
+#include <odb/mysql/database.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using std::string;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ // This code should not execute.
+ //
+ if (argc != 0)
+ return 0;
+
+ {
+ database d1 (0, 0, 0);
+ database d2 ("bob", "secret", "db1");
+ database d3 ("bob", "secret", "db1", "server1");
+ database d4 ("bob", "secret", "db1", "server1", 999);
+ database d5 ("bob", "secret", "db1", "server1", 999, "sock1");
+ database d6 ("bob", "secret", "db1", "server1", 999, "sock1", "charset1");
+ }
+
+ std::string u ("bob"), p ("secret"), db ("bd1"), h ("server1"),
+ s ("sock1"), cs ("charset1");
+
+ {
+ database d1 (u, p, db);
+ database d2 (u, p, db, h);
+ database d3 (u, p, db, h, 999);
+ database d4 (u, p, db, h, 999, &s);
+ database d5 (u, p, db, h, 999, &s, cs);
+ }
+
+ {
+ database d1 (u, 0, db);
+ database d2 (u, &p, db);
+ database d3 (u, &p, db, h);
+ database d4 (u, &p, db, h, 999);
+ database d5 (u, &p, db, h, 999, &s);
+ database d6 (u, &p, db, h, 999, &s, cs);
+ }
+
+ {
+ database d1 (u, p, db, h, 999, "socket1");
+ database d2 (u, p, db, h, 999, s);
+ database d3 (u, p, db, h, 999, s, cs);
+ }
+
+ {
+ database d1 (u, 0, db, h, 999, s);
+ database d2 (u, &p, db, h, 999, "socket1");
+ database d3 (u, &p, db, h, 999, s, cs);
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ database d3 (argc, argv, true, "charset1");
+ }
+}
diff --git a/odb-tests/mysql/database/testscript b/odb-tests/mysql/database/testscript
new file mode 100644
index 0000000..c2ff256
--- /dev/null
+++ b/odb-tests/mysql/database/testscript
@@ -0,0 +1,6 @@
+# file : mysql/database/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/index/buildfile b/odb-tests/mysql/index/buildfile
new file mode 100644
index 0000000..9cadce3
--- /dev/null
+++ b/odb-tests/mysql/index/buildfile
@@ -0,0 +1,34 @@
+# file : mysql/index/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-mysql%lib{odb-mysql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix mysql_index_ \
+ --generate-schema \
+ --default-database common
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{mysql-client}: include = adhoc
diff --git a/odb-tests/mysql/index/driver.cxx b/odb-tests/mysql/index/driver.cxx
new file mode 100644
index 0000000..4d0b7ad
--- /dev/null
+++ b/odb-tests/mysql/index/driver.cxx
@@ -0,0 +1,44 @@
+// file : mysql/index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test MySQL index creation. See also the common test.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ // This is just a schema creation test.
+ //
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mysql/index/test.hxx b/odb-tests/mysql/index/test.hxx
new file mode 100644
index 0000000..b4f6ae8
--- /dev/null
+++ b/odb-tests/mysql/index/test.hxx
@@ -0,0 +1,20 @@
+// file : mysql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ std::string s;
+ #pragma db index method("BTREE") member(s, "(200) DESC")
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mysql/index/testscript b/odb-tests/mysql/index/testscript
new file mode 100644
index 0000000..26dfc4f
--- /dev/null
+++ b/odb-tests/mysql/index/testscript
@@ -0,0 +1,11 @@
+# file : mysql/index/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../mysql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/native/buildfile b/odb-tests/mysql/native/buildfile
new file mode 100644
index 0000000..57c3c30
--- /dev/null
+++ b/odb-tests/mysql/native/buildfile
@@ -0,0 +1,16 @@
+# file : mysql/native/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-mysql%lib{odb-mysql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{mysql-client}: include = adhoc
diff --git a/odb-tests/mysql/native/driver.cxx b/odb-tests/mysql/native/driver.cxx
new file mode 100644
index 0000000..9b34fd2
--- /dev/null
+++ b/odb-tests/mysql/native/driver.cxx
@@ -0,0 +1,75 @@
+// file : mysql/native/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test native SQL execution.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Create the database schema.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->execute ("DROP TABLE IF EXISTS mysql_native_test");
+
+ db->execute ("CREATE TABLE mysql_native_test (n INT PRIMARY KEY) "
+ "ENGINE=InnoDB");
+
+ t.commit ();
+ }
+
+ // Insert a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("INSERT INTO mysql_native_test (n) VALUES (1)") == 1);
+
+ assert (
+ db->execute ("INSERT INTO mysql_native_test (n) VALUES (2)") == 1);
+
+ t.commit ();
+ }
+
+ // Select a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("SELECT n FROM mysql_native_test WHERE n < 3") == 2);
+
+ assert (
+ db->execute ("SELECT n FROM mysql_native_test WHERE n > 3") == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mysql/native/testscript b/odb-tests/mysql/native/testscript
new file mode 100644
index 0000000..21327ff
--- /dev/null
+++ b/odb-tests/mysql/native/testscript
@@ -0,0 +1,9 @@
+# file : mysql/native/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../mysql.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/truncation/buildfile b/odb-tests/mysql/truncation/buildfile
new file mode 100644
index 0000000..fbd936b
--- /dev/null
+++ b/odb-tests/mysql/truncation/buildfile
@@ -0,0 +1,35 @@
+# file : mysql/truncation/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-mysql%lib{odb-mysql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix mysql_truncation_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{mysql-client}: include = adhoc
diff --git a/odb-tests/mysql/truncation/driver.cxx b/odb-tests/mysql/truncation/driver.cxx
new file mode 100644
index 0000000..21084f5
--- /dev/null
+++ b/odb-tests/mysql/truncation/driver.cxx
@@ -0,0 +1,192 @@
+// file : mysql/truncation/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test insufficient buffer/truncation handling.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/connection.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ // The default pre-allocated buffer is 256 bytes long.
+ //
+ string long_str (300, 'c'); // This will get the buffer to 512
+ string longer_str (1025, 'b');
+
+ try
+ {
+ // Test basic operations.
+ //
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Run persist/load so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (1);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (1, o);
+ t.commit ();
+ }
+
+ {
+ object2 o (2);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (2, o);
+ t.commit ();
+ }
+
+ // Store/load the long string which should trigger buffer growth.
+ //
+ {
+ object1 o (3);
+ o.str_ = long_str;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == long_str);
+ t.commit ();
+ }
+
+ // Store/load longer string.
+ //
+ {
+ object1 o (3);
+ o.str_ = longer_str;
+
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == longer_str);
+ t.commit ();
+ }
+ }
+
+ // Test query.
+ //
+ {
+ typedef mysql::query<object1> query;
+ typedef odb::result<object1> result;
+
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Run persist/query so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (20);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+
+ result r (db->query<object1> (query::id == 20));
+ assert (r.begin ()->id_ == 20);
+ t.commit ();
+ }
+
+ // Test buffer growth with cached result.
+ //
+ {
+ object1 o;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::id >= 20));
+ result::iterator i (r.begin ());
+
+ o.id_ = i->id_;
+ o.str_ = long_str;
+
+ // This forces buffer growth in the middle of result iteration.
+ //
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ o.id_ = i->id_;
+ o.str_ = longer_str;
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ t.commit ();
+ }
+ }
+
+ // Test containers.
+ //
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Use different connections to persist and load the object.
+ //
+ connection_ptr c1 (db->connection ());
+ connection_ptr c2 (db->connection ());
+
+ container o (1);
+ o.vec_.push_back (string (513, 'x'));
+
+ {
+ transaction t (c1->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (c2->begin ());
+ unique_ptr<container> p (db->load<container> (1));
+ t.commit ();
+
+ assert (p->vec_ == o.vec_);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mysql/truncation/test.hxx b/odb-tests/mysql/truncation/test.hxx
new file mode 100644
index 0000000..1883b0e
--- /dev/null
+++ b/odb-tests/mysql/truncation/test.hxx
@@ -0,0 +1,48 @@
+// file : mysql/truncation/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db object table ("test")
+struct object1
+{
+ object1 () {}
+ object1 (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#pragma db object table ("test")
+struct object2
+{
+ object2 () {}
+ object2 (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#pragma db object
+struct container
+{
+ container () {}
+ container (unsigned long id) : id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ std::vector<std::string> vec_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mysql/truncation/testscript b/odb-tests/mysql/truncation/testscript
new file mode 100644
index 0000000..b9b6792
--- /dev/null
+++ b/odb-tests/mysql/truncation/testscript
@@ -0,0 +1,11 @@
+# file : mysql/truncation/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../mysql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/types/buildfile b/odb-tests/mysql/types/buildfile
new file mode 100644
index 0000000..112a81f
--- /dev/null
+++ b/odb-tests/mysql/types/buildfile
@@ -0,0 +1,36 @@
+# file : mysql/types/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($mysql && !$multi || $build.meta_operation == 'dist') \
+"mysql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-mysql%lib{odb-mysql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix mysql_types_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --hxx-prologue '#include "traits.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{mysql-client}: include = adhoc
diff --git a/odb-tests/mysql/types/driver.cxx b/odb-tests/mysql/types/driver.cxx
new file mode 100644
index 0000000..2354b04
--- /dev/null
+++ b/odb-tests/mysql/types/driver.cxx
@@ -0,0 +1,168 @@
+// file : mysql/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test MySQL type conversion.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace mysql = odb::mysql;
+using namespace mysql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ mysql_version v;
+ {
+ transaction t (db->begin ());
+ db->query<mysql_version> ().begin ().load (v);
+ t.commit ();
+ }
+
+ //cerr << "MySQL " << v.major << '.' << v.minor << '.' << v.release
+ // << " protocol " << v.protocol << endl;
+
+ object o (1);
+
+ o.bool_ = true;
+ o.schar_ = -123;
+ o.uchar_ = 123;
+ o.short_ = -12345;
+ o.ushort_ = 12345;
+ o.mint_ = -123456;
+ o.umint_ = 123456;
+ o.int_ = -123456;
+ o.uint_ = 123456;
+ o.long_long_ = -123456;
+ o.ulong_long_ = 123456;
+
+ o.float_ = 1.123F;
+ o.float8_ = 1.123;
+ o.double_ = 1.123;
+ o.decimal_ = "123.456";
+
+ o.date_ = date_time (false, 2010, 8, 29, 0, 0, 0);
+ o.time_ = date_time (true, 0, 0, 0, 12, 26, 59);
+ o.date_time_ = date_time (false, 2010, 8, 29, 12, 26, 59);
+ o.timestamp_ = date_time (false, 2010, 8, 29, 12, 26, 59);
+ o.year_ = 2010;
+
+ // If we are running against MySQL 5.6.4 or later, add fractional
+ // seconds and also alter the table to allow sub-second precision.
+ //
+ if (v.major > 5 ||
+ (v.major == 5 && (v.minor > 6 ||
+ (v.minor == 6 && v.release >= 4))))
+ {
+ o.time_.microseconds = 123456;
+ o.date_time_.microseconds = 234567;
+ o.timestamp_.microseconds = 345678;
+
+ transaction t (db->begin ());
+ db->execute ("ALTER TABLE `mysql_types_object`" \
+ " MODIFY COLUMN `time` TIME(6)," \
+ " MODIFY COLUMN `date_time` DATETIME(6)," \
+ " MODIFY COLUMN `timestamp` TIMESTAMP(6)");
+ t.commit ();
+ }
+
+ string short_str (128, 's');
+ string medium_str (250, 'm');
+ string long_str (2040, 'l');
+
+ const char* sb (short_str.c_str ()), *se (sb + short_str.size ());
+ const char* mb (medium_str.c_str ()), *me (mb + medium_str.size ());
+ const char* lb (long_str.c_str ()), *le (lb + long_str.size ());
+
+ o.char_ = short_str;
+ o.binary_.assign (sb, se);
+ o.varchar_ = medium_str;
+ o.varbinary_.assign (mb, me);
+ o.tinytext_ = short_str;
+ o.tinyblob_.assign (sb, se);
+ o.text_ = long_str;
+ o.blob_.assign (lb, le);
+ o.mediumtext_ = long_str;
+ o.mediumblob_.assign (lb, le);
+ o.longtext_ = long_str;
+ o.longblob_.assign (lb, le);
+
+ o.bit_.a = 1;
+ o.bit_.b = 0;
+ o.bit_.c = 0;
+ o.bit_.d = 1;
+
+ o.enum_def_ = green;
+ o.enum_cst_ = blue;
+ o.enum_str_ = "green";
+ o.set_.insert ("green");
+ o.set_.insert ("red");
+ o.set_.insert ("blue");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ //
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Test char array.
+ //
+ {
+ char_array o1 (1, "");
+ char_array o2 (2, "1234567890");
+ char_array o3 (3, "1234567890123456");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<char_array> p1 (db->load<char_array> (1));
+ unique_ptr<char_array> p2 (db->load<char_array> (2));
+ unique_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/mysql/types/test.hxx b/odb-tests/mysql/types/test.hxx
new file mode 100644
index 0000000..82f7496
--- /dev/null
+++ b/odb-tests/mysql/types/test.hxx
@@ -0,0 +1,328 @@
+// file : mysql/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <set>
+#include <string>
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <cstring> // std::memcpy, std::str[n]cmp, std::strlen
+
+#include <odb/core.hxx>
+
+typedef std::vector<char> buffer;
+
+struct date_time
+{
+ date_time ()
+ {
+ }
+
+ date_time (bool n,
+ unsigned int y,
+ unsigned int m,
+ unsigned int d,
+ unsigned int h,
+ unsigned int min,
+ unsigned int sec,
+ unsigned int msec = 0)
+ : negative (n),
+ year (y),
+ month (m),
+ day (d),
+ hour (h),
+ minute (min),
+ second (sec),
+ microseconds (msec)
+ {
+ }
+
+ bool
+ operator== (const date_time& y) const
+ {
+ return
+ negative == y.negative &&
+ year == y.year &&
+ month == y.month &&
+ day == y.day &&
+ hour == y.hour &&
+ minute == y.minute &&
+ second == y.second &&
+ microseconds == y.microseconds;
+ }
+
+ bool negative;
+ unsigned int year;
+ unsigned int month;
+ unsigned int day;
+ unsigned int hour;
+ unsigned int minute;
+ unsigned int second;
+ unsigned int microseconds;
+};
+
+struct bitfield
+{
+ unsigned int a: 1;
+ unsigned int b: 1;
+ unsigned int c: 1;
+ unsigned int d: 1;
+};
+
+inline bool
+operator== (bitfield x, bitfield y)
+{
+ return
+ x.a == y.a &&
+ x.b == y.b &&
+ x.c == y.c &&
+ x.d == y.d;
+}
+
+#pragma db value(bitfield) type ("BIT(4)")
+
+typedef std::set<std::string> set;
+typedef std::unique_ptr<std::string> string_ptr;
+
+enum color {red, green, blue};
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ // Integral types.
+ //
+ #pragma db type ("BOOL")
+ bool bool_;
+
+ #pragma db type ("TINYINT")
+ signed char schar_;
+
+ #pragma db type ("TINYINT UNSIGNED")
+ unsigned char uchar_;
+
+ #pragma db type ("SMALLINT")
+ short short_;
+
+ #pragma db type ("SMALLINT UNSIGNED")
+ unsigned short ushort_;
+
+ #pragma db type ("MEDIUMINT")
+ int mint_;
+
+ #pragma db type ("MEDIUMINT UNSIGNED")
+ unsigned int umint_;
+
+ #pragma db type ("INT")
+ int int_;
+
+ #pragma db type ("INT UNSIGNED")
+ unsigned int uint_;
+
+ #pragma db type ("BIGINT")
+ long long long_long_;
+
+ #pragma db type ("BIGINT UNSIGNED")
+ unsigned long long ulong_long_;
+
+ // Float types.
+ //
+ #pragma db type ("FLOAT")
+ float float_;
+
+ #pragma db type ("FLOAT(32)")
+ double float8_;
+
+ #pragma db type ("DOUBLE")
+ double double_;
+
+ #pragma db type ("DECIMAL(6,3)")
+ std::string decimal_;
+
+ // Data-time types.
+ //
+ #pragma db type ("DATE")
+ date_time date_;
+
+ #pragma db type ("TIME")
+ date_time time_;
+
+ #pragma db type ("DATETIME")
+ date_time date_time_;
+
+ #pragma db type ("TIMESTAMP")
+ date_time timestamp_;
+
+ #pragma db type ("YEAR")
+ short year_;
+
+ // String and binary types.
+ //
+ #pragma db type ("CHAR(128)")
+ std::string char_;
+
+ #pragma db type ("BINARY(128)")
+ buffer binary_;
+
+ #pragma db type ("VARCHAR(256)")
+ std::string varchar_;
+
+ #pragma db type ("VARBINARY(256)")
+ buffer varbinary_;
+
+ #pragma db type ("TINYTEXT")
+ std::string tinytext_;
+
+ #pragma db type ("TINYBLOB")
+ buffer tinyblob_;
+
+ #pragma db type ("TEXT")
+ std::string text_;
+
+ #pragma db type ("BLOB")
+ buffer blob_;
+
+ #pragma db type ("MEDIUMTEXT")
+ std::string mediumtext_;
+
+ #pragma db type ("MEDIUMBLOB")
+ buffer mediumblob_;
+
+ #pragma db type ("LONGTEXT")
+ std::string longtext_;
+
+ #pragma db type ("LONGBLOB")
+ buffer longblob_;
+
+ // Other types.
+ //
+ // #pragma db type ("BIT(4)") - assigned by #pragma db value
+ bitfield bit_;
+
+ // Test ENUM representations (integer and string).
+ //
+ color enum_def_;
+
+ // Map to a custom MySQL ENUM type.
+ //
+ #pragma db type ("ENUM('R', 'G', 'B')")
+ color enum_cst_;
+
+ #pragma db type ("ENUM('red', 'green', 'blue')")
+ std::string enum_str_;
+
+ #pragma db type ("SET('red', 'green', 'blue')")
+ set set_;
+
+ // Test NULL value.
+ //
+ #pragma db type ("TEXT") null
+ string_ptr null_;
+
+ bool
+ operator== (const object& y) const
+ {
+ return
+ id_ == y.id_ &&
+ bool_ == y.bool_ &&
+ schar_ == y.schar_ &&
+ uchar_ == y.uchar_ &&
+ short_ == y.short_ &&
+ ushort_ == y.ushort_ &&
+ mint_ == y.mint_ &&
+ umint_ == y.umint_ &&
+ int_ == y.int_ &&
+ uint_ == y.uint_ &&
+ long_long_ == y.long_long_ &&
+ ulong_long_ == y.ulong_long_ &&
+ float_ == y.float_ &&
+ float8_ == y.float8_ &&
+ double_ == y.double_ &&
+ decimal_ == y.decimal_ &&
+ date_ == y.date_ &&
+ time_ == y.time_ &&
+ date_time_ == y.date_time_ &&
+ timestamp_ == y.timestamp_ &&
+ year_ == y.year_ &&
+ char_ == y.char_ &&
+ binary_ == y.binary_ &&
+ varchar_ == y.varchar_ &&
+ varbinary_ == y.varbinary_ &&
+ tinytext_ == y.tinytext_ &&
+ tinyblob_ == y.tinyblob_ &&
+ text_ == y.text_ &&
+ blob_ == y.blob_ &&
+ mediumtext_ == y.mediumtext_ &&
+ mediumblob_ == y.mediumblob_ &&
+ longtext_ == y.longtext_ &&
+ longblob_ == y.longblob_ &&
+ bit_ == y.bit_ &&
+ enum_def_ == y.enum_def_ &&
+ enum_cst_ == y.enum_cst_ &&
+ enum_str_ == y.enum_str_ &&
+ set_ == y.set_ &&
+ ((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);
+ }
+};
+
+// Test char array.
+//
+#pragma db object
+struct char_array
+{
+ char_array () {}
+ char_array (unsigned long id, const char* s)
+ : id_ (id)
+ {
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ std::memcpy (s2, s, std::strlen (s) + 1);
+ s3[0] = c1 = *s;
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ char s1[17];
+
+ #pragma db type("CHAR(16)")
+ char s2[16];
+
+ char s3[1];
+ char c1;
+
+ bool
+ operator== (const char_array& y) const
+ {
+ return id_ == y.id_ &&
+ std::strcmp (s1, y.s1) == 0 &&
+ std::strncmp (s2, y.s2, sizeof (s2)) == 0 &&
+ s3[0] == y.s3[0] &&
+ c1 == y.c1;
+ }
+};
+
+// MySQL server version view.
+//
+#pragma db view query( \
+ "SELECT " \
+ "CAST(SUBSTRING_INDEX(@@version, '.', 1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '.', 2), '.', -1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '-', 1), '.', -1) AS UNSIGNED)," \
+ "@@protocol_version")
+struct mysql_version
+{
+ unsigned int major;
+ unsigned int minor;
+ unsigned int release;
+
+ unsigned int protocol;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/mysql/types/testscript b/odb-tests/mysql/types/testscript
new file mode 100644
index 0000000..2962d1c
--- /dev/null
+++ b/odb-tests/mysql/types/testscript
@@ -0,0 +1,11 @@
+# file : mysql/types/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../mysql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/mysql/types/traits.hxx b/odb-tests/mysql/types/traits.hxx
new file mode 100644
index 0000000..d4ce200
--- /dev/null
+++ b/odb-tests/mysql/types/traits.hxx
@@ -0,0 +1,198 @@
+// file : mysql/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <cstring> // std::memcpy, std::memset
+
+#include <odb/mysql/traits.hxx>
+
+#include "test.hxx" // date_time, string_ptr
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <database_type_id ID>
+ class value_traits<date_time, ID>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (date_time& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ v.negative = i.neg;
+ v.year = i.year;
+ v.month = i.month;
+ v.day = i.day;
+ v.hour = i.hour;
+ v.minute = i.minute;
+ v.second = i.second;
+ v.microseconds = static_cast<unsigned int> (i.second_part);
+ }
+ else
+ v = date_time ();
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const date_time& v)
+ {
+ is_null = false;
+ i.neg = v.negative;
+ i.year = v.year;
+ i.month = v.month;
+ i.day = v.day;
+ i.hour = v.hour;
+ i.minute = v.minute;
+ i.second = v.second;
+ i.second_part = v.microseconds;
+ }
+ };
+
+ template <>
+ class value_traits<bitfield, id_bit>
+ {
+ public:
+ typedef bitfield value_type;
+ typedef bitfield query_type;
+ typedef unsigned char* image_type;
+
+ static void
+ set_value (bitfield& v,
+ const unsigned char* s,
+ std::size_t,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ v.a = *s & 1;
+ v.b = (*s >> 1) & 1;
+ v.c = (*s >> 2) & 1;
+ v.d = (*s >> 3) & 1;
+ }
+ else
+ v.a = v.b = v.c = v.d = 0;
+ }
+
+ static void
+ set_image (unsigned char* s,
+ std::size_t,
+ std::size_t& n,
+ bool& is_null,
+ bitfield v)
+ {
+ is_null = false;
+ n = 1;
+ *s = v.a | (v.b << 1) | (v.c << 2) | (v.d << 3);
+ }
+ };
+
+ template <>
+ class value_traits<set, id_set>
+ {
+ public:
+ typedef set value_type;
+ typedef set query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (set& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.clear ();
+
+ if (!is_null)
+ {
+ const char* s (b.data ());
+ const char* e (s + n);
+
+ while (s < e)
+ {
+ const char* p (s);
+
+ while (p < e && *p != ',')
+ ++p;
+
+ v.insert (std::string (s, p - s));
+ s = p;
+
+ if (p != e)
+ ++s;
+ }
+ }
+ }
+
+ static void
+ set_image (details::buffer& buf,
+ std::size_t& n,
+ bool& is_null,
+ const set& v)
+ {
+ is_null = false;
+ n = 0;
+
+ for (set::const_iterator b (v.begin ()), i (b); i != v.end (); ++i)
+ {
+ std::size_t m (i->size () + (i != b ? 1 : 0));
+
+ if (n + m > buf.capacity ())
+ buf.capacity (n + m, n);
+
+ if (i != b)
+ buf.data ()[n++] = ',';
+
+ std::memcpy (buf.data () + n, i->c_str (), i->size ());
+ n += i->size ();
+ }
+ }
+ };
+
+ template <>
+ class value_traits<string_ptr, id_string>
+ {
+ public:
+ typedef string_ptr value_type;
+ typedef std::string query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (string_ptr& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.reset (is_null ? 0 : new std::string (b.data (), n));
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const string_ptr& v)
+ {
+ is_null = v.get () == 0;
+
+ if (!is_null)
+ {
+ n = v->size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ if (n != 0)
+ std::memcpy (b.data (), v->c_str (), n);
+ }
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/oracle/custom/custom.sql b/odb-tests/oracle/custom/custom.sql
new file mode 100644
index 0000000..6e22903
--- /dev/null
+++ b/odb-tests/oracle/custom/custom.sql
@@ -0,0 +1,53 @@
+/* This file contains custom type definitions and helper functions.
+ */
+
+/* For some reason CREATE OR REPLACE TYPE does not work on Oracle 10.2. */
+BEGIN
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TYPE Numbers';
+ EXCEPTION
+ WHEN OTHERS THEN
+ IF SQLCODE != -4043 THEN RAISE; END IF;
+ END;
+END;
+/
+
+CREATE TYPE Numbers AS VARRAY(100) OF NUMBER(10);
+/
+
+CREATE OR REPLACE FUNCTION string_to_numbers(in_str IN VARCHAR2) RETURN Numbers
+IS
+ ret Numbers := Numbers();
+ s_pos NUMBER := 1;
+ e_pos NUMBER := 0;
+BEGIN
+ IF in_str IS NOT NULL THEN
+ LOOP
+ e_pos := INSTR(in_str, ',', s_pos);
+ EXIT WHEN e_pos = 0;
+ ret.extend;
+ ret(ret.COUNT) := CAST(SUBSTR(in_str, s_pos, e_pos - s_pos) AS NUMBER);
+ s_pos := e_pos + 1;
+ END LOOP;
+ ret.extend;
+ ret(ret.COUNT) := CAST(SUBSTR(in_str, s_pos) AS NUMBER);
+ END IF;
+ RETURN ret;
+END;
+/
+
+CREATE OR REPLACE FUNCTION numbers_to_string(in_nums IN Numbers) RETURN VARCHAR2
+IS
+ ret VARCHAR2(1500);
+BEGIN
+ IF in_nums.COUNT != 0 THEN
+ FOR i IN in_nums.FIRST .. in_nums.LAST LOOP
+ IF i != in_nums.FIRST THEN
+ ret := ret || ',';
+ END IF;
+ ret := ret || in_nums(i);
+ END LOOP;
+ END IF;
+ RETURN ret;
+END;
+/
diff --git a/odb-tests/oracle/custom/driver.cxx b/odb-tests/oracle/custom/driver.cxx
new file mode 100644
index 0000000..45f0a4e
--- /dev/null
+++ b/odb-tests/oracle/custom/driver.cxx
@@ -0,0 +1,77 @@
+// file : oracle/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom database type mapping in Oracle.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace oracle = odb::oracle;
+using namespace oracle;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+ o.iv.push_back (123);
+ o.iv.push_back (234);
+ o.iv.push_back (-345);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Update.
+ //
+ o.iv[0]++;
+ o.iv.pop_back ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/oracle/custom/test.hxx b/odb-tests/oracle/custom/test.hxx
new file mode 100644
index 0000000..523d50b
--- /dev/null
+++ b/odb-tests/oracle/custom/test.hxx
@@ -0,0 +1,40 @@
+// file : oracle/custom/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Map Numbers VARRAY Oracle type to std::vector<int>. This type is defined
+// in the custom.sql file along with two helper functions that convert
+// between Numbers and its string representation. The other half of this
+// mapping is in traits.hxx (value_traits<std::vector<int>, id_string>).
+//
+#pragma db map type("Numbers") \
+ as("VARCHAR2(1500)") \
+ to("CAST(string_to_numbers((?)) AS Numbers)") \
+ from("numbers_to_string((?))")
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id_) : id (id_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db type("Numbers")
+ std::vector<int> iv;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id == y.id && iv == y.iv;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/oracle/custom/traits.hxx b/odb-tests/oracle/custom/traits.hxx
new file mode 100644
index 0000000..8df2f91
--- /dev/null
+++ b/odb-tests/oracle/custom/traits.hxx
@@ -0,0 +1,76 @@
+// file : oracle/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <vector>
+#include <sstream>
+#include <cstring> // std::memcpy
+#include <cassert> // std::memcpy
+
+#include <odb/oracle/traits.hxx>
+
+namespace odb
+{
+ namespace oracle
+ {
+
+ template <>
+ class value_traits<std::vector<int>, id_string>
+ {
+ public:
+ typedef std::vector<int> value_type;
+ typedef value_type query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (value_type& v,
+ const char* b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.clear ();
+
+ if (!is_null)
+ {
+ // Array format is "n1,n2,n3...".
+ //
+ std::istringstream is (std::string (b, n));
+
+ for (char c; !is.eof (); is >> c)
+ {
+ v.push_back (int ());
+ is >> v.back ();
+ }
+ }
+ }
+
+ static void
+ set_image (char* b,
+ std::size_t c,
+ std::size_t& n,
+ bool& is_null,
+ const value_type& v)
+ {
+ is_null = false;
+ std::ostringstream os;
+
+ for (value_type::const_iterator i (v.begin ()), e (v.end ()); i != e;)
+ {
+ os << *i;
+
+ if (++i != e)
+ os << ',';
+ }
+
+ const std::string& s (os.str ());
+ n = s.size ();
+ assert (n <= c);
+ std::memcpy (b, s.c_str (), n);
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/oracle/database/driver.cxx b/odb-tests/oracle/database/driver.cxx
new file mode 100644
index 0000000..499f136
--- /dev/null
+++ b/odb-tests/oracle/database/driver.cxx
@@ -0,0 +1,33 @@
+// file : oracle/database/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous (compilation only).
+//
+
+#include <odb/oracle/database.hxx>
+
+namespace oracle = odb::oracle;
+using namespace oracle;
+
+int
+main (int argc, char* argv[])
+{
+ // This code should not execute.
+ //
+ if (argc != 0)
+ return 0;
+
+ {
+ database d1 ("bob", "secret", "db1");
+ }
+
+ {
+ database d1 ("bob", "secret", "svc1", "server1");
+ database d2 ("bob", "secret", "svc1", "server1", 999);
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ }
+}
diff --git a/odb-tests/oracle/native/driver.cxx b/odb-tests/oracle/native/driver.cxx
new file mode 100644
index 0000000..541d21e
--- /dev/null
+++ b/odb-tests/oracle/native/driver.cxx
@@ -0,0 +1,77 @@
+// file : oracle/native/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test native SQL execution.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+using namespace std;
+namespace oracle = odb::oracle;
+using namespace oracle;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Create the database schema.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->execute ("BEGIN "
+ " EXECUTE IMMEDIATE 'DROP TABLE oracle_native_test'; "
+ " EXCEPTION "
+ " WHEN OTHERS THEN "
+ " IF SQLCODE != -942 THEN RAISE; END IF; "
+ "END;");
+
+ db->execute ("CREATE TABLE oracle_native_test (n NUMERIC(10,0))");
+
+ t.commit ();
+ }
+
+ // Insert a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("INSERT INTO oracle_native_test (n) VALUES (1)") == 1);
+
+ assert (
+ db->execute ("INSERT INTO oracle_native_test (n) VALUES (2)") == 1);
+
+ t.commit ();
+ }
+
+ // Select a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("SELECT n FROM oracle_native_test WHERE n < 3") == 2);
+
+ assert (
+ db->execute ("SELECT n FROM oracle_native_test WHERE n > 3") == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/oracle/template/driver.cxx b/odb-tests/oracle/template/driver.cxx
new file mode 100644
index 0000000..13317df
--- /dev/null
+++ b/odb-tests/oracle/template/driver.cxx
@@ -0,0 +1,40 @@
+// file : oracle/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace oracle = odb::oracle;
+using namespace oracle;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/oracle/template/template-vc10.vcxproj b/odb-tests/oracle/template/template-vc10.vcxproj
new file mode 100644
index 0000000..92066cf
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/oracle/template/template-vc10.vcxproj.filters b/odb-tests/oracle/template/template-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/oracle/template/template-vc11.vcxproj b/odb-tests/oracle/template/template-vc11.vcxproj
new file mode 100644
index 0000000..a92e437
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/oracle/template/template-vc11.vcxproj.filters b/odb-tests/oracle/template/template-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/oracle/template/template-vc12.vcxproj b/odb-tests/oracle/template/template-vc12.vcxproj
new file mode 100644
index 0000000..de35c03
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-oracle.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/oracle/template/template-vc12.vcxproj.filters b/odb-tests/oracle/template/template-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/oracle/template/template-vc8.vcproj b/odb-tests/oracle/template/template-vc8.vcproj
new file mode 100644
index 0000000..71e2b52
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-oracle.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-oracle.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/oracle/template/template-vc9.vcproj b/odb-tests/oracle/template/template-vc9.vcproj
new file mode 100644
index 0000000..de9804e
--- /dev/null
+++ b/odb-tests/oracle/template/template-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-oracle.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-d.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-oracle.lib odb.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), __value__(src_base)/, ) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/oracle/template/test.hxx b/odb-tests/oracle/template/test.hxx
new file mode 100644
index 0000000..bfa9cc9
--- /dev/null
+++ b/odb-tests/oracle/template/test.hxx
@@ -0,0 +1,25 @@
+// file : oracle/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/oracle/types/driver.cxx b/odb-tests/oracle/types/driver.cxx
new file mode 100644
index 0000000..2e3e2e7
--- /dev/null
+++ b/odb-tests/oracle/types/driver.cxx
@@ -0,0 +1,366 @@
+// file : oracle/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Oracle type conversion.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+namespace oracle = odb::oracle;
+using namespace oracle;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ // Create an Oracle database instance, setting both the client database
+ // and national character set to UTF-8.
+ //
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+
+ o.int_ = -123456;
+ o.uint_ = 123456;
+ o.long_long_ = -123456;
+ o.ulong_long_ = 123456;
+
+ o.float_ = 1.123F;
+ o.double_ = 1.123;
+ o.num_float_ = 1.123F;
+ o.num_double_ = 1.123;
+ o.binary_float_ = 1.123F;
+ o.binary_double_ = 1.123;
+
+ o.date_ = date_time (2010, 8, 29, 15, 33, 18, 0);
+ o.timestamp_ = date_time (1996, 3, 9, 18, 2, 54, 123000);
+ o.interval_ds_ = time_interval (0, 0, 13, 15, 23, 19, 123000);
+ o.interval_ym_ = time_interval (12, 3, 0, 0, 0, 0, 0);
+
+ string vshort_str (8, 's');
+ string short_str (13, 's');
+ string medium_str (104, 'm');
+ string long_str (1018, 'l');
+ string vlong_str (15000, 'v');
+
+ o.char_ = short_str;
+ o.varchar2_ = medium_str;
+ o.clob_.assign (vlong_str.data (), vlong_str.data () + vlong_str.size ());
+
+ o.nchar_ = vshort_str;
+ o.nvarchar2_ = medium_str;
+ o.nclob_.assign (vlong_str.data (), vlong_str.data () + vlong_str.size ());
+
+ o.empty_c_.push_back ("");
+
+ o.raw_.assign (long_str.data (), long_str.data () + long_str.size ());
+ o.blob_.assign (vlong_str.data (), vlong_str.data () + vlong_str.size ());
+
+ o.strs_.push_back (short_str);
+ o.strs_.push_back (medium_str);
+ o.strs_.push_back (long_str);
+ o.strs_.push_back (vlong_str);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Test character set conversion.
+ //
+ const char* unicode_str = "a \xD5\x95 \xEA\xAA\xAA \xF2\xAA\xAA\xAA";
+
+ // Testing of character set conversion to and from the client's database
+ // character set is disabled as the server database character set may
+ // not be able to represent some Unicode characters. If this were the case
+ // the test outcome would be a false negative.
+ //
+ // o.char_ = unicode_str;
+ // o.varchar2_ = unicode_str;
+ // o.clob_ = unicode_str;
+
+ o.nchar_ = unicode_str;
+ o.nvarchar2_ = unicode_str;
+ o.nclob_ = unicode_str;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Test 64 bit integers.
+ //
+ big_int bi1 (1, 0x8000000000000000LL);
+ big_int bi2 (2, -123456);
+ big_int bi3 (3, 0);
+ big_int bi4 (4, 123456);
+ big_int bi5 (5, 0xFFFFFFFFFFFFFFFFULL);
+
+ big_uint bui1 (1, 0);
+ big_uint bui2 (2, 123456);
+ big_uint bui3 (3, 0xFFFFFFFFFFFFFFFFULL);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (bi1);
+ db->persist (bi2);
+ db->persist (bi3);
+ db->persist (bi4);
+ db->persist (bi5);
+ db->persist (bui1);
+ db->persist (bui2);
+ db->persist (bui3);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<big_int> bil1 (db->load<big_int> (1));
+ auto_ptr<big_int> bil2 (db->load<big_int> (2));
+ auto_ptr<big_int> bil3 (db->load<big_int> (3));
+ auto_ptr<big_int> bil4 (db->load<big_int> (4));
+ auto_ptr<big_int> bil5 (db->load<big_int> (5));
+ auto_ptr<big_uint> buil1 (db->load<big_uint> (1));
+ auto_ptr<big_uint> buil2 (db->load<big_uint> (2));
+ auto_ptr<big_uint> buil3 (db->load<big_uint> (3));
+ t.commit ();
+
+ assert (bi1 == *bil1);
+ assert (bi2 == *bil2);
+ assert (bi3 == *bil3);
+ assert (bi4 == *bil4);
+ assert (bi5 == *bil5);
+ assert (bui1 == *buil1);
+ assert (bui2 == *buil2);
+ assert (bui3 == *buil3);
+ }
+
+ // Test large BLOBs.
+ //
+ descriptor b1 (1);
+ b1.blob.assign (50000, 'b');
+ b1.timestamp = date_time (1996, 3, 9, 18, 2, 54, 123000);
+ b1.interval_ds = time_interval (0, 0, 13, 15, 23, 19, 123000);
+ b1.interval_ym = time_interval (12, 3, 0, 0, 0, 0, 0);
+
+ descriptor b2 (2);
+ b2.blob.assign (500000, 'b');
+ b2.timestamp = date_time (1997, 4, 10, 19, 3, 55, 234000);
+ b2.interval_ds = time_interval (0, 0, 14, 16, 24, 20, 234000);
+ b2.interval_ym = time_interval (13, 4, 0, 0, 0, 0, 0);
+
+ descriptor b3 (3);
+ b3.blob.assign (5000, 'b');
+ b3.timestamp = date_time (1995, 2, 8, 17, 1, 53, 120000);
+ b3.interval_ds = time_interval (0, 0, 12, 14, 22, 18, 120000);
+ b3.interval_ym = time_interval (11, 2, 0, 0, 0, 0, 0);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (b1);
+ db->persist (b2);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<descriptor> p1 (db->load<descriptor> (1));
+ auto_ptr<descriptor> p2 (db->load<descriptor> (2));
+ t.commit ();
+
+ assert (b1 == *p1);
+ assert (b2 == *p2);
+ }
+
+ // Test image copying with descriptor-based type (LOB, date-time) data.
+ //
+ {
+ typedef oracle::query<descriptor> query;
+ typedef odb::result<descriptor> result;
+
+ transaction t (db->begin ());
+
+ // Pre-bind the image for other operations.
+ //
+ {
+ db->persist (b3);
+ db->update (b3);
+ db->reload (b3);
+ db->erase (b3);
+ }
+
+
+ result r (db->query<descriptor> (query::id < 3));
+ result::iterator i (r.begin ());
+
+ assert (i != r.end ());
+
+ {
+ result r (db->query<descriptor> (query::id > 1));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (*i == b2);
+ assert (++i == r.end ());
+ }
+
+ assert (*i == b1); // Load from copy (copy c-tor).
+
+ ++i;
+ assert (i != r.end ());
+
+ {
+ result r (db->query<descriptor> (query::id < 2));
+ result::iterator i (r.begin ());
+ assert (i != r.end ());
+ assert (*i == b1);
+ assert (++i == r.end ());
+ }
+
+ assert (*i == b2); // Load from copy (copy assign).
+ assert (++i == r.end ());
+
+ // Make sure all other operations are still working.
+ //
+ {
+ db->persist (b3);
+#ifdef HAVE_CXX11
+ unique_ptr<descriptor> p (db->load<descriptor> (3));
+#else
+ auto_ptr<descriptor> p (db->load<descriptor> (3));
+#endif
+ assert (b3 == *p);
+ b3.blob.push_back (123);
+ db->update (b3);
+ db->reload (p);
+ assert (b3 == *p);
+ db->erase (b3);
+ }
+
+ t.commit ();
+ }
+
+ // Test descriptor management in TIMESTAMP and INTERVAL images.
+ //
+ {
+ typedef oracle::query<object> query;
+ typedef odb::result<object> result;
+
+ query q (query::timestamp == o.timestamp_ &&
+ query::interval_ym == o.interval_ym_ &&
+ query::interval_ds == o.interval_ds_);
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> (q));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (q));
+ assert (size (r) == 1);
+ }
+
+ {
+ // Query temporary.
+ //
+ result r (db->query<object> (
+ query::timestamp == o.timestamp_ &&
+ query::interval_ym == o.interval_ym_ &&
+ query::interval_ds == o.interval_ds_));
+
+ query dummy (query::timestamp == o.timestamp_ &&
+ query::interval_ym == o.interval_ym_ &&
+ query::interval_ds == o.interval_ds_);
+
+ assert (size (r) == 1);
+ }
+
+ t.commit ();
+ }
+
+ // Test char array.
+ //
+ {
+ char_array o1 (1, "");
+ char_array o2 (2, "1234567890");
+ char_array o3 (3, "1234567890123456");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ // Oracle returns padded values for CHAR(N) unless they are
+ // empty (represented as NULL).
+ //
+ memcpy (o2.s2, "1234567890 ", 16);
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<char_array> p1 (db->load<char_array> (1));
+ auto_ptr<char_array> p2 (db->load<char_array> (2));
+ auto_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/oracle/types/test.hxx b/odb-tests/oracle/types/test.hxx
new file mode 100644
index 0000000..255bc08
--- /dev/null
+++ b/odb-tests/oracle/types/test.hxx
@@ -0,0 +1,353 @@
+// file : oracle/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <common/config.hxx> // HAVE_CXX11
+
+#include <string>
+#include <vector>
+#include <memory> // std::auto_ptr
+#include <cstring> // std::memcpy, std::str[n]cmp, std::strlen
+
+#include <odb/core.hxx>
+
+struct date_time
+{
+ date_time ()
+ {
+ }
+
+ date_time (unsigned short y,
+ unsigned char m,
+ unsigned char d,
+ unsigned char h,
+ unsigned char min,
+ unsigned char sec,
+ unsigned int nsec)
+ : year (y),
+ month (m),
+ day (d),
+ hour (h),
+ minute (min),
+ second (sec),
+ nanosecond (nsec)
+ {
+ }
+
+ bool
+ operator== (const date_time& y) const
+ {
+ return
+ year == y.year &&
+ month == y.month &&
+ day == y.day &&
+ hour == y.hour &&
+ minute == y.minute &&
+ second == y.second &&
+ nanosecond == y.nanosecond;
+ }
+
+ unsigned short year;
+ unsigned char month;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ unsigned int nanosecond;
+};
+
+struct time_interval
+{
+ time_interval ()
+ {
+ }
+
+ time_interval (int y, int m, int d, int h, int min, int sec, int nsec)
+ : year (y),
+ month (m),
+ day (d),
+ hour (h),
+ minute (min),
+ second (sec),
+ nanosecond (nsec)
+ {
+ }
+
+ bool
+ operator== (const time_interval& y) const
+ {
+ return
+ year == y.year &&
+ month == y.month &&
+ day == y.day &&
+ hour == y.hour &&
+ minute == y.minute &&
+ second == y.second &&
+ nanosecond == y.nanosecond;
+ }
+
+ int year;
+ int month;
+ int day;
+ int hour;
+ int minute;
+ int second;
+ int nanosecond;
+};
+
+#ifdef HAVE_CXX11
+typedef std::unique_ptr<std::string> string_ptr;
+#else
+typedef std::auto_ptr<std::string> string_ptr;
+#endif
+
+typedef std::vector<std::string> strings;
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ // Integral types.
+ //
+ #pragma db type ("NUMBER(10)")
+ int int_;
+
+ #pragma db type ("NUMBER(10)")
+ unsigned uint_;
+
+ #pragma db type ("NUMBER(19)")
+ long long long_long_;
+
+ #pragma db type ("NUMBER(20)")
+ unsigned long long ulong_long_;
+
+ // Float types.
+ //
+ #pragma db type ("FLOAT(24)")
+ float float_;
+
+ #pragma db type ("FLOAT(53)")
+ double double_;
+
+ #pragma db type ("NUMBER(7,3)")
+ float num_float_;
+
+ #pragma db type ("NUMBER(15,5)")
+ double num_double_;
+
+ #pragma db type ("BINARY_FLOAT")
+ float binary_float_;
+
+ #pragma db type ("BINARY_DOUBLE")
+ double binary_double_;
+
+ // Data-time types.
+ //
+ #pragma db type ("DATE")
+ date_time date_;
+
+ #pragma db type ("TIMESTAMP(6)")
+ date_time timestamp_;
+
+ #pragma db type ("INTERVAL DAY TO SECOND")
+ time_interval interval_ds_;
+
+ #pragma db type ("INTERVAL YEAR TO MONTH")
+ time_interval interval_ym_;
+
+ // String and binary types.
+ //
+ #pragma db type ("CHAR(13)")
+ std::string char_;
+
+ #pragma db type ("VARCHAR2(512)") null
+ std::string varchar2_;
+
+ #pragma db type ("NCHAR(8)")
+ std::string nchar_;
+
+ #pragma db type ("NVARCHAR2(512)") null
+ std::string nvarchar2_;
+
+ // Oracle treats empty and NULL VARCHAR2 the same. Test that we
+ // handle this.
+ //
+ std::string empty_;
+ std::vector<std::string> empty_c_;
+
+ #pragma db type ("RAW(1024)")
+ std::vector<char> raw_;
+
+ // LOB types.
+ //
+ #pragma db type ("BLOB")
+ std::vector<char> blob_;
+
+ #pragma db type ("CLOB")
+ std::string clob_;
+
+ #pragma db type ("NCLOB")
+ std::string nclob_;
+
+ // Test containers of LOBs
+ //
+ #pragma db value_type ("CLOB")
+ strings strs_;
+
+ // Test NULL value.
+ //
+ #pragma db type ("VARCHAR2(32)") null
+ string_ptr null_;
+
+ bool
+ operator== (const object& y) const
+ {
+ return
+ id_ == y.id_ &&
+ int_ == y.int_ &&
+ uint_ == y.uint_ &&
+ long_long_ == y.long_long_ &&
+ ulong_long_ == y.ulong_long_ &&
+ float_ == y.float_ &&
+ double_ == y.double_ &&
+ num_float_ == y.num_float_ &&
+ num_double_ == y.num_double_ &&
+ binary_float_ == y.binary_float_ &&
+ binary_double_ == y.binary_double_ &&
+ date_ == y.date_ &&
+ timestamp_ == y.timestamp_ &&
+ interval_ds_ == y.interval_ds_ &&
+ interval_ym_ == y.interval_ym_ &&
+ char_ == y.char_ &&
+ varchar2_ == y.varchar2_ &&
+ nchar_ == y.nchar_ &&
+ nvarchar2_ == y.nvarchar2_ &&
+ empty_ == y.empty_ &&
+ empty_c_ == y.empty_c_ &&
+ raw_ == y.raw_ &&
+ blob_ == y.blob_ &&
+ clob_ == y.clob_ &&
+ nclob_ == y.nclob_ &&
+ strs_ == y.strs_ &&
+ ((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);
+ }
+};
+
+#pragma db object
+struct big_uint
+{
+ big_uint (unsigned int id = 0, unsigned long long v = 0)
+ : id_ (id), value (v)
+ {
+ }
+
+ #pragma db id
+ unsigned int id_;
+
+ unsigned long long value;
+
+ bool
+ operator== (const big_uint& y) const
+ {
+ return id_ == y.id_ && value == y.value;
+ }
+};
+
+#pragma db object
+struct big_int
+{
+ big_int (unsigned int id = 0, long long v = 0)
+ : id_ (id), value (v)
+ {
+ }
+
+ #pragma db id
+ unsigned int id_;
+
+ long long value;
+
+ bool
+ operator== (const big_int& y) const
+ {
+ return id_ == y.id_ && value == y.value;
+ }
+};
+
+#pragma db object
+struct descriptor
+{
+ descriptor (unsigned int id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned int id_;
+
+ #pragma db type ("BLOB")
+ std::vector<char> blob;
+
+ #pragma db type ("TIMESTAMP(6)")
+ date_time timestamp;
+
+ #pragma db type ("INTERVAL DAY TO SECOND")
+ time_interval interval_ds;
+
+ #pragma db type ("INTERVAL YEAR TO MONTH")
+ time_interval interval_ym;
+
+ bool
+ operator== (const descriptor& y) const
+ {
+ return id_ == y.id_ &&
+ blob == y.blob &&
+ timestamp == y.timestamp &&
+ interval_ds == y.interval_ds &&
+ interval_ym == y.interval_ym;
+ }
+};
+
+// Test char array.
+//
+#pragma db object
+struct char_array
+{
+ char_array () {}
+ char_array (unsigned long id, const char* s)
+ : id_ (id)
+ {
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ std::memcpy (s2, s, std::strlen (s) + 1);
+ s3[0] = c1 = *s;
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ char s1[17];
+
+ #pragma db type("CHAR(16)") null
+ char s2[16];
+
+ #pragma db null
+ char s3[1];
+
+ #pragma db null
+ char c1;
+
+ bool
+ operator== (const char_array& y) const
+ {
+ return id_ == y.id_ &&
+ std::strcmp (s1, y.s1) == 0 &&
+ std::strncmp (s2, y.s2, sizeof (s2)) == 0 &&
+ s3[0] == y.s3[0] &&
+ c1 == y.c1;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/oracle/types/traits.hxx b/odb-tests/oracle/types/traits.hxx
new file mode 100644
index 0000000..ad747d8
--- /dev/null
+++ b/odb-tests/oracle/types/traits.hxx
@@ -0,0 +1,192 @@
+// file : oracle/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <odb/oracle/oracle-types.hxx> // datetime, interval_ym, interval_ds
+#include <odb/oracle/traits.hxx>
+
+#include <odb/oracle/details/date.hxx>
+
+#include "test.hxx" // date_time, time_interval
+
+namespace odb
+{
+ namespace oracle
+ {
+ template <>
+ class value_traits<date_time, id_date>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef char* image_type;
+
+ static void
+ set_value (date_time& v, const char* i, bool is_null)
+ {
+ if (!is_null)
+ {
+ short y (0);
+ unsigned char m (0), d (0), h (0), mins (0), s (0);
+
+ details::get_date (i, y, m, d, h, mins, s);
+
+ v.year = y;
+ v.month = m;
+ v.day = d;
+ v.hour = h;
+ v.minute = mins;
+ v.second = s;
+
+ // Oracle DATE does not support fractional seconds.
+ //
+ v.nanosecond = 0;
+ }
+ }
+
+ static void
+ set_image (char* i, bool& is_null, const date_time& v)
+ {
+ is_null = false;
+ details::set_date (i,
+ static_cast<unsigned short> (v.year),
+ v.month,
+ v.day,
+ v.hour,
+ v.minute,
+ v.second);
+ }
+ };
+
+ template <>
+ class value_traits<date_time, id_timestamp>
+ {
+ public:
+ typedef date_time value_type;
+ typedef date_time query_type;
+ typedef datetime image_type;
+
+ static void
+ set_value (date_time& v, const datetime& i, bool is_null)
+ {
+ if (!is_null)
+ {
+ sb2 y (0);
+ ub1 m (0), d (0), h (0), mins (0), s (0);
+ ub4 ns (0);
+
+ i.get (y, m, d, h, mins, s, ns);
+
+ v.year = y;
+ v.month = m;
+ v.day = d;
+ v.hour = h;
+ v.minute = mins;
+ v.second = s;
+ v.nanosecond = ns;
+ }
+ }
+
+ static void
+ set_image (datetime& i,
+ bool& is_null,
+ const date_time& v)
+ {
+ is_null = false;
+
+ i.set (static_cast<sb2> (v.year),
+ v.month,
+ v.day,
+ v.hour,
+ v.minute,
+ v.second,
+ v.nanosecond);
+ }
+ };
+
+ template <>
+ class value_traits<time_interval, id_interval_ds>
+ {
+ public:
+ typedef time_interval value_type;
+ typedef time_interval query_type;
+ typedef interval_ds image_type;
+
+ static void
+ set_value (time_interval& v,
+ const interval_ds& i,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ sb4 d (0), h (0), m (0), s (0), ns (0);
+ i.get (d, h, m, s, ns);
+
+ v.year = 0;
+ v.month = 0;
+ v.day = static_cast<unsigned char> (d);
+ v.hour = static_cast<unsigned char> (h);
+ v.minute = static_cast<unsigned char> (m);
+ v.second = static_cast<unsigned char> (s);
+ v.nanosecond = static_cast<unsigned int> (ns);
+ }
+ }
+
+ static void
+ set_image (interval_ds& i,
+ bool& is_null,
+ const time_interval& v)
+ {
+ is_null = false;
+
+ i.set (v.day,
+ v.hour,
+ v.minute,
+ v.second,
+ static_cast<sb4> (v.nanosecond));
+ }
+ };
+
+ template <>
+ class value_traits<time_interval, id_interval_ym>
+ {
+ public:
+ typedef time_interval value_type;
+ typedef time_interval query_type;
+ typedef interval_ym image_type;
+
+ static void
+ set_value (time_interval& v,
+ const interval_ym& i,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ sb4 y (0), m (0);
+ i.get (y, m);
+
+ v.year = static_cast<unsigned short> (y);
+ v.month = static_cast<unsigned char> (m);
+ v.day = 0;
+ v.hour = 0;
+ v.minute = 0;
+ v.second = 0;
+ v.nanosecond = 0;
+ }
+ }
+
+ static void
+ set_image (interval_ym& i,
+ bool& is_null,
+ const time_interval& v)
+ {
+ is_null = false;
+ i.set (v.year, v.month);
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/pgsql-schema.testscript b/odb-tests/pgsql-schema.testscript
new file mode 100644
index 0000000..8659bcd
--- /dev/null
+++ b/odb-tests/pgsql-schema.testscript
@@ -0,0 +1,6 @@
+# file : pgsql-schema.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# Create the PostgreSQL database schema creation canned command base.
+#
+create_schema_cmd = [cmdline] $pgsql_client_cmd
diff --git a/odb-tests/pgsql.testscript b/odb-tests/pgsql.testscript
new file mode 100644
index 0000000..e4b4636
--- /dev/null
+++ b/odb-tests/pgsql.testscript
@@ -0,0 +1,12 @@
+# file : pgsql.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# Create the PostgreSQL database schema creation canned command and setup the
+# test driver command line for the subsequent tests.
+#
+.include pgsql-schema.testscript
+
+schema_file = [path] $out_base/"$schema"($multi ? '-pgsql' : '').sql
+create_schema = [cmdline] $create_schema_cmd -f $schema_file
+
+test.arguments += ($multi ? 'pgsql' : ) $pgsql_options
diff --git a/odb-tests/pgsql/buildfile b/odb-tests/pgsql/buildfile
new file mode 100644
index 0000000..c6385c0
--- /dev/null
+++ b/odb-tests/pgsql/buildfile
@@ -0,0 +1,6 @@
+# file : pgsql/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -bulk/}
+
+./: bulk/: include = ($pgsql && !$multi && $pgsql_bulk)
diff --git a/odb-tests/pgsql/bulk/buildfile b/odb-tests/pgsql/bulk/buildfile
new file mode 100644
index 0000000..6984edb
--- /dev/null
+++ b/odb-tests/pgsql/bulk/buildfile
@@ -0,0 +1,40 @@
+# file : pgsql/bulk/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+if ($build.meta_operation != 'dist')
+{
+ assert ($pgsql && !$multi) \
+ "pgsql should be configured via config.odb_tests.database variable as a single database"
+
+ assert ($pgsql_bulk) "bulk operations are disabled for pgsql"
+}
+
+import libodb = libodb%lib{odb}
+
+import libs = libpq%lib{pq}
+import libs += libodb-pgsql%lib{odb-pgsql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pgsql_bulk_ \
+ --generate-schema \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/bulk/driver.cxx b/odb-tests/pgsql/bulk/driver.cxx
new file mode 100644
index 0000000..ba25542
--- /dev/null
+++ b/odb-tests/pgsql/bulk/driver.cxx
@@ -0,0 +1,361 @@
+// file : pgsql/bulk/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test transaction savepoints.
+//
+
+#include <libpq-fe.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stddef.h>
+#include <sys/select.h>
+
+// Note: hack.
+//
+#include <arpa/inet.h>
+#define htonll(x) ((((long long)htonl(x)) << 32) + htonl((x) >> 32))
+
+#undef NDEBUG
+#include <assert.h>
+
+static const size_t columns = 3;
+
+struct data
+{
+ long long id;
+ long long idata;
+ const char* sdata;
+};
+
+static char* values[columns];
+static int lengths[columns];
+static int formats[columns] = {1, 1, 1};
+
+static const unsigned int types[columns] = {
+ 20, // int8
+ 20, // int8
+ 25 // text
+};
+
+static void
+init (const struct data* d)
+{
+ values[0] = (char*)&d->id;
+ lengths[0] = sizeof (d->id);
+
+ values[1] = (char*)&d->idata;
+ lengths[1] = sizeof (d->idata);
+
+ values[2] = (char*)d->sdata;
+ lengths[2] = strlen (d->sdata);
+}
+
+static void
+execute (PGconn* conn, const struct data* ds, size_t n)
+{
+ int sock = PQsocket (conn);
+ assert (sock != -1);
+
+ if (PQsetnonblocking (conn, 1) == -1 ||
+ PQenterPipelineMode (conn) == 0)
+ assert (false);
+
+ // True if we've written and read everything, respectively.
+ //
+ bool wdone = false;
+ bool rdone = false;
+
+ size_t wn = 0;
+ size_t rn = 0;
+
+ while (!rdone)
+ {
+ fd_set wds;
+ if (!wdone)
+ {
+ FD_ZERO (&wds);
+ FD_SET (sock, &wds);
+ }
+
+ fd_set rds;
+ FD_ZERO (&rds);
+ FD_SET (sock, &rds);
+
+ if (select (sock + 1, &rds, wdone ? NULL : &wds, NULL, NULL) == -1)
+ {
+ if (errno == EINTR)
+ continue;
+
+ assert (false);
+ }
+
+ // Try to minimize the chance of blocking the server by first processing
+ // the result and then sending more queries.
+ //
+ if (FD_ISSET (sock, &rds))
+ {
+ if (PQconsumeInput (conn) == 0)
+ assert (false);
+
+ while (wn > rn && PQisBusy (conn) == 0)
+ {
+ //fprintf (stderr, "PQgetResult %zu\n", rn);
+
+ PGresult* res = PQgetResult (conn);
+ assert (res != NULL);
+ ExecStatusType stat = PQresultStatus (res);
+
+ if (stat == PGRES_PIPELINE_SYNC)
+ {
+ assert (wdone && rn == n);
+ PQclear (res);
+ rdone = true;
+ break;
+ }
+
+ if (stat == PGRES_FATAL_ERROR)
+ {
+ const char* s = PQresultErrorField (res, PG_DIAG_SQLSTATE);
+
+ if (strcmp (s, "23505") == 0)
+ fprintf (stderr, "duplicate id at %zu\n", rn);
+ }
+
+ PQclear (res);
+ assert (rn != n);
+ ++rn;
+
+ // We get a NULL result after each query result.
+ //
+ {
+ PGresult* end = PQgetResult (conn);
+ assert (end == NULL);
+ }
+ }
+ }
+
+ if (!wdone && FD_ISSET (sock, &wds))
+ {
+ // Send queries until we get blocked (write-biased). This feels like
+ // a better overall strategy to keep the server busy compared to
+ // sending one query at a time and then re-checking if there is
+ // anything to read because the results of INSERT/UPDATE/DELETE are
+ // presumably small and quite a few of them can get buffered before
+ // the server gets blocked.
+ //
+ for (;;)
+ {
+ if (wn < n)
+ {
+ //fprintf (stderr, "PQsendQueryPrepared %zu\n", wn);
+
+ init (ds + wn);
+
+ if (PQsendQueryPrepared (conn,
+ "persist_object",
+ (int)(columns),
+ values,
+ lengths,
+ formats,
+ 1) == 0)
+ assert (false);
+
+ if (++wn == n)
+ {
+ if (PQpipelineSync (conn) == 0)
+ assert (false);
+
+ ++wn;
+ }
+ }
+
+ // PQflush() result:
+ //
+ // 0 -- success (queue is now empty)
+ // 1 -- blocked
+ // -1 -- error
+ //
+ int r = PQflush (conn);
+ assert (r != -1);
+
+ if (r == 0)
+ {
+ if (wn < n)
+ {
+ // If we continue here, then we are write-biased. And if we
+ // break, then we are read-biased.
+ //
+#if 0
+ break;
+#else
+ continue;
+#endif
+ }
+
+ wdone = true;
+ }
+
+ break; // Blocked or done.
+ }
+ }
+ }
+
+ if (PQexitPipelineMode (conn) == 0 ||
+ PQsetnonblocking (conn, 0) == -1)
+ assert (false);
+}
+
+static void
+test (PGconn* conn)
+{
+ const size_t batch = 500;
+ struct data ds[batch];
+
+ for (size_t i = 0; i != batch; ++i)
+ {
+ ds[i].id = htonll (i == batch / 2 ? i - 1 : i); // Cause duplicate PK.
+ ds[i].idata = htonll (i);
+ ds[i].sdata = "abc";
+ }
+
+ // Prepare the statement.
+ //
+ {
+ PGresult* res = PQprepare (
+ conn,
+ "persist_object",
+ "INSERT INTO \"pgsql_bulk_object\" "
+ "(\"id\", "
+ "\"idata\", "
+ "\"sdata\") "
+ "VALUES "
+ "($1, $2, $3)",
+ (int)(columns),
+ types);
+ assert (PQresultStatus (res) == PGRES_COMMAND_OK);
+ PQclear (res);
+ }
+
+ // Begin transaction.
+ //
+ {
+ PGresult* res = PQexec (conn, "begin");
+ assert (PQresultStatus (res) == PGRES_COMMAND_OK);
+ PQclear (res);
+ }
+
+ execute (conn, ds, batch);
+
+ // Commit transaction.
+ //
+ {
+ PGresult* res = PQexec (conn, "commit");
+ assert (PQresultStatus (res) == PGRES_COMMAND_OK);
+ PQclear (res);
+ }
+}
+
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <cstring>
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ bool fail_already_persistent (false);
+
+ for (int i (1); i != argc; ++i)
+ {
+ if (strcmp (argv[i], "--fail-already-persistent") == 0)
+ {
+ fail_already_persistent = true;
+
+ for (; i != argc - 1; ++i)
+ argv[i] = argv[i + 1];
+
+ --argc;
+
+ break;
+ }
+ }
+
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ connection_ptr cn (db->connection ());
+
+ if (false)
+ {
+ PGconn* conn (cn->handle ());
+ test (conn);
+ }
+
+ {
+ const unsigned long n (500);
+
+ vector<object> os;
+
+ for (unsigned long i (0); i != n; ++i)
+ {
+ os.push_back (object {i, i, string (i, 'x')});
+
+ if (fail_already_persistent && i == n / 2)
+ os.push_back (object {i, i, to_string (i)});
+ }
+
+ {
+ transaction t (cn->begin ());
+ db->persist (os.begin (), os.end ());
+ t.commit ();
+ }
+
+ {
+ transaction t (cn->begin ());
+ db->find<object> (2);
+ t.commit ();
+ }
+
+ for (unsigned long i (0); i != n; ++i)
+ {
+ //assert (os[i].id == i + 1);
+ os[i].idata++;
+ }
+
+ {
+ transaction t (cn->begin ());
+ db->update (os.begin (), os.end ());
+ t.commit ();
+ }
+
+ {
+ transaction t (cn->begin ());
+ db->erase (os.begin (), os.end ());
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/pgsql/bulk/test.hxx b/odb-tests/pgsql/bulk/test.hxx
new file mode 100644
index 0000000..25dd138
--- /dev/null
+++ b/odb-tests/pgsql/bulk/test.hxx
@@ -0,0 +1,34 @@
+// file : pgsql/savepoint/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object bulk(1000)
+struct object
+{
+ /*
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+ */
+
+ #pragma db id //auto
+ unsigned long id;
+
+ unsigned long idata;
+
+ //#pragma db
+ std::string sdata;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/pgsql/bulk/testscript b/odb-tests/pgsql/bulk/testscript
new file mode 100644
index 0000000..60b7d92
--- /dev/null
+++ b/odb-tests/pgsql/bulk/testscript
@@ -0,0 +1,18 @@
+# file : pgsql/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
++$create_schema
+
+: basics
+:
+{
+ $*;
+
+ $* --fail-already-persistent 2>>EOE != 0
+ multiple exceptions, 252 elements attempted, 1 failed, fatal:
+ [251] object already persistent
+ EOE
+}
diff --git a/odb-tests/pgsql/custom/buildfile b/odb-tests/pgsql/custom/buildfile
new file mode 100644
index 0000000..a5c6717
--- /dev/null
+++ b/odb-tests/pgsql/custom/buildfile
@@ -0,0 +1,37 @@
+# file : pgsql/custom/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pgsql_custom_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --hxx-prologue '#include "traits.hxx"' \
+ --hxx-prologue '#include "query.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/custom/driver.cxx b/odb-tests/pgsql/custom/driver.cxx
new file mode 100644
index 0000000..91ff0ce
--- /dev/null
+++ b/odb-tests/pgsql/custom/driver.cxx
@@ -0,0 +1,125 @@
+// file : pgsql/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom database type mapping in PostgreSQL.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+ o.p = point (1.1111, 2222222222.2);
+ o.pv.push_back (point (1.1234, 2.2345));
+ o.pv.push_back (point (3.3456, 4.4567));
+ o.pv.push_back (point (0.0000001, 0.000000001)); // Scientific notation.
+
+ o.n1 = "23.5154";
+ o.n2 = "235154";
+ o.n3 = "2222222222222222222222222222.111111111111111111111111111111";
+
+ o.iv.push_back (123);
+ o.iv.push_back (234);
+ o.iv.push_back (-345);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Query.
+ //
+ typedef pgsql::query<object> query;
+ typedef odb::result<object> result;
+
+ {
+ transaction t (db->begin ());
+
+ // Point comparison.
+ //
+ {
+ result r (db->query<object> (query::p == o.p));
+ assert (!r.empty ());
+ }
+
+ // Point comparison using native query.
+ //
+ {
+ result r (db->query<object> (query::p + "~=" + query::_val (o.p)));
+ assert (!r.empty ());
+ }
+
+ // Access to individual members.
+ //
+ {
+ result r (db->query<object> (query::p.x == o.p.x));
+ assert (!r.empty ());
+ }
+
+ t.commit ();
+ }
+
+ // Update.
+ //
+ o.p.x++;
+ o.p.y--;
+ o.pv[1].x--;
+ o.pv[1].y++;
+ o.n3 += "999";
+ o.iv[0]++;
+ o.iv.pop_back ();
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/pgsql/custom/query.hxx b/odb-tests/pgsql/custom/query.hxx
new file mode 100644
index 0000000..8b89047
--- /dev/null
+++ b/odb-tests/pgsql/custom/query.hxx
@@ -0,0 +1,158 @@
+// file : pgsql/custom/query.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef QUERY_HXX
+#define QUERY_HXX
+
+#include <string>
+
+#include <odb/pgsql/query.hxx>
+
+#include "test.hxx" // point
+
+namespace odb
+{
+ namespace pgsql
+ {
+ template <>
+ struct query_column<point, id_string>
+ {
+ private:
+ const char* table_;
+ const char* column_;
+ const char* conversion_;
+
+ std::string x_column_;
+ std::string y_column_;
+
+ // Sub-columns for individual members.
+ //
+ public:
+ query_column<double, id_double> x, y;
+
+ // is_null, is_not_null
+ //
+ public:
+ query_base
+ is_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NULL";
+ return q;
+ }
+
+ query_base
+ is_not_null () const
+ {
+ query_base q (table_, column_);
+ q += "IS NOT NULL";
+ return q;
+ }
+
+ // =
+ //
+ public:
+ query_base
+ equal (const point& v) const
+ {
+ return equal (val_bind<point> (v));
+ }
+
+ query_base
+ equal (val_bind<point> v) const
+ {
+ query_base q (table_, column_);
+ q += "~=";
+ q.append<point, id_string> (v, conversion_);
+ return q;
+ }
+
+ query_base
+ equal (ref_bind<point> r) const
+ {
+ query_base q (table_, column_);
+ q += "~=";
+ q.append<point, id_string> (r, conversion_);
+ return q;
+ }
+
+ friend query_base
+ operator== (const query_column& c, const point& v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const point& v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, val_bind<point> v)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (val_bind<point> v, const query_column& c)
+ {
+ return c.equal (v);
+ }
+
+ friend query_base
+ operator== (const query_column& c, ref_bind<point> r)
+ {
+ return c.equal (r);
+ }
+
+ friend query_base
+ operator== (ref_bind<point> r, const query_column& c)
+ {
+ return c.equal (r);
+ }
+
+ // Column comparison.
+ //
+ public:
+ query_base
+ operator== (const query_column<point, id_string>& c) const
+ {
+ query_base q (table_, column_);
+ q += "~=";
+ q.append (c.table (), c.column ());
+ return q;
+ }
+
+ public:
+ query_column (const char* table, const char* column, const char* conv)
+ : table_ (table), column_ (column), conversion_ (conv),
+ x_column_ (std::string (column) + "[0]"),
+ y_column_ (std::string (column) + "[1]"),
+ x (table, x_column_.c_str (), 0),
+ y (table, y_column_.c_str (), 0)
+ {
+ }
+
+ const char*
+ table () const
+ {
+ return table_;
+ }
+
+ const char*
+ column () const
+ {
+ return column_;
+ }
+
+ const char*
+ conversion () const
+ {
+ return conversion_;
+ }
+ };
+ }
+}
+
+#endif // QUERY_HXX
diff --git a/odb-tests/pgsql/custom/test.hxx b/odb-tests/pgsql/custom/test.hxx
new file mode 100644
index 0000000..ec3d496
--- /dev/null
+++ b/odb-tests/pgsql/custom/test.hxx
@@ -0,0 +1,86 @@
+// file : pgsql/custom/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Map POINT PostgreSQL type to the point C++ struct. The other half
+// of this mapping is in traits.hxx (value_traits<point, id_string>).
+//
+#pragma db map type("POINT") as("TEXT") to("(?)::POINT") from("(?)::TEXT")
+
+#pragma db value type("POINT")
+struct point
+{
+ point () {}
+ point (double x_, double y_): x (x_), y (y_) {}
+
+ double x;
+ double y;
+};
+
+inline bool
+operator== (const point& a, const point& b)
+{
+ return a.x == b.x && a.y == b.y;
+}
+
+// Map NUMERIC PostgreSQL type to std::string (or any other type that
+// provides the value_traits<?, id_string> specialization).
+//
+#pragma db map type("NUMERIC *(\\(.+\\))?") \
+ as("TEXT") \
+ to("(?)::NUMERIC$1") \
+ from("(?)::TEXT")
+
+// Map INTEGER[] PostgreSQL type to std::vector<int>. The other half of
+// this mapping is in traits.hxx (value_traits<std::vector<int>, id_string>).
+//
+#pragma db map type("INTEGER *\\[(\\d*)\\]") \
+ as("TEXT") \
+ to("(?)::INTEGER[$1]") \
+ from("(?)::TEXT")
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id_) : id (id_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ point p;
+ std::vector<point> pv;
+
+ #pragma db type("NUMERIC(6, 4)")
+ std::string n1;
+
+ #pragma db type("NUMERIC(6)")
+ std::string n2;
+
+ #pragma db type("NUMERIC")
+ std::string n3;
+
+ #pragma db type("INTEGER [123]")
+ std::vector<int> iv;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id == y.id &&
+ p == y.p &&
+ pv == y.pv &&
+ n1 == y.n1 &&
+ n2 == y.n2 &&
+ n3 == y.n3 &&
+ iv == y.iv;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/pgsql/custom/testscript b/odb-tests/pgsql/custom/testscript
new file mode 100644
index 0000000..8e1448b
--- /dev/null
+++ b/odb-tests/pgsql/custom/testscript
@@ -0,0 +1,11 @@
+# file : pgsql/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/custom/traits.hxx b/odb-tests/pgsql/custom/traits.hxx
new file mode 100644
index 0000000..c45dec0
--- /dev/null
+++ b/odb-tests/pgsql/custom/traits.hxx
@@ -0,0 +1,166 @@
+// file : pgsql/custom/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <limits> // std::numeric_limits
+#include <vector>
+#include <sstream>
+#include <cstring> // std::memcpy
+
+#include <odb/pgsql/traits.hxx>
+
+#include "test.hxx" // point
+
+namespace odb
+{
+ namespace pgsql
+ {
+ template <>
+ class value_traits<point, id_string>
+ {
+ public:
+ typedef point value_type;
+ typedef point query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (point& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = point ();
+ else
+ {
+ // Point format is "(x,y)".
+ //
+ char c;
+ std::istringstream is (std::string (b.data (), n));
+
+ is >> c; // '('
+ is >> v.x;
+ is >> c; // ','
+ is >> v.y;
+ }
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const point& v)
+ {
+ is_null = false;
+ std::ostringstream os;
+
+ // The formula for the number of decimla digits required is given in:
+ //
+ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
+ //
+ os.precision (std::numeric_limits<double>::digits10);
+ // os.precision (2 + std::numeric_limits<double>::digits * 301/1000);
+
+ os << '(' << v.x << ',' << v.y << ')';
+
+ const std::string& s (os.str ());
+ n = s.size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ std::memcpy (b.data (), s.c_str (), n);
+ }
+ };
+
+ template <>
+ struct type_traits<point>
+ {
+ static const database_type_id db_type_id = id_string;
+
+ struct conversion
+ {
+ static const char* to () {return "(?)::POINT";}
+ };
+ };
+
+ template <>
+ class value_traits<std::vector<int>, id_string>
+ {
+ public:
+ typedef std::vector<int> value_type;
+ typedef value_type query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (value_type& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.clear ();
+
+ if (!is_null)
+ {
+ // Array format is "{n1,n2,n3...}".
+ //
+ char c;
+ std::istringstream is (std::string (b.data (), n));
+
+ is >> c; // '{'
+
+ for (c = static_cast<char> (is.peek ()); c != '}'; is >> c)
+ {
+ v.push_back (int ());
+ is >> v.back ();
+ }
+ }
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const value_type& v)
+ {
+ is_null = false;
+ std::ostringstream os;
+
+ os << '{';
+
+ for (value_type::const_iterator i (v.begin ()), e (v.end ()); i != e;)
+ {
+ os << *i;
+
+ if (++i != e)
+ os << ',';
+ }
+
+ os << '}';
+
+ const std::string& s (os.str ());
+ n = s.size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ std::memcpy (b.data (), s.c_str (), n);
+ }
+ };
+
+ template <>
+ struct type_traits<std::vector<int> >
+ {
+ static const database_type_id db_type_id = id_string;
+
+ struct conversion
+ {
+ static const char* to () {return "(?)::INTEGER[]";}
+ };
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/pgsql/database/buildfile b/odb-tests/pgsql/database/buildfile
new file mode 100644
index 0000000..6977ea6
--- /dev/null
+++ b/odb-tests/pgsql/database/buildfile
@@ -0,0 +1,11 @@
+# file : pgsql/database/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/pgsql/database/driver.cxx b/odb-tests/pgsql/database/driver.cxx
new file mode 100644
index 0000000..56bde0a
--- /dev/null
+++ b/odb-tests/pgsql/database/driver.cxx
@@ -0,0 +1,44 @@
+// file : pgsql/database/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous (compilation only).
+//
+
+#include <odb/pgsql/database.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ // This code should not execute.
+ //
+ if (argc != 0)
+ return 0;
+
+ {
+ database d1 ("bob", "secret", "db1");
+ database d2 ("bob", "secret", "db1", "server1");
+ database d3 ("bob", "secret", "db1", "server1", 999);
+ database d4 ("bob", "secret", "db1", "server1", 999, "extra");
+ }
+
+ {
+ database d1 ("bob", "secret", "db1", "server1", "ext1");
+ database d2 ("bob", "secret", "db1", "server1", "ext1", "extra");
+ }
+
+ {
+ database d1 ("conninfo");
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ database d3 (argc, argv, true, "extra");
+ }
+}
diff --git a/odb-tests/pgsql/database/testscript b/odb-tests/pgsql/database/testscript
new file mode 100644
index 0000000..f57a8e1
--- /dev/null
+++ b/odb-tests/pgsql/database/testscript
@@ -0,0 +1,6 @@
+# file : pgsql/database/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/index/buildfile b/odb-tests/pgsql/index/buildfile
new file mode 100644
index 0000000..a84ed9a
--- /dev/null
+++ b/odb-tests/pgsql/index/buildfile
@@ -0,0 +1,34 @@
+# file : pgsql/index/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pgsql_index_ \
+ --generate-schema \
+ --default-database common
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/index/driver.cxx b/odb-tests/pgsql/index/driver.cxx
new file mode 100644
index 0000000..dc4c11e
--- /dev/null
+++ b/odb-tests/pgsql/index/driver.cxx
@@ -0,0 +1,44 @@
+// file : pgsql/index/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test PostgreSQL index creation. See also the common test.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ // This is just a schema creation test.
+ //
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/pgsql/index/test.hxx b/odb-tests/pgsql/index/test.hxx
new file mode 100644
index 0000000..d728188
--- /dev/null
+++ b/odb-tests/pgsql/index/test.hxx
@@ -0,0 +1,19 @@
+// file : pgsql/index/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ int i;
+ #pragma db index type("UNIQUE CONCURRENTLY") method("BTREE") member(i)
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/pgsql/index/testscript b/odb-tests/pgsql/index/testscript
new file mode 100644
index 0000000..671a8c3
--- /dev/null
+++ b/odb-tests/pgsql/index/testscript
@@ -0,0 +1,11 @@
+# file : pgsql/index/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/native/buildfile b/odb-tests/pgsql/native/buildfile
new file mode 100644
index 0000000..ec4c80c
--- /dev/null
+++ b/odb-tests/pgsql/native/buildfile
@@ -0,0 +1,16 @@
+# file : pgsql/native/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/native/driver.cxx b/odb-tests/pgsql/native/driver.cxx
new file mode 100644
index 0000000..843db41
--- /dev/null
+++ b/odb-tests/pgsql/native/driver.cxx
@@ -0,0 +1,75 @@
+// file : pgsql/native/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test PostgreSQL native SQL execution.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Create the database schema.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->execute ("DROP TABLE IF EXISTS pgsql_native_test");
+ db->execute ("CREATE TABLE pgsql_native_test (n INT PRIMARY KEY)");
+
+ t.commit ();
+ }
+
+ // Insert a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("INSERT INTO pgsql_native_test (n) VALUES (1)") == 1);
+
+ assert (
+ db->execute ("INSERT INTO pgsql_native_test (n) VALUES (2)") == 1);
+
+ t.commit ();
+ }
+
+ // select a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("SELECT n FROM pgsql_native_test WHERE n < 3") == 2);
+
+ assert (
+ db->execute ("SELECT n FROM pgsql_native_test WHERE n > 3") == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/odb-tests/pgsql/native/testscript b/odb-tests/pgsql/native/testscript
new file mode 100644
index 0000000..4fd9d2c
--- /dev/null
+++ b/odb-tests/pgsql/native/testscript
@@ -0,0 +1,9 @@
+# file : pgsql/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/truncation/buildfile b/odb-tests/pgsql/truncation/buildfile
new file mode 100644
index 0000000..2f2f3a2
--- /dev/null
+++ b/odb-tests/pgsql/truncation/buildfile
@@ -0,0 +1,35 @@
+# file : pgsql/truncation/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pgsql_truncation_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/truncation/driver.cxx b/odb-tests/pgsql/truncation/driver.cxx
new file mode 100644
index 0000000..337a26e
--- /dev/null
+++ b/odb-tests/pgsql/truncation/driver.cxx
@@ -0,0 +1,163 @@
+// file : pgsql/truncation/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test insufficient buffer/truncation handling.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ // The default pre-allocated buffer is 512 bytes long.
+ //
+ string long_str (640, 'c'); // This will get the buffer to 1024
+ string longer_str (1025, 'b');
+
+ try
+ {
+ // Test basic operations.
+ //
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Run persist/load so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (1);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (1, o);
+ t.commit ();
+ }
+
+ {
+ object2 o (2);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (2, o);
+ t.commit ();
+ }
+
+ // Store/load the long string which should trigger buffer growth.
+ //
+ {
+ object1 o (3);
+ o.str_ = long_str;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == long_str);
+ t.commit ();
+ }
+
+ // Store/load longer string.
+ //
+ {
+ object1 o (3);
+ o.str_ = longer_str;
+
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == longer_str);
+ t.commit ();
+ }
+ }
+
+ // Test query.
+ //
+ {
+ typedef pgsql::query<object1> query;
+ typedef odb::result<object1> result;
+
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Run persist/query so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (20);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+
+ result r (db->query<object1> (query::id == 20));
+ assert (r.begin ()->id_ == 20);
+ t.commit ();
+ }
+
+ // Test buffer growth with cached result.
+ //
+ {
+ object1 o;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::id >= 20));
+ result::iterator i (r.begin ());
+
+ o.id_ = i->id_;
+ o.str_ = long_str;
+
+ // This forces buffer growth in the middle of result iteration.
+ //
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ o.id_ = i->id_;
+ o.str_ = longer_str;
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/pgsql/truncation/test.hxx b/odb-tests/pgsql/truncation/test.hxx
new file mode 100644
index 0000000..73110c0
--- /dev/null
+++ b/odb-tests/pgsql/truncation/test.hxx
@@ -0,0 +1,46 @@
+// file : pgsql/truncation/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <odb/core.hxx>
+
+#pragma db object table ("test")
+struct object1
+{
+ object1 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object1 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#pragma db object table ("test")
+struct object2
+{
+ object2 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object2 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/pgsql/truncation/testscript b/odb-tests/pgsql/truncation/testscript
new file mode 100644
index 0000000..c57b723
--- /dev/null
+++ b/odb-tests/pgsql/truncation/testscript
@@ -0,0 +1,11 @@
+# file : pgsql/truncation/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/types/buildfile b/odb-tests/pgsql/types/buildfile
new file mode 100644
index 0000000..64f0c02
--- /dev/null
+++ b/odb-tests/pgsql/types/buildfile
@@ -0,0 +1,36 @@
+# file : pgsql/types/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($pgsql && !$multi || $build.meta_operation == 'dist') \
+"pgsql should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+import libcommon = lib{common}
+import libs = libodb-pgsql%lib{odb-pgsql}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb and libcommon
+# libraries are resolved for the odb_compile ad hoc rule (see build/root.build
+# for details).
+#
+libue{test-meta}: $libodb $libcommon
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix pgsql_types_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --cxx-prologue '#include "traits.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../alias{pgsql-client}: include = adhoc
diff --git a/odb-tests/pgsql/types/driver.cxx b/odb-tests/pgsql/types/driver.cxx
new file mode 100644
index 0000000..710f601
--- /dev/null
+++ b/odb-tests/pgsql/types/driver.cxx
@@ -0,0 +1,165 @@
+// file : pgsql/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test PostgreSQL type conversion.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+
+ o.bool_ = true;
+ o.short_ = 12345;
+ o.int_ = -123456;
+ o.long_long_ = 123456;
+
+ o.float_ = 1.123F;
+ o.float8_ = 1.123;
+ o.double_ = 1.123;
+
+ o.date_ = 4015;
+ o.time_ = 48180000000LL;
+ o.timestamp_ = 346896000LL;
+
+ string short_str (128, 's');
+ string medium_str (250, 'm');
+ string long_str (2040, 'l');
+
+ o.char_ = short_str;
+ o.varchar_ = medium_str;
+ o.text_ = long_str;
+
+ o.bytea_.assign (long_str.c_str (), long_str.c_str () + long_str.size ());
+
+ unsigned char varbit_buf[8] = {1, 3, 1, 3, 1, 3, 1, 3};
+ o.varbit_.size = 52;
+ o.varbit_.ubuffer_ = ubuffer (varbit_buf, 8);
+
+ o.bit_.a = 0;
+ o.bit_.b = 1;
+ o.bit_.c = 0;
+ o.bit_.d = 1;
+
+ // 6F846D41-C89A-4E4D-B22F-56443CFA543F
+ memcpy (o.uuid_, "\x6F\x84\x6D\x41\xC8\x9A\x4E\x4D\xB2\x2F"
+ "\x56\x44\x3C\xFA\x54\x3F", 16);
+
+ o.enum_ = green;
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ typedef pgsql::query<object> query;
+ typedef odb::result<object> result;
+
+ // Test UUID in queries.
+ //
+ {
+ char uuid[16];
+ memcpy (uuid, o.uuid_, 16);
+
+ transaction t (db->begin ());
+
+ {
+ result r (db->query<object> (query::uuid == uuid));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::uuid == query::_val (uuid)));
+ assert (size (r) == 1);
+ }
+
+ {
+ result r (db->query<object> (query::uuid == query::_ref (uuid)));
+ assert (size (r) == 1);
+ }
+
+ {
+ const char* d (uuid);
+ result r (db->query<object> (query::uuid == d));
+ assert (size (r) == 1);
+ }
+
+ t.commit ();
+ }
+
+ // Test char array.
+ //
+ {
+ char_array o1 (1, "");
+ char_array o2 (2, "1234567890");
+ char_array o3 (3, "1234567890123456");
+
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ // PostgreSQL returns padded values for CHAR(N).
+ //
+ memcpy (o1.s2, " ", 16);
+ o1.s3[0] = o1.c1 = ' ';
+ memcpy (o2.s2, "1234567890 ", 16);
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<char_array> p1 (db->load<char_array> (1));
+ unique_ptr<char_array> p2 (db->load<char_array> (2));
+ unique_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/pgsql/types/test.hxx b/odb-tests/pgsql/types/test.hxx
new file mode 100644
index 0000000..462ebad
--- /dev/null
+++ b/odb-tests/pgsql/types/test.hxx
@@ -0,0 +1,220 @@
+// file : pgsql/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <set>
+#include <string>
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <cstring> // std::memcmp, std::memcpy, std::str[n]cmp, std::strlen
+#include <cstddef> // std::size_t
+
+#include <odb/core.hxx>
+
+#include <libcommon/buffer.hxx>
+
+struct bitfield
+{
+ unsigned int a: 1;
+ unsigned int b: 1;
+ unsigned int c: 1;
+ unsigned int d: 1;
+};
+
+inline bool
+operator== (bitfield x, bitfield y)
+{
+ return
+ x.a == y.a &&
+ x.b == y.b &&
+ x.c == y.c &&
+ x.d == y.d;
+}
+
+struct varbit
+{
+ std::size_t size;
+ ubuffer ubuffer_;
+
+ bool
+ compare (const varbit& x) const
+ {
+ if (size != x.size)
+ return false;
+
+ std::size_t byte_len = size / 8;
+
+ if (std::memcmp (ubuffer_.data (), x.ubuffer_.data (), byte_len) != 0)
+ return false;
+
+ std::size_t trailing_bits = size % 8;
+
+ if (trailing_bits != 0)
+ {
+ unsigned char mask (0xFFU << (8 - trailing_bits));
+
+ return (ubuffer_.data ()[byte_len] & mask) ==
+ (x.ubuffer_.data ()[byte_len] & mask);
+ }
+
+ return true;
+ }
+};
+
+inline bool
+operator== (const varbit& x, const varbit& y)
+{
+ return x.compare (y);
+}
+
+#pragma db value(bitfield) type ("BIT(4)")
+
+typedef std::unique_ptr<std::string> string_ptr;
+
+enum color {red, green, blue};
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ // Integral types.
+ //
+ #pragma db type ("BOOL")
+ bool bool_;
+
+ #pragma db type ("SMALLINT")
+ short short_;
+
+ #pragma db type ("INT")
+ int int_;
+
+ #pragma db type ("BIGINT")
+ long long long_long_;
+
+ // Float types.
+ //
+ #pragma db type ("REAL")
+ float float_;
+
+ #pragma db type ("FLOAT(32)")
+ double float8_;
+
+ #pragma db type ("DOUBLE PRECISION")
+ double double_;
+
+ // Data-time types.
+ //
+ #pragma db type ("DATE")
+ int date_;
+
+ #pragma db type ("TIME")
+ long long time_;
+
+ #pragma db type ("TIMESTAMP")
+ long long timestamp_;
+
+ // String and binary types.
+ //
+ #pragma db type ("CHAR(128)")
+ std::string char_;
+
+ #pragma db type ("VARCHAR(256)")
+ std::string varchar_;
+
+ #pragma db type ("TEXT")
+ std::string text_;
+
+ #pragma db type ("BYTEA")
+ std::vector<char> bytea_;
+
+ #pragma db type ("VARBIT(1024)")
+ varbit varbit_;
+
+ // #pragma db type ("BIT(4)") - assigned by #pragma db value
+ bitfield bit_;
+
+ // Other types.
+ //
+ #pragma db type ("UUID")
+ char uuid_[16];
+
+ // Test ENUM representation.
+ //
+ color enum_;
+
+ // Test NULL value.
+ //
+ #pragma db type ("TEXT") null
+ string_ptr null_;
+
+ bool
+ operator== (const object& y) const
+ {
+ return
+ id_ == y.id_ &&
+ bool_ == y.bool_ &&
+ short_ == y.short_ &&
+ int_ == y.int_ &&
+ long_long_ == y.long_long_ &&
+ float_ == y.float_ &&
+ float8_ == y.float8_ &&
+ double_ == y.double_ &&
+ date_ == y.date_ &&
+ time_ == y.time_ &&
+ timestamp_ == y.timestamp_ &&
+ char_ == y.char_ &&
+ varchar_ == y.varchar_ &&
+ text_ == y.text_ &&
+ bytea_ == y.bytea_ &&
+ bit_ == y.bit_ &&
+ varbit_ == y.varbit_ &&
+ memcmp (uuid_, y.uuid_, 16) == 0 &&
+ enum_ == y.enum_ &&
+ ((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);
+ }
+};
+
+// Test char array.
+//
+#pragma db object
+struct char_array
+{
+ char_array () {}
+ char_array (unsigned long id, const char* s)
+ : id_ (id)
+ {
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ std::memcpy (s2, s, std::strlen (s) + 1);
+ s3[0] = c1 = *s;
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ char s1[17];
+
+ #pragma db type("CHAR(16)")
+ char s2[16];
+
+ char s3[1];
+ char c1;
+
+ bool
+ operator== (const char_array& y) const
+ {
+ return id_ == y.id_ &&
+ std::strcmp (s1, y.s1) == 0 &&
+ std::strncmp (s2, y.s2, sizeof (s2)) == 0 &&
+ s3[0] == y.s3[0] &&
+ c1 == y.c1;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/pgsql/types/testscript b/odb-tests/pgsql/types/testscript
new file mode 100644
index 0000000..57218e1
--- /dev/null
+++ b/odb-tests/pgsql/types/testscript
@@ -0,0 +1,11 @@
+# file : pgsql/types/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../pgsql.testscript
+
++$create_schema
+
+: basics
+:
+$*
diff --git a/odb-tests/pgsql/types/traits.hxx b/odb-tests/pgsql/types/traits.hxx
new file mode 100644
index 0000000..a1c8fbe
--- /dev/null
+++ b/odb-tests/pgsql/types/traits.hxx
@@ -0,0 +1,171 @@
+// file : pgsql/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <cassert>
+#include <cstring> // std::memcpy, std::memset
+
+#include <odb/pgsql/traits.hxx>
+#include <odb/pgsql/details/endian-traits.hxx>
+
+#include "test.hxx" // varbit, ubuffer, string_ptr
+
+namespace odb
+{
+ namespace pgsql
+ {
+ // The first 4 bytes of the image is a signed int specifying the
+ // number of significant bits contained by the BIT. The following
+ // bytes contain the bit data.
+ //
+ template <>
+ class value_traits<bitfield, id_bit>
+ {
+ public:
+ typedef bitfield value_type;
+ typedef bitfield query_type;
+ typedef unsigned char* image_type;
+
+ static void
+ set_value (bitfield& v,
+ const unsigned char* i,
+ std::size_t,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ assert (
+ details::endian_traits::ntoh (
+ *reinterpret_cast<const int*> (i)) == 4);
+
+ const unsigned char* d (i + 4);
+
+ v.a = *d >> 4 & 1;
+ v.b = (*d >> 5) & 1;
+ v.c = (*d >> 6) & 1;
+ v.d = (*d >> 7) & 1;
+ }
+ else
+ v.a = v.b = v.c = v.d = 0;
+ }
+
+ static void
+ set_image (unsigned char* i,
+ std::size_t,
+ std::size_t& n,
+ bool& is_null,
+ bitfield v)
+ {
+ is_null = false;
+ n = 5;
+
+ *reinterpret_cast<int*> (i) = details::endian_traits::hton (4);
+ *(i + 4) = v.a << 4 | (v.b << 5) | (v.c << 6) | (v.d << 7);
+ }
+ };
+
+ // The first 4 bytes of the image is a signed int specifying the
+ // number of significant bits contained by the VARBIT. The following
+ // bytes contain the VARBIT data.
+ //
+ template <>
+ class value_traits<varbit, id_varbit>
+ {
+ public:
+ typedef varbit value_type;
+ typedef varbit query_type;
+ typedef details::ubuffer image_type;
+
+ static void
+ set_value (varbit& v,
+ const details::ubuffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ v.size = static_cast<std::size_t> (
+ details::endian_traits::ntoh (
+ *reinterpret_cast<const int*> (b.data ())));
+
+ std::size_t byte_len (v.size / 8 + (v.size % 8 > 0 ? 1 : 0));
+ assert (n >= byte_len + 4);
+
+ v.ubuffer_.assign (b.data () + 4, byte_len);
+ }
+
+ else
+ {
+ v.size = 0;
+ v.ubuffer_.assign (0, 0);
+ }
+ }
+
+ static void
+ set_image (details::ubuffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const varbit& v)
+ {
+ is_null = false;
+ n = 4 + v.size / 8 + (v.size % 8 > 0 ? 1 : 0);
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ // PostgreSQL requires all trailing bits of a VARBIT image
+ // to be zero.
+ //
+ std::memset (b.data (), 0, b.capacity ());
+
+ *reinterpret_cast<int*> (b.data ()) =
+ details::endian_traits::hton (static_cast<int> (v.size));
+
+ if (v.size != 0)
+ std::memcpy (b.data () + 4, v.ubuffer_.data (), n - 4);
+ }
+ };
+
+ template <>
+ class value_traits<string_ptr, id_string>
+ {
+ public:
+ typedef string_ptr value_type;
+ typedef std::string query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (string_ptr& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.reset (is_null ? 0 : new std::string (b.data (), n));
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const string_ptr& v)
+ {
+ is_null = v.get () == 0;
+
+ if (!is_null)
+ {
+ n = v->size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ if (n != 0)
+ std::memcpy (b.data (), v->c_str (), n);
+ }
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX
diff --git a/odb-tests/qt/common/basic/driver.cxx b/odb-tests/qt/common/basic/driver.cxx
new file mode 100644
index 0000000..342a313
--- /dev/null
+++ b/odb-tests/qt/common/basic/driver.cxx
@@ -0,0 +1,66 @@
+// file : qt/common/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence (common part).
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o (1);
+ o.uuid_ = QUuid::createUuid ();
+ o.null_ = QUuid ();
+ o.zero_ = QUuid ();
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (*p == o);
+ }
+
+ {
+ typedef odb::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::uuid == o.uuid_));
+ result::iterator i (r.begin ());
+ assert (i != r.end () && i->id_ == o.id_);
+ assert (++i == r.end ());
+ t.commit ();
+ }
+
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/common/basic/test.hxx b/odb-tests/qt/common/basic/test.hxx
new file mode 100644
index 0000000..e67302e
--- /dev/null
+++ b/odb-tests/qt/common/basic/test.hxx
@@ -0,0 +1,35 @@
+// file : qt/common/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QUuid>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ QUuid uuid_;
+ QUuid null_;
+
+ #pragma db not_null
+ QUuid zero_;
+
+ bool operator== (const object& x) const
+ {
+ return id_ == x.id_ &&
+ uuid_ == x.uuid_ &&
+ null_ == x.null_ &&
+ zero_ == x.zero_;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/common/containers/basics/driver.cxx b/odb-tests/qt/common/containers/basics/driver.cxx
new file mode 100644
index 0000000..5e38ee1
--- /dev/null
+++ b/odb-tests/qt/common/containers/basics/driver.cxx
@@ -0,0 +1,569 @@
+// file : qt/common/containers/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic Qt containers persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ object empty ("empty"), med ("medium"), full ("full");
+
+ //
+ // empty
+ //
+
+ empty.num = 0;
+ empty.str = "";
+
+ //
+ // med
+ //
+
+ med.num = 999;
+ med.str = "xxx";
+
+ // vector
+ //
+ med.nv.push_back (123);
+ med.nv.push_back (234);
+
+ med.sv.push_back ("aaa");
+ med.sv.push_back ("bbbb");
+
+ med.cv.push_back (comp (123, "aaa"));
+ med.cv.push_back (comp (234, "bbbb"));
+
+ med.uv.push_back (123);
+ med.uv.push_back (234);
+
+ // list
+ //
+ med.sl.push_back ("aaa");
+ med.sl.push_back ("bbbb");
+
+ med.nl.push_back (123);
+ med.nl.push_back (234);
+
+ med.cl.push_back (comp (123, "aaa"));
+ med.cl.push_back (comp (234, "bbbb"));
+
+ // linked list
+ //
+ med.sll.push_back ("aaa");
+ med.sll.push_back ("bbbb");
+
+ med.nll.push_back (123);
+ med.nll.push_back (234);
+
+ med.cll.push_back (comp (123, "aaa"));
+ med.cll.push_back (comp (234, "bbbb"));
+
+ // set
+ //
+ med.ns.insert (123);
+ med.ns.insert (234);
+
+ med.ss.insert ("aaa");
+ med.ss.insert ("bbbb");
+
+ // map
+ //
+ med.nsm[123] = "aaa";
+ med.nsm[234] = "bbbb";
+
+ med.snm["aaa"] = 123;
+ med.snm["bbbb"] = 234;
+
+ med.ncm[123] = comp (123, "aaa");
+ med.ncm[234] = comp (234, "bbbb");
+
+ med.csm[comp (123, "aaa")] = "aaa";
+ med.csm[comp (234, "bbbb")] = "bbbb";
+
+ // multimap
+ //
+ med.nsmm.insert (123, "aaa");
+ med.nsmm.insert (123, "bbbb");
+ med.nsmm.insert (234, "ccccc");
+
+ med.snmm.insert ("aaa", 123);
+ med.snmm.insert ("aaa", 234);
+ med.snmm.insert ("bbb", 345);
+
+ med.ncmm.insert (123, comp (123, "aaa"));
+ med.ncmm.insert (123, comp (234, "bbbb"));
+ med.ncmm.insert (234, comp (345, "ccccc"));
+
+ // hash
+ //
+ med.nsh[123] = "aaa";
+ med.nsh[234] = "bbbb";
+
+ med.snh["aaa"] = 123;
+ med.snh["bbb"] = 234;
+
+ med.sch["iii"] = comp (123, "aaa");
+ med.sch["jjj"] = comp (234, "bbbb");
+
+ // multihash
+ //
+ med.nsmh.insert (123, "aaa");
+ med.nsmh.insert (123, "bbbb");
+ med.nsmh.insert (234, "ccccc");
+
+ med.snmh.insert ("aaa", 123);
+ med.snmh.insert ("aaa", 234);
+ med.snmh.insert ("bbb", 345);
+
+ med.ncmh.insert (123, comp (123, "aaa"));
+ med.ncmh.insert (123, comp (234, "bbbb"));
+ med.ncmh.insert (234, comp (345, "ccccc"));
+
+ //
+ // full
+ //
+
+ full.num = 9999;
+ full.str = "xxxx";
+
+ // vector
+ //
+ full.nv.push_back (1234);
+ full.nv.push_back (2345);
+ full.nv.push_back (3456);
+
+ full.sv.push_back ("aaaa");
+ full.sv.push_back ("bbbbb");
+ full.sv.push_back ("cccccc");
+
+ full.cv.push_back (comp (1234, "aaaa"));
+ full.cv.push_back (comp (2345, "bbbbb"));
+ full.cv.push_back (comp (3456, "cccccc"));
+
+ full.uv.push_back (1234);
+ full.uv.push_back (2345);
+ full.uv.push_back (3456);
+
+ // list
+ //
+ full.sl.push_back ("aaaa");
+ full.sl.push_back ("bbbbb");
+ full.sl.push_back ("cccccc");
+
+ full.nl.push_back (1234);
+ full.nl.push_back (2345);
+ full.nl.push_back (3456);
+
+ full.cl.push_back (comp (1234, "aaaa"));
+ full.cl.push_back (comp (2345, "bbbbb"));
+ full.cl.push_back (comp (3456, "cccccc"));
+
+ // linked list
+ //
+ full.sll.push_back ("aaaa");
+ full.sll.push_back ("bbbbb");
+ full.sll.push_back ("cccccc");
+
+ full.nll.push_back (1234);
+ full.nll.push_back (2345);
+ full.nll.push_back (3456);
+
+ full.cll.push_back (comp (1234, "aaaa"));
+ full.cll.push_back (comp (2345, "bbbbb"));
+ full.cll.push_back (comp (3456, "cccccc"));
+
+ // set
+ //
+ full.ns.insert (1234);
+ full.ns.insert (2345);
+ full.ns.insert (3456);
+
+ full.ss.insert ("aaaa");
+ full.ss.insert ("bbbbb");
+ full.ss.insert ("cccccc");
+
+ // map
+ //
+ full.nsm[1234] = "aaaa";
+ full.nsm[2345] = "bbbbb";
+ full.nsm[3456] = "cccccc";
+
+ full.snm["aaaa"] = 1234;
+ full.snm["bbbb"] = 2345;
+ full.snm["cccc"] = 3456;
+
+ full.ncm[1234] = comp (1234, "aaaa");
+ full.ncm[2345] = comp (2345, "bbbbb");
+ full.ncm[3456] = comp (3456, "cccccc");
+
+ full.csm[comp (1234, "aaaa")] = "aaaa";
+ full.csm[comp (2345, "bbbb")] = "bbbbb";
+ full.csm[comp (3456, "cccc")] = "cccccc";
+
+ // multimap
+ //
+ full.nsmm.insert (1234, "aaaa");
+ full.nsmm.insert (1234, "bbbbb");
+ full.nsmm.insert (2345, "cccccc");
+ full.nsmm.insert (2345, "ddddddd");
+
+ full.snmm.insert ("aaaa", 1234);
+ full.snmm.insert ("aaaa", 2345);
+ full.snmm.insert ("bbbb", 3456);
+ full.snmm.insert ("bbbb", 4567);
+
+ full.ncmm.insert (1234, comp (1234, "aaaa"));
+ full.ncmm.insert (1234, comp (2345, "bbbbb"));
+ full.ncmm.insert (2345, comp (3456, "cccccc"));
+ full.ncmm.insert (2345, comp (4567, "ddddddd"));
+
+ // hash
+ //
+ full.nsh[1234] = "aaaa";
+ full.nsh[2345] = "bbbbb";
+ full.nsh[3456] = "cccccc";
+
+ full.snh["aaaa"] = 1234;
+ full.snh["bbbb"] = 2345;
+ full.snh["cccc"] = 3456;
+
+ full.sch["iiii"] = comp (1234, "aaaa");
+ full.sch["jjjj"] = comp (2345, "bbbbb");
+ full.sch["kkkk"] = comp (3456, "cccccc");
+
+ // multihash
+ //
+ full.nsmh.insert (1234, "aaaa");
+ full.nsmh.insert (1234, "bbbbb");
+ full.nsmh.insert (2345, "cccccc");
+ full.nsmh.insert (2345, "ddddddd");
+
+ full.snmh.insert ("aaaa", 1234);
+ full.snmh.insert ("aaaa", 2345);
+ full.snmh.insert ("bbbb", 3456);
+ full.snmh.insert ("bbbb", 4567);
+
+ full.ncmh.insert (1234, comp (1234, "aaaa"));
+ full.ncmh.insert (1234, comp (2345, "bbbbb"));
+ full.ncmh.insert (2345, comp (3456, "cccccc"));
+ full.ncmh.insert (2345, comp (4567, "ddddddd"));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (empty);
+ db->persist (med);
+ db->persist (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ //
+ // empty
+ //
+
+ empty.num = 99;
+ empty.str = "xx";
+
+ // vector
+ //
+ empty.nv.push_back (12);
+ empty.sv.push_back ("aa");
+ empty.cv.push_back (comp (12, "aa"));
+ empty.uv.push_back (12);
+
+ // list
+ //
+ empty.sl.push_back ("aa");
+ empty.nl.push_back (12);
+ empty.cl.push_back (comp (12, "aa"));
+
+ // linked list
+ //
+ empty.nll.push_back (12);
+ empty.sll.push_back ("aa");
+ empty.cll.push_back (comp (12, "aa"));
+
+ // set
+ //
+ empty.ns.insert (12);
+ empty.ss.insert ("aa");
+
+ // map
+ //
+ empty.nsm[12] = "aa";
+ empty.snm["aa"] = 12;
+ empty.ncm[12] = comp (12, "aa");
+ empty.csm[comp (12, "aa")] = "aa";
+
+ // multimap
+ //
+ empty.nsmm.insert (12, "aa");
+ empty.nsmm.insert (12, "bbb");
+ empty.nsmm.insert (23, "cccc");
+ empty.snmm.insert ("aa", 12);
+ empty.snmm.insert ("aa", 23);
+ empty.snmm.insert ("bb", 34);
+ empty.ncmm.insert (12, comp (12, "aa"));
+ empty.ncmm.insert (12, comp (23, "bb"));
+ empty.ncmm.insert (23, comp (34, "cc"));
+
+ // hash
+ //
+ empty.nsh[12] = "aa";
+ empty.snh["aa"] = 12;
+ empty.sch["ii"] = comp (12, "aa");
+
+ // multihash
+ //
+ empty.nsmh.insert (12, "aa");
+ empty.nsmh.insert (12, "bbb");
+ empty.nsmh.insert (23, "cccc");
+ empty.snmh.insert ("aa", 12);
+ empty.snmh.insert ("aa", 23);
+ empty.snmh.insert ("bb", 34);
+ empty.ncmh.insert (12, comp (12, "aa"));
+ empty.ncmh.insert (12, comp (23, "bb"));
+ empty.ncmh.insert (23, comp (34, "cc"));
+
+ //
+ // med
+ //
+
+ med.num = 0;
+ med.str = "";
+
+ // vector
+ //
+ med.nv.clear ();
+ med.sv.clear ();
+ med.cv.clear ();
+ med.uv.clear ();
+
+ // list
+ //
+ med.sl.clear ();
+ med.nl.clear ();
+ med.cl.clear ();
+
+ // linked list
+ //
+ med.nll.clear ();
+ med.sll.clear ();
+ med.cll.clear ();
+
+ // set
+ //
+ med.ns.clear ();
+ med.ss.clear ();
+
+ // map
+ //
+ med.nsm.clear ();
+ med.snm.clear ();
+ med.ncm.clear ();
+ med.csm.clear ();
+
+ // multimap
+ //
+ med.nsmm.clear ();
+ med.snmm.clear ();
+ med.ncmm.clear ();
+
+ // hash
+ //
+ med.nsh.clear ();
+ med.snh.clear ();
+ med.sch.clear ();
+
+ // multihash
+ //
+ med.nsmh.clear ();
+ med.snmh.clear ();
+ med.ncmh.clear ();
+
+
+ //
+ // full
+ //
+
+ full.num++;
+ full.str += "x";
+
+ // vector
+ //
+ full.nv.back ()++;
+ full.nv.push_back (4567);
+
+ full.sv.back () += "c";
+ full.sv.push_back ("ddddddd");
+
+ full.cv.back ().num++;
+ full.cv.back ().str += "c";
+ full.cv.push_back (comp (4567, "ddddddd"));
+
+ full.uv.back ()++;
+ full.uv.push_back (4567);
+
+ // list
+ //
+ full.sl.back () += "c";
+ full.sl.push_back ("ddddddd");
+
+ full.nl.back ()++;
+ full.nl.push_back (4567);
+
+ full.cl.back ().num++;
+ full.cl.back ().str += "c";
+ full.cl.push_back (comp (4567, "ddddddd"));
+
+ // linked list
+ //
+ full.sll.back () += "c";
+ full.sll.push_back ("ddddddd");
+
+ full.nll.back ()++;
+ full.nll.push_back (4567);
+
+ full.cll.back ().num++;
+ full.cll.back ().str += "c";
+ full.cll.push_back (comp (4567, "ddddddd"));
+
+ // set
+ //
+ full.ns.insert (4567);
+ full.ss.insert ("ddddddd");
+
+ // map
+ //
+ full.nsm[3456] += "c";
+ full.nsm[4567] = "ddddddd";
+
+ full.snm["cccc"]++;
+ full.snm["dddd"] = 4567;
+
+ full.ncm[3456].num++;
+ full.ncm[3456].str += "c";
+ full.ncm[4567] = comp (4567, "ddddddd");
+
+ full.csm[comp (3456, "cccc")] += "c";
+ full.csm[comp (4567, "dddd")] = "ddddddd";
+
+ // multimap
+ //
+ full.nsmm.find (2345).value () += "d";
+ full.nsmm.insert (3456, "eeeeeeee");
+
+ full.snmm.find ("bbbb").value ()++;
+ full.snmm.insert ("cccc", 5678);
+
+ full.ncmm.find (1234).value ().num++;
+ full.ncmm.find (2345).value ().str += "d";
+ full.ncmm.insert (3456, comp (5678, "eeeeeeee"));
+
+ // hash
+ //
+ full.nsh[3456] += "c";
+ full.nsh[4567] = "ddddddd";
+
+ full.snh["cccc"]++;
+ full.snh["dddd"] = 4567;
+
+ full.sch["iiii"].num++;
+ full.sch["jjjj"].str += "b";
+ full.sch["kkkk"] = comp (4567, "dddddddd");
+
+ // multihash
+ //
+ full.nsmh.find (2345).value () += "d";
+ full.nsmh.insert (3456, "eeeeeeee");
+
+ full.snmh.find ("bbbb").value ()++;
+ full.snmh.insert ("cccc", 5678);
+
+ full.ncmh.find (1234).value ().num++;
+ full.ncmh.find (2345).value ().str += "d";
+ full.ncmh.insert (3456, comp (5678, "eeeeeeee"));
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (empty);
+ db->update (med);
+ db->update (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<object> ("empty");
+ db->erase<object> ("medium");
+ db->erase<object> ("full");
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/common/containers/basics/test.hxx b/odb-tests/qt/common/containers/basics/test.hxx
new file mode 100644
index 0000000..2c61c88
--- /dev/null
+++ b/odb-tests/qt/common/containers/basics/test.hxx
@@ -0,0 +1,224 @@
+// file : qt/common/containers/basics/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QVector>
+#include <QtCore/QList>
+#include <QtCore/QLinkedList>
+#include <QtCore/QSet>
+#include <QtCore/QMap>
+#include <QtCore/QMultiMap>
+#include <QtCore/QHash>
+#include <QtCore/QMultiHash>
+
+#include <odb/core.hxx>
+
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, const QString& s) : num (n), str (s) {}
+
+ #pragma db column("number")
+ int num;
+ QString str;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num && x.str == y.str;
+}
+
+inline bool
+operator< (const comp& x, const comp& y)
+{
+ return x.num != y.num ? x.num < y.num : x.str < y.str;
+}
+
+typedef QVector<int> num_vector;
+typedef QVector<QString> str_vector;
+typedef QVector<comp> comp_vector;
+
+typedef QList<int> num_list;
+typedef QList<QString> str_list;
+typedef QList<comp> comp_list;
+
+typedef QLinkedList<int> num_linked_list;
+typedef QLinkedList<QString> str_linked_list;
+typedef QLinkedList<comp> comp_linked_list;
+
+typedef QSet<int> num_set;
+typedef QSet<QString> str_set;
+
+typedef QMap<int, QString> num_str_map;
+typedef QMap<QString, int> str_num_map;
+typedef QMap<int, comp> num_comp_map;
+typedef QMap<comp, QString> comp_str_map;
+
+typedef QMultiMap<int, QString> num_str_multimap;
+typedef QMultiMap<QString, int> str_num_multimap;
+typedef QMultiMap<int, comp> num_comp_multimap;
+
+typedef QHash<int, QString> num_str_hash;
+typedef QHash<QString, int> str_num_hash;
+typedef QHash<QString, comp> str_comp_hash;
+
+typedef QMultiHash<int, QString> num_str_multihash;
+typedef QMultiHash<QString, int> str_num_multihash;
+typedef QMultiHash<int, comp> num_comp_multihash;
+
+#pragma db value
+struct cont_comp1
+{
+ // This composite value does not have any columns.
+ //
+ num_vector sv; // Have the name "conflict" with the one in the object.
+};
+
+#pragma db value
+struct cont_comp2
+{
+ cont_comp2 (): num (777), str ("ggg") {}
+
+ int num;
+ str_list sl;
+ QString str;
+};
+
+#pragma db object
+struct object
+{
+ object (): nv (comp1_.sv), sl (comp2_.sl) {}
+ object (const QString& id) : id_ (id), nv (comp1_.sv), sl (comp2_.sl) {}
+
+ #pragma db id
+ QString id_;
+
+ int num;
+
+ cont_comp1 comp1_;
+ cont_comp2 comp2_;
+
+ // vector
+ //
+ #pragma db transient
+ num_vector& nv;
+
+ #pragma db table("object_strings") id_column ("obj_id")
+ str_vector sv;
+
+ #pragma db value_column("")
+ comp_vector cv;
+
+ #pragma db unordered
+ num_vector uv;
+
+ // list
+ //
+ #pragma db transient
+ str_list& sl;
+
+ num_list nl;
+ comp_list cl;
+
+ // linked list
+ //
+ str_linked_list sll;
+ num_linked_list nll;
+ comp_linked_list cll;
+
+ // set
+ //
+ num_set ns;
+ str_set ss;
+
+ // map
+ //
+ num_str_map nsm;
+ str_num_map snm;
+ num_comp_map ncm;
+ comp_str_map csm;
+
+ // multimap
+ //
+ num_str_multimap nsmm;
+ str_num_multimap snmm;
+ num_comp_multimap ncmm;
+
+ // hash
+ //
+ num_str_hash nsh;
+ str_num_hash snh;
+ str_comp_hash sch;
+
+ // multihash
+ //
+ num_str_multihash nsmh;
+ str_num_multihash snmh;
+ num_comp_multihash ncmh;
+
+ QString str;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ if (x.uv.size () != y.uv.size ())
+ return false;
+
+ int xs (0), ys (0);
+
+ for (num_vector::size_type i (0); i < x.uv.size (); ++i)
+ {
+ xs += x.uv[i];
+ ys += y.uv[i];
+ }
+
+ return
+ x.id_ == y.id_ &&
+ x.num == y.num &&
+
+ x.comp2_.num == y.comp2_.num &&
+ x.comp2_.str == y.comp2_.str &&
+
+ x.nv == y.nv &&
+ x.sv == y.sv &&
+ x.cv == y.cv &&
+ xs == ys &&
+
+ x.sl == y.sl &&
+ x.nl == y.nl &&
+ x.cl == y.cl &&
+
+ x.nll == y.nll &&
+ x.sll == y.sll &&
+ x.cll == y.cll &&
+
+ x.ns == y.ns &&
+ x.ss == y.ss &&
+
+ x.nsm == y.nsm &&
+ x.snm == y.snm &&
+ x.ncm == y.ncm &&
+ x.csm == y.csm &&
+
+ x.nsmm.uniqueKeys () == y.nsmm.uniqueKeys () &&
+ x.snmm.uniqueKeys () == y.snmm.uniqueKeys () &&
+ x.ncmm.uniqueKeys () == y.ncmm.uniqueKeys () &&
+
+ x.nsh == y.nsh &&
+ x.snh == y.snh &&
+ x.sch == y.sch &&
+
+ x.nsmh.uniqueKeys () == y.nsmh.uniqueKeys () &&
+ x.snmh.uniqueKeys () == y.snmh.uniqueKeys () &&
+ x.ncmh.uniqueKeys () == y.ncmh.uniqueKeys () &&
+
+ x.str == y.str;
+}
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/common/containers/change-tracking/driver.cxx b/odb-tests/qt/common/containers/change-tracking/driver.cxx
new file mode 100644
index 0000000..8157d96
--- /dev/null
+++ b/odb-tests/qt/common/containers/change-tracking/driver.cxx
@@ -0,0 +1,643 @@
+// file : qt/common/containers/change-tracking/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test change-tracking Qt containers.
+//
+
+#include <common/config.hxx> // HAVE_CXX11
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#ifdef HAVE_CXX11
+# include <utility> // std::move
+#endif
+
+#include <QtCore/QtGlobal> // QT_VERSION, Q_FOREACH
+#include <QtCore/QCoreApplication>
+
+#include <odb/tracer.hxx>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <odb/qt/list-iterator.hxx>
+#include <odb/qt/mutable-list-iterator.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+struct counting_tracer: odb::tracer
+{
+ void
+ reset (transaction& tr) {u = i = d = s = t = 0; tr.tracer (*this);}
+
+ virtual void
+ execute (odb::connection&, const char* stmt)
+ {
+ string p (stmt, 6);
+ if (p == "UPDATE")
+ u++;
+ else if (p == "INSERT")
+ i++;
+ else if (p == "DELETE")
+ d++;
+ else if (p == "SELECT")
+ s++;
+ t++;
+ }
+
+ size_t u, i, d, s, t;
+};
+
+static counting_tracer tr;
+
+// Compilation test: instantiate all the functions. Only do this if we
+// have a fairly recent version of Qt, otherwise some underlying
+// functions will be missing.
+//
+#if QT_VERSION >= 0x050000
+template class QOdbList<short>;
+template class QOdbListIteratorImpl<QOdbList<short> >;
+template class QOdbListIterator<short>;
+template class QMutableOdbListIterator<short>;
+#endif
+
+void
+f (const QList<int>&) {}
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ // Test extended interface.
+ //
+ {
+ typedef QOdbList<int> list;
+
+ list ol;
+ QList<int> ql;
+ f (ol); // Implicit conversion to QList.
+ list ol1 (ql); // Initialization from QList.
+ ol = ql; // Assignement from QList.
+
+ // Container comparison.
+ //
+ if (ol != ol1 ||
+ ol != ql ||
+ ql != ol1)
+ ol.clear ();
+
+ // Container operators.
+ //
+ ol += ol1;
+ ol += ql;
+ ol = ol1 + ql;
+ ol = ql + ol1;
+
+ // Iterator comparison/conversion.
+ //
+#ifndef QT_STRICT_ITERATORS
+ list::const_iterator i (ol.begin ());
+ if (i != ol.end ())
+ i = ol.end ();
+#endif
+
+ Q_FOREACH (const int& i, ol)
+ cerr << i;
+ }
+
+ auto_ptr<database> db (create_database (argc, argv));
+
+ // Test traits logic.
+ //
+ {
+ object o ("1");
+ o.i = 123;
+ o.s.push_back ("a");
+
+ assert (!o.s._tracking ());
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ assert (o.s._tracking ());
+
+ // load
+ //
+ {
+ transaction t (db->begin ());
+#ifdef HAVE_CXX11
+ unique_ptr<object> p (db->load<object> ("1"));
+#else
+ auto_ptr<object> p (db->load<object> ("1"));
+#endif
+ assert (p->s._tracking ());
+ t.commit ();
+ }
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ assert (o.s._tracking ());
+
+ // erase
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (o);
+ t.commit ();
+ }
+
+ assert (!o.s._tracking ());
+ }
+
+ // Test change tracking.
+ //
+ object o ("1");
+ o.i = 123;
+ o.s.push_back ("a");
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // push_back/pop_back
+ //
+ {
+ o.s.push_back ("b"); // insert
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.pop_back ();
+ o.s.push_back ("c"); // update
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.pop_back (); // delete
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.push_back ("b");
+ o.s.pop_back (); // no-op
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.t == 1);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // insert
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.begin (), "a1"); // insert front
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.i == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.begin () + 1, "a2"); // insert middle
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.i == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.insert (o.s.end (), "b1"); // insert back
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // erase
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.begin ()); // erase front
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 4 && tr.d == 1 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.begin () + 1); // erase middle
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.d == 1 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.erase (o.s.end () - 1); // erase back
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // modify
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.modify (1) += 'b';
+ o.s.modify_back () += 'd';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.modify_front () += 'a';
+ o.s.modify_back () += 'd';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.t == 3);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.begin ().modify () += 'a';
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 2 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.mbegin ();
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 5 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // clear
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.clear ();
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.d == 1 && tr.t == 2);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // assign
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ QList<QString> v;
+ v.push_back ("1");
+ v.push_back ("2");
+ v.push_back ("3");
+ v.push_back ("4");
+ o.s = v;
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 4 && tr.i == 1 && tr.t == 5);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // removeOne/removeAll
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+ o.s.push_back ("a");
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.removeOne ("c");
+ assert (o.s.size () == 5 && o.s[3] == "a");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.d == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ o.s.removeAll ("a");
+ assert (o.s.size () == 2 && o.s[0] == "b" && o.s[1] == "d");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 3 && tr.d == 1 && tr.t == 4);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ // Transaction rollback.
+ //
+ {
+ o.s.clear ();
+ o.s.push_back ("a");
+ o.s.push_back ("b");
+ o.s.push_back ("c");
+
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (*db->load<object> ("1") == o);
+ t.commit ();
+ }
+
+ {
+ {
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ db->update (o);
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.i == 4 && tr.d == 1 && tr.t == 6);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (o);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Armed copy.
+ //
+ {
+
+#ifdef HAVE_CXX11
+ unique_ptr<object> c;
+#else
+ auto_ptr<object> c;
+#endif
+
+
+ {
+ o.s.pop_back ();
+
+ transaction t (db->begin ());
+ db->update (o);
+ c.reset (new object (o));
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 3 && tr.d == 1 && tr.t == 5);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+
+ // Armed swap.
+ //
+#if QT_VERSION >= 0x040800
+ {
+ object c (o);
+
+ {
+ o.s.push_back ("d");
+
+ transaction t (db->begin ());
+ db->update (o);
+ assert (o.s._tracking () && !c.s._tracking ());
+ c.s.swap (o.s);
+ assert (!o.s._tracking () && c.s._tracking ());
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 4 && tr.d == 1 && tr.t == 6);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+#endif
+
+ // Armed move.
+ //
+#ifdef HAVE_CXX11
+ {
+ unique_ptr<object> c;
+
+ {
+ o.s.pop_back ();
+
+ transaction t (db->begin ());
+ db->update (o);
+ assert (o.s._tracking ());
+ c.reset (new object (std::move (o)));
+ assert (!o.s._tracking () && c->s._tracking ());
+ t.rollback ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.i == 2 && tr.d == 1 && tr.t == 4);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ tr.reset (t);
+ db->update (c);
+ assert (tr.u == 1 && tr.t == 1);
+ t.commit ();
+ }
+ }
+#endif
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/common/containers/change-tracking/test.hxx b/odb-tests/qt/common/containers/change-tracking/test.hxx
new file mode 100644
index 0000000..6067581
--- /dev/null
+++ b/odb-tests/qt/common/containers/change-tracking/test.hxx
@@ -0,0 +1,46 @@
+// file : qt/common/containers/change-tracking/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <common/config.hxx> // HAVE_CXX11
+
+#include <memory>
+
+#ifdef HAVE_CXX11
+# include <utility> // std::move
+#endif
+
+#include <QtCore/QString>
+
+#include <odb/core.hxx>
+#include <odb/qt/list.hxx>
+
+#ifdef HAVE_CXX11
+#pragma db object pointer(std::unique_ptr)
+#else
+#pragma db object pointer(std::auto_ptr)
+#endif
+struct object
+{
+ object () {}
+ object (const QString& id): id_ (id) {}
+
+#ifdef HAVE_CXX11
+ object (const object& x): id_ (x.id_), i (x.i), s (x.s) {}
+ object (object&& x): id_ (std::move (x.id_)), i (x.i), s (std::move (x.s)) {}
+#endif
+
+ #pragma db id
+ QString id_;
+
+ unsigned int i;
+
+ QOdbList<QString> s;
+
+ inline bool
+ operator== (const object& o) {return id_ == o.id_ && i == o.i && s == o.s;}
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/common/smart-ptr/driver.cxx b/odb-tests/qt/common/smart-ptr/driver.cxx
new file mode 100644
index 0000000..2c7c38a
--- /dev/null
+++ b/odb-tests/qt/common/smart-ptr/driver.cxx
@@ -0,0 +1,248 @@
+// file : qt/common/smart-ptr/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt smart pointers.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QSharedPointer>
+#include <QtCore/QCoreApplication>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+// Force instantiation of all QLazySharedPointer and QLazyWeakPointer
+// class template members.
+//
+template class QLazySharedPointer<cont>;
+template class QLazyWeakPointer<cont>;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ QSharedPointer<cont> c1 (new cont (1));
+ QSharedPointer<cont> c2 (new cont (2));
+
+ // Test boolean conversion operator.
+ //
+ {
+ assert (!QLazySharedPointer<cont> ());
+ assert (!QLazyWeakPointer<cont> ());
+ assert (QLazySharedPointer<cont> (c1));
+ assert (QLazySharedPointer<cont> (*db, 1));
+ assert (QLazyWeakPointer<cont> (c1));
+ assert (QLazyWeakPointer<cont> (*db, 1));
+ }
+
+ // Test loaded () implementation.
+ //
+ {
+ assert (QLazySharedPointer<cont> ().loaded ());
+ assert (!QLazySharedPointer<cont> (c1).loaded ());
+ assert (!QLazySharedPointer<cont> (*db, 1).loaded ());
+ assert (QLazySharedPointer<cont> (*db, c1).loaded ());
+ assert (QLazyWeakPointer<cont> ().loaded ());
+ assert (!QLazyWeakPointer<cont> (c1).loaded ());
+ assert (!QLazyWeakPointer<cont> (*db, 1).loaded ());
+ assert (QLazyWeakPointer<cont> (*db, c1).loaded ());
+ }
+
+ // Test comparison operators.
+ //
+ {
+ // Transient QLazySharedPointer.
+ //
+ assert (QLazySharedPointer<cont> () == QLazySharedPointer<cont> ());
+ assert (QLazySharedPointer<cont> () != QLazySharedPointer<cont> (c1));
+ assert (QLazySharedPointer<cont> (c1) != QLazySharedPointer<cont> (c2));
+ assert (QLazySharedPointer<cont> (c2) == QLazySharedPointer<cont> (c2));
+
+ // Persistent QLazySharedPointer.
+ //
+ QLazySharedPointer<cont> ls1 (*db, 1), ls2 (*db, c2);
+ assert (ls1 != QLazySharedPointer<cont> ());
+ assert (ls1 != QLazySharedPointer<cont> (c1));
+ assert (ls1 == QLazySharedPointer<cont> (*db, c1));
+ assert (ls1 != ls2);
+ assert (ls2 == QLazySharedPointer<cont> (c2));
+
+ // Transient QLazyWeakPointer.
+ //
+ assert (QLazyWeakPointer<cont> () == QLazyWeakPointer<cont> ());
+ assert (QLazyWeakPointer<cont> () != QLazyWeakPointer<cont> (c1));
+ assert (QLazyWeakPointer<cont> (c1) != QLazyWeakPointer<cont> (c2));
+ assert (QLazyWeakPointer<cont> (c2) == QLazyWeakPointer<cont> (c2));
+ assert (QLazyWeakPointer<cont> () == QLazySharedPointer<cont> ());
+ assert (QLazyWeakPointer<cont> () != QLazySharedPointer<cont> (c1));
+ assert (QLazyWeakPointer<cont> (c1) != QLazySharedPointer<cont> (c2));
+ assert (QLazyWeakPointer<cont> (c2) == QLazySharedPointer<cont> (c2));
+
+ // Persistent QLazyWeakPointer.
+ //
+ QLazyWeakPointer<cont> lw1 (*db, 1), lw2 (*db, c2);
+ assert (lw1 != QLazyWeakPointer<cont> ());
+ assert (lw1 != QLazyWeakPointer<cont> (c1));
+ assert (lw1 == QLazyWeakPointer<cont> (*db, c1));
+ assert (lw1 != lw2);
+ assert (lw2 == QLazyWeakPointer<cont> (c2));
+ assert (ls1 == lw1);
+ assert (ls1 != QLazyWeakPointer<cont> (c1));
+ assert (ls1 == QLazyWeakPointer<cont> (*db, c1));
+ assert (ls1 != lw2);
+ assert (ls2 == QLazyWeakPointer<cont> (c2));
+ }
+
+ // Test swap.
+ //
+ {
+ QLazySharedPointer<cont> lx (*db, 1), ly;
+ swap (lx, ly);
+
+ assert (lx.isNull ());
+ assert (ly == QLazySharedPointer<cont> (*db, c1));
+ }
+
+ // Persist.
+ //
+ QSharedPointer<obj> o1 (new obj (1));
+ QSharedPointer<obj> o2 (new obj (2));
+ QSharedPointer<obj> o3 (new obj (3));
+ QSharedPointer<obj> o4 (new obj (4));
+
+ o1->c = c1;
+ o2->c = c1;
+ o3->c = c2;
+ o4->c = c2;
+
+ {
+ transaction t (db->begin ());
+
+ db->persist (c1);
+
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ db->persist (o4);
+
+ db->persist (c2);
+
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ session s;
+ transaction t (db->begin ());
+
+ QSharedPointer<cont> c (db->load<cont> (1));
+ QSharedPointer<obj> o (db->load<obj> (1));
+
+ // Ensure that lazy pointers are present but not loaded.
+ //
+ assert (c->o.size () == 2);
+ assert (!c->o[0].loaded ());
+ assert (!c->o[1].loaded ());
+ assert (!o->c.loaded ());
+
+ // Ensure that the correct object IDs were loaded.
+ //
+ assert (c->o[0].objectId<obj> () == 1);
+ assert (c->o[1].objectId<obj> () == 2);
+ assert (o->c.objectId<obj> () == 1);
+
+ // Load the lazy pointer targets ensuring that the loaded
+ // targets correspond to the cached session objects.
+ //
+ QSharedPointer<cont> cl (o->c.load ());
+ QSharedPointer<obj> ol (c->o[0].load ());
+
+ assert (c->o[0].loaded ());
+ assert (o->c.loaded ());
+
+ assert (cl == c);
+ assert (ol == o);
+
+ t.commit ();
+ }
+
+ // Test lazy weak locking and reloading.
+ //
+ {
+ // No session.
+ //
+ transaction t (db->begin ());
+ QSharedPointer<cont> c (db->load<cont> (1));
+
+ // Lock.
+ //
+ assert (!c->o[1].loaded ());
+ QLazySharedPointer<obj> l (c->o[1].toStrongRef ());
+ assert (!l.loaded ());
+ assert (l.objectId<obj> () == c->o[1].objectId<obj> ());
+
+ // Reload.
+ //
+ assert (!c->o[1].loaded ());
+
+ QSharedPointer<obj> ol (c->o[1].load ());
+ assert (c->o[1].loaded ());
+
+ ol.clear ();
+ assert (!c->o[1].loaded ());
+
+ ol = c->o[1].load ();
+ assert (c->o[1].loaded ());
+
+ t.commit ();
+ }
+
+ //
+ // Test QSharedPointer as a value wrapper.
+ //
+
+ {
+ obj2 o1 (1);
+ obj2 o2 (2);
+ o2.num = QSharedPointer<unsigned long> (new unsigned long (123));
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ QSharedPointer<obj2> o1 (db->load<obj2> (1));
+ QSharedPointer<obj2> o2 (db->load<obj2> (2));
+ t.commit ();
+
+ assert (!o1->num);
+ assert (o2->num && *o2->num == 123);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/common/smart-ptr/test.hxx b/odb-tests/qt/common/smart-ptr/test.hxx
new file mode 100644
index 0000000..2c8bf36
--- /dev/null
+++ b/odb-tests/qt/common/smart-ptr/test.hxx
@@ -0,0 +1,77 @@
+// file : qt/common/smart-ptr/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <QtCore/QSharedPointer>
+
+#include <odb/core.hxx>
+#include <odb/qt/lazy-ptr.hxx>
+
+struct obj;
+
+#pragma db object
+struct cont
+{
+ cont ()
+ {
+ }
+
+ cont (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ typedef std::vector<QLazyWeakPointer<obj> > obj_list;
+
+ #pragma db inverse(c) value_not_null
+ obj_list o;
+};
+
+#pragma db object
+struct obj
+{
+ obj ()
+ {
+ }
+
+ obj (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db not_null
+ QLazySharedPointer<cont> c;
+};
+
+// Test QSharedPointer as a value wrapper.
+//
+#pragma db object
+struct obj2
+{
+ obj2 ()
+ {
+ }
+
+ obj2 (unsigned long id)
+ : id (id)
+ {
+ }
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db null
+ QSharedPointer<unsigned long> num;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/common/template/driver.cxx b/odb-tests/qt/common/template/driver.cxx
new file mode 100644
index 0000000..30f9fc6
--- /dev/null
+++ b/odb-tests/qt/common/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/common/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/common/template/template-qt4-vc10.vcxproj b/odb-tests/qt/common/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..fddcac3
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,177 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/common/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt4-vc11.vcxproj b/odb-tests/qt/common/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..a71ac6b
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,181 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/common/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt4-vc12.vcxproj b/odb-tests/qt/common/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..eaa4d12
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/common/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt4-vc8.vcproj b/odb-tests/qt/common/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..63fc22c
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc8.vcproj
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-__value__(database).lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-__value__(database).lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/common/template/template-qt4-vc9.vcproj b/odb-tests/qt/common/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..b37675e
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt4-vc9.vcproj
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-__value__(database).lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-__value__(database).lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/common/template/template-qt5-vc10.vcxproj b/odb-tests/qt/common/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..add071a
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,177 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/common/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt5-vc11.vcxproj b/odb-tests/qt/common/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..07daa25
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,181 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/common/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt5-vc12.vcxproj b/odb-tests/qt/common/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..a64ba40
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>
+ <ItemGroup>
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx)
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/common/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/common/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..f3ee658
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx)
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__source_filter_entry__(test-odb.cxx)
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/common/template/template-qt5-vc9.vcproj b/odb-tests/qt/common/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..57b4edc
--- /dev/null
+++ b/odb-tests/qt/common/template/template-qt5-vc9.vcproj
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-__value__(database).lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-__value__(database).lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__source_entry__(test-odb.cxx)
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx)
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/common/template/test.hxx b/odb-tests/qt/common/template/test.hxx
new file mode 100644
index 0000000..6f38186
--- /dev/null
+++ b/odb-tests/qt/common/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/common/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mssql/basic/driver.cxx b/odb-tests/qt/mssql/basic/driver.cxx
new file mode 100644
index 0000000..fca335d
--- /dev/null
+++ b/odb-tests/qt/mssql/basic/driver.cxx
@@ -0,0 +1,65 @@
+// file : qt/mssql/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence. SQL Server version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.id_ = "object 1";
+ o.sstr_ = QString (512, 's');
+ o.lstr_ = QString (65000, 'l'); // Test temp buffer boundary.
+ o.snstr_ = QString (512, QChar (0x1234));
+ o.lnstr_ = QString (65536, QChar (0x2345));
+ o.sbuf_ = QByteArray (512, 0x01);
+ o.lbuf_ = QByteArray (65536, 0x02);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.id_));
+ t.commit ();
+
+ assert (*p == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/mssql/basic/test.hxx b/odb-tests/qt/mssql/basic/test.hxx
new file mode 100644
index 0000000..bce87b6
--- /dev/null
+++ b/odb-tests/qt/mssql/basic/test.hxx
@@ -0,0 +1,46 @@
+// file : qt/mssql/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QByteArray>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id_ == x.id_ &&
+ sstr_ == x.sstr_ &&
+ lstr_ == x.lstr_ &&
+ snstr_ == x.snstr_ &&
+ lnstr_ == x.lnstr_ &&
+ sbuf_ == x.sbuf_ &&
+ lbuf_ == x.lbuf_;
+ }
+
+ #pragma db id
+ QString id_;
+
+ QString sstr_;
+
+ #pragma db type ("VARCHAR(max)")
+ QString lstr_;
+
+ #pragma db type ("NVARCHAR(512)")
+ QString snstr_;
+
+ #pragma db type ("NVARCHAR(max)")
+ QString lnstr_;
+
+ #pragma db type ("VARBINARY(512)")
+ QByteArray sbuf_;
+
+ QByteArray lbuf_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mssql/date-time/driver.cxx b/odb-tests/qt/mssql/date-time/driver.cxx
new file mode 100644
index 0000000..9b4320e
--- /dev/null
+++ b/odb-tests/qt/mssql/date-time/driver.cxx
@@ -0,0 +1,94 @@
+// file : qt/mssql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt date/time type persistence. SQL Server version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Check persistence of null values.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (ol->is_null ());
+ }
+
+ // Check persistence of valid dates and times.
+ //
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ QDateTime t (QDateTime::currentDateTime ());
+
+ o.date = t.date ();
+ o.date_time = t;
+#endif
+
+ // In DATETIME fractional seconds are rounded to .000, .003, or .007.
+ //
+ o.date_time_dt = QDateTime (QDate (2012, 1, 14),
+ QTime (11, 57, 13, 3));
+
+ // SMALLDATETIME doesn't have seconds (always 0).
+ //
+ o.date_time_sdt = QDateTime (QDate (2012, 1, 14),
+ QTime (11, 57, 0, 0));
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ o.time = t.time ();
+#endif
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/mssql/date-time/test.hxx b/odb-tests/qt/mssql/date-time/test.hxx
new file mode 100644
index 0000000..71769b9
--- /dev/null
+++ b/odb-tests/qt/mssql/date-time/test.hxx
@@ -0,0 +1,68 @@
+// file : qt/mssql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QDateTime>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ QDate date;
+
+ QDateTime date_time;
+#endif
+
+ #pragma db type ("DATETIME")
+ QDateTime date_time_dt;
+
+ #pragma db type ("SMALLDATETIME")
+ QDateTime date_time_sdt;
+
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ QTime time;
+#endif
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && date == x.date
+ && date_time == x.date_time
+#endif
+ && date_time_dt == x.date_time_dt
+ && date_time_sdt == x.date_time_sdt
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && time == x.time
+#endif
+ ;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ true
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && date.isNull ()
+ && date_time.isNull ()
+#endif
+ && date_time_dt.isNull ()
+ && date_time_sdt.isNull ()
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && time.isNull ()
+#endif
+ ;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mssql/template/driver.cxx b/odb-tests/qt/mssql/template/driver.cxx
new file mode 100644
index 0000000..97ef6ef
--- /dev/null
+++ b/odb-tests/qt/mssql/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/mssql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj b/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..e4902d0
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj b/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..b9dd89c
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj b/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..0916a38
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc8.vcproj b/odb-tests/qt/mssql/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..38916fa
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mssql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mssql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mssql/template/template-qt4-vc9.vcproj b/odb-tests/qt/mssql/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..da1b5ab
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt4-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mssql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mssql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj b/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..508e262
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj b/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..a974034
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj b/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..40e2fbb
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mssql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mssql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mssql/template/template-qt5-vc9.vcproj b/odb-tests/qt/mssql/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..66ea9ab
--- /dev/null
+++ b/odb-tests/qt/mssql/template/template-qt5-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mssql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mssql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mssql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mssql/template/test.hxx b/odb-tests/qt/mssql/template/test.hxx
new file mode 100644
index 0000000..033703a
--- /dev/null
+++ b/odb-tests/qt/mssql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/mssql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mysql/basic/driver.cxx b/odb-tests/qt/mysql/basic/driver.cxx
new file mode 100644
index 0000000..b685d68
--- /dev/null
+++ b/odb-tests/qt/mysql/basic/driver.cxx
@@ -0,0 +1,60 @@
+// file : qt/mysql/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence. MySQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.str = "Constantin Michael";
+ o.blob = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.str));
+ t.commit ();
+
+ assert (*p == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/mysql/basic/test.hxx b/odb-tests/qt/mysql/basic/test.hxx
new file mode 100644
index 0000000..6dd246e
--- /dev/null
+++ b/odb-tests/qt/mysql/basic/test.hxx
@@ -0,0 +1,27 @@
+// file : qt/mysql/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QByteArray>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ str == x.str &&
+ blob == x.blob;
+ }
+
+ #pragma db id
+ QString str;
+
+ QByteArray blob;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mysql/date-time/driver.cxx b/odb-tests/qt/mysql/date-time/driver.cxx
new file mode 100644
index 0000000..94cf653
--- /dev/null
+++ b/odb-tests/qt/mysql/date-time/driver.cxx
@@ -0,0 +1,178 @@
+// file : qt/mysql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt date/time type persistence. MySQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+bool
+test_out_of_range_value (object&, database&);
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ mysql_version v;
+ {
+ transaction t (db->begin ());
+ db->query<mysql_version> ().begin ().load (v);
+ t.commit ();
+ }
+
+ // If we are running against MySQL 5.6.4 or later alter the tables
+ // to allow sub-second precision.
+ //
+ bool fs (v.major > 5 ||
+ (v.major == 5 && (v.minor > 6 ||
+ (v.minor == 6 && v.release >= 4))));
+ if (fs)
+ {
+ transaction t (db->begin ());
+ db->execute ("ALTER TABLE `qt_mysql_dt_object`" \
+ " MODIFY COLUMN `date_time` DATETIME(3)," \
+ " MODIFY COLUMN `timestamp` TIMESTAMP(3) NULL," \
+ " MODIFY COLUMN `time` TIME(3)");
+ t.commit ();
+ }
+
+ //
+ // Check valid dates and times.
+ //
+
+ object o;
+
+ // Check persistence of null values.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (ol->is_null ());
+ }
+
+ // Check persistence of valid dates and times.
+ //
+
+ // Create a QDateTime containing the current date and time
+ // but with the milliseconds zeroed. MySQL prior to 5.6.4
+ // does not support sub-second prevision.
+ //
+ QDateTime t (QDateTime::currentDateTime ());
+
+ if (!fs)
+ t.setTime (QTime (t.time ().hour (),
+ t.time ().minute (),
+ t.time ().second ()));
+
+ o.date = t.date ();
+ o.date_time = t;
+ o.timestamp = t;
+ o.time = t.time ();
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+
+ //
+ // Check invalid dates and times.
+ //
+
+ {
+ // Test out of range dates.
+ //
+ object or1, or2;
+ or1.date = QDate (999, 12, 31);
+ or2.date = QDate (10000, 1, 1);
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, *db));
+ assert (test_out_of_range_value (or2, *db));
+ t.commit ();
+ }
+
+ {
+ // Test out of range date-times.
+ //
+ object or1, or2;
+ or1.date_time = QDateTime (QDate (999, 12, 31), QTime (23, 59, 59));
+ or2.date_time = QDateTime (QDate (10000, 1, 1));
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, *db));
+ assert (test_out_of_range_value (or2, *db));
+ t.commit ();
+ }
+
+ {
+ // Test out of range timestamps.
+ //
+ object or1, or2;
+ or1.timestamp = QDateTime (QDate (1970, 1, 1));
+ or2.timestamp = QDateTime (QDate (2038, 1, 19), QTime (3, 14, 8));
+
+ transaction t (db->begin ());
+ assert (test_out_of_range_value (or1, *db));
+ assert (test_out_of_range_value (or2, *db));
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_out_of_range_value (object& x, database& db)
+{
+ try
+ {
+ db.persist (x);
+ return false;
+ }
+ catch (const odb::qt::date_time::value_out_of_range&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/qt/mysql/date-time/test.hxx b/odb-tests/qt/mysql/date-time/test.hxx
new file mode 100644
index 0000000..ba31da5
--- /dev/null
+++ b/odb-tests/qt/mysql/date-time/test.hxx
@@ -0,0 +1,70 @@
+// file : qt/mysql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <QtCore/QDateTime>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ date == x.date &&
+ date_time == x.date_time &&
+ timestamp == x.timestamp &&
+ time == x.time;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ date.isNull () &&
+ date_time.isNull () &&
+ timestamp.isNull () &&
+ time.isNull ();
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ QDate date;
+ QDateTime date_time;
+
+ // Make timestamp NULL-able to suppress the auto-initialization and
+ // auto-update characteristics of the TIMESTAMP datatype, and to
+ // allow NULL values.
+ //
+ #pragma db type("TIMESTAMP") null
+ QDateTime timestamp;
+
+ QTime time;
+};
+
+// MySQL server version view.
+//
+#pragma db view query( \
+ "SELECT " \
+ "CAST(SUBSTRING_INDEX(@@version, '.', 1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '.', 2), '.', -1) AS UNSIGNED)," \
+ "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(@@version, '-', 1), '.', -1) AS UNSIGNED)," \
+ "@@protocol_version")
+struct mysql_version
+{
+ unsigned int major;
+ unsigned int minor;
+ unsigned int release;
+
+ unsigned int protocol;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/mysql/template/driver.cxx b/odb-tests/qt/mysql/template/driver.cxx
new file mode 100644
index 0000000..1e293b4
--- /dev/null
+++ b/odb-tests/qt/mysql/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/mysql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj b/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..0f57bbe
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj b/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..33cb785
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj b/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..6a2812a
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc8.vcproj b/odb-tests/qt/mysql/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..25e096f
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mysql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mysql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mysql/template/template-qt4-vc9.vcproj b/odb-tests/qt/mysql/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..a904d40
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt4-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mysql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mysql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj b/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..27eb1a8
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj b/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..7a2e2b9
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj b/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..f75d5d3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/mysql/template/template-qt5-vc9.vcproj b/odb-tests/qt/mysql/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..c17267b
--- /dev/null
+++ b/odb-tests/qt/mysql/template/template-qt5-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-mysql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-mysql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-mysql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/mysql/template/test.hxx b/odb-tests/qt/mysql/template/test.hxx
new file mode 100644
index 0000000..94b806d
--- /dev/null
+++ b/odb-tests/qt/mysql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/mysql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/oracle/basic/driver.cxx b/odb-tests/qt/oracle/basic/driver.cxx
new file mode 100644
index 0000000..43a20e2
--- /dev/null
+++ b/odb-tests/qt/oracle/basic/driver.cxx
@@ -0,0 +1,81 @@
+// file : qt/oracle/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence. Oracle version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+#include <string>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ string short_str (13, 's');
+ string medium_str (150, 'm');
+ string long_str (20000, 'v');
+ // Oracle UTF-8 support is limited to 3-byte sequences.
+ //
+ string unicode_str ("a \xD5\x95 \xEA\xAA\xAA \xE2\x82\xAC bcdef");
+
+ object o;
+
+ o.char_= QString::fromStdString (short_str);
+ o.varchar2 = QString::fromStdString (medium_str);
+ o.clob = QString::fromStdString (long_str);
+
+ // fromStdString() assumes ASCII in Qt4 and UTF-8 in Qt5.
+ //
+ o.nchar= QString::fromUtf8 (unicode_str.c_str (),
+ static_cast<int> (unicode_str.size ()));
+ o.nvarchar2 = QString::fromUtf8 (unicode_str.c_str (),
+ static_cast<int> (unicode_str.size ()));
+ o.nclob = QString::fromStdString (long_str);
+
+ o.raw = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8);
+ o.blob = QByteArray (long_str.c_str (),
+ static_cast<int> (long_str.size ()));
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.varchar2));
+ t.commit ();
+ assert (*p == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/oracle/basic/test.hxx b/odb-tests/qt/oracle/basic/test.hxx
new file mode 100644
index 0000000..6781a97
--- /dev/null
+++ b/odb-tests/qt/oracle/basic/test.hxx
@@ -0,0 +1,51 @@
+// file : qt/oracle/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QByteArray>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ varchar2 == x.varchar2 &&
+ char_ == x.char_ &&
+ nchar == x.nchar &&
+ nvarchar2 == x.nvarchar2 &&
+ clob == x.clob &&
+ nclob == x.nclob &&
+ blob == x.blob &&
+ raw == x.raw;
+ }
+
+ #pragma db id
+ QString varchar2;
+
+ #pragma db type ("CHAR(13)")
+ QString char_;
+
+ #pragma db type ("NCHAR(13)")
+ QString nchar;
+
+ #pragma db type ("NVARCHAR2(512)")
+ QString nvarchar2;
+
+ #pragma db type ("CLOB")
+ QString clob;
+
+ #pragma db type ("NCLOB")
+ QString nclob;
+
+ QByteArray blob;
+
+ #pragma db type ("RAW(128)")
+ QByteArray raw;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/oracle/date-time/driver.cxx b/odb-tests/qt/oracle/date-time/driver.cxx
new file mode 100644
index 0000000..d13fab7
--- /dev/null
+++ b/odb-tests/qt/oracle/date-time/driver.cxx
@@ -0,0 +1,80 @@
+// file : qt/oracle/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt date/time type persistence. Oracle version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+
+ // Check persistence of null values.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (ol->is_null ());
+ }
+
+ // Check persistence of valid dates and times.
+ //
+ QDateTime t (QDateTime::currentDateTime ());
+
+ o.date = t.date ();
+ o.date_time = t;
+ o.date_time_d = QDateTime (QDate (2012, 6, 27), QTime (14, 17, 05, 0));
+ o.time = t.time ();
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/oracle/date-time/test.hxx b/odb-tests/qt/oracle/date-time/test.hxx
new file mode 100644
index 0000000..93bc5b7
--- /dev/null
+++ b/odb-tests/qt/oracle/date-time/test.hxx
@@ -0,0 +1,45 @@
+// file : qt/oracle/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QDateTime>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ date == x.date &&
+ date_time == x.date_time &&
+ date_time_d == x.date_time_d &&
+ time == x.time;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ date.isNull () &&
+ date_time.isNull () &&
+ date_time_d.isNull () &&
+ time.isNull ();
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ QDate date;
+ QDateTime date_time;
+ #pragma db type("DATE")
+ QDateTime date_time_d;
+ QTime time;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/oracle/template/driver.cxx b/odb-tests/qt/oracle/template/driver.cxx
new file mode 100644
index 0000000..9b092a9
--- /dev/null
+++ b/odb-tests/qt/oracle/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/oracle/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj b/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..6e7c369
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj b/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..ad1e888
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj b/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..88dffa8
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc8.vcproj b/odb-tests/qt/oracle/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..187254b
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-oracle.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-oracle.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/oracle/template/template-qt4-vc9.vcproj b/odb-tests/qt/oracle/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..292b899
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt4-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-oracle.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-oracle.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj b/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..c388d6b
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj b/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..79d5d15
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj b/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..2ae82a6
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-oracle-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-oracle.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/oracle/template/template-qt5-vc9.vcproj b/odb-tests/qt/oracle/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..2712157
--- /dev/null
+++ b/odb-tests/qt/oracle/template/template-qt5-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-oracle.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-oracle-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-oracle.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/oracle/template/test.hxx b/odb-tests/qt/oracle/template/test.hxx
new file mode 100644
index 0000000..0ad65cf
--- /dev/null
+++ b/odb-tests/qt/oracle/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/oracle/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/pgsql/basic/driver.cxx b/odb-tests/qt/pgsql/basic/driver.cxx
new file mode 100644
index 0000000..4c6a78a
--- /dev/null
+++ b/odb-tests/qt/pgsql/basic/driver.cxx
@@ -0,0 +1,60 @@
+// file : qt/pgsql/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence. PostgreSQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.str = "Constantin Michael";
+ o.blob = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.str));
+ t.commit ();
+
+ assert (*p == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/pgsql/basic/test.hxx b/odb-tests/qt/pgsql/basic/test.hxx
new file mode 100644
index 0000000..d4a1ba6
--- /dev/null
+++ b/odb-tests/qt/pgsql/basic/test.hxx
@@ -0,0 +1,27 @@
+// file : qt/pgsql/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QByteArray>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ str == x.str &&
+ blob == x.blob;
+ }
+
+ #pragma db id
+ QString str;
+
+ QByteArray blob;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/pgsql/date-time/driver.cxx b/odb-tests/qt/pgsql/date-time/driver.cxx
new file mode 100644
index 0000000..43a676d
--- /dev/null
+++ b/odb-tests/qt/pgsql/date-time/driver.cxx
@@ -0,0 +1,108 @@
+// file : qt/pgsql/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt date/time type persistence. PostgreSQL version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+bool
+test_out_of_range_value (object&, database&);
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ // Check persistence of null values.
+ //
+ {
+ object o;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (ol->is_null ());
+ }
+ }
+
+ // Check persistence of valid dates and times.
+ //
+ {
+ QDateTime ct (QDateTime::currentDateTime ());
+
+ object o;
+ o.date = ct.date ();
+ o.time = ct.time ();
+ o.date_time = ct;
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+ }
+
+ // Test a QDateTime value before PG epoch.
+ //
+ {
+ object o;
+ o.date_time = QDateTime (QDate (1969, 12, 31), QTime (23, 59, 59, 123));
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol (db->load<object> (o.id));
+ t.commit ();
+
+ assert (*ol == o);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/pgsql/date-time/test.hxx b/odb-tests/qt/pgsql/date-time/test.hxx
new file mode 100644
index 0000000..2da5587
--- /dev/null
+++ b/odb-tests/qt/pgsql/date-time/test.hxx
@@ -0,0 +1,43 @@
+// file : qt/pgsql/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <QtCore/QDateTime>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ date == x.date &&
+ time == x.time &&
+ date_time == x.date_time;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ date.isNull () &&
+ time.isNull () &&
+ date_time.isNull ();
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ QDate date;
+ QTime time;
+ QDateTime date_time;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/pgsql/template/driver.cxx b/odb-tests/qt/pgsql/template/driver.cxx
new file mode 100644
index 0000000..71934a7
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/pgsql/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj b/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..1c1e1a7
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj b/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..a7e7a86
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj b/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..f1b9924
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc8.vcproj b/odb-tests/qt/pgsql/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..3f364d2
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-pgsql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-pgsql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/pgsql/template/template-qt4-vc9.vcproj b/odb-tests/qt/pgsql/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..2e9e84b
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt4-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-pgsql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-pgsql.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj b/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..cb6aa0c
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj b/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..863bd51
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj b/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..5d958c2
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/pgsql/template/template-qt5-vc9.vcproj b/odb-tests/qt/pgsql/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..b32a1e7
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/template-qt5-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-pgsql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-pgsql-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-pgsql.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/pgsql/template/test.hxx b/odb-tests/qt/pgsql/template/test.hxx
new file mode 100644
index 0000000..8b866bd
--- /dev/null
+++ b/odb-tests/qt/pgsql/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/pgsql/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/sqlite/basic/driver.cxx b/odb-tests/qt/sqlite/basic/driver.cxx
new file mode 100644
index 0000000..3bae10b
--- /dev/null
+++ b/odb-tests/qt/sqlite/basic/driver.cxx
@@ -0,0 +1,60 @@
+// file : qt/sqlite/basic/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt basic type persistence. SQLite version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ object o;
+ o.str = QString::fromUtf8 ("Constantin Micha\xC3\x88l");
+ o.blob = QByteArray ("\0x13\0xDE\0x00\0x00\0x00\0x54\0xF2\0x6A", 8);
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.str));
+ t.commit ();
+
+ assert (*p == o);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/sqlite/basic/test.hxx b/odb-tests/qt/sqlite/basic/test.hxx
new file mode 100644
index 0000000..b0cdf46
--- /dev/null
+++ b/odb-tests/qt/sqlite/basic/test.hxx
@@ -0,0 +1,27 @@
+// file : qt/sqlite/basic/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <QtCore/QString>
+#include <QtCore/QByteArray>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ str == x.str &&
+ blob == x.blob;
+ }
+
+ #pragma db id
+ QString str;
+
+ QByteArray blob;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/sqlite/date-time/driver.cxx b/odb-tests/qt/sqlite/date-time/driver.cxx
new file mode 100644
index 0000000..adf7889
--- /dev/null
+++ b/odb-tests/qt/sqlite/date-time/driver.cxx
@@ -0,0 +1,140 @@
+// file : qt/sqlite/date-time/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test Qt date/time type persistence. SQLite version.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+bool
+test_out_of_range_value (object&, database&);
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ // Check persistence of null values.
+ //
+ object o1;
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol1 (db->load<object> (o1.id));
+ t.commit ();
+
+ assert (ol1->is_null ());
+ }
+
+ QDateTime ct (QDateTime::currentDateTime ());
+ QDateTime ct_no_ms = QDateTime (QDate (ct.date ().year (),
+ ct.date ().month (),
+ ct.date ().day ()),
+ QTime (ct.time ().hour (),
+ ct.time ().minute (),
+ ct.time ().second ()));
+
+ // Check persistence of valid dates and times.
+ //
+ object o2;
+ {
+ o2.date = ct.date ();
+ o2.unix_day = ct.date ();
+ o2.time = ct.time ();
+
+ // QTime stored as SQLite INTEGER has second resolution.
+ // The millsecond part is zeroed to avoid false negatives.
+ //
+ o2.seconds = ct_no_ms.time ();
+
+ o2.date_time = ct;
+
+ // UNIX time has second reolution. The millsecond part is
+ // zeroed to avoid false negatives.
+ //
+ o2.unix_time = ct_no_ms;
+
+ transaction t (db->begin ());
+ db->persist (o2);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> ol2 (db->load<object> (o2.id));
+ t.commit ();
+
+ assert (*ol2 == o2);
+ }
+
+ // Test out of range values for QDateTime traits UNIX time
+ // implementation.
+ //
+ {
+ object o;
+ o.unix_time = QDateTime (QDate (1969, 12, 31),
+ QTime (23, 59, 59),
+ Qt::UTC);
+
+ assert (test_out_of_range_value (o, *db));
+ }
+
+ // Test out of range values for QDate traits UNIX time
+ // implementation.
+ //
+ {
+ object o;
+ o.unix_day = QDate (QDate (1969, 12, 31));
+
+ assert (test_out_of_range_value (o, *db));
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
+
+bool
+test_out_of_range_value (object& x, database& db)
+{
+ try
+ {
+ transaction t (db.begin ());
+ db.persist (x);
+ t.rollback ();
+
+ return false;
+ }
+ catch (const odb::qt::date_time::value_out_of_range&)
+ {
+ }
+
+ return true;
+}
diff --git a/odb-tests/qt/sqlite/date-time/test.hxx b/odb-tests/qt/sqlite/date-time/test.hxx
new file mode 100644
index 0000000..9795846
--- /dev/null
+++ b/odb-tests/qt/sqlite/date-time/test.hxx
@@ -0,0 +1,60 @@
+// file : qt/sqlite/date-time/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <QtCore/QDateTime>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id &&
+ date == x.date &&
+ unix_day == x.unix_day &&
+ time == x.time &&
+ seconds == x.seconds &&
+ date_time == x.date_time &&
+ unix_time == x.unix_time;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ date.isNull () &&
+ unix_day.isNull () &&
+ time.isNull () &&
+ seconds.isNull () &&
+ date_time.isNull () &&
+ unix_time.isNull ();
+ }
+
+ #pragma db id auto
+ unsigned long id;
+
+ QDate date;
+
+ #pragma db type ("INTEGER")
+ QDate unix_day;
+
+ QTime time;
+
+ #pragma db type ("INTEGER")
+ QTime seconds;
+
+ QDateTime date_time;
+
+ #pragma db type ("INTEGER")
+ QDateTime unix_time;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/qt/sqlite/template/driver.cxx b/odb-tests/qt/sqlite/template/driver.cxx
new file mode 100644
index 0000000..dc1181c
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/driver.cxx
@@ -0,0 +1,43 @@
+// file : qt/sqlite/template/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj b/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj
new file mode 100644
index 0000000..5d4cd02
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj b/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj
new file mode 100644
index 0000000..217b75e
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj b/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj
new file mode 100644
index 0000000..43959de
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;QtCored4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;QtCore4.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc8.vcproj b/odb-tests/qt/sqlite/template/template-qt4-vc8.vcproj
new file mode 100644
index 0000000..16623a8
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc8.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-sqlite.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-sqlite.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/sqlite/template/template-qt4-vc9.vcproj b/odb-tests/qt/sqlite/template/template-qt4-vc9.vcproj
new file mode 100644
index 0000000..b52f2ec
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt4-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-sqlite.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib QtCored4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-sqlite.lib odb-qt.lib odb.lib QtCore4.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj b/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj
new file mode 100644
index 0000000..b0f2c28
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj
@@ -0,0 +1,180 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc10.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj b/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj
new file mode 100644
index 0000000..d0ca5d9
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj
@@ -0,0 +1,184 @@
+<?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="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc11.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj b/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj
new file mode 100644
index 0000000..dc303a6
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <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>{__uuid__()}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>__value__(name)</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <TargetName>driver</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common-d.lib;odb-sqlite-d.lib;odb-qt-d.lib;odb-d.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\libcommon</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(SolutionDir)\..\..\libcommon\lib64\common.lib;odb-sqlite.lib;odb-qt.lib;odb.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+__ifelse__(__value__(odb_options),,,
+m4_dnl
+ <ItemGroup>
+__custom_build_entry__(
+test.hxx,
+odb test.hxx,
+odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+ </ItemGroup>)
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_entry__(test-odb.hxx)
+__header_entry__(test-odb.ixx))
+__header_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj.filters b/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj.filters
new file mode 100644
index 0000000..8ac18a3
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc12.vcxproj.filters
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{__uuid__()}</UniqueIdentifier>
+ <Extensions>h;hxx;ixx;txx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+__ifelse__(__value__(odb_options),,,
+__header_filter_entry__(test.hxx)
+__header_filter_entry__(test-odb.hxx)
+__header_filter_entry__(test-odb.ixx))
+__header_filter_entries__(extra_headers)
+ </ItemGroup>
+ <ItemGroup>
+__source_filter_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx))
+__source_filter_entries__(extra_sources)
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/odb-tests/qt/sqlite/template/template-qt5-vc9.vcproj b/odb-tests/qt/sqlite/template/template-qt5-vc9.vcproj
new file mode 100644
index 0000000..79c9389
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/template-qt5-vc9.vcproj
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="__value__(name)"
+ ProjectGUID="{__uuid__()}"
+ RootNamespace="__value__(name)"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib\common.lib odb-sqlite.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common-d.lib odb-sqlite-d.lib odb-qt-d.lib odb-d.lib Qt5Cored.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SolutionDir)\..\..\libcommon"
+ PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)\..\..\libcommon\lib64\common.lib odb-sqlite.lib odb-qt.lib odb.lib Qt5Core.lib"
+ OutputFile="$(OutDir)\driver.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cxx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__source_entry__(driver.cxx)
+__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx))
+__source_entries__(extra_sources)
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hxx;ixx;txx"
+ UniqueIdentifier="{__uuid__()}"
+ >
+__ifelse__(__value__(odb_options),,,
+__file_entry_custom_build__(
+test.hxx,
+odb test.hxx,
+odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 -I$(SolutionDir)\..\..\libcommon)) test.hxx,
+test-odb.hxx;test-odb.ixx;test-odb.cxx)
+__file_entry__(test-odb.hxx)
+__file_entry__(test-odb.ixx))
+__file_entries__(extra_headers)
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/odb-tests/qt/sqlite/template/test.hxx b/odb-tests/qt/sqlite/template/test.hxx
new file mode 100644
index 0000000..1a8d616
--- /dev/null
+++ b/odb-tests/qt/sqlite/template/test.hxx
@@ -0,0 +1,25 @@
+// file : qt/sqlite/template/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite.testscript b/odb-tests/sqlite.testscript
new file mode 100644
index 0000000..986bb37
--- /dev/null
+++ b/odb-tests/sqlite.testscript
@@ -0,0 +1,10 @@
+# file : sqlite.testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# Setup the test driver command line for the subsequent SQLite tests.
+#
+# Note that for SQLite the schema is created implicitly by the database object
+# creation function called by the test driver.
+#
+test.arguments += ($multi ? 'sqlite' : ) $sqlite_options
+test.cleanups += &odb-test.db # See database-options.testscript for details.
diff --git a/odb-tests/sqlite/attach/buildfile b/odb-tests/sqlite/attach/buildfile
new file mode 100644
index 0000000..959f050
--- /dev/null
+++ b/odb-tests/sqlite/attach/buildfile
@@ -0,0 +1,32 @@
+# file : sqlite/attach/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_attach_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --schema main
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/attach/driver.cxx b/odb-tests/sqlite/attach/driver.cxx
new file mode 100644
index 0000000..25d279f
--- /dev/null
+++ b/odb-tests/sqlite/attach/driver.cxx
@@ -0,0 +1,109 @@
+// file : sqlite/attach/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test attached database support.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/schema-catalog.hxx>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/connection.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> mdb (create_specific_database<database> (argc, argv));
+
+ {
+ object o ("one");
+
+ connection_ptr c (mdb->connection ());
+
+ database adb (c, ":memory:", "adb");
+
+ // Create schema similar to create_database().
+ //
+ {
+ c->execute ("PRAGMA foreign_keys=OFF");
+
+ transaction t (c->begin ());
+ odb::schema_catalog::create_schema (adb);
+ t.commit ();
+
+ c->execute ("PRAGMA foreign_keys=ON");
+ }
+
+ {
+ transaction t (c->begin ());
+ mdb->persist (o);
+ adb.persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (c->begin ());
+ unique_ptr<object> p (adb.load<object> (o.id));
+ t.commit ();
+
+ assert (p->str == o.str);
+ }
+
+ {
+ o.str = "two";
+
+ transaction t (c->begin ());
+ adb.update (o);
+ t.commit ();
+ }
+
+ {
+ typedef sqlite::query<object> query;
+
+ transaction t (c->begin ());
+ unique_ptr<object> p (adb.query_one<object> (query::str == "two"));
+ t.commit ();
+
+ assert (p->str == o.str);
+ }
+
+ {
+ transaction t (c->begin ());
+ adb.erase (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (c->begin ());
+ unique_ptr<object> p (mdb->load<object> (o.id));
+ t.commit ();
+
+ assert (p.get () != 0);
+ }
+
+ adb.detach ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/attach/test.hxx b/odb-tests/sqlite/attach/test.hxx
new file mode 100644
index 0000000..b3b8f63
--- /dev/null
+++ b/odb-tests/sqlite/attach/test.hxx
@@ -0,0 +1,32 @@
+// file : sqlite/attach/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ explicit
+ object (const std::string& s): str (s) {}
+
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db unique
+ std::string str;
+
+private:
+ object () {}
+
+ friend class odb::access;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/attach/testscript b/odb-tests/sqlite/attach/testscript
new file mode 100644
index 0000000..db5089d
--- /dev/null
+++ b/odb-tests/sqlite/attach/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/attach/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/auto/buildfile b/odb-tests/sqlite/auto/buildfile
new file mode 100644
index 0000000..2c70b7c
--- /dev/null
+++ b/odb-tests/sqlite/auto/buildfile
@@ -0,0 +1,32 @@
+# file : sqlite/auto/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_auto_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --sqlite-lax-auto-id
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/auto/driver.cxx b/odb-tests/sqlite/auto/driver.cxx
new file mode 100644
index 0000000..bcd42c1
--- /dev/null
+++ b/odb-tests/sqlite/auto/driver.cxx
@@ -0,0 +1,76 @@
+// file : sqlite/auto/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test manual/automatic id assignment.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // object
+ //
+ {
+ unsigned long id1, id2, id3;
+ {
+ object o1 (1, "one");
+ object o2 ("two");
+ object o3 (3, "three");
+
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+
+ id1 = *o1.id_;
+ id2 = *o2.id_;
+ id3 = *o3.id_;
+
+ assert (id1 == 1);
+ assert (id3 == 3);
+
+ assert (id2 != id1);
+ assert (id2 != id3);
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (id1));
+ unique_ptr<object> o2 (db->load<object> (id2));
+ unique_ptr<object> o3 (db->load<object> (id3));
+ t.commit ();
+
+ assert (*o1->id_ == id1 && o1->str_ == "one");
+ assert (*o2->id_ == id2 && o2->str_ == "two");
+ assert (*o3->id_ == id3 && o3->str_ == "three");
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/auto/test.hxx b/odb-tests/sqlite/auto/test.hxx
new file mode 100644
index 0000000..9905182
--- /dev/null
+++ b/odb-tests/sqlite/auto/test.hxx
@@ -0,0 +1,32 @@
+// file : sqlite/auto/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#include <string>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ explicit
+ object (const std::string& str): str_ (str) {}
+ object (unsigned long id, const std::string& str): id_ (id), str_ (str) {}
+
+ #pragma db auto id
+ odb::nullable<unsigned long> id_;
+
+ std::string str_;
+
+private:
+ object () {}
+
+ friend class odb::access;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/auto/testscript b/odb-tests/sqlite/auto/testscript
new file mode 100644
index 0000000..a5a7da5
--- /dev/null
+++ b/odb-tests/sqlite/auto/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/auto/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/custom/buildfile b/odb-tests/sqlite/custom/buildfile
new file mode 100644
index 0000000..3325762
--- /dev/null
+++ b/odb-tests/sqlite/custom/buildfile
@@ -0,0 +1,31 @@
+# file : sqlite/custom/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_custom_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/custom/driver.cxx b/odb-tests/sqlite/custom/driver.cxx
new file mode 100644
index 0000000..0627708
--- /dev/null
+++ b/odb-tests/sqlite/custom/driver.cxx
@@ -0,0 +1,78 @@
+// file : sqlite/custom/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test custom database type mapping in SQLite.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+ o.nv.push_back ("123"); // INTEGER
+ o.nv.push_back ("1.23"); // REAL
+ o.nv.push_back ("abc"); // TEXT
+
+ // Persist.
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ // Load.
+ //
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+ // Update.
+ //
+ o.nv[1] += "4";
+
+ {
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/custom/test.hxx b/odb-tests/sqlite/custom/test.hxx
new file mode 100644
index 0000000..54a2ba3
--- /dev/null
+++ b/odb-tests/sqlite/custom/test.hxx
@@ -0,0 +1,39 @@
+// file : sqlite/custom/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <vector>
+
+#include <odb/core.hxx>
+
+// Map NUMERIC SQLite type to std::string (or any other type that
+// provides the value_traits<?, id_string> specialization). By
+// default ODB treats NUMERIC as REAL. Note also that we don't
+// need to specify to/from conversions since SQLite will convert
+// implicitly.
+//
+#pragma db map type("NUMERIC") as("TEXT")
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id_): id (id_) {}
+
+ #pragma db id
+ unsigned long id;
+
+ #pragma db value_type("NUMERIC")
+ std::vector<std::string> nv;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id == y.id && nv == y.nv;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/custom/testscript b/odb-tests/sqlite/custom/testscript
new file mode 100644
index 0000000..53561ae
--- /dev/null
+++ b/odb-tests/sqlite/custom/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/custom/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/database/buildfile b/odb-tests/sqlite/database/buildfile
new file mode 100644
index 0000000..e74ab1a
--- /dev/null
+++ b/odb-tests/sqlite/database/buildfile
@@ -0,0 +1,11 @@
+# file : sqlite/database/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/database/driver.cxx b/odb-tests/sqlite/database/driver.cxx
new file mode 100644
index 0000000..5e16653
--- /dev/null
+++ b/odb-tests/sqlite/database/driver.cxx
@@ -0,0 +1,40 @@
+// file : sqlite/database/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous and some other things.
+//
+
+#include <odb/sqlite/database.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ // Test UTF-16 to UTF-8 conversion.
+ //
+#ifdef _WIN32
+ {
+ database d (L"t\x00C8st");
+ assert (d.name () == "t\xC3\x88st");
+ }
+#endif
+
+ // This code should not execute.
+ //
+ if (argc != 0)
+ return 0;
+
+ {
+ database d1 ("db1");
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ }
+}
diff --git a/odb-tests/sqlite/database/testscript b/odb-tests/sqlite/database/testscript
new file mode 100644
index 0000000..b9c0f5f
--- /dev/null
+++ b/odb-tests/sqlite/database/testscript
@@ -0,0 +1,6 @@
+# file : sqlite/database/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/native/buildfile b/odb-tests/sqlite/native/buildfile
new file mode 100644
index 0000000..49aa05b
--- /dev/null
+++ b/odb-tests/sqlite/native/buildfile
@@ -0,0 +1,12 @@
+# file : sqlite/native/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/native/driver.cxx b/odb-tests/sqlite/native/driver.cxx
new file mode 100644
index 0000000..c87aa5d
--- /dev/null
+++ b/odb-tests/sqlite/native/driver.cxx
@@ -0,0 +1,74 @@
+// file : sqlite/native/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test native SQL execution.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (
+ create_specific_database<database> (argc, argv, false));
+
+ // Create the database schema.
+ //
+ {
+ transaction t (db->begin ());
+
+ db->execute ("DROP TABLE IF EXISTS sqlitex_native_test");
+ db->execute ("CREATE TABLE sqlitex_native_test (n INTEGER PRIMARY KEY)");
+
+ t.commit ();
+ }
+
+ // Insert a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("INSERT INTO sqlitex_native_test (n) VALUES (1)") == 1);
+
+ assert (
+ db->execute ("INSERT INTO sqlitex_native_test (n) VALUES (2)") == 1);
+
+ t.commit ();
+ }
+
+ // Select a few rows.
+ //
+ {
+ transaction t (db->begin ());
+
+ assert (
+ db->execute ("SELECT n FROM sqlitex_native_test WHERE n < 3") == 2);
+
+ assert (
+ db->execute ("SELECT n FROM sqlitex_native_test WHERE n > 3") == 0);
+
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/native/testscript b/odb-tests/sqlite/native/testscript
new file mode 100644
index 0000000..16f05e0
--- /dev/null
+++ b/odb-tests/sqlite/native/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/native/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/stream/buildfile b/odb-tests/sqlite/stream/buildfile
new file mode 100644
index 0000000..fb8f605
--- /dev/null
+++ b/odb-tests/sqlite/stream/buildfile
@@ -0,0 +1,31 @@
+# file : sqlite/stream/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+import libodb_sqlite = libodb-sqlite%lib{odb-sqlite}
+import libs = lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb and
+# libodb-sqlite libraries are resolved for the odb_compile ad hoc rule (see
+# build/root.build for details).
+#
+libue{test-meta}: $libodb $libodb_sqlite
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_stream_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/stream/driver.cxx b/odb-tests/sqlite/stream/driver.cxx
new file mode 100644
index 0000000..86522ec
--- /dev/null
+++ b/odb-tests/sqlite/stream/driver.cxx
@@ -0,0 +1,281 @@
+// file : sqlite/stream/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test SQLite BLOB/TEXT incremental I/O.
+//
+
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <odb/sqlite/text-stream.hxx>
+#include <odb/sqlite/blob-stream.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+template <typename S>
+void
+print (const S&)
+{
+ /*
+ cerr << s.db () << '.'
+ << s.table () << '.'
+ << s.column () << '#'
+ << s.rowid () << endl;
+ */
+}
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ string txt (1024 * 1024, 't');
+ vector<char> blb (1024 * 1024, 'b');
+
+ object o;
+
+ {
+ transaction tx (db->begin ());
+
+ o.t.size (txt.size ());
+ o.b.size (blb.size ());
+ o.bv.push_back (blob (blb.size ()));
+ o.bv.push_back (blob (blb.size ()));
+
+ db->persist (o);
+
+ print (o.t);
+ print (o.b);
+ print (o.bv[0]);
+ print (o.bv[1]);
+
+ blob_stream bs (o.b, true);
+ bs.write (blb.data (), blb.size ());
+
+ text_stream ts (o.t, true);
+ ts.write (txt.data (), txt.size ());
+
+ for (vector<blob>::iterator i (o.bv.begin ()); i != o.bv.end (); ++i)
+ {
+ blob_stream bs (*i, true);
+ bs.write (blb.data (), blb.size ());
+ }
+
+ tx.commit ();
+ }
+
+ {
+ transaction tx (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ print (p->t);
+ print (p->b);
+ print (p->bv[0]);
+ print (p->bv[1]);
+
+ text_stream ts (p->t, false);
+ string t (ts.size (), '*');
+ ts.read (const_cast<char*> (t.c_str ()), t.size ());
+ assert (t == txt);
+
+ blob_stream bs (p->b, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+
+ for (vector<blob>::iterator i (p->bv.begin ()); i != p->bv.end (); ++i)
+ {
+ blob_stream bs (*i, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+ }
+
+ assert (p->nb.null ());
+
+ tx.commit ();
+ }
+
+ txt.resize (txt.size () + 1, 't');
+ txt[0] = 'A';
+ txt[txt.size () - 1] = 'Z';
+
+ blb.resize (blb.size () - 1);
+ blb.front () = 'A';
+ blb.back () = 'Z';
+
+ {
+ transaction tx (db->begin ());
+
+ o.t.clear ();
+ o.t.size (txt.size ());
+
+ o.b.clear ();
+ o.b.size (blb.size ());
+
+ o.bv[0].clear ();
+ o.bv[0].size (blb.size ());
+
+ o.bv[1].clear ();
+ o.bv[1].size (blb.size ());
+
+ o.nb = blob (blb.size ());
+
+ db->update (o);
+
+ print (o.t);
+ print (o.b);
+ print (o.bv[0]);
+ print (o.bv[1]);
+ print (*o.nb);
+
+ {
+ text_stream ts (o.t, true);
+ ts.write (txt.data (), txt.size ());
+ }
+
+ {
+ blob_stream bs (o.b, true);
+ bs.write (blb.data (), blb.size ());
+ }
+
+ for (vector<blob>::iterator i (o.bv.begin ()); i != o.bv.end (); ++i)
+ {
+ blob_stream bs (*i, true);
+ bs.write (blb.data (), blb.size ());
+ }
+
+ {
+ blob_stream bs (*o.nb, true);
+ bs.write (blb.data (), blb.size ());
+ }
+
+ tx.commit ();
+ }
+
+ {
+ transaction tx (db->begin ());
+ unique_ptr<object> p (db->load<object> (o.id));
+
+ print (p->t);
+ print (p->b);
+ print (p->bv[0]);
+ print (p->bv[1]);
+ print (*p->nb);
+
+ text_stream ts (p->t, false);
+ string t (ts.size (), '*');
+ ts.read (const_cast<char*> (t.c_str ()), t.size ());
+ assert (t == txt);
+
+ blob_stream bs (p->b, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+
+ for (vector<blob>::iterator i (p->bv.begin ()); i != p->bv.end (); ++i)
+ {
+ blob_stream bs (*i, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+ }
+
+ {
+ blob_stream bs (*p->nb, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+ }
+
+ tx.commit ();
+ }
+
+ // Test query.
+ //
+
+ txt.resize (32);
+ blb.resize (64);
+
+ {
+ transaction tx (db->begin ());
+
+ o.t.size (txt.size ());
+ o.b.size (blb.size ());
+ o.bv.clear ();
+ o.nb.reset ();
+
+ db->update (o);
+
+ text_stream ts (o.t, true);
+ ts.write (txt.data (), txt.size ());
+
+ blob_stream bs (o.b, true);
+ bs.write (blb.data (), blb.size ());
+
+ tx.commit ();
+ }
+
+ {
+ typedef sqlite::query<object> query;
+ transaction tx (db->begin ());
+
+ {
+ object o1 (db->query_value<object> (query::t == txt));
+
+ blob_stream bs (o1.b, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+ }
+
+ {
+ object o1 (db->query_value<object> (query::b == blb));
+
+ text_stream ts (o1.t, false);
+ string t (ts.size (), '*');
+ ts.read (const_cast<char*> (t.c_str ()), t.size ());
+ assert (t == txt);
+ }
+
+ tx.commit ();
+ }
+
+ // Test view.
+ //
+ {
+ typedef sqlite::query<view> query;
+ transaction tx (db->begin ());
+
+ view v (db->query_value<view> (query::t == txt));
+
+ blob_stream bs (v.b, false);
+ vector<char> b (bs.size (), '\0');
+ bs.read (b.data (), b.size ());
+ assert (b == blb);
+
+ tx.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/stream/test.hxx b/odb-tests/sqlite/stream/test.hxx
new file mode 100644
index 0000000..9189a87
--- /dev/null
+++ b/odb-tests/sqlite/stream/test.hxx
@@ -0,0 +1,37 @@
+// file : sqlite/stream/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+#include <odb/nullable.hxx>
+
+#include <odb/sqlite/text.hxx>
+#include <odb/sqlite/blob.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id;
+
+ odb::sqlite::text t;
+
+ #pragma db column("_123foo_bar")
+ odb::sqlite::blob b;
+
+ std::vector<odb::sqlite::blob> bv;
+
+ odb::nullable<odb::sqlite::blob> nb;
+};
+
+#pragma db view object(object)
+struct view
+{
+ odb::sqlite::blob b;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/stream/testscript b/odb-tests/sqlite/stream/testscript
new file mode 100644
index 0000000..2b9f019
--- /dev/null
+++ b/odb-tests/sqlite/stream/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/stream/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/transaction/buildfile b/odb-tests/sqlite/transaction/buildfile
new file mode 100644
index 0000000..e29092d
--- /dev/null
+++ b/odb-tests/sqlite/transaction/buildfile
@@ -0,0 +1,30 @@
+# file : sqlite/transaction/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_transaction_ \
+ --generate-schema \
+ --default-database common
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/transaction/driver.cxx b/odb-tests/sqlite/transaction/driver.cxx
new file mode 100644
index 0000000..80a0804
--- /dev/null
+++ b/odb-tests/sqlite/transaction/driver.cxx
@@ -0,0 +1,61 @@
+// file : sqlite/transaction/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test esoteric SQLite transaction semantics aspects.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // In SQLite, when a commit fails because of the deferred foreign
+ // key constraint violation, the transaction is not automatically
+ // rolled back. Make sure we compensate for that.
+ //
+ try
+ {
+ object o;
+ o.p = odb::lazy_ptr<object1> (*db, 0);
+
+ transaction t (db->begin ());
+ db->persist(o);
+ t.commit ();
+ }
+ catch (const odb::exception&)
+ {
+ }
+
+ // Make sure we can start a new transaction.
+ //
+ {
+ transaction t (db->begin ());
+ t.commit ();
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/transaction/test.hxx b/odb-tests/sqlite/transaction/test.hxx
new file mode 100644
index 0000000..bfb981b
--- /dev/null
+++ b/odb-tests/sqlite/transaction/test.hxx
@@ -0,0 +1,26 @@
+// file : sqlite/transaction/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+#include <odb/lazy-ptr.hxx>
+
+#pragma db object
+struct object1
+{
+ #pragma db id
+ unsigned long id_;
+};
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id_;
+
+ odb::lazy_ptr<object1> p;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/transaction/testscript b/odb-tests/sqlite/transaction/testscript
new file mode 100644
index 0000000..c3388cb
--- /dev/null
+++ b/odb-tests/sqlite/transaction/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/transaction/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/truncation/buildfile b/odb-tests/sqlite/truncation/buildfile
new file mode 100644
index 0000000..9a014e6
--- /dev/null
+++ b/odb-tests/sqlite/truncation/buildfile
@@ -0,0 +1,31 @@
+# file : sqlite/truncation/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_truncation_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/truncation/driver.cxx b/odb-tests/sqlite/truncation/driver.cxx
new file mode 100644
index 0000000..a2f6d66
--- /dev/null
+++ b/odb-tests/sqlite/truncation/driver.cxx
@@ -0,0 +1,163 @@
+// file : sqlite/truncation/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test insufficient buffer/truncation handling.
+//
+
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ // The default pre-allocated buffer is 512 bytes long.
+ //
+ string long_str (640, 'c'); // This will get the buffer to 1024
+ string longer_str (1025, 'b');
+
+ try
+ {
+ // Test basic operations.
+ //
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ // Run persist/load so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (1);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (1, o);
+ t.commit ();
+ }
+
+ {
+ object2 o (2);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ db->load (2, o);
+ t.commit ();
+ }
+
+ // Store/load the long string which should trigger buffer growth.
+ //
+ {
+ object1 o (3);
+ o.str_ = long_str;
+
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == long_str);
+ t.commit ();
+ }
+
+ // Store/load longer string.
+ //
+ {
+ object1 o (3);
+ o.str_ = longer_str;
+
+ transaction t (db->begin ());
+ db->update (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object2> o (db->load<object2> (3));
+ assert (o->str_ == longer_str);
+ t.commit ();
+ }
+ }
+
+ // Test query.
+ //
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ typedef sqlite::query<object1> query;
+ typedef odb::result<object1> result;
+
+ // Run persist/query so that the initial bindings are established
+ // (version == 0).
+ //
+ {
+ object1 o (20);
+ o.str_ = "test string";
+
+ transaction t (db->begin ());
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+ o.id_++;
+ db->persist (o);
+
+ result r (db->query<object1> (query::id == 20));
+ assert (r.begin ()->id_ == 20);
+ t.commit ();
+ }
+
+ // Test buffer growth with cached result.
+ //
+ {
+ object1 o;
+
+ transaction t (db->begin ());
+
+ result r (db->query<object1> (query::id >= 20));
+ result::iterator i (r.begin ());
+
+ o.id_ = i->id_;
+ o.str_ = long_str;
+
+ // This forces buffer growth in the middle of result iteration.
+ //
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ o.id_ = i->id_;
+ o.str_ = longer_str;
+ db->update (o);
+
+ ++i;
+ assert (i->str_ == "test string");
+
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/truncation/test.hxx b/odb-tests/sqlite/truncation/test.hxx
new file mode 100644
index 0000000..8ca44ea
--- /dev/null
+++ b/odb-tests/sqlite/truncation/test.hxx
@@ -0,0 +1,46 @@
+// file : sqlite/truncation/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <odb/core.hxx>
+
+#pragma db object table ("test")
+struct object1
+{
+ object1 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object1 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#pragma db object table ("test")
+struct object2
+{
+ object2 (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object2 ()
+ {
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ std::string str_;
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/truncation/testscript b/odb-tests/sqlite/truncation/testscript
new file mode 100644
index 0000000..97e04f7
--- /dev/null
+++ b/odb-tests/sqlite/truncation/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/truncation/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/types/buildfile b/odb-tests/sqlite/types/buildfile
new file mode 100644
index 0000000..1bf719d
--- /dev/null
+++ b/odb-tests/sqlite/types/buildfile
@@ -0,0 +1,32 @@
+# file : sqlite/types/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libodb = libodb%lib{odb}
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $libodb
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --table-prefix sqlitex_types_ \
+ --generate-schema \
+ --default-database common \
+ --generate-query \
+ --cxx-prologue '#include "traits.hxx"'
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/types/driver.cxx b/odb-tests/sqlite/types/driver.cxx
new file mode 100644
index 0000000..b444d94
--- /dev/null
+++ b/odb-tests/sqlite/types/driver.cxx
@@ -0,0 +1,113 @@
+// file : sqlite/types/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test SQLite type conversion.
+//
+
+#include <limits> // std::numeric_limits
+#include <memory> // std::unique_ptr
+#include <iostream>
+
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+
+#include <libcommon/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+#undef NDEBUG
+#include <cassert>
+
+using namespace std;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ try
+ {
+ unique_ptr<database> db (create_specific_database<database> (argc, argv));
+
+ object o (1);
+
+ o.bool_ = true;
+ o.integer_ = -123456;
+ o.real_ = 1.123;
+ o.nan_ = numeric_limits<double>::quiet_NaN ();
+
+ string long_str (2040, 'l');
+
+ o.text_ = long_str;
+#ifdef _WIN32
+ o.wtext_ = L"t\x00C8st string";
+#endif
+ o.blob_.assign (long_str.c_str (), long_str.c_str () + long_str.size ());
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<object> o1 (db->load<object> (1));
+ t.commit ();
+
+ assert (o == *o1);
+ }
+
+#ifdef _WIN32
+ {
+ typedef sqlite::query<object> query;
+ typedef odb::result<object> result;
+
+ transaction t (db->begin ());
+ result r (db->query<object> (query::wtext == L"t\x00C8st string"));
+ assert (!r.empty ());
+ t.commit ();
+ }
+#endif
+
+ // Test char/wchar_t arrays
+ //
+ {
+#ifndef _WIN32
+ char_array o1 (1, "");
+ char_array o2 (2, "1234567890");
+ char_array o3 (3, "12345678901234567");
+#else
+ char_array o1 (1, "", L"");
+ char_array o2 (2, "1234567890", L"123456789\x00C8");
+ char_array o3 (3, "12345678901234567", L"1234567890123456\x00C8");
+#endif
+
+ {
+ transaction t (db->begin ());
+ db->persist (o1);
+ db->persist (o2);
+ db->persist (o3);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ unique_ptr<char_array> p1 (db->load<char_array> (1));
+ unique_ptr<char_array> p2 (db->load<char_array> (2));
+ unique_ptr<char_array> p3 (db->load<char_array> (3));
+ t.commit ();
+
+ assert (o1 == *p1);
+ assert (o2 == *p2);
+ assert (o3 == *p3);
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/odb-tests/sqlite/types/test.hxx b/odb-tests/sqlite/types/test.hxx
new file mode 100644
index 0000000..fe0b274
--- /dev/null
+++ b/odb-tests/sqlite/types/test.hxx
@@ -0,0 +1,125 @@
+// file : sqlite/types/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <set>
+#include <string>
+#include <vector>
+#include <memory> // std::unique_ptr
+#include <cstring> // std::memcpy, std::str[n]cmp, std::strlen
+
+#ifdef _WIN32
+# include <cwchar> // std::wcslen, std::wcs[n]cmp
+#endif
+
+#include <odb/core.hxx>
+
+typedef std::unique_ptr<std::string> string_ptr;
+
+#pragma db object
+struct object
+{
+ object () {}
+ object (unsigned long id): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db type("BOOL")
+ bool bool_;
+
+ #pragma db type("INTEGER")
+ int integer_;
+
+ #pragma db type("REAL")
+ double real_;
+
+ double nan_; // Represented in SQLite as NULL.
+
+ #pragma db type("TEXT")
+ std::string text_;
+
+#ifdef _WIN32
+ std::wstring wtext_;
+#endif
+
+ #pragma db type("BLOB")
+ std::vector<char> blob_;
+
+ // Test NULL value.
+ //
+ #pragma db type("TEXT") null
+ string_ptr null_;
+
+ bool
+ operator== (const object& y) const
+ {
+ return id_ == y.id_
+ && bool_ == y.bool_
+ && integer_ == y.integer_
+ && real_ == y.real_
+ && nan_ != nan_
+ && text_ == y.text_
+#ifdef _WIN32
+ && wtext_ == y.wtext_
+#endif
+ && blob_ == y.blob_
+ && ((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);
+ }
+};
+
+// Test char/wchar_t arrays.
+//
+#pragma db object
+struct char_array
+{
+ char_array () {}
+ char_array (unsigned long id
+ , const char* s
+#ifdef _WIN32
+ , const wchar_t* ws
+#endif
+ )
+ : id_ (id)
+ {
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
+ s2[0] = c1 = *s;
+
+#ifdef _WIN32
+ std::memcpy (ws1, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
+ ws2[0] = wc1 = *ws;
+#endif
+ }
+
+ #pragma db id
+ unsigned long id_;
+
+ char s1[17];
+ char s2[1];
+ char c1;
+
+#ifdef _WIN32
+ wchar_t ws1[17];
+ wchar_t ws2[1];
+ wchar_t wc1;
+#endif
+
+ bool
+ operator== (const char_array& y) const
+ {
+ return id_ == y.id_
+ && std::strncmp (s1, y.s1, sizeof (s1)) == 0
+ && s2[0] == y.s2[0]
+ && c1 == y.c1
+#ifdef _WIN32
+ && std::wcsncmp (ws1, y.ws1, sizeof (ws1) / 2) == 0
+ && ws2[0] == y.ws2[0]
+ && wc1 == y.wc1
+#endif
+ ;
+ }
+};
+
+#endif // TEST_HXX
diff --git a/odb-tests/sqlite/types/testscript b/odb-tests/sqlite/types/testscript
new file mode 100644
index 0000000..5e50d32
--- /dev/null
+++ b/odb-tests/sqlite/types/testscript
@@ -0,0 +1,9 @@
+# file : sqlite/types/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../database-options.testscript
+.include ../../sqlite.testscript
+
+: basics
+:
+$*
diff --git a/odb-tests/sqlite/types/traits.hxx b/odb-tests/sqlite/types/traits.hxx
new file mode 100644
index 0000000..9483f58
--- /dev/null
+++ b/odb-tests/sqlite/types/traits.hxx
@@ -0,0 +1,57 @@
+// file : sqlite/types/traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TRAITS_HXX
+#define TRAITS_HXX
+
+#include <cstring> // std::memcpy, std::memset
+
+#include <odb/sqlite/traits.hxx>
+
+#include "test.hxx" // string_ptr
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ class value_traits<string_ptr, id_text>
+ {
+ public:
+ typedef string_ptr value_type;
+ typedef std::string query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (string_ptr& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ v.reset (is_null ? 0 : new std::string (b.data (), n));
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const string_ptr& v)
+ {
+ is_null = v.get () == 0;
+
+ if (!is_null)
+ {
+ n = v->size ();
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ if (n != 0)
+ std::memcpy (b.data (), v->c_str (), n);
+ }
+ }
+ };
+ }
+}
+
+#endif // TRAITS_HXX