1. ODBC

I sent Rob my ODBC wrapper.  It's up on the user contribution page today.
The demo will require you to modify win32lib 55.1 slightly (there was a bug
in some of my original listview code :).

So far, I've only tested it with MS Access, but it should work with anything
for which you've set up a DSN.

I only wrapped the functions that submit a sql command directly to the
database.  This was basically meant for queries that you only expect to run
once.  There are other commands that allow you to prepare a sql statement
for repeated use, so it will be faster.

Matt Lewis

new topic     » topic index » view message » categorize

2. Re: ODBC

On Thu, 18 Jan 2001 09:32:04 -0800, Matthew Lewis <MatthewL at KAPCOUSA.COM>
wrote:

Hi Matt,

>I sent Rob my ODBC wrapper.  It's up on the user contribution page today.
>The demo will require you to modify win32lib 55.1 slightly (there was a bug
>in some of my original listview code :).

This is great!!!

I downloaded it and connected to an ACU Cobol ODBC driver sitting on a SCO
Unix box.
I can't say I wanted to do it in Euphoria ... but it does show the
flexibility ODBC has.

What is the correct way of closing an ODBC connection?

Thanks for the great lib.

Ray Smith

Note: I think you had a little type error in your readme file when you
wrote .... ODBC was "online" database connectivity.

new topic     » goto parent     » topic index » view message » categorize

3. Re: ODBC

> From: Ray Smith

> This is great!!!

Thanks!

> I downloaded it and connected to an ACU Cobol ODBC driver
> sitting on a SCO
> Unix box.
> I can't say I wanted to do it in Euphoria ... but it does show the
> flexibility ODBC has.
>
> What is the correct way of closing an ODBC connection?

You should use the function SQLDisconnect:

SQLDisconnect
Conformance
Version Introduced: ODBC 1.0
Standards Compliance: ISO 92
Summary
SQLDisconnect closes the connection associated with a specific connection
handle.
Syntax
SQLRETURN SQLDisconnect(
     SQLHDBC     ConnectionHandle);
Arguments
ConnectionHandle
[Input]
Connection handle.
Returns
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

This is one of the things that's defined in the file, but it isn't wrapped
at all--and that you should really use if you're writing an ODBC app.  I'd
recommend writing a disconnect procedure that closes the connection and then
frees the connection handle.

This is a good example of the rest of the work that needs to be done before
someone incorporates it into a serious project.

You can check out MSDN for the full API docs (that's what I've been using):


If you want to connect with a connect string, take a look at
SQLDriverConnect

> Note: I think you had a little type error in your readme file when you
> wrote .... ODBC was "online" database connectivity.
err....yeah.....<blushes>

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

4. ODBC

I don't suppose anyone knows of a reference on how to write ODBC *drivers* ???

-------------------------
Sincerely,
Mathew Hounsell

mat.hounsell at excite.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: ODBC

Hey Mat,

    The best thing I could find was this. Hope it helps.

new topic     » goto parent     » topic index » view message » categorize

6. ODBC

I'm setting up to try and use Matt's ODBC and connect to MySQL for a data
base. In reviewing what I need to do I've found a point of confusion in how
I've been handeling dates and how MySQL handle's dates. I've been using a
"sub sequence" in my record when using EUDB. as below.

{a,b,c,{2003,09,29},e,f.....}

this is quite convenient for dates to use the DateTime library (from user
contributions) of functions I found in the archives. The problem is that
MySQL uses yyy-mm-dd format. Is anyone doing this or has a suggestion on
what happens when this is sent to MySQL. Hopefully there is a solution or a
better way to solve this issue.

thanks.

george

new topic     » goto parent     » topic index » view message » categorize

7. Re: ODBC

> I've been handeling dates and how MySQL handle's dates. I've been using a
> "sub sequence" in my record when using EUDB. as below.
>
> {a,b,c,{2003,09,29},e,f.....}

> this is quite convenient for dates to use the DateTime library (from user
> contributions) of functions I found in the archives. The problem is that
> MySQL uses yyy-mm-dd format. Is anyone doing this or has a suggestion on

Format your data with this:

    sprintf("\"%04d-%02d-%02d\"", { year,month,day } )

Then give it to MySQL. I don't know if you'll need the quotes... I would
expect so to send a string.

This way you can keep all your current algorithms.

new topic     » goto parent     » topic index » view message » categorize

8. Re: ODBC

George Walters wrote:

> I'm setting up to try and use Matt's ODBC and connect to MySQL for a
> database. In reviewing what I need to do I've found a point of confusion
> in how I've been handeling dates and how MySQL handle's dates. I've been
> using a "sub sequence" in my record when using EUDB. as below.
>
> {a,b,c,{2003,09,29},e,f.....}
>
> this is quite convenient for dates to use the DateTime library (from
> user contributions) of functions I found in the archives. The problem is
> that MySQL uses yyy-mm-dd format. Is anyone doing this or has a
> suggestion on what happens when this is sent to MySQL. Hopefully there
 > is a solution or a better way to solve this issue.

Passing a Date as a sub-sequence to MySQL probably will likely pass the 
database three junk characters - not what you want.

If your Date is in variable 'd' then you'll want to do:
{a,b,c,sprintf("%04d-%02d-%02d",d),e,f.....}

Reading back into a date is a bit more tricky and you'll need to use 
Euphoria's get.e to parse the string back into a Date:

include get.e
sequence s, temp
Date d

s    = ??? -- get the stringified date from the db here
temp = value(s[1..4]) & value(s[6..7]) & value(s[9..10])
d    = temp[2] & temp[4] & temp[6]

There's no error checking in the above code. Look up value() and 
GET_SUCCESS / GET_FAIL in the Euphoria docs if you need to check that 
things are being parsed correctly. The status codes in the above snippet 
would be in temp[1], temp[3] and temp[5] respectively.

HTH,
Carl

-- 
[ Carl R White == aka () = The Domain of Cyrek = ]
[ Cyrek the Illogical /\ www.cyreksoft.yorks.com ]

new topic     » goto parent     » topic index » view message » categorize

9. Re: ODBC

Thanks for all the replies. I guess I'll have to encode going in and decode
coming out....It's a little strange that a DB would store dates as a string
since you cannot do arithmetic on a string, although I guess you can use
greater/less than in comparisons for date ranges.

george

----- Original Message -----
From: "George Walters" <gwalters at sc.rr.com>
To: "EUforum" <EUforum at topica.com>
Subject: ODBC


>
>
> I'm setting up to try and use Matt's ODBC and connect to MySQL for a data
> base. In reviewing what I need to do I've found a point of confusion in
how
> I've been handeling dates and how MySQL handle's dates. I've been using a
> "sub sequence" in my record when using EUDB. as below.
>
> {a,b,c,{2003,09,29},e,f.....}
>
> this is quite convenient for dates to use the DateTime library (from user
> contributions) of functions I found in the archives. The problem is that
> MySQL uses yyy-mm-dd format. Is anyone doing this or has a suggestion on
> what happens when this is sent to MySQL. Hopefully there is a solution or
a
> better way to solve this issue.
>
> thanks.
>
> george
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

10. ODBC

Hi,

I found on the next url http://www.microsoft.com/data/mdac2.htm ODBC
information. It
includes the header files sql.h, sqlext.h and sqltypes.h for the constant
declaration and a lot more information.

The ODBC Software Development kit is now known as "MDAC". I downloaded the stand
alone version 2. It's about 30Mb in size. It's worth to download.

Thanks to all who pushed me in the right direction.

Marcel

new topic     » goto parent     » topic index » view message » categorize

11. ODBC

This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C2EC0B.45E0F000
	charset="iso-8859-1"

I am looking to run TSLibrary_Odbc_Test.exw. I am on XP Pro and selected =
the Driver and created it.I don't understand where the Access database =
is to run program.Do I need Access or what don't I understand?
Jvandal

------=_NextPart_000_0006_01C2EC0B.45E0F000
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style=3D"COLOR: #000000; FONT-FAMILY: " bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am looking to run =
TSLibrary_Odbc_Test.exw. I am=20
on XP Pro and selected the Driver and created it.I don't understand =
where the=20
Access database is to run program.Do I need Access or what don't I=20
understand?</FONT></DIV>

------=_NextPart_000_0006_01C2EC0B.45E0F000--

new topic     » goto parent     » topic index » view message » categorize

12. Re: ODBC

This is a multi-part message in MIME format.

------=_NextPart_000_007E_01C2F7CE.341D3C10
	charset="iso-8859-1"

Hi,
Sorry for late answer, been without computer.
You have to setup a DSN on your computer. Dont remember how to do that =
at the moment. Try to find a tutorial on the net.

  ----- Original Message -----=20
  From: sixs at ida.net=20
  Subject: ODBC



  I am looking to run TSLibrary_Odbc_Test.exw. I am on XP Pro and =
selected the Driver and created it.I don't understand where the Access =
database is to run program.Do I need Access or what don't I understand?
  Jvandal


TOPICA - Start your own email discussion group. FREE!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


------=_NextPart_000_007E_01C2F7CE.341D3C10
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style=3D"COLOR: #000000; FONT-FAMILY: " bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sorry for late answer, been without=20
computer.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>You have to setup a DSN on your =
computer. Dont=20
remember how to do that at the moment. Try to find a tutorial on the=20
net.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Dsixs at ida.net href=3D"mailto:sixs at ida.net">sixs at ida.net</A>
  =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DEUforum at topica.com=20
  href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, March 17, 2003 =
7:27=20
AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> ODBC</DIV>
  <DIV><BR></DIV><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The Euphoria =
Mailing List =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
</PRE>
  <DIV><FONT face=3DArial size=3D2>I am looking to run =
TSLibrary_Odbc_Test.exw. I am=20
  on XP Pro and selected the Driver and created it.I don't understand =
where the=20
  Access database is to run program.Do I need Access or what don't I=20
  understand?</FONT></DIV>
  <DIV><FONT face=3DArial =
size=3D2>Jvandal</FONT></DIV><PRE>=3D=3D^=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
This email was sent to: tone.skoda at gmx.net

EASY UNSUBSCRIBE click here: <A =
href=3D"http://topica.com/u/?b1dd66.b3ipgX.dG9uZS5z">http://topica.com/u/=
?b1dd66.b3ipgX.dG9uZS5z</A>
Or send an email to: EUforum-unsubscribe at topica.com

TOPICA - Start your own email discussion group. FREE!
<A =
href=3D"http://www.topica.com/partner/tag02/create/index2.html">http://ww=
w.topica.com/partner/tag02/create/index2.html</A>
=3D=3D^=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

------=_NextPart_000_007E_01C2F7CE.341D3C10--

new topic     » goto parent     » topic index » view message » categorize

13. ODBC

Matt, your doc shows an argument to moveToRecord of SQL_FETCH_BOOKMARK but
it was apparently overlooked (var not defined). Do you know it's value....
maybe 0 or 7? I'm assuming that this would return your current position in
the cursor?

george

new topic     » goto parent     » topic index » view message » categorize

14. Re: ODBC

thanks....

george
----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: ODBC


>
>
> > From: George Walters [mailto:gwalters at sc.rr.com]
> >
> > Matt, your doc shows an argument to moveToRecord of
> > SQL_FETCH_BOOKMARK but it was apparently overlooked (var not
> > defined). Do you know it's value.... maybe 0 or 7? I'm
> > assuming that this would return your current position in the cursor?
>
> I'm not sure.  I'll have to dig that up, but 7 would be my guess.
Actually,
> it looks a bit more complicated than that.  You can set bookmarks, and
then
> go back to them later, but I haven't figured out how to do this yet.
>
> > ...is there a way to position in  a cursor other than by a
> > "record number"?.... for example find partNbr 1234 in the cursor set?
>
> Not that I'm aware of.
>
> > ...It would be nice (if MS has such a
> > function) to remove it from the cursor rather than reloading
> > the data, particularly if it's a larger file.
>
> It looks like you can do this with calls to SQLSetPos().  I'll look at
> adding support for this for the next release.
>
> Matt Lewis
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

15. ODBC

I'm wondering if you can have 2 independant cursors on the same file. I have
a program where I'm trying to do that. What seems to happen is that the
program goes away in some type of loop and even trace(1) "locks" and shows
no activity. The program is one to print customer statements. I have one
cursor scanning the open invoice file and when it reaches a new customer it
calls a separate routine to print the statement. The statement routine then
creates another cursor with just that customers invoices to print the
statement. somewhere it starts and never returns, even with trace(1) on.

They look something like this: (these are not clipped code)

cursorOne = createCursor(connectId, "select * from arInvoice")

cursorTwo = createCursor(connectId, "select * from arInvoice where arCust =
123")

The task manager shows 100% cpu, so something is grinding away...but nothing
comes out.

george

new topic     » goto parent     » topic index » view message » categorize

16. Re: ODBC

OK, no problem. I worked most of yesterday on this problem. I guess my brain
works better in the morning so I found the problem. It was my bug. I created
the loop in a "while 1 do" that never found a way to exit but the loop
executed no code becuse of an "if " statement, so I guess it was a really
tight loop.

george

----- Original Message -----
From: "George Walters" <gwalters at sc.rr.com>
To: "EUforum" <EUforum at topica.com>
Subject: ODBC


>
>
> I'm wondering if you can have 2 independant cursors on the same file. I
have
> a program where I'm trying to do that. What seems to happen is that the
> program goes away in some type of loop and even trace(1) "locks" and shows
> no activity. The program is one to print customer statements. I have one
> cursor scanning the open invoice file and when it reaches a new customer
it
> calls a separate routine to print the statement. The statement routine
then
> creates another cursor with just that customers invoices to print the
> statement. somewhere it starts and never returns, even with trace(1) on.
>
> They look something like this: (these are not clipped code)
>
> cursorOne = createCursor(connectId, "select * from arInvoice")
>
> cursorTwo = createCursor(connectId, "select * from arInvoice where arCust
=
> 123")
>
> The task manager shows 100% cpu, so something is grinding away...but
nothing
> comes out.
>
> george
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu