converting datatypes w/o using srv_convert and dbconvert

converting datatypes w/o using srv_convert and dbconvert

Post by Michael Zarlen » Fri, 09 Aug 1996 04:00:00



Does anyone here have any code for emulating either srv_convert or
dbconvert, for the following conversions?
        1. SYBCHAR -> SYBMONEY
        2. SYBMONEY -> SYBCHAR
        3. SYBCHAR -> SYBDATETIME
        4. SYBDATETIME -> SYBCHAR

We've got a bunch of working Sybase open server C code that builds
debug strings as it processes information.  The C code pulls specific
information from a very large data structure, formats it, creates
various debug strings and outputs them with srv_log()s, all the while
also using db functions (eg: dbrpcparam()) to build and send an RPC
call to Sybase.

I've created a bunch of stubs/shells for the db*() calls so that we
can use the existing C code (re-linked with our stubs/shells instead
of the Sybase libraries) as a processing engine without actually send-
ing anything to our database.

My stumbling block is the shell that will emulate srv_convert for the
four conversions we need.

I'm hoping that someone else has done this already and is willing to
share the code.

Can anyone help with this request?

--
-- Mike Zarlenga

 
 
 

converting datatypes w/o using srv_convert and dbconvert

Post by Michael Zarlen » Fri, 09 Aug 1996 04:00:00


Alternatively,

If I were to use the Sybase dbconvert(), and call my stubs for every-
thing else, what is the minimum I would  need to do (eg: dbinit()) for
Sybase to be able to do the  dbconvert() successfully?

--
-- Mike Zarlenga

 
 
 

converting datatypes w/o using srv_convert and dbconvert

Post by Stan Sulsk » Tue, 13 Aug 1996 04:00:00



>Alternatively,

>If I were to use the Sybase dbconvert(), and call my stubs for every-
>thing else, what is the minimum I would  need to do (eg: dbinit()) for
>Sybase to be able to do the  dbconvert() successfully?

This is strictly from recall, so take it with a grain of salt,
but I don't think you even have to dbinit(), so long as you
don't require localization.  Just pass dbconvert() a NULL dbprocess.

--stan

--
Stan Sulsky                              

          97 Madbury Rd.            |   (603) 868-2270 - voice
          Durham, NH 03824   USA    |   (603) 868-1352 - fax

 
 
 

converting datatypes w/o using srv_convert and dbconvert

Post by Michael Zarlen » Tue, 13 Aug 1996 04:00:00



Quote:>>If I were to use the Sybase dbconvert(), and call my stubs for every-
>>thing else, what is the minimum I would  need to do (eg: dbinit()) for
>>Sybase to be able to do the  dbconvert() successfully?

>This is strictly from recall, so take it with a grain of salt,
>but I don't think you even have to dbinit(), so long as you
>don't require localization.  Just pass dbconvert() a NULL dbprocess.

Thanks.  I got it working.  I'm using the Sybase dbconvert() for all
my datatype conversions.  Works just fine with a NULL DBPROCESS *.

--
-- Mike Zarlenga

 
 
 

converting datatypes w/o using srv_convert and dbconvert

Post by Scott Gr » Wed, 14 Aug 1996 04:00:00




>>Alternatively,

>>If I were to use the Sybase dbconvert(), and call my stubs for every-
>>thing else, what is the minimum I would  need to do (eg: dbinit()) for
>>Sybase to be able to do the  dbconvert() successfully?

>This is strictly from recall, so take it with a grain of salt,
>but I don't think you even have to dbinit(), so long as you
>don't require localization.  Just pass dbconvert() a NULL dbprocess.

Interesting side note: from my experience, it seems that dbinit()
is an empty function on all platforms except Netware and the Mac.
Of course, I wouldn't count on this behaviour for future releases. :)

Also, if anyone is interested, I have a date parsing library available
for doing conversions such as CHAR -> DATETIME.  It is held under
the GNU GPL, and if you want a copy, let me know.

-scott

--


   http://www.voicenet.com/~gray/sqsh.html