Hello ingres users,

I am trying to copy a table to a file, but this does not work.

This is my code:
    // Query database
    // queryText: "copy table myTable() into '/tmp/filename'"
    IIapi_query(&queryParm);
  
   while( queryParm.qy_genParm.gp_completed == FALSE )
    {
        IIapi_wait( &waitParm );
    }      

    if ( queryParm.qy_genParm.gp_status != IIAPI_ST_SUCCESS )
    {
        checkError( &queryParm.qy_genParm );
    }
    
    tranHandle = queryParm.qy_tranHandle;
    stmtHandle = queryParm.qy_stmtHandle;

    IIAPI_GETCOPYMAPPARM getCopyMapParm;
    getCopyMapParm.gm_genParm.gp_callback = NULL;
    getCopyMapParm.gm_genParm.gp_closure = NULL;
    getCopyMapParm.gm_stmtHandle = stmtHandle;
    IIapi_getCopyMap( &getCopyMapParm );

    while( getCopyMapParm.gm_genParm.gp_completed == FALSE )
        IIapi_wait( &waitParm );

    getColParm.gc_genParm.gp_callback = NULL;
    getColParm.gc_genParm.gp_closure = NULL;
    getColParm.gc_rowCount = 1;
    getColParm.gc_columnCount = getCopyMapParm.gm_copyMap.cp_dbmsCount;
    getColParm.gc_moreSegments = 0;

    do
    {
        IIapi_getColumns( &getColParm );

        while( getColParm.gc_genParm.gp_completed == FALSE )
            IIapi_wait( &waitParm );

        if ( getColParm.gc_genParm.gp_status >= IIAPI_ST_NO_DATA )
            break;

        //some output ...

    } while( 1 );

This works fine, except that I get no output file.
If I use the sql terminal, everything works as expected and I get
an very nice table copy.

So, can someone please explain me, what I have to do to make
this work with OpenAPI?

Many thanks in advance
Rolf
_______________________________________________
Users mailing list
Users@lists.ingres.com
http://lists.ingres.com/mailman/listinfo/users

Reply via email to