rawsrc / pdoplusplus Goto Github PK
View Code? Open in Web Editor NEWA PHP single class PDO Wrapper : PDO++ (alias PPP) - CRUD - SP - BIGINT natively compatible
License: MIT License
A PHP single class PDO Wrapper : PDO++ (alias PPP) - CRUD - SP - BIGINT natively compatible
License: MIT License
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 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);
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 ?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.