Zen Cart Logo
Forums / Code Collaboration / Documentation Plugin SQL Installation

Documentation Plugin SQL Installation

Views: 3,974

Results 1 to 5 of 5
31 Oct 2020, 2:19 PM
#1
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Documentation Plugin SQL Installation

ZC 1.5.7
Trying to write a new plugin. I have a few questions re the SQL installer Class and how to write one if i need to.
The current version of zen cart reports errors if you use multi line SQL for use in install sql patch in zen cart admin. so

Does the new installer method use the same validation and have the same requirements for multi line sql as the install sql patch in admin? e.g.
I want to run the following Query

INSERT  IGNORE INTO products_location (products_id, products_location)
SELECT products_id,"" FROM  products ;

to cope with the select from products in the insert it needs to be on a new line.
Is this still true if I just use straight sql for the install and will it still produce the same erroneous error message?

You quote in the documentation an example of how to create an installer class. However there is no link to the plugin. When I look at the plugins i can find the one quoted but is does not use the installer class. Does the example exist? if so can i see it? It may be easier to code a sql installer than it is to correct the issue above.

31 Oct 2020, 2:59 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Documentation Plugin SQL Installation

brittainmark:

ZC 1.5.7
The current version of zen cart reports errors if you use multi line SQL for use in install sql patch in zen cart admin. so

... if I just use straight sql for the install and will it still produce the same erroneous error message?
What "erroneous error message" are you referring to?

Are you referring to this issue that was fixed? Re: [Done v157a] Spurious error message Query incomplete: missing closing semicolon.

31 Oct 2020, 3:36 PM
#3
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: Documentation Plugin SQL Installation

Yes just seen 1.5.7a.
Unfortunately it was not fixed now get error as it is no longer capable of processing multi line sql statements if you have a prefix present!

31 Oct 2020, 4:02 PM
#4
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: Documentation Plugin SQL Installation

My above statement is not true. It works fin I had double spaces in my query that cause the issues.
So I assume that it uses the same module.
If i want to write a sql installer class is it as simple as creating the install and uninstall functions and putting what i need in them?

2 Nov 2020, 6:37 PM
#5
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,837
Plugin Contributions:
3

Re: Documentation Plugin SQL Installation

The inbuilt DisplayLogs plugin contains an example of using an Installer Class

e.g. zc_plugins/DisplayLogs/v3.0.0/Installer/ScriptedInstaller.php