Skip to Content.
Sympa Menu

freetds - Re: [freetds] parsing T-SQL with flex & yacc (was: segfault in Perl'sEmail::Store when using freetds)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] parsing T-SQL with flex & yacc (was: segfault in Perl'sEmail::Store when using freetds)
  • Date: Tue, 15 Nov 2005 12:56:08 +0100

Il giorno mar, 15/11/2005 alle 14.34 +0300, Зверев Виталий Борисович ha
scritto:
> James,
> I would like to contribute parser into such strong project like FreeTDS if
> I only could parse its task properly ;).
> Okay, at first glance I should organize T-SQL placeholders knowledge and
> figure out their transformations and invariants.
> 1) DataType(Size,Scale,Nullable) transition for all predicates ?= , ? In
> () , ? <> any and so on
> 2) -//- mutations and constraints in buildin functions ( ... where sin(?) =
> ? And DATEADD ( ? , ?, ? ) = ? )
> 3) indirect type conversations (... where ?+'1'+'2' = ?), inline view
> attributes and stored proc parameters (by name and by position)
> The second question stuck me in longterm thought:
> What is *STANDARD* in prediction of placeholder metadata transformation?
> Really, if we are planning to mimic SQLDescribeParam, then mimic like which
> - Sybase, Ms, EasySoft, etc?
> Seems their SQLDescribeParam has a real implementation problems and
> deviations. As example, Easysoft for Sybase(Oracle driver has the same
> issue) http://www.mail-archive.com/dbi-users AT perl.org/msg25754.html and MS
> http://support.microsoft.com/default.aspx?scid=kb;en-us;273813
> ,http://support.microsoft.com/default.aspx?scid=kb;en-us;325243.
> And third...
> May be T-Sql has grammar not fully LALR and my revelation about yacc is
> vain, but it should be investigated in more details. Any opinions would be
> covered. Has anybody viable reasons for using non LALR grammar?
>
> Sincerely yours.
> -------------------------------------------------------
> Vitaly Zverev, OCP DBA 8&8i
> Oracle E-Business Suite &
> Infiniband Linux Cluster Administrator
> Genesis Ltd., St.Petersburg, Russia
>

I think that ms docs contains specifications for statement and I think
that with flex and yacc you can represent syntax. How to extract query
to get param description this is quite complicated. ms odbc driver are
not able to extract type in all cases (mostly where functions appear...
mainly it support quite simple syntaxes). Sybase return parameter types
as you prepare query. However for store procedures ({call ...}) and
query that contains text (which cannot be prepared on Sybase) are more
complicated. As you spot mssql require parsing queries and extract
parameter informations manually... see also
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_odbc_d_1not.asp

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page