We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 )
) ) [TABLE] => Array ( [base_expr] => "table_activites" [name] => "table_activites" [no_quotes] => Array ( [delim] => [parts] => Array ( [0] => table_activites ) ) [create-def] => Array ( [expr_type] => bracket_expression [base_expr] =>
( 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 ) [sub_tree] => Array ( [0] => Array ( [expr_type] => column-def [base_expr] => 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 [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_event__fk 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 [auto_inc] => [primary] => [default] => 10000 ) ) ) ) ) [options] => ) ) [options:PHPSQLParser\PHPSQLParser:private] => PHPSQLParser\Options Object ( [options:PHPSQLParser\Options:private] => Array ( ) )
)
` 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);
$create = new PHPSQLParser($result[0]["sql"]); echo "<p>CREATE TABLE ARRAY : <textarea>"; print_r($create); echo "</p></textarea>";
`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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_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
)
[sub_tree] => Array
(
[0] => Array
(
[expr_type] => column-def
[base_expr] => 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
[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_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 [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_event__fk 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);
`
The text was updated successfully, but these errors were encountered: