A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL
BSD 3-Clause "New" or "Revised" License
601
stars
156
forks
source link
Warning: Undefined variable $currCategory in C:\Users\manue\PhpstormProjects\untitled\vendor\greenlion\php-sql-parser\src\PHPSQLParser\processors\ReferenceDefinitionProcessor.php #352
Open
manuelddahmen opened 2 years ago
I got an error with table with foreign key. I don't know what to do.
`Opened database successfully name=action,value=add name=table,value=table_activites name=id,value=0 name=idName,value=id_activite DEBUG Add item. Display form
SELECT * FROM sqlite_schema WHERE type ='table' AND tbl_name='table_activites';Array ( [0] => Array ( [type] => table [name] => table_activites [tbl_name] => table_activites [rootpage] => 7 [sql] => CREATE TABLE "table_activites" ( id_activite integer default 10000 constraint table_activites_event__fk references table_animateurs constraint table_activites_hospitalise__fk references table_hospitalises constraint table_activites_table_event_id_fk references table_event, nom varchar(30) default '', tache_calendrier integer, no_animateur integer ) ) ) Warning: Undefined variable $currCategory in C:\Users\manue\PhpstormProjects\untitled\vendor\greenlion\php-sql-parser\src\PHPSQLParser\processors\ReferenceDefinitionProcessor.php on line 154
Warning: Undefined variable $currCategory in C:\Users\manue\PhpstormProjects\untitled\vendor\greenlion\php-sql-parser\src\PHPSQLParser\processors\ReferenceDefinitionProcessor.php on line 154 CREATE TABLE ARRAY : PHPSQLParser\PHPSQLParser Object ( [parsed] => Array ( [CREATE] => Array ( [expr_type] => table [not-exists] => [base_expr] => TABLE [sub_tree] => Array ( [0] => Array ( [expr_type] => reserved [base_expr] => TABLE )
( id_activite integer default 10000 constraint table_activites_eventfk references table_animateurs constraint table_activites_hospitalise__fk references table_hospitalises constraint table_activites_table_event_id_fk references table_event, nom varchar(30) default '', tache_calendrier integer, no_animateur integer ) [sub_tree] => Array ( [0] => Array ( [expr_type] => column-def [base_expr] => id_activite integer default 10000 constraint table_activites_eventfk references table_animateurs constraint table_activites_hospitalise__fk references table_hospitalises constraint table_activites_table_event_id_fk references table_event, nom varchar(30) default '', tache_calendrier integer, no_animateur integer [sub_tree] => Array ( [0] => Array ( [expr_type] => colref [base_expr] => id_activite [no_quotes] => Array ( [delim] => [parts] => Array ( [0] => id_activite )
)
Array ( [expr_type] => column-def [base_expr] => id_activite integer default 10000 constraint table_activites_eventfk references table_animateurs constraint table_activites_hospitalise__fk references table_hospitalises constraint table_activites_table_event_id_fk references table_event, nom varchar(30) default '', tache_calendrier integer, no_animateur integer [sub_tree] => Array ( [0] => Array ( [expr_type] => colref [base_expr] => id_activite [no_quotes] => Array ( [delim] => [parts] => Array ( [0] => id_activite ) ) ) [1] => Array ( [expr_type] => column-type [base_expr] => integer default 10000 constraint table_activites_eventfk references table_animateurs constraint table_activites_hospitalise__fk references [sub_tree] => Array ( [0] => Array ( [expr_type] => data-type [base_expr] => integer [unsigned] => [zerofill] => [length] => ) [1] => Array ( [expr_type] => reserved [base_expr] => default ) [2] => Array ( [expr_type] => default-value [base_expr] => 10000 ) [expr_type] => foreign-ref [base_expr] => [sub_tree] => Array ( ) ) [unique] => [nullable] => 1`` echo($sql = "SELECT * FROM sqlite_schema WHERE type ='table' AND tbl_name='" . $tablename . "';"); $stmt = $db->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(); print_r($result);
`