Skip to Content Skip to Menu

[SOLVED] Executing stored procedures using CB Query field plugin version 2.1.0

  • agabites
  • agabites
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
11 years 6 months ago - 10 years 7 months ago #226580 by agabites
Hi all

Anyone know if this can be done? Here's the scenario.

We have a group of members on our joomla site. Existing members already have simple 4 digit member numbers from an external database. We want to merge the two databases and end up with just the one online database that we can manage through Joomla.

For new members we have written a stored procedure and put it into the MySQL database for the site. Essentially when it's called it returns a number 1 greater than the last number it provided, and then that number is then put into the membership number. Here's the code to create the table and the sp
Code:
-- Create the table create table mbr_MemberCode ( MemberId smallint not null auto_increment, InsertDateTime datetime not null, primary key (MemberId) ); -- Set the value to at least the last currently used number + 1 -- or whereever we want to start from alter table mbr_MemberCode auto_increment = 7200; -- Create stored procedure to insert record and return the next number delimiter $$ CREATE PROCEDURE `GetNextMemberCode`(OUT MemberId smallint) BEGIN insert into mbr_MemberCode(InsertDateTime) values(now()); select last_insert_id() into MemberId; END$$ delimiter ;


However when I run the code to do that through the CB Query field plugin:
Code:
call GetNextMemberCode(@MemberId); select @MemberId;
Nothing is output to the field.

I'm assuming the plugin does not support stored procedure calls. Can anyone confirm.

Also if it doesn't, any suggestions on how we could achieve this?

Thanks in advance
Last edit: 10 years 7 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
11 years 6 months ago #226673 by krileon
No idea. Enable debug mode and maximum error reporting in Joomla global configuration then re-test to expose any errors. Joomla 2.5 and Joomla 3.0 both support stored procedures when using MySQLi driver, so it should work ok; although I don't know if your usage is correct for Joomla.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 208
  • Thanks: 27
  • Karma: 0
10 years 7 months ago - 10 years 7 months ago #242628 by fdinkler
I solved this problem by creating a view in MySQL, as follows:

CREATE VIEW #__nextnumber as
SELECT MAX(CONVERT(c.cb_membernumber,UNSIGNED INTEGER))+1 'cb_membernumber'
FROM `#__comprofiler` c

Doing a SELECT on the new table returns one row, with a single value that's the next largest member number.
Last edit: 10 years 7 months ago by fdinkler.
The following user(s) said Thank You: nant, ricco1

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum