Recent

Author Topic: calling selectable stored proc for MySQL  (Read 42198 times)

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #15 on: April 09, 2010, 08:37:16 am »
can I modify source code of SQLQuery.Open then recompile Lazarus?
Yes locate into your lazarus instalation directory a there in:
FPC/x.x.x/source/packages/fcl-db/src/sqldb/...
There are 2 important files:
sqldb.pp and mysql/mysqlconn.inc

You must make changes in them ... I made some changes and it seems, that it is working as expected (I use only MySQL 5.1!)
See attached files ...

You must not recompile whole Lazarus, only modify Paths in your project.

I also have reported the bug http://bugs.freepascal.org/view.php?id=16236

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #16 on: April 09, 2010, 09:07:02 am »
Thank you very much for reporting the problem and for telling me how to fix it.
I'll do this modification and I'll let you know.
I have this problem in my work computer (Windows client and Linux server). At home I have only Linux, and I'll go to work after election here in Sudan, we may have a complete off week.

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #17 on: April 09, 2010, 01:58:09 pm »
ok, let me know ...
I found bug in my previous mysqlconn.inc
Here are updated files.

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: calling selectable stored proc for MySQL
« Reply #18 on: April 09, 2010, 02:41:12 pm »
Hello
I don't use MySQL, but you patch sqldb.pp

With Firebird, this code (without select) return a dataset.

insert into imagenes (Socio) values (21095) returning clave_imagen
SQLQuery1.open;

Look at this example
http://www.lazarus.freepascal.org/index.php/topic,8217.msg39713.html#msg39713

Strange...

Regards





motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #19 on: April 11, 2010, 11:06:33 am »
Lacak2, I do the modifications in sqlconn.inc and sqldb.pas, then I include it's source path in compiler options, I get the same error. Then I copied sqldb.pas/.ppu and sqlconn.inc to local application folder, and I get the same error.
any ideas

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #20 on: April 12, 2010, 06:55:53 am »
I don't use MySQL, but you patch sqldb.pp

Strange...
I patched FPC 2.2.5 version, where patch is required
Current version (trunk) is ok, so no patch is required ;-)

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #21 on: April 12, 2010, 07:13:11 am »
are u suggesting to download and install the latest version from snapshot 0.9.29?

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #22 on: April 12, 2010, 07:13:42 am »
Motaz, which version of FPC do you use ?
My paths (in Compiler Options/Paths/Source units):
$(FPCSrcDir)\packages\fcl-db\src\sqldb\mysql\;
$(FPCSrcDir)\packages\fcl-db\src\sqldb\;
$(LazarusDir)\components\sqldb\

When you compile your project, do you see in Message window, that units sqldb.pp and mysqlconn.inc are compiled ?

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #23 on: April 12, 2010, 07:15:31 am »
are u suggesting to download and install the latest version from snapshot 0.9.29?
You can try it.
Then replace mysqlconn.inc (sqldb.pp is ok in trunk, so no modification is required)

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #24 on: April 12, 2010, 07:51:44 am »
since I'm using Lazarus in a real production, which is better to download:

- Lazarus fixes + fpc 2.4.0   :  Lazarus-0.9.28.3-24591-fpc-2.4.0-20100412-win32.exe
- Lazarus + fpc 2.4.0 : Lazarus-0.9.29-24591-fpc-2.4.0-20100412-win32.exe

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #25 on: April 12, 2010, 08:50:14 am »
IMHO you can use both, FPC (FreePascal) version is the same 2.4.0 (so fcl-db (sqldb) code will be identical)

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #26 on: April 12, 2010, 09:39:27 am »
I've downloaded 0.9.28.3 with FPC 2.4.0, and I replaced mysqlconn.inc and I open this file from Lazarus, and I see your modifications, but I get the same error:

Code: [Select]
call getBalanceMdn( '120258463', 'motaz@bananaaa.com')
when I called .Open I get:

SQLQuery1 : Cannot open a non-select statement

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #27 on: April 12, 2010, 10:30:36 am »
I tried also 0.9.29 with FPC 2.4.1
I replaced mysqlconn.inc and I get the same error

Lacak2

  • Guest
Re: calling selectable stored proc for MySQL
« Reply #28 on: April 12, 2010, 12:15:29 pm »
I tried also 0.9.29 with FPC 2.4.1
I replaced mysqlconn.inc and I get the same error
I have also downloaded and installed todays Lazarus snapshot 0.9.29 + FPC 2.4.1 and after replacing mysqlconn.inc (+small modification in sqldb.pp) works for me.

My environment is:
- Windows Vista + MySQL 5.1
My test procedure:
- create procedure proc1 begin select * from tab1; end
(tab1 contains 2 rows)

I am sure, that patch is ok, but I do not know where problem may be ?
Can you test with very simple SQL procedure, which returns only small amount of rows ?

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: calling selectable stored proc for MySQL
« Reply #29 on: April 12, 2010, 12:37:45 pm »
I tried your file, but the same result.
Should I do any modification to the path of include or .pp directory?

my environment:

Client: Vista
Server: CentOS
Clustered MySQL 5.1

 

TinyPortal © 2005-2018