Skip to content
New issue

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

Issues with PDO and our data #2448

Closed
designermonkey opened this issue May 21, 2015 · 5 comments
Closed

Issues with PDO and our data #2448

designermonkey opened this issue May 21, 2015 · 5 comments

Comments

@designermonkey
Copy link
Member

Since the PDO upgrade, using the query function from the database classes means that we can't pass null as a value any more.

PDO expects an actual value for a column, or to use bindValue and explicitly set PDO:: PARAM_NULL for the type. As we don't use that in query we can't define the type properly, and get errors instead.

So, the manager classes need to migrate over to using prepare and bindValue to function correctly again. I would be uncomfortable in allowing a 0 to go through to the table in place of null as this could have consequences further down the line that we don't know yet.

@designermonkey designermonkey changed the title PageManager can't create pages Issues with PDO and our data May 22, 2015
@designermonkey
Copy link
Member Author

I have tried to save an entry today, that has Publish Tabs in it. Publish Tabs don't send any data through, but PDO is still expecting a value to be present; The value it recieves is '' (an empty string).

Symphony Fatal Database Error: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'value' at row 1
An error occurred while attempting to execute the following query
INSERT INTO `sym_entries_data_11` (`entry_id`, `value`) VALUES (?,?)
Backtrace
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.database.php:745]
    Database->error();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.database.php:535]
    Database->q();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.mysql.php:427]
    Database->insert();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.entrymanager.php:209]
    MySQL->insert();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.entry.php:311]
    EntryManager::edit();
[/data/sites/cms.nigella.local.embarknow.net/symphony/content/content.publish.php:1434]
    Entry->commit();
[/data/sites/cms.nigella.local.embarknow.net/symphony/content/content.publish.php:374]
    contentPublish->__actionEdit();
[/data/sites/cms.nigella.local.embarknow.net/symphony/content/content.publish.php:350]
    contentPublish->__switchboard();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/toolkit/class.administrationpage.php:464]
    contentPublish->action();
[/data/sites/cms.nigella.local.embarknow.net/symphony/content/content.publish.php:345]
    AdministrationPage->build();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/core/class.administration.php:212]
    contentPublish->build();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/core/class.administration.php:479]
    Administration->__buildPage();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/boot/func.utilities.php:189]
    Administration->display();
[/data/sites/cms.nigella.local.embarknow.net/symphony/lib/boot/func.utilities.php:171]
    symphony_launcher();
[/data/sites/cms.nigella.local.embarknow.net/public/index.php:35]
    symphony();

@designermonkey
Copy link
Member Author

Adding PDO was supposed to make our API so much easier, but instead, after looking through the relevant classes, it is so much more complicated. I really want to help debug and fix this, but I have no idea where to even start.

@jensscherbl
Copy link
Member

Adding PDO was supposed to make our API so much easier, but instead, after looking through the relevant classes, it is so much more complicated.

Thought the same thing, but I assumed this is only a rough first step and a long way to go until release. To be more specific, I don't really understand why there are two database classes now, class.database.php and class.mysql.php.

@brendo
Copy link
Member

brendo commented May 23, 2015

Yep, there's still a way off to go to clear it up and have it production ready. It's a little bit more effort than I thought it'd be, but the hard part is done :)

I don't really understand why there are two database classes now, class.database.php and class.mysql.php.

That's me being a little ambitious/naive by thinking eventually there will be class.postgres.php, class.sqlserver.php.

@designermonkey
Copy link
Member Author

There's nothing naive about being ambitious :)

I've kind of fixed my immediate issue, by forcing the Publish Tabs field locally to send null, but weirdly, it's null values in the PageManager that cause the initial issue.

Very confused, but definitely sure we need to re-address how we process queries.

@nitriques nitriques added this to the 3.0.0 milestone Jun 1, 2017
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Sep 27, 2017
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Jan 31, 2018
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 1, 2018
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 1, 2018
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 14, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 15, 2018
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 15, 2018
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 15, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Feb 15, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
Picked from 33102ad
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
Picked from dee9e5a
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>

Picked from e6c7673
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
Picked from 33102ad
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
Picked from dee9e5a
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>

Picked from e6c7673
nitriques pushed a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 20, 2018
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
Co-authored-by: Nicolas Brassard <nitriques@users.noreply.github.com>

Picked from e6c7673
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Mar 29, 2019
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
Picked from 33102ad
Picked from 5355f60
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Mar 29, 2019
Usign bindValue makes it easier to support NULL in general.
Fixes symphonycms#2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
Picked from dee9e5a
Picked from 55723a3
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Mar 29, 2019
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
Co-authored-by: Nicolas Brassard <nitriques@users.noreply.github.com>

Picked from e6c7673
Picked from fee6f90
nitriques added a commit that referenced this issue Apr 8, 2019
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re #2604
Fixes #2562
Re #2472
Re #2448
Fixes #2425
Re #2015

Picked from 69439c6
Picked from 33102ad
Picked from 5355f60
Picked from fb6bcec
nitriques added a commit that referenced this issue Apr 8, 2019
Usign bindValue makes it easier to support NULL in general.
Fixes #2448

Using bindValue allows us to insert NULLs in integer columns.

Picked from 158b87d
Picked from dee9e5a
Picked from 55723a3
Picked from 4cd818d
nitriques added a commit that referenced this issue Apr 8, 2019
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re #2015
Fixes #2425
Fixes #2448
Fixes #2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
Co-authored-by: Nicolas Brassard <nitriques@users.noreply.github.com>

Picked from e6c7673
Picked from fee6f90
Picked from a35ce85
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 8, 2019
This commit brings a new API for the datbase layer.
Instead of creating our dynamic SQL queries with concat and sprintf

The way it works is that you first start with on of the factory methods
available in the Database class. You then use the created
DatabaseStatement and its chainable API to add `part` to the clause.

This is very much a WIP. The API will change at some point.

Re symphonycms#2604
Fixes symphonycms#2562
Re symphonycms#2472
Re symphonycms#2448
Fixes #2425
Re symphonycms#2015

Picked from 69439c6
Picked from 33102ad
Picked from 5355f60
Picked from fb6bcec
nitriques added a commit to DeuxHuitHuit/symphonycms that referenced this issue Apr 8, 2019
This commit is based on the original PDO implementation from the
integration branch. It replaces the original PDO changes with the new
Query Builder API.

Picked from 989299b
Picked from 5ba3664
Re symphonycms#2015
Fixes #2425
Fixes symphonycms#2448
Fixes symphonycms#2562

Co-authored-by: Nils Werner <nils.werner@gmail.com>
Co-authored-by: Brendan Abbott <brendan@bloodbone.ws>
Co-authored-by: Nicolas Brassard <nitriques@users.noreply.github.com>

Picked from e6c7673
Picked from fee6f90
Picked from a35ce85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants