-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I may have missed some of this thread but isn't SQLCancel just used to cancel:

[1] a function running asynchronously
[2] a function on a statement that needs data
[3] a function running on the statement in another thread

Your code doesn't seem to fit any of those.

[1] I don't see any setting for ASYNCHRONOUS execution
[2] you execute is returning a result-set and does not need any data (i.e. it
    is not parameterised with SQL_DATA_AT_EXEC.
[3] there are no threads.

Any code doing:

SQLPrepare
SQLExecute (select * from table)
SQLCancel

is going to fail in ODBC if asynchronous execution is turned off (it is by
default). If asynchronous execution was enabled and the SQLExecute need to take
a very long time then the SQLExecute call comes back with SQL_STILL_EXECUTING
and THEN you can call SQLCancel.

Martin
- -- 
Martin J. Evans
Easysoft Ltd, UK
Development


On 04-Dec-2002 Vassiliy Truskov wrote:
> Hello everybody.
> 
> I call SQLCancel function to cancel my query and got an error:
> DBD: no statement executing err=-1.
> It looks like statement is not defined in DBIc_ACTIVE(imp_sth).
> I run it on osf1 unix 4, DBI 1.31, DBD::ODBC 0.45_18.
> I use SDK iODBC driver manager version 3.
> 
> The trace is following:
> 
>     -> prepare for DBD::ODBC::db (DBI::db=HASH(0x140087e68)~0x140087dd8
> 'select count(*) from amount where amount > 1200' HASH(0x1402f6b60))
>     New DBI::st (for DBD::ODBC::st, parent=DBI::db=HASH(0x140087dd8),
> id=)
> 
> dbih_setup_handle(DBI::st=HASH(0x140087e58)=>DBI::st=HASH(0x140089508),
> DBD::ODBC::st, 140087e78, Null!)
>     dbih_make_com(DBI::db=HASH(0x140087dd8), DBD::ODBC::st, 368) thr#0
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), Err,
> DBI::db=HASH(0x140087dd8)) SCALAR(0x14022f240) (already defined)
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), State,
> DBI::db=HASH(0x140087dd8)) SCALAR(0x14022f1e0) (already defined)
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), Errstr,
> DBI::db=HASH(0x140087dd8)) SCALAR(0x14022f210) (already defined)
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), Debug,
> DBI::db=HASH(0x140087dd8)) 0 (already defined)
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), FetchHashKeyName,
> DBI::db=HASH(0x140087dd8)) 'NAME' (already defined)
>     dbih_setup_attrib(DBI::st=HASH(0x140089508), HandleError,
> DBI::db=HASH(0x140087dd8)) undef (not defined)
>     <- prepare= DBI::st=HASH(0x140087e58) at psql_m.pl line 1036 via
> psql_m.pl line 865
>     -> execute for DBD::ODBC::st (DBI::st=HASH(0x140087e58)~0x140089508)
> 
> 1   -> cancel for DBD::ODBC::st (DBI::st=HASH(0x140087e58)~0x140089508)
>     !! ERROR: -1 '(DBD: no statement executing err=-1)'
> 1   <- cancel= undef at psql_m.pl line 3540 via psql_m.pl line 1060
>     -> $DBI::errstr (&) FETCH from lasth=HASH
>     >> DBD::ODBC::st::errstr
>     <- $DBI::errstr= '(DBD: no statement executing err=-1)'
>     !! ERROR: -1 '(DBD: st_execute/SQLExecute err=-1)'
> 
> Thanks in advance,
> Vassiliy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE98GwijLvsvprkFrMRAkxbAJ0byKurxDVqsZ9ZvErEvBNCNXsKaACfQ94i
8awIFTtDZhDkCZz/VX6jG4M=
=g7zP
-----END PGP SIGNATURE-----

Reply via email to