[BETA] Dynamic Build gives error No "CREATE TABLE.." were found, please check your sql. #1032
Labels
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#1032
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Go to Dynamic Build(Beta) tab.
Add a piece of create table from an mysql dump like:
CREATE TABLE
#__followlist(
idint(6) NOT NULL AUTO_INCREMENT PRIMARY KEY,
useridint(6) NOT NULL,
followidint(6) NOT NULL,
asset_idINT(10) UNSIGNED NOT NULL DEFAULT '0',
stateTINYINT(1) NULL DEFAULT 1,
orderingINT(11) NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Press Save
Expected result
back-end views created
Actual result
No "CREATE TABLE.." were found, please check your sql.
System information (as much as possible)
Additional comments
This problem was reported already here #990, and I am happy to announce that I managed to make it work, I will soon post the changes I made.
The
Build(Beta) tab
project was abandoned for some time now. We want to improve this area, to also take a path to all the field xml files.... but moving JCB to build towards Joomla 4 and 5 became the over bearing focus for a long time now.This means we will soon start looking at all the peripheral features again... so if you have debugged this and fixed something, please share it here.
So that you know the code that currently is being used to build is found here it also needs refactoring into the powers area of JCB, and will be containerized.
Dynamic Build gives error No "CREATE TABLE.." were found, please check your sql.to [BETA] Dynamic Build gives error No "CREATE TABLE.." were found, please check your sql.OK great.
Could also be a great addition for site-end views I guess.
Hi, I managed to advance a little with this section, now the Admin view and the fields are created.
At least 2 rules must be respected.
I've used this sql code:
1. In \libraries\jcb_powers\VDM.Joomla\src\Utilities\GetHelper.php I've changed the between function
FROM
TO
2. In \administrator\components\com_componentbuilder\helpers\extrusion\b_builder.php
FROM
TO
we get this error now: Unknown column 'text' in 'where clause' because $fieldId = 'text'.
Because the function getFieldTypeProperties tries to bring us one of the field types existing in JCB
So if I change the above code to this, it will work and create my admin view as well as the columns.
But because I added manually the ID (24), all the fields are gonna be of type text.
A small problems that remain after creating the admin-view and the columns/fields
Go to JCB > Fields and "1 (dynamic build)" will appear in the list of fields, you will see from the very beginning that the Type is not set.
Select one of the dynamically created fields and manually set: Type. (all fixed :D )
Probably something should be done so that in the database, in JCB where the field types are defined, the field type is saved on the "dataType1" column, so that the getFieldTypeProperties function query can identify the desired field.
I'm inclined to introduce a new
between
function(class) rather than altering the existing one, given its extensive usage and the critical bugs encountered when modifications were previously attempted during component compilation. The inherent complexities in string manipulation, through functions likeexplode
,strpos
, andsubstr
, present varied edge-case challenges.For substantial components, such as JCB itself, direct modifications to the
between
method warrant cautious consideration. A pragmatic approach involves integrating the component into a Git repository before implementing any changes. This process should extend to several components: compile each into the repository, introduce the modifications, then recompile. Should there be no discrepancies in the Git repositories post-change, we can proceed. This methodology reflects my standard practice for significant adjustments in JCB: secure the baseline with a Git commit, implement the changes, and meticulously review the outcomes. If the alterations deviate from expectations, I halt the process, refining the approach until achieving the desired results, aiming for clarity and precision in these endeavors.Regarding the
Dynamic Build(Beta)
feature, its segregation from the compiler's shared methods and classes is not only feasible but advisable, enhancing its utility and application.Then for the second point, I would have to run some tests actually :) (been a while since I used this area).
But you must understand that the whole idea of this feature is to try and find the correct field types, and not just build generic text fields.... or at least that is what I would like it to do.
The essence of this feature aims at identifying accurate field types rather than settling for generic text fields. This ambition guides my proposal to utilize
xml files
for better mapping of views and fields. Recognizing the current limitations, it might be prudent to address this issue through a dedicated code sprint. This would allow us to thoroughly assess its present capabilities and envision a pathway toward enhanced automation.By a code sprint, I envision a synchronized collaboration, possibly facilitated through audio or video calls (via Telegram or Google Meet), allowing for real-time dialogue about the feature and its existing codebase. Our objective would be to outline a clear, achievable plan, setting the stage for concerted coding efforts toward our agreed-upon goals.
I'm still thinking of this problem, and I think that's the only option, to set the fields to be created as a text field by default.
I can't see any solution for this, because you can't set the type of field in the sql query, unless we decide to use an improved/customized sql query, something like this [dropdown], [text], [etc]
And based on that we set the field type.
CREATE TABLE '#__mycomponent_location' (
'field_state' VARCHAR(255) [dropdown],
'field_city' VARCHAR(255) [text],
) ENGINE=InnoDB;
Because I remember that in the yii framework it still works like that when you try to create the CRUD based on the database.
I personally do not see any problem in changing the type of the field after it has been created 👯
Hi everyone,
The idea of oxido is excellent to my point view because it allows you to be specific or not. However we should use a standard SQL syntax and the comment is perfect for that. We should also use the exact name of fieldtype.
CREATE TABLE '#__mycomponent_location' (
'field_state' VARCHAR(255) COMMENT 'List',
'field_city' VARCHAR(255) COMMENT 'Text',
) ENGINE=InnoDB;
I am nearly finished with the update of this area, and I need to just note that it was still working when I used valid
SQL
, and going forward it will be even more necessary for validMySQL
or it will not work. I am also starting to add the option to set field related properties, I have not yet completed this... but I am going to update the comment in that area to note the idea we will try to implement.Great!
I tend to believe using a SQL file generated by phpmyadmin can be considered valid SQL.
At least that's what I used in my try.
Okay lets say this, I use to use string manipulation to try and extract the columns and the there properties and there I only worked with
backticks
. So that was me... and so I basically build it to only work with what I thought is valid secure SQL. My Bad!But now things have changed, I am now giving your sql to the SQL itself and so it will be going via the Joomla API, and no longer via Llewellyn lane.
This means your SQL if valid should work as expected, and yet in the old approach, it might have been valid, and still fail.... because it was not valid according to me (chuckle, chuckle) So test the new release and let me know.
Okay this is fixed, and the basic option to set the name and lable via the comment area is also implemented.