Comments (10)
@ErikV88 tested this on MySQL and it works, could it be that you forgot to add:
ALTER
TABLE posts
ADD PRIMARY KEY id
(id
);`
Where 'posts' is your table?
from php-crud-api.
Please let me know whether or not this solves the issue.
from php-crud-api.
closed due to inactivity
from php-crud-api.
Sorry, It fail when calling a view . We need a uniq table It also be cool if we add a table with synoynm /alias for all object . DatabaseObjects what have metadata to db objects , also sp view , and tables
from php-crud-api.
Please post your table definition, so I can help you. Use:
show table
posts;
Where 'posts' is the table you are using.
from php-crud-api.
CREATE TABLE IF NOT EXISTS `BasketProducts` (
`BasketID` int(11) NOT NULL,
`ProductID` int(11) NOT NULL,
`NummerOfProducts` int(11) NOT NULL DEFAULT '1',
`PrimKey` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`PrimKey`),
KEY `WebShop_BasketProductsProductID` (`ProductID`,`BasketID`),
KEY `IX_ProductBasket` (`BasketID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TRIGGER IF EXISTS `IXBasketProducts`;
DELIMITER //
CREATE TRIGGER `IXBasketProducts` BEFORE INSERT ON `BasketProducts`
FOR EACH ROW SET NEW.PrimKey=UUID()
//
DELIMITER ;
ALTER ALGORITHM=UNDEFINED DEFINER=`myUser`@`localhost` SQL SECURITY DEFINER VIEW `aviw_BasketProducts` AS
SELECT `P`.`ID` AS `ID`,`P`.`Name` AS `Name`,`P`.`Price` AS `Price`,`P`.`Description` AS `Description`,`BP`.`NummerOfProducts` AS `NummerOfProducts`,`BP`.`PrimKey` AS `PrimKey`,(`P`.`Price` * `BP`.`NummerOfProducts`) AS `TotalPrice`
FROM (`BasketProducts` `BP`
INNER JOIN WebShop_Products` `P` on((`P`.`ID` = `BP`. `ProductID`)))
GROUP BY `BP`.`BasketID`,`BP`.`ProductID`
from php-crud-api.
I think your view has either none or two primary keys. Check the output of:
SELECT
COLUMN_NAMEFROM
INFORMATION_SCHEMA.
COLUMNSWHERE
COLUMN_KEY= 'PRI' AND
TABLE_NAME = 'aviw_BasketProducts';
Probably it does not show one single primary key (1pk) on the view (as is required).
from php-crud-api.
Tried to simulate your case and even without join there are no primary keys defined for views (probably by definition). This means that in order to expose full crud on a view we need another method to find the primary key. Fallback to the name "id" comes to mind as a possible solution or to default to the first column of the view.
from php-crud-api.
I find a solution to it ... in my js lib , my object now the uniqtable of the view... Then i can call the view if update and delete or update . but if select then the view 👍
from php-crud-api.
Fallback to the name "id" comes to mind as a possible solution or to default to the first column of the view.
This is now implemented
from php-crud-api.
Related Issues (20)
- HTML Middleware HOT 2
- Update with "where" HOT 8
- "Request Tranformer" middleware HOT 2
- Azure App Service HOT 1
- Add PHP backend to any app project with one command HOT 1
- Any advice on events integration? HOT 2
- Synchronization between local IndexedDB and MySQL Database. HOT 3
- Can the API Support Customized Cache Management for Specific Tables? HOT 9
- Question: Add property on create HOT 3
- Insights on caching with Redis HOT 2
- Using Customization handler to insert app-generated ID HOT 11
- PUT using curl comes back successful but the record is not actually updated HOT 2
- Suggestion to modify response JSON root Key (records) HOT 2
- firebase jwt public key rotation HOT 5
- "Route '' not found" HOT 3
- Additional SQL queries in authorization handlers HOT 2
- Direct usage of PHP CRUD API functions in external PHP Files HOT 8
- Failure on postgres when table name is domains HOT 10
- Returning user uploaded file using custom controller HOT 2
- Found this PDOException occurred (enable debug mode) in message HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-crud-api.