Search found 13 matches

by ca_cruiser
Mon 13 Jul 2009 14:49
Forum: dotConnect for MySQL
Topic: MySqlDataReader multiple use - best practice
Replies: 2
Views: 2906

MySqlDataReader multiple use - best practice

What is the best practice for using MySqlDataReader for multiple query's ?

I have a procedure that does something like below. The problem is that the MySqlDataReader gets corrupted after 5-6 iterations.

I noticed that if I do a closeConnection then openConnection, I do not get any corruption in the MySqlDataReader.

MySqlDataReader mr;

for many transaction types:
OpenDataSet(sqlStmt)

procedure OpenDataSet(string sqlStmt)
if ( mr != null && !mr.IsClosed ) mr.Close()
// if closeConnection here then all is fine.
if ( connection not open) openConnection()
mr = ExecuteReader()
case transactionType
do your thing
mr.Close()
by ca_cruiser
Fri 19 Dec 2008 14:19
Forum: MySQL Data Access Components
Topic: Insert Blob SQL
Replies: 13
Views: 8348

MyDAC v 5.55.0.39 for Delphi-6
by ca_cruiser
Tue 16 Dec 2008 17:55
Forum: MySQL Data Access Components
Topic: Insert Blob SQL
Replies: 13
Views: 8348

MyQuery.Params.ParamByName(fnBlob).SetBlobData(BlobData,Bytes - BytesWritten)

does not work when the data has \0 values.

How can I accomplish this ? i.e. how to escape the binary data?

I currently have to do the following:

ms := TMemoryStream.Create;
ms.WriteBuffer(BlobData^, Bytes - BytesWritten);
ms.Position := 0;
MyQuery.Params.ParamByName(fnBlob).LoadFromStream(ms,ftBlob);
ms.Free;
by ca_cruiser
Wed 22 Oct 2008 20:10
Forum: MySQL Data Access Components
Topic: cannot determine how field size is returned - data truncated
Replies: 5
Views: 3615

hello,

more info.

same code/config under MySql 5.0.20a-nt-log results:

select
replace(r.proc_path
,"Reports.exe" # 11 chars
,"Reports2.exe" # 12 chars
) proc_path2
,r.proc_path
from proc_run r

fieldByName('proc_path2').Size: 109
fieldByName('proc_path').Size: 100
by ca_cruiser
Wed 22 Oct 2008 14:42
Forum: MySQL Data Access Components
Topic: cannot determine how field size is returned - data truncated
Replies: 5
Views: 3615

If I replace valueA with valueB where valueB is larger in size, I get truncated data. if valueB is smaller or of equal size then truncation does NOT occur.
by ca_cruiser
Wed 22 Oct 2008 14:38
Forum: MySQL Data Access Components
Topic: cannot determine how field size is returned - data truncated
Replies: 5
Views: 3615

forgot config.

Delphi 6 sp2
MySql 3.23.58
MyDAC 5.55.0.39
by ca_cruiser
Wed 22 Oct 2008 14:36
Forum: MySQL Data Access Components
Topic: cannot determine how field size is returned - data truncated
Replies: 5
Views: 3615

cannot determine how field size is returned - data truncated

hello,

Delphi 6 sp2
MySql 3.23.58
MyDAC 5.55.0.39

I'm having trouble with a Field.Size for sql stmt below.
I cannot figure out why data is being truncated at field level
where the mysql client program handles it just fine.

mysql> desc proc_run;
+------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------+------+-----+---------+-------+
| proc_key | char(5) | | PRI | | |
| proc_name | char(40) | | PRI | | |
| proc_host | char(25) | | | | |
| proc_path | char(100) | | | | |
| proc_parms | char(100) | | | | |
+------------+-----------+------+-----+---------+-------+
5 rows in set (0.00 sec)

-- Data truncated here
select
replace(r.proc_path
,"Reports.exe" # 11 chars
,"Reports2.exe" # 12 chars
) proc_path2
,r.proc_path
from proc_run r

fieldByName('proc_path2').Size: 10
fieldByName('proc_path').Size: 100

-- Data NOT truncated here

select
replace(r.proc_path
,"Reports.exe" # 11 chars
,"Reports2.xe" # 11 chars
) proc_path2
,r.proc_path
from proc_run r

fieldByName('proc_path2').Size: 100
fieldByName('proc_path').Size: 100
by ca_cruiser
Sat 06 Oct 2007 03:06
Forum: MySQL Data Access Components
Topic: How is TMyQuery.options.LongString used
Replies: 1
Views: 2305

How is TMyQuery.options.LongString used

Hello,

I had a MySql concat function truncating at 8192 chars. I set Options.LongString=False and was able to avoid string truncation.

Ae their any consequences to leaving LongString=False at all times?
e.g. performance,

I used this particualr query to retrieve single fields, one row (i.e. As a function).

JohnC
by ca_cruiser
Thu 28 Dec 2006 13:51
Forum: MySQL Data Access Components
Topic: TimeStamp column type - Migrating from Zeos to MyDAC
Replies: 3
Views: 2177

Sorry, but I should have given more details.

I understand I can handle this programmatically .AsString but my problem is that when using 3rd party components (like RaveReports), it directly reads the Table and Field as TString under Zeos and TDateTime under MyDAC.

Can this only be addressed by acquiring the source code and making modifications?
by ca_cruiser
Wed 27 Dec 2006 19:52
Forum: MySQL Data Access Components
Topic: TimeStamp column type - Migrating from Zeos to MyDAC
Replies: 3
Views: 2177

TimeStamp column type - Migrating from Zeos to MyDAC

Hello,

I'm swapping out data access components from Zeos to MyDAC. The MySql column type TimeStamp(14) is returned as follows:

Zeos : TStringField
MyDac: TDateTime

How can I get the MyDAC components to treat the MySql TimeStamp column to be returned as a TStringField ?
by ca_cruiser
Tue 24 May 2005 19:39
Forum: dotConnect for MySQL
Topic: How to escape strings in sql stmts
Replies: 5
Views: 3032

Cannot tell what the 5th replace statment is (\r)?
Serious wrote:We do not provide public method for string escaping.
Here is the simplest example of the string escaping in MySQL way.

Code: Select all

string EscapeString(string s)
{
	s = s.Replace("\", "\");
	s = s.Replace("\", "\");
	s = s.Replace(""", "\"");
	s = s.Replace("`", "\`");
	s = s.Replace("ґ", "\ґ");
	s = s.Replace("’", "\’");
	s = s.Replace("‘", "\‘");
	return s;
}
by ca_cruiser
Tue 17 May 2005 13:36
Forum: dotConnect for MySQL
Topic: How to escape strings in sql stmts
Replies: 5
Views: 3032

If I use Parameters, are the strings escaped?