Git Product home page Git Product logo

pdoplusplus's People

Contributors

rawsrc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pdoplusplus's Issues

La syntaxe de PhpEcho

Discussed in #12

Originally posted by laurentsc October 26, 2023
Voici le code que je ne comprend pas :

    $layout = new PhpEcho('LayoutActus.php');
    $layout['body'] = new PhpEcho('block/admin/ActuFormEdit.php', $this['actu']);

C'est la 2e ligne qui me pose problème : le 2e argument que tu passes au constructeur de PhpEcho est $this['actu']. J'en étais resté à la syntaxe de ton exemple rapide dans Github (cool la version française) :

$homepage = new PhpEcho('layout/main.php', [
'header' => new PhpEcho('block/header.php', [
'user' => 'rawsrc',
'navbar' => new PhpEcho('block/navbar.php'),
]),

Ici le 2e argument est un tableau et on voit par exemple que le fichier layout/main.php connaîtra $this['header'] et que block/header.php connaîtra $this['user'] et $this['navbar']. Alors qu'avec ton code, je ne comprend pas ce que va recevoir le bloc block/admin/ActuFormEdit.php. Pourrais-tu m'expliquer STP ?

The vanilla PDO example is all wrong, undermining the whole idea behind the wrapper. NOT AN ISSUE, JUST AN OPEN DISCUSSION

The real vanilla PDO example should be

$sql = 'INSERT INTO t_video
(video_title, video_support, video_multilingual, video_chapter, video_year, video_summary, video_stock)
VALUES (:video_title, :video_support, :video_multilingual, :video_chapter, :video_year, :video_summary, :video_stock)';
$pdo->prepare($sql)->execute($film);
$id = $pdo->lastInsertId();

which is actually much simpler than yours

$in  = $ppp->injectorInByVal();
$sql = <<<sql
INSERT INTO t_video (
    video_title, video_support, video_multilingual, video_chapter, video_year, video_summary, video_stock
) VALUES (
   {$in($film['title'])}, {$in($film['support'])}, {$in($film['multilingual'], 'bool')}, 
   {$in($film['chapter'], 'int')}, {$in($film['year'], 'int')}, {$in($film['summary'])}, 
   {$in($film['stock'], 'int')}
);
sql;
$id = $ppp->insert($sql);

La syntaxe de PhpEcho

Discussed in #12

Originally posted by laurentsc October 26, 2023
Voici le code que je ne comprend pas :

    $layout = new PhpEcho('LayoutActus.php');
    $layout['body'] = new PhpEcho('block/admin/ActuFormEdit.php', $this['actu']);

C'est la 2e ligne qui me pose problème : le 2e argument que tu passes au constructeur de PhpEcho est $this['actu']. J'en étais resté à la syntaxe de ton exemple rapide dans Github (cool la version française) :

$homepage = new PhpEcho('layout/main.php', [
'header' => new PhpEcho('block/header.php', [
'user' => 'rawsrc',
'navbar' => new PhpEcho('block/navbar.php'),
]),

Ici le 2e argument est un tableau et on voit par exemple que le fichier layout/main.php connaîtra $this['header'] et que block/header.php connaîtra $this['user'] et $this['navbar']. Alors qu'avec ton code, je ne comprend pas ce que va recevoir le bloc block/admin/ActuFormEdit.php. Pourrais-tu m'expliquer STP ?

Crash under PHP 8.x

Hello,

It seems that PDO++ has an issue running under PHP 8.
The problem is related to the var type passed to the function str_replace.
Since PHP 8 with declare(strict_types=1);, the second parameter must be a strict string or in some case the var may be an integer.

The workaround is just to cast explicitly the second parameter to string:
From $sql = str_replace($tag, $v['value'], $sql);
To $sql = str_replace($tag, (string)$v['value'], $sql);

and from $sql = str_replace($tag, self::sqlValue($v['value'], $v['type'], false, $this->current_cnx_id), $sql);
To $sql = str_replace($tag, (string)self::sqlValue($v['value'], $v['type'], false, $this->current_cnx_id), $sql);

Both are located in: private function builtPrepareAndAttachValuesOrParams(string $sql) (row 1037 and 1042)

I will fully test PDO++ under PHP8 very soon and update the wrapper as needed and also add some new features.

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.