Re: Procedure or function has too many arguments specified
"Frediano Ziglio" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
> > > > Il giorno mar, 04/11/2008 alle 20.48 -0800, Man Min Yan ha scritto: >> > Hi Frediano, >> > >> > You're right, tds_free_dynamic doesn't seem to be right. It's not >> removing the items from the tds->dyns list properly. Also, my previous patch >> is not right as it would throw away any previously prepared statement. >> Here's my 2nd go at fixing this problem. >> > >> > I've also tried to identify where the prepares were happening, and it >> seems to be a freetds problem. Here's the call stack: >> > main() >> > perl_run() >> > Perl_runops_standard() >> > Perl_pp_entersub() >> > XS_DBI_dispatch() >> > XS_DBD__ODBC__st_execute() >> > odbc_st_execute() >> > SQLExecute() from libodbc.so.1 >> > SQLExecute() at odbc.c:3343 >> > _SQLExecute() at odbc.c:3142 >> > tds_submit_prepare() at query.c:1007 >> > >> > The code in _SQLExecute is actually un-preparing the statement, >> re-preparing it, then executing it every time it is called. >> > >> > Rgds, >> > Man Min >> > >> >> Mmmm... currently there are 3 issues: >> - generated ids can create duplication leading to dynamic reuse, perhaps >> we should throw error on same id and generate betters ids. TODO: test in >> libTDS to check no duplication on generated ids > > > Perhaps the best way is to allow NULL id calling tds_alloc_dynamic and > generate id in tds_alloc_dynamic. Also I don't understand why > tds_alloc_dynamic should return same dynamic, perhaps is better to return > NULL... id duplicated should not be allowed, even by CTLib.(ct_dynamic state > that id are univoque) > > >> >> - on reused dynamic I had cur_dyn set but no dynamic on list... that is >> a huge memory problem! TODO: test in odbc to remove the problem > > > Mmmm... this is due to tds_alloc_dynamic returning same dynamic, two > statements have stmt->dyn set on same dynamic so on second > tds_submit_unprepare you have dynamic not in list, you set tds->cur_dyn and > you get the error, avoiding duplicate return should fix the problem. Perhaps > adding reference counting to TDSDYNAMIC would help. > Both points done. Now tds_alloc_dynamic accept NULL as id meaning generated id and never return a previous dynamic. Fix backported to 0.82 (see freetds.sf.net) > > >> >> - odbc prepare too much, in this case due to rebinding. TODO: cache >> argument and query in libTDS to avoid this case. >> > > > This is a TODO, we should add a test on freeclose test which already could > round_trips and inserts (but with another SQLFreeStmt option). > I'll put this in my TODO list... freddy77