Search found 12 matches

by AngelusB
Fri 20 Dec 2019 18:51
Forum: dbExpress driver for MySQL
Topic: Create function query in MySQL
Replies: 1
Views: 21049

Create function query in MySQL

I try to execute the query below with DBexpress (TSQLQuery connected to TSQLConnection). The query runs fine in Navicat or other clients, but not in DBExpress (driver DevartMySqlDirect).

DELIMITER $$
CREATE FUNCTION totaalStabu(stabuId int,molenId int,periodeId int) RETURNS float
BEGIN
DECLARE Status FLOAT;
SELECT sum(oh_aantal) INTO Status
FROM sim
WHERE oh_molen= molenId and oh_periode=periodeId and oh_stabu=stabuId
group by oh_stabu;
RETURN Status;
END$$
DELIMITER ;

Error message
#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$
CREATE FUNCTION totaalStabu(stabuId int,molenId int,periodeId int)' at line 1

Please help
by AngelusB
Thu 28 May 2009 08:24
Forum: dbExpress driver for MySQL
Topic: embedded MySQL invalid fieldtype on enum fields
Replies: 7
Views: 7571

For as far I can see now: this solved the problems. Thank you verry much.
by AngelusB
Mon 25 May 2009 17:20
Forum: dbExpress driver for MySQL
Topic: embedded MySQL invalid fieldtype on enum fields
Replies: 7
Views: 7571

I made a (empty) file mysql.sym in \data.
(If I don's make this file the application keeps asking for it)
I deleted ibdata1, etc.
But I still get an error message:
A call to an mysql_server_init failed
Access violation at address 7C91B21a in module 'ntdll.dll'. Write of address 00000010
by AngelusB
Sat 23 May 2009 15:55
Forum: dbExpress driver for MySQL
Topic: embedded MySQL invalid fieldtype on enum fields
Replies: 7
Views: 7571

I tried libmysqld.dll version 5.1.34. The demo in C:\Program Files\Devart\DbxMda\Demos\Win32\Embedded gives a set of error messages:
A call to an mysql_server_init failed
Access violation ... in module 'ntdll.dll" etc.

- .. data\mysql.sym : the system can't find the file
- .. data\ibdata1 : the file already exists
- .. data\ib_logfile0 : the file already exists
- .. data\ib_logfile1 : the file already exists

(some messages were in Dutch, I made a translation)

It seems this dll brings me further away.
by AngelusB
Sun 03 May 2009 13:23
Forum: dbExpress driver for MySQL
Topic: embedded MySQL invalid fieldtype on enum fields
Replies: 7
Views: 7571

embedded MySQL invalid fieldtype on enum fields

Working with Delphi 2009, dbexpmda40.dll (version 4.40.0.15), libmysqld.dll (no version known, size 3444 kB, date 2005-03-24)

CREATE TABLE `test` (
`aId` int(11) NOT NULL auto_increment,
`aEnum` enum('N','J') NOT NULL default 'N',
PRIMARY KEY (`aId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

insert into `test` values(null,'J');

The query "select aId from test" is working correct, but "select aEnum from test " gives an error : invalid field type.
Same error when selecting all columns: "select * from test".

I got this problem while porting an application from Delphi 2007 to Delphi 2009. I didn't have problems with enum-fields in Delphi 2007.
by AngelusB
Mon 16 Mar 2009 19:53
Forum: dbExpress driver for MySQL
Topic: Dbexpress convert empty string to null
Replies: 10
Views: 13299

ffcDev wrote:
AngelusB wrote:Name is null .
See my posted message on Mar 06 about the behaviour of MySQL on Linux and Windows. All the way: the parameter sent is and not an empty string.
by AngelusB
Mon 09 Mar 2009 19:22
Forum: dbExpress driver for MySQL
Topic: Dbexpress convert empty string to null
Replies: 10
Views: 13299

ffcDev wrote:AngelusB: I've posted QC# 71984... let's see what we get...
Thanks Bill.
In addition to your example: Using a DBGrid, empty the 'text' data (e.g. field "Name") and ApplyUpdates.
The query will look like:
update
ATest
set
Name is null <--wrong
where
ID = 1 and
Name = 'text' and
Name2= 'text'
by AngelusB
Fri 06 Mar 2009 12:16
Forum: dbExpress driver for MySQL
Topic: Dbexpress convert empty string to null
Replies: 10
Views: 13299

Re: Dbexpress convert empty string to null

ffcDev wrote: This worked for allowing empty strings in fields to be set properly, but i still can't apply updates. What components are you using to update the data to the database?
I'm using the same components as you use:TClientDataset->TDataSetProvider->TSQLQuery->TSQLConnection->DevartMySQLDirect

As you write, the workaround in QC #67891 does not solve the problem.

Discovered some strange behavior of MySQL 5.0.51a. I use a windows installation (localhost) as well as a linux one (Suse enterprice 10.1).
Following your example: if you empty field "Name" in record with id 1, this causes an error on windows-MySQL and no error on linux-MySQL. Examining the query that was sent, gives a null-value for field Name. MySQL accepts the null value and write an empty string (!).

Both on Linux and on Windows empty the Name field in record with id 2 causes an error (record not found etc etc)
I'm working for years with the components. This problem is new in D2009.
by AngelusB
Wed 04 Mar 2009 15:44
Forum: dbExpress driver for MySQL
Topic: Dbexpress convert empty string to null
Replies: 10
Views: 13299

Dbexpress convert empty string to null

I'm converting an application from D2007 to D2009.
Using DbExpress en dbexpmda40.dll (4.40.0.14).
I use TCrSQLConnection (driver DevartMySQLDirect).
The application works fine in D2007.
In D2009 I did add the parameter UseUnicode=true to the TCrSQLConnection and converted TStringFields in TWideStringFields.

In the MySQL database some fields are NOT NULL. As example I used a DBGrid. When I empty a Widestring, the information send to the database (after applyupdates) is an Null value. So anywhere the empty string is converted to a null- value. This causes a EMyError 25000 : column cannot be null.
What's wrong?
by AngelusB
Mon 26 Jan 2009 15:00
Forum: dbExpress driver for MySQL
Topic: [Embedded Server] Specify config params for embedded server
Replies: 14
Views: 9449

It's a libmysqld.dll without version number, dated 2005-3-24. (3444 Kb).
I downloaded this file some time ago.

And now the good news:
I made a new download from http://www.dlldll.com/downdll/3057.html and that solved the problem. Everything is working fine now.

Thank you pointing my attention to the embedded server version.
by AngelusB
Wed 21 Jan 2009 15:22
Forum: dbExpress driver for MySQL
Topic: [Embedded Server] Specify config params for embedded server
Replies: 14
Views: 9449

Dimon wrote:Please make sure that you have privileges to create files in the data and data\database_name directories.
I'm very sure that I have all privileges to that directories.

Something must be wrong with the syntax of the parameters. When I create the directory c:\mysql c:\mysql\data and c:\mysql\share etc. all is working perfect. So I guess the parameter string is incorrect. Did I use the right syntax?
by AngelusB
Tue 20 Jan 2009 15:47
Forum: dbExpress driver for MySQL
Topic: [Embedded Server] Specify config params for embedded server
Replies: 14
Views: 9449

embedded MySQL parameters

I'm using Delphi2007 and driver DevartMySQLEmbedded (driver 4.40.13 12-Dec-08)
If I use "my.in" in "c:\windows" (as in C:\Program Files\Devart\DbxMda\Demos\Win32\Embedded), all is working perfect.

But I try to prevent my customers to install files in c:\windows (Vista problems), so I tried to use parameter settings in the TCRSQLConnection.

My "basedir" is the application's directory. "datadir" is a subdirectory of "basedir".

Before connecting to the database I have the code:

MyConnection.Params.Values['Custom String'] := 'Params="--basedir=.'#13#10'--datadir=data"';

But this doesn't work. The error message is something like '
A call to an mysql_server_init failed.
c:\mysql\share\english.sym - System can't find the path
etc.

What's wrong?