I need to fill my sqlda with the data from the row that I am
inserting. I am using default autoincrement id's and I need
to retrieve the id's. Sybase 10 says this:

INTO clause If EXECUTE INTO is used with an INSERT
statement, the inserted row is returned in the second
descriptor. For example, when using auto-increment primary
keys or BEFORE INSERT triggers that generate primary key
values, the EXECUTE statement provides a mechanism to
re-fetch the row immediately and determine the primary key
value that was assigned to the row. The same thing can be
achieved by using @@identity with auto-increment keys.

I am doing just that but my sqlda is empty after executing
the statement. Any and all help would be appreciated.

my code:

SQLDA *sqlda;

sqlda = pXli->sqlda;

pXli->sqlda = alloc_sqlda( 6 );
sqlda = pXli->sqlda;

pSqlStmt = pStr;

EXEC SQL
PREPARE XLI_INSERT FROM SqlStmt WITH EXECUTE;

// Select into
EXEC SQL
DESCRIBE OUTPUT FOR XLI_INSERT INTO sqlda;

EXEC SQL
GET DESCRIPTOR sqlda :numcols=COUNT;

if( numcols > 6 )
{ EXEC SQL
DEALLOCATE DESCRIPTOR sqlda;

sqlda = NULL;

EXEC SQL
ALLOCATE DESCRIPTOR sqlda WITH MAX :numcols;

EXEC SQL
DESCRIBE OUTPUT FOR XLI_INSERT INTO sqlda;

pXli->sqlda = sqlda;
}

fill_sqlda( sqlda );

XliClearSqlda( pXli );

EXEC SQL
EXECUTE XLI_INSERT USING DESCRIPTOR sqlda INTO
DESCRIPTOR sqlda;

if( SQLCODE == SQLE_NOERROR )
{ StrCreateIfNull( &pXlr->id, XLR_ID_LEN+1 );
StrNCopy( pXlr->id, (XLR_ID_LEN+1),
sqlda[0].sqlvar->sqldata, XLR_ID_LEN );
StrSetStringChars( pXlr->id, (XLR_ID_LEN+1), 0, '\0' );

EXEC SQL
DEALLOCATE DESCRIPTOR sqlda;

EXEC SQL
DROP STATEMENT XLI_INSERT;

return False;
}

EXEC SQL
DEALLOCATE DESCRIPTOR sqlda;

EXEC SQL
DROP STATEMENT XLI_INSERT;

if( SQLCODE == SQLE_NOTFOUND )
return True;

KdbErrMessage( KdbAsObj() );

return True;