[BETA] Error: No "CREATE TABLE.." were found, please check your sql. #990
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#990
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
In JCB, create a new component or use an existing one
Grab a sql dump, the part that creat a table.
In JCB go to "Dynamic Build (beta)" tab, paste your sql
I even use sql dump from joomla table, same result.
Expected result
To save without any error :P
Actual result
Error No "CREATE TABLE.." were found, please check your sql.
System information (as much as possible)
Additional comments
This sometime happen when the database is not updated as it should be, please watch these tutorials to help resolve the issue manually:
And possibly these:
https://youtu.be/bRPJTRat158
https://youtu.be/ZxC6z701ixA
I checked the youtube videos indicated by you, my problem does not appear when I compile the component and try to install it.
The problem for me occurs when I try to create a back-end/admin view based on the structure of a database, using JCB > Demo Component > Dynamic Build (beta)[tab] > Build Backend-views Dynamically.
If I'm wrong, I apologize and please tell me if there's anything else I need to check, or I'll watch the previous videos again, maybe I didn't understand what I should do.
Okay, it seems I did not understand where you are getting this error. I must admit I have not used or worked with that area in years. It is a part of JCB that is due a major upgrade, overall improvement. That was a beta area, and it has never been brought to stable.
Ideally the plan was that it can from an existing Joomla Component setup all your boilerplate things like fields and the basic relationships. Yet there has been little insert and even less supporting programmers to help move that forward.
At this time I am overloaded with moving JCB to Joomla 4, and honestly I will have to see when I get time to look at this, unless your willing to get your hands dirty and jump in to debug things... I am not sure there will be any thing I can do soon to help.
Yet if your can kinda boil it down to where the issue is and by doing so save me the time... I will be willing to help.
Quick side note, JCB does not work in Google Chrome, but must run in Firefox.
Sure, no problem, I can use JCB as it is used by everyone, I was just curious how that section of JCB works.
I have used a similar system a few years ago in the Yii framework, which used the database schema to create the complete CRUD schema.
First, we created a model based on the database, and then used that model to create the other sections of the site, such as the list view, create, edit, and delete.
Yes, sure, if you want that part of JCB to be improved, I will try to help you.
I really appreciate the effort you have put into creating this wonderful application, from the beginning, and now for porting it to Joomla 4, thank you!
And yes, I noticed a few years ago that JCB works better on Firefox :D
I am refactoring most of JCB into a containerized system like Joomla 4 and this area of JCB also needs refactoring.
This is where all the code lives now: https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/extrusion
And this is where is must move to: https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder
This new area holds al the new refactored code of JCB, we also have a powers repository that has decouples the code from JCB for individual project use:
https://git.vdm.dev/joomla/jcb-compiler
https://git.vdm.dev/joomla/super-powers
The new super powers of JCB will take JCB into a dimension of freedom never seen before, or so I think. Getting your head around the powers area of JCB and the soon to be released super powers ideology will be very satisfying to say the least.
Bu the way this extrusion area of JCB is also using the database to build all the views and fields, but I though of adding an xml layer to it so we can more correctly get the field types and other low level (field) details to even speed it up more, then I though well if we go there, why not use the new PARSER (still only in beta) we just build for the super powers area to get even more details from the modules and controllers and other parts of the existing component to more fully transition a extension into JCB... this it the direction we are looking at.
By the way... if your want to see what I am working on you should follow the beta version of JCB... as the it the tip of the development stream, and by the way also the version JCB is being build in.
I finally had time to spend trying to debug this problem.
Okay, so I found this message from the error
No "CREATE TABLE.." were found, please check your sql
inadministrator/components/com_componentbuilder/helpers/extrusion/a_mapping.php
Here are 2 functions,
getTableName(&$query)
andgetFields(&$query)
, in bouth function. the tables name and the columns name are selected only if the name is quoted using ' or ` .My mysql code was not quoted, so I created a functiones to add quote's to the names.
protected function addQuotesToName($name) { return "'#__" . $name . "'"; }
Now in
getTableName(&$query)
I do one more check like this:elseif(strpos($query, "#") !== false){
$regex = '/#([\w-]+)(?=\s)/';
$matches = array();
if (preg_match($regex, $query, $matches)) {
// get table name
$tableName = $this->addQuotesToName($matches[1]);
}
}
And in getFields(&$query) I do a last check like this:
if (0 === strpos($row, '
')) { // get field name $name = GetHelper::between($row, '
', '`');}elseif (0 === strpos($row, "'"))
{
// get field name
$name = GetHelper::between($row, "'", "'");
}else{
$regex = '/\b(\w+)\s+INT\b/';
$matches = array();
preg_match($regex, $row, $matches);
if(!empty($matches[1])){
$name = $this->addQuotesToName($matches[1]);
}
} .
But now, after all this I'm getting a new error:
Unknown column 'text' in 'where clause' \libraries\joomla\database\driver\mysqli.php:668
JROOT\administrator\components\com_componentbuilder\helpers\componentbuilder.php:2256
I thought that the problem would disappear if I put the names of the columns between ` '', but no.
The only difference obtained is with the changes made by me, and the sql dump code should not contain no quotes whatsoever
Error: No "CREATE TABLE.." were found, please check your sql.to [BETA]Error: No "CREATE TABLE.." were found, please check your sql.[BETA]Error: No "CREATE TABLE.." were found, please check your sql.to [BETA] Error: No "CREATE TABLE.." were found, please check your sql.New thread is here #1032