Deprecated: Assigning the return value of new by reference is deprecated in /home/jjonahha/public_html/oracle-internals/blog/wp-includes/cache.php on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /home/jjonahha/public_html/oracle-internals/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/jjonahha/public_html/oracle-internals/blog/wp-includes/theme.php on line 540
ORACLE INTERNALS » 2008» February

Archive for February, 2008

Feb 26 2008

NYOUG Update

Published by jonah.harris under General

I’ve been extremely busy working on my IOUG white papers.  Damn procrastination!  Regardless, I think you all will like them, especially the network protocol one :)

Also, I’ll be attending NYOUG’s DBA SIG on March 6th and speaking (about DUDE) at the March 11th General Meeting.  If anyone out there will be in attendance, let’s get together for a beer or something; I love to meet my fellow Oracle peeps :)

No responses yet

Feb 20 2008

ciORA: A cool little OCI library for C…

Published by jonah.harris under General, Open Source, SQL, Tools

Just recently, a friend of mine sent me an OCI wrapper library I’d never run across, ciORA. ciORA was written by Zane Dodson and, unlike the other OCI wrapper libraries, ciORA calls are modeled after the stream-based standard I/O type C functions with error handling similar to that of errno.

An example of ciORA is as follows:

/* Logon and open an SQL descriptor for the SELECT statement that
   supports both reading and writing.  Cache 1 row for input, 5 on
   output. */
    ora_db = ora_dbo("scott", "tiger", NULL);
    check();
    ora_sql = ora_sqlo(ora_db, "SELECT month, day, holiday FROM holidays "
                       "WHERE (day < :1 or month = :2) "
                       "ORDER by monthid, day", 5, "%5s%d%35s", "%d%5s");
    check();

/* Write the where clause value to the descriptor. */
    ora_sqlw(ora_sql, 20, "Dec");
    check();

/* Writing must occur before reading and must be completed before the
   first read from an SQL descriptor that accepts both input and
   output.  Otherwise, you will get unpredictable results. */

/* Retrieve and output the query results. */
    printf("First Query Results:\n");
    printf("Month\t\tDay\t\tHoliday\n");
    printf("-----\t\t---\t\t-------\n");

    while (ora_sqlr(ora_sql, month, &day, holiday) > 0)
    {
        check();
        printf("%s\t\t%d\t\t%s\n", month, day, holiday);
    }

As ciORA is written using OCI7, you can use it with any version of Oracle from 7-11g. And, while its release status is alpha, it seems to work fairly well on the tests I’ve done. So, if you’re interested in another quick-and-easy OCI wrapper library, give ciORA a try.

About the attachment
Attached is the source code for ciORA with a few modifications for indentation and compiler flags to build on GCC. As this version is from 1994, I’ve contacted the author to see if he still maintains it. If not, I’ll pick it up and make it more widely available.

One response so far

Next »