Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Unable to use plugin text column in where clause of SQL Query

I created a plugin table with a text column using the IPluginDatabase interface.  FogBugz creates text columns as ntext types in SQL Server 2005.  I then try to use that column in the where clause of a query using the generic database access functions.  The problem is that the ntext type in SQL Server only supports the following functions:

DATALENGTH
READTEXT
SET TEXTSIZE
SUBSTRING
UPDATETEXT
TEXTPTR
WRITETEXT
TEXTVALID

so I can't do something like "WHERE myColumn = 'abcd'" in my where clause.  Unfortunately, FogBugz is parsing the query string and won't let me use any of the above functions.  Thus it appears that it's basically impossible to do anything with a FogBugz plugin text column in SqlServer 2005 other than retrieve it.  What am I missing?
Brian Send private email
Wednesday, October 14, 2009
 
 
Yes, currently that is the case.  We restrict the functions that can be called for two reasons:

1) Security - we have to use a whitelist here because there are too many ways to do damage otherwise
2) Cross-platform support - we currently restrict plugins to only those functions that are identical across all supported databases (MySQL, MSSQL, Access/Jet)

Eventually we want to add a query rewriter that will convert, for example, DATALENGTH to CHARACTER_LENGTH in MySQL.  We just haven't gotten to it yet.
David Fullerton Send private email
Wednesday, October 14, 2009
 
 
Thanks David.  I originally wanted to do an attribute table that holds name/value pairs.  I suppose I could just use integer constants for my attribute names but that's obviously not ideal.  Using an integer constant is still more preferable than adding a fixed column for each possible attribute out of a very broad set.
Brian Send private email
Wednesday, October 14, 2009
 
 
You can't use a variable-width (varchar) column?  They can be up to 256 characters long.
David Fullerton Send private email
Wednesday, October 14, 2009
 
 
Would that be added with CTable.addVarcharColumn?  I didn't see that previously.  I'll give it a try.

Thanks,

Brian
Brian Send private email
Wednesday, October 14, 2009
 
 
Doh!  I also missed the fact that a CPluginKeyValueTable interface already exists.  Don't you just hate that feeling you get when you realize how much time you've wasted reinventing the wheel?
Brian Send private email
Wednesday, October 14, 2009
 
 
Ah, sorry, I should have pointed that out sooner.  Yes, we provide a simple key-value table for your convenience :)
David Fullerton Send private email
Wednesday, October 14, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz