This question is about the handling of parameter overflow in the Firebird.NET
Provider. If you do something along these lines:
c:=FbCommand.Create('select * from zip where zip_code=?', FbConnection1);
c.Parameters.Add('', FbDbType.VarChar).Value:='123456'; <<-- note 6
chars
c.ExecuteReader
and zip_code is defined to be varchar(5), you'll receive an isc_arith_except
error. In the Delphi TDataSet world, if you write a parameterized query like
this, and then supply a value that is too long, it will in general be shortened
to fit and no error returned or exception raised.
I'm not so much interested in the merits of the two approaches, but I am
interested in how .net programmers handle situations like this in general. It
seems like a lot of work to validate every piece of data coming into the system
for length since at a minimum it requires the program to know the length of all
fields in the database. But if the application programmer doesn't do this,
then if his query has multiple parameters the isc_arith_except error doesn't
tell him which one is too long so he has no way to convey this information back
to the user.
Is there a way to make the Firebird.NET Provider tolerant of parameter overflow
like this and to truncate automatically? Or is there a better way to handle
this that I'm missing, like a way to validate parameters individually using
metadata fetched from the database?
Thanks,
Kevin Donn-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider