🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1099

Re: Accessing MySQL via ADO

#1099
From: Viatcheslav V. Vassiliev
Date: Sat, 25 Dec 2004 09:45
92 lines
4571 bytes
For multiple DBMS datetime is better to pass as parameter - syntax for
datetime fields differes between DBMS.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Tumurbaatar S." <nospam_tumur@magicnet.mn> �������/�������� � ��������
���������: news:41cc005e@newsgroups.borland.com...
> Thank you!
> It seems, this driver does not support transactions.
> And I've found a solution. It is MyODBC Option=3.
> But there raised another problem. I pass datetime
> field values as ODBC escape clauses, e.g. {ts '...'},
> but MyODBC does not convert them. At least MySQL
> server log file contains supplied datetime strings
> as is and, as result, datetime fields are set to zero value.
> Anybody knows what is a matter?
> I use ODBC escapes because my program should work
> with any ODBC compliant databases.
>
>
>
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> news:41cb0467$1@newsgroups.borland.com...
> > Native OLEDB provider for MySQL:
> >
> > http://www.mysql.com/Downloads/Win32/MyOLEDB.exe
> > http://www.mysql.com/Downloads/Win32/MyOLEDB.chm
> >
> > Not sure that it completely supports features of version 4, but it is
most
> > native (goes from MySQL site).
> >
> > Try also cmd->Parameters->...->Value = bytes;
> >
> > //------------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> > ADO.Net
> > http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> > MS Jet (Access) and Interbase (through OLEDB)
> >
> > "Tumurbaatar S." <nospam_tumur@magicnet.mn> �������/�������� � ��������
> > ���������: news:41caab99@newsgroups.borland.com...
> >> My program connects to MySQL 4.1.7 using ADO components.
> >> The connection string points to MyODBC 3.51.10 DSN (Anybody know
> >> MySQL native OLEDB provider?). The table has only 4 fields where one
> >> of them is BLOB. The next code inserts a new record and it raises
> >> EAccessViolation when a command executes. When Execute() is
> >> removed/commented, no error.
> >>
> >>     int bounds[2] = {0};
> >>     cmd->Parameters->ParamByName("id")->Value = PacketID++;
> >>     cmd->Parameters->ParamByName("ip")->Value = AnsiString(Buff->ip);
> >>     bounds[1] = Buff->size - 1;
> >>     Variant bytes = VarArrayCreate(bounds, 1, varByte);
> >>     memcpy(bytes.ArrayLock(), Buff->data, Buff->size);
> >>     bytes.ArrayUnlock();
> >>     cmd->Parameters->ParamByName("data")->AppendChunk(bytes);
> >>     cmd->Execute();
> >>
> >> table stucture:
> >>
> >> CREATE TABLE packets
> >> (
> >>   id INT NOT NULL,
> >>   ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
> >>   ip VARCHAR(15) NOT NULL,
> >>   data BLOB NOT NULL,
> >>
> >>   PRIMARY KEY (id)
> >> );
> >>
> >> CREATE INDEX packets_ts ON packets (ts);
> >> CREATE INDEX packets_ip ON packets (ip);
> >>
> >> P.S. Also, all 3 above parameters returned by TADOCommand are
> >> ftString, Size=25165824, Attributes=paNullable, paLong. Why?
> >> Does it mean that MyODBC and ADO do not understand each other?
> >>
> >>
> >>
> >
> >
>
>
Technical Details
Message-ID: <41cd36c2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41caab99@newsgroups.borland.com> <41cb0467$1@newsgroups.borland.com> <41cc005e@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,5756267530e63452
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <41caab99@newsgroups.borland.com> <41cb0467$1@newsgroups.borland.com> <41cc005e@newsgroups.borland.com>
Subject: Re: Accessing MySQL via ADO
Date: Sat, 25 Dec 2004 12:45:46 +0300
Lines: 94
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 217.73.240.61
Message-ID: <41cd36c2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103967938 217.73.240.61 (25 Dec 2004 01:45:38 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail