Code Monkey home page Code Monkey logo

Comments (5)

harikt avatar harikt commented on August 23, 2024

I have the commit over here harikt@3d63841 , but I need to rebase it , else there is an index.md which I have changed to add some documentation earlier which will not work in the new way :P .

from aura.sql.

pmjones avatar pmjones commented on August 23, 2024

So, the problem with overriding from an AbstractDriver is this: if you have lastInsertId($table, $col) that means you have to provide a table and column name, even if the driver doesn't need them. In MySQL and SQLite they will be ignored, but in Postgres it's important. If we just make AbstractDriver lastInsertId() and then make just the pgsql driver lastInsertId($table, $col) then you get a strictness error; the subclass signature needs to match the abstract signature. The easiest solution to make sure each driver works the way the underlying database expects it to, is to have lastInsertId() be specific to each driver.

from aura.sql.

harikt avatar harikt commented on August 23, 2024

May be I am missing something to understand from you .

But I wonder if we have kept lastInsertId($table = null , $col = null )
will have the same trouble ?

I did a test with

<?php
abstract class AbstractClass
{
    public function display($k = '' , $l = '' )
    {
        echo "Hello World" . PHP_EOL;
    }
}

class Hello extends AbstractClass
{
}

class World extends AbstractClass
{
    public function display($k , $l)
    {
        echo "From World" . $k . $l . PHP_EOL;
    }
}

$world = new World();
$world->display( "Yes you are right" , " You are wrong");

$hello = new Hello();
$hello->display();

output is

hari@local-lx1:/var/www/test$ php AbstractClass.php
From WorldYes you are right You are wrong
Hello World

So may be you missed to see my point . As the abstract class signature is
already having a value , but set default as null or '' , it will not be a
trouble I guess .

Did you looked the commit over
harikt@3d63841?

from aura.sql.

pmjones avatar pmjones commented on August 23, 2024

The problem with that signature is that it makes it easy for developers to think "Oh, I can get the last insert ID from any table I want." It looks wrong when applied to MySQL. Do you get what I mean there?

from aura.sql.

harikt avatar harikt commented on August 23, 2024

Yes understood .

from aura.sql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.