-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Pdo sub classing rough WIP #8707
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
Closed
Closed
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
86f5b53
Adding PDOSQLite in the wrong place.
Danack 9d69e0e
Version with PDOSqlite apparently working. Which seems unlikely.
Danack c5317fc
Typo on class name.
Danack 357fffa
Initial version of PDOSQLite::loadExtension.
Danack a3f77cc
PDOSQLite::blobOpen is working.
Danack b60f678
Improve test to search for sqlite extension location.
Danack d95dbfb
Moved code to a more correct place.
Danack 6377bb0
First draft of pdo_dblib extension class.
Danack 479859e
Added PDOMySql class and a driver specific method.
Danack 6cbe69e
Initial version of PDOPgSql sub-class
Danack df94bbf
Added missed file.
Danack a1b050e
Copied methods across from PDO class.
Danack fd96e22
PDO_DBLIB tests are passing.
Danack 835c38b
All subclasses created, ODBC works.
Danack a4b3fcf
pdo_firebird subclass is working.
Danack a987f0c
Changed config files name to be not ignored.
Danack 5f80549
Fix PDOOci tests
tontonsb 4454698
Fix PDOFirebird test names
tontonsb cd97c9d
Use RECREATE for PDOFirebird tests
tontonsb 524c893
Add PDOMysql testing setup helper
tontonsb 83bb08c
Copy methods from being the magic implementations, to being declared …
Danack 8803312
Standardized class names.
Danack 08abcf4
Corrected constants to not have prefix.
Danack 9f95d8b
Added note on safety.
Danack 51487c2
WS.
Danack 4572b8d
Tidying up.
Danack 4439f57
Standardised directory name.
Danack 6aafba0
Fix tpyo.
Danack 43acd48
Copy function detection in m4 file across from sqlite3, and separate …
Danack 23aab3c
Standardized case.
Danack 61d8ae2
Remove trailing ?>
Danack bb3a634
Removed un-needed includes.
Danack 589c950
CS
Danack 48e458b
Change to ZEND_ASSERT
Danack b51d423
Change to unsigned int. remove setting something to null.
Danack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** @generate-class-entries */ | ||
|
||
/** @not-serializable */ | ||
class PdoDblib extends PDO | ||
{ | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* This is a generated file, edit the .stub.php file instead. | ||
* Stub hash: 06c2f52a638c1ca9c56bcbebdc00367bb3eb9b26 */ | ||
|
||
|
||
|
||
|
||
static const zend_function_entry class_PdoDblib_methods[] = { | ||
ZEND_FE_END | ||
}; | ||
|
||
static zend_class_entry *register_class_PdoDblib(zend_class_entry *class_entry_PDO) | ||
{ | ||
zend_class_entry ce, *class_entry; | ||
|
||
INIT_CLASS_ENTRY(ce, "PdoDblib", class_PdoDblib_methods); | ||
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO); | ||
class_entry->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; | ||
|
||
return class_entry; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
function getDsnUserAndPassword() | ||
{ | ||
|
||
if (false !== getenv('PDO_DBLIB_TEST_DSN')) { | ||
$dsn = getenv('PDO_DBLIB_TEST_DSN'); | ||
} else { | ||
$dsn = 'dblib:host=localhost;dbname=test'; | ||
} | ||
|
||
if (false !== getenv('PDO_DBLIB_TEST_USER')) { | ||
$user = getenv('PDO_DBLIB_TEST_USER'); | ||
} else { | ||
$user = 'php'; | ||
} | ||
|
||
if (false !== getenv('PDO_DBLIB_TEST_PASS')) { | ||
$pass = getenv('PDO_DBLIB_TEST_PASS'); | ||
} else { | ||
$pass = 'password'; | ||
} | ||
return [$dsn, $user, $pass]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--TEST-- | ||
PdoDblib basic | ||
--EXTENSIONS-- | ||
pdo | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . "/../config_functions.inc"; | ||
|
||
if (class_exists(PdoDblib::class) === false) { | ||
echo "PdoDblib class does not exist.\n"; | ||
exit(-1); | ||
} | ||
echo "PdoDblib class exists.\n"; | ||
|
||
|
||
[$dsn, $user, $pass] = getDsnUserAndPassword(); | ||
|
||
$db = new PdoDblib($dsn, $user, $pass); | ||
|
||
$db->query('drop table if exists #foobar;'); | ||
|
||
$db->query("create table #foobar(name varchar(32)); "); | ||
$db->query("insert into #foobar values('PHP');"); | ||
$db->query("insert into #foobar values('PHP6');"); | ||
|
||
foreach ($db->query('SELECT name FROM #foobar') as $row) { | ||
var_dump($row); | ||
} | ||
|
||
$db->query('drop table #foobar;'); | ||
|
||
echo "Fin."; | ||
?> | ||
--EXPECT-- | ||
PdoDblib class exists. | ||
array(2) { | ||
["name"]=> | ||
string(3) "PHP" | ||
[0]=> | ||
string(3) "PHP" | ||
} | ||
array(2) { | ||
["name"]=> | ||
string(4) "PHP6" | ||
[0]=> | ||
string(4) "PHP6" | ||
} | ||
Fin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--TEST-- | ||
PdoDblib create through PDO::connect | ||
--EXTENSIONS-- | ||
pdo | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . "/../config_functions.inc"; | ||
|
||
if (class_exists(PdoDblib::class) === false) { | ||
echo "PdoDblib class does not exist.\n"; | ||
exit(-1); | ||
} | ||
|
||
echo "PdoDblib class exists.\n"; | ||
|
||
[$dsn, $user, $pass] = getDsnUserAndPassword(); | ||
|
||
$db = Pdo::connect($dsn, $user, $pass); | ||
|
||
if (!$db instanceof PdoDblib) { | ||
echo "Wrong class type. Should be PdoDblib but is [" . get_class($db) . "\n"; | ||
} | ||
|
||
$db->query('drop table if exists #test;'); | ||
|
||
$db->query("create table #test(name varchar(32)); "); | ||
$db->query("insert into #test values('PHP');"); | ||
$db->query("insert into #test values('PHP6');"); | ||
|
||
foreach ($db->query('SELECT name FROM #test') as $row) { | ||
var_dump($row); | ||
} | ||
|
||
$db->query('drop table #test;'); | ||
|
||
echo "Fin."; | ||
?> | ||
--EXPECT-- | ||
PdoDblib class exists. | ||
array(2) { | ||
["name"]=> | ||
string(3) "PHP" | ||
[0]=> | ||
string(3) "PHP" | ||
} | ||
array(2) { | ||
["name"]=> | ||
string(4) "PHP6" | ||
[0]=> | ||
string(4) "PHP6" | ||
} | ||
Fin. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it makes sense to have this be a zend_string that is interned by the driver on startup. But that can be a future improvement.