Projects / libsqlora8 / Comments

Comments for libsqlora8

22 Jul 2003 07:40 yatos

Re: A little problem with sqlo_ocol_names and memory alloc size

Hello :

My name is Ignacio Holgado. Apologies for my english ( I am spanish ).
I am developping an aplication server with oracle support in a multithreaded environment in a SuSe O.S.
I have developped a "cursor object" in order to allow the access to a generic database from the aplications dispatched by my aplication server.
The first implementation of this cursor object was implemented using the "easy interface" but now I need some functionalities from the advanced interface
and i have 2 litle problems:

1 - My first problem is that i can't obtain the column names from the advanced interface. It seams that it don't works with the "advanced interface". Maybe i am not using it propertly. I have made a bad solution and i would like to have a better solution.
I use it with the following code :



...
*cursor = sqlo_prepare ( *connection, sql_stmt ); // runs OK
...
status = SQLexecute(cursor,0); // runs OK ( this is a wrapper to sqlo_execute )
...
result->n_ocols = sqlo_ncols(*cursor, 0); // returns the number of columns OK !!


for (type = SQLgetColType(cursor,i+1); (type>=0) && (i<=result->n_ocols);type = SQLgetColType(cursor,(++i)+1))
{
...
if (SQLO_SUCCESS != (status = sqlo_define_by_pos(*cursor, i+1, type, result->data[2*i], size, result->data[2*i+1],&(result->length[i]),0)))
{
....
....
}
}

...
status = SQLexecute(cursor,0); // OK
...
status = SQLfetch(cursor,0); // OK
...


sqlo_loadNames(*cursor, result->n_ocols + 1); // This function is mine


result->ocol_names = sqlo_ocol_names(*cursor, &type); // returns an array of null pointers





The sqlo_loadNames function is a function that a have made to allow mi aplication to access the private function _define_ocol_by_pos
that is non available from my aplication.

In order to get the names I have put the following code inside the sqlora.c file.

//
// by ihm
//

//
// Ampliation to enable getNames from Advanced interface
//

int sqlo_loadNames(sqlo_stmt_handle_t sth, int num_cols)
{
register sqlo_stmt_ptr_t stp;
int status = SQLO_SUCCESS;

register unsigned int col_pos; /* The column position (1based) */
// ub4 num_cols; /* number of columns in the select list */
sqlo_col_ptr_t colp;

CHECK_STHANDLE(stp, sth, "sqlo_reopen", SQLO_INVALID_STMT_HANDLE);

/* define all columns */
for (col_pos = 1, colp = stp->ocolsv; col_pos <= (unsigned int) num_cols ;
++col_pos, ++colp)
{
_define_ocol_by_pos(stp, colp, col_pos);
}
return 1;
}

I know that this is a bad solution but is the only one that i have.


2 - My second problem is that i don't know how much space allocate in a string when i call tho the sqlo_define_by_pos function.
Maybe a solution can be to implement a new sqlo_define_by_pos3 function with a double pointer to the data:

sqlo_define_by_pos3 ( stmt , pos, type, void **the_data, int *size, ...

And the sqlo_fetch, command allocates the memory and stores a pointer of the data inside the the_data double pointer when the true size of the data will be know:

*the_data = __malloc(...);
snprintf ( *the_data, the_size, ... ); // or some similar.

The followind problem is who frees the memory: the sqlora library or the user. But i thing this situation is the same that the situation of the
allocation of "alloc_lob" and "free_lob" with the lob's API.

Thanks in advance:

22 Jul 2003 07:37 yatos

A little problem with sqlo_ocol_names... ( part II )

/* define all columns */
for (col_pos = 1, colp = stp->ocolsv; col_pos

22 Jul 2003 07:31 yatos

A little problem with sqlo_ocol_names and memory alloc size

Hello :

My name is Ignacio Holgado. Apologies for my english ( I am spanish ).
I am developping an aplication server with oracle support in a multithreaded environment in a SuSe O.S.
I have developped a "cursor object" in order to allow the access to a generic database from the aplications dispatched by my aplication server.
The first implementation of this cursor object was implemented using the "easy interface" but now I need some functionalities from the advanced interface
and i have 2 litle problems:

1 - My first problem is that i can't obtain the column names from the advanced interface. It seams that it don't works with the "advanced interface". Maybe i am not using it propertly. I have made a bad solution and i would like to have a better solution.
I use it with the following code :



...
*cursor = sqlo_prepare ( *connection, sql_stmt ); // runs OK
...
status = SQLexecute(cursor,0); // runs OK ( this is a wrapper to sqlo_execute )
...
result->n_ocols = sqlo_ncols(*cursor, 0); // returns the number of columns OK !!
...
...
for (type = SQLgetColType(cursor,i+1); (type>=0) && (in_ocols);type = SQLgetColType(cursor,(++i)+1))
{
...
if (SQLO_SUCCESS != (status = sqlo_define_by_pos(*cursor, i+1, type, result->data[2*i], size, result->data[2*i+1],&(result->length[i]),0)))
{
....
....
}
}

...
status = SQLexecute(cursor,0); // OK
...
status = SQLfetch(cursor,0); // OK
...


sqlo_loadNames(*cursor, result->n_ocols + 1); // This function is mine


result->ocol_names = sqlo_ocol_names(*cursor, &type); // returns an array of null pointers





The sqlo_loadNames function is a function that a have made to allow mi aplication to access the private function _define_ocol_by_pos
that is non available from my aplication.

In order to get the names I have put the following code inside the sqlora.c file.

//
// by ihm
//

//
// Ampliation to enable getNames from Advanced interface
//

int sqlo_loadNames(sqlo_stmt_handle_t sth, int num_cols)
{
register sqlo_stmt_ptr_t stp;
int status = SQLO_SUCCESS;

register unsigned int col_pos; /* The column position (1based) */
// ub4 num_cols; /* number of columns in the select list */
sqlo_col_ptr_t colp;

CHECK_STHANDLE(stp, sth, "sqlo_reopen", SQLO_INVALID_STMT_HANDLE);

/* define all columns */
for (col_pos = 1, colp = stp->ocolsv; col_pos

23 Apr 2002 02:06 poitsch

Re: Can it install on Red Hat 7.2 successfully?
Please send problem reports directly to libsqlora8@poitschke.de.

Please include the output of your configure run.

Kai

22 Apr 2002 21:53 beershow

Can it install on Red Hat 7.2 successfully?
The environment is Redhat 7.2, oracle8.1.7,and I copy the package to "/root". And the errors echo as follow:
#make
make all-recursive
make[1]: Entering directory `/root/libsqlora8-2.2.0'
Making all in .
make[2]: Entering directory `/root/libsqlora8-2.2.0'
source='sqlora.c' object='sqlora.lo' libtool=yes \
depfile='.deps/sqlora.Plo' tmpdepfile='.deps/sqlora.TPlo' \
depmode=gcc3 /bin/sh ./depcomp \
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/oracle/product/8.1.7/rdbms/demo -I/oracle/product/8.1.7/rdbms/public -I/oracle/product/8.1.7/precomp/public -DBUILD_DATE="\"Tue Apr 23 09:35:40 CST 2002\"" -O3 -Wall -c -o sqlora.lo `test -f sqlora.c || echo './'`sqlora.c
rm -f .libs/sqlora.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/oracle/product/8.1.7/rdbms/demo -I/oracle/product/8.1.7/rdbms/public -I/oracle/product/8.1.7/precomp/public "-DBUILD_DATE=\"Tue Apr 23 09:35:40 CST 2002\"" -O3 -Wall -c sqlora.c -MT sqlora.lo -MD -MP -MF .deps/sqlora.TPlo -fPIC -DPIC -o .libs/sqlora.lo
sqlora.c:772: conflicting types for `strdup'
/usr/include/string.h:120: previous declaration of `strdup'
make[2]: *** [sqlora.lo] Error 1
make[2]: Leaving directory `/root/libsqlora8-2.2.0'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/libsqlora8-2.2.0'
make: *** [all] Error 2

Your assistance will be high appreciated! : )

17 Apr 2002 12:45 poitsch

Re: Has This Been Successfully Referenced In COM?

> Has this library been successfully
> reference in a Windows COM environment
> (ie VB)? I would be very interested in
> exploring any information or suggestions
> you have on this.


AFAIK, no. Maybe it never will be :( Most of the users are Unix users which don't care about (D)COM. I have not enough know-how to do it.

Sorry
Kai

17 Apr 2002 12:28 benbahrenburg

Has This Been Successfully Referenced In COM?
Has this library been successfully reference in a Windows COM environment (ie VB)? I would be very interested in exploring any information or suggestions you have on this. Due to the shortcomings of Oracle Objects For OLE. Please let me know if you have any information on this topic

16 Aug 2001 03:44 poitsch

Please add comments
Hello,
as the maintainer of the package I would like to see some comments here.
Please add some feedback and rate the project.

Happy computing
Kai

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.