igor-sadchenko / brig

Brig is a collection of cross-platform C++ 11 header only libraries that offers interaction with many databases and usability of the geometric data.
https://code.google.com/p/brig
1 stars 0 forks source link

The data types varchar and ntext are incompatible in the equal to operator. #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an MSSQL Server 2008 table with a varchar column (mine is varchar(20) 
in addition to a geometry column
2. Attempt to query based on the varchar column (I'm also doing a bounding box)

What is the expected output? What do you see instead?

I expect the query to be made, instead I get the following exception thrown:
[Microsoft][SQL Server Native Client 11.0][SQL Server]The data types varchar 
and ntext are incompatible in the equal to operator. [Microsoft][SQL Server 
Native Client 11.0][SQL Server]Statement(s)

What version of the product are you using? On what operating system?
Windows 7 SP1
MSSQLServer 2008 Spatial
Brig 1306

Please provide any additional information below.

Original issue reported on code.google.com by david.mo...@gmail.com on 25 Sep 2013 at 1:16

GoogleCodeExporter commented 9 years ago
here is a code snippet

  using namespace std;
  using namespace brig;
  using namespace brig::boost;

  database::provider<false> pvd(make_shared<database::odbc::command_allocator>("DSN=<dsnname>;Database=<databasename>;"));

  auto lr(pvd.get_geometry_layers());
  auto tbl(pvd.get_table_def(lr));

  tbl.query_columns.push_back("textColumn");
  tbl["textColumn"]->query_value = "foobar";

  tbl.query_columns.push_back(lr.qualifier);
  tbl[lr.qualifier]->query_value = as_binary(box(...));

  for (auto& row: pvd.select(tbl))
  {
    for ( auto& cell : row  )
    {
      cout << cell << "|";
    }
    cout << endl;
  }

Original comment by david.mo...@gmail.com on 25 Sep 2013 at 1:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've produced a patch for this to at least make it work.  It maybe better to 
add an enum to brig::identifier to identify the type rather than doing a string 
comparison like the patch does. 

Original comment by david.mo...@gmail.com on 27 Sep 2013 at 4:45

Attachments: