Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] parsing T-SQL with flex & yacc (was: segfaultinPerl'sEmail::Store when using freetds)
  • Date: Tue, 15 Nov 2005 23:29:13 -0500

ú×ÅÒÅ× ÷ÉÔÁÌÉÊ âÏÒÉÓÏ×ÉÞ wrote:
> James, Frediano,
> thanks for comments in friendly atmosphere (I'm not a native English
> writer, so excuse me my ugly essay)

When I can apologize for my Russian, I'll pass judgement on your English,
Vitaly. :-)

You're undertaking something ambitious and potentially very useful. Being
friendly is pretty easy by comparison.

I am hoping that you will write a function that will accept an SQL string,
find the placeholders, and return an array of structures. Each structure
will contain:

database
system object name
system object type (S/U/P/V/TR, per sysobjects)
column/parameter name

In this query, for example:

select * from systypes where name = ?

The answer would be:

database = NULL
object name = 'systypes'
object type = 'S'
column/parameter name = 'name'

The caller of your function will formulate a query for the server about
the datatype of each placeholder. To do that it may need to know if the
placeholder is a parameter to a stored procedure or function, or will be
compared to a column. Not everything can be found in syscolumns.

> BTW, FireBird like a Sybase has open interface to parametrised Dinamic
> SQL parser & ODBC driver (with SQLDescribeParam implementation)
> http://cvs.sourceforge.net/viewcvs.py/*checkout*/firebird/firebird2/src/dsql/parse.y?rev=1.193.
>

Yep. Firebird has a very different design and SQL. I know a little about
it. I contributed patches that made sure it runs on NetBSD.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page