Looking for DBLibrary function

Looking for DBLibrary function

Post by Jose Ignacio Gijo » Tue, 29 Sep 1998 04:00:00



Hello all,

I'm doing a migration of an application from ODBC to DBLibrary.
In my application I do a lot of querys of the form:
  INSERT INTO table ...; SELECT MAX(index) FROM table

I use to exec the ODBC function SQLMoreResults to point to the next
statement in order
to get the rows.

I've tried combinations of dbresults, dbnextrow and dbmorecmds whitout
luck, Does
somebody knows how to implement SQLMoreResults with DBLibrary?

Thank's a lot in advance


 
 
 

Looking for DBLibrary function

Post by Achim Oehlenschlaeg » Thu, 01 Oct 1998 04:00:00


Hello Jose,

you should try the following:

  dbcmd(dbproc, pCmd);

  if( SUCCEED != dbsqlexec(dbproc) )
    exit(EXIT_FAILURE);

  while( SUCCEED == (result_code=dbresults(dbproc)) )
  {
    if( FAIL == result_code )
      exit(EXIT_FAILURE);

    if( SUCCEED == DBROWS(dbproc) )
    {
      dbbind( dbproc, 1, INTBIND, (DBINT) 0, (BYTE*)(&number) );

      // evtl. more columns to bind

      result_code = dbnextrow(dbproc);
      if( FAIL == result_code )
        exit(EXIT_FAILURE);

      while( NO_MORE_ROWS != result_code )
      {
        // do what ever you need to do with the results

        result_code = dbnextrow(dbproc);
        if( FAIL == result_code )
          exit(EXIT_FAILURE);
      }
    }
  }

Regards,

Achim

 
 
 

1. anybody use dblibrary dbcount function?

Does anybody use the dblibrary function dbcount in connection with triggers
/ stored procedures?  We have a problem where the value returned from
dbcount is reset when a trigger / sp is called (as documented in BOL).  How
do we know how many rows the original SQL (that caused the trigger)
affected?

Thanks for any help,

.Richard

2. Help on Prefixed Indexes

3. Does oracle function obindxxx exists in DBLibrary ?

4. problem with Oracle database on SunSolaris

5. Missing dblibrary functions - Sybase 10

6. Applicant database in FoxPro?

7. Look for update cascade, delete restrict function

8. Websphere

9. Looking for sql ce functions

10. Please take a look at my String Distance Function

11. looking for Oracle-like functions Signals/Alerts