Spaces:
Sleeping
Sleeping
Claude Sonnet 4.6
feat(membership): admin-driven account creation, real estate tier/investment work, in-progress monorepo migration state
b2dcf0f Download tests/api/db-helper.php from nyakslamo/mdn-backend: direct link, hf CLI and curl.
- Browser
- Download file 844 Bytes
-
https://huggingface.co/spaces/nyakslamo/mdn-backend/resolve/main/tests/api/db-helper.php
- Command line
-
hf download hf://spaces/nyakslamo/mdn-backend/tests/api/db-helper.php
-
curl -L -o db-helper.php https://huggingface.co/spaces/nyakslamo/mdn-backend/resolve/main/tests/api/db-helper.php
844 Bytes
| declare(strict_types=1); | |
| $mode = $argv[1] ?? ''; | |
| $sql = getenv('MDN_SQL') ?: ''; | |
| $params = []; | |
| $paramCount = (int) (getenv('MDN_PARAM_COUNT') ?: 0); | |
| for ($index = 0; $index < $paramCount; $index++) { | |
| $params[] = getenv('MDN_PARAM_'.$index); | |
| } | |
| $pdo = new PDO( | |
| 'mysql:host='.getenv('MDN_DB_HOST').';dbname='.getenv('MDN_DB_NAME').';charset=utf8mb4', | |
| getenv('MDN_DB_USER'), | |
| getenv('MDN_DB_USER_PASS'), | |
| [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION], | |
| ); | |
| $interpolatedSql = $sql; | |
| foreach ($params as $value) { | |
| $quoted = $value === null ? 'NULL' : $pdo->quote((string) $value); | |
| $interpolatedSql = preg_replace('/\?/', $quoted, $interpolatedSql, 1); | |
| } | |
| $stmt = $pdo->query($interpolatedSql); | |
| if ($mode === 'scalar') { | |
| $value = $stmt->fetchColumn(); | |
| if ($value !== false) { | |
| echo $value; | |
| } | |
| } | |