summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-06-19 16:42:34 +0000
committertailor <cygnus@janrain.com>2007-06-19 16:42:34 +0000
commit3a278d6c217fa14db0e000e10d089078acc24784 (patch)
treed45aeea939045d232bd43a739c1d5e3c5b661a9d
parente19d4dd7ae18418f084bd9f76d1ce76730696491 (diff)
downloadphp-openid-3a278d6c217fa14db0e000e10d089078acc24784.zip
php-openid-3a278d6c217fa14db0e000e10d089078acc24784.tar.gz
php-openid-3a278d6c217fa14db0e000e10d089078acc24784.tar.bz2
[project @ Fix query-building for Auth_OpenID_SQLStore::tableExists (thanks markus@silverstripe.com)]
-rw-r--r--Auth/OpenID/SQLStore.php5
-rw-r--r--Tests/Auth/OpenID/StoreTest.php8
2 files changed, 11 insertions, 2 deletions
diff --git a/Auth/OpenID/SQLStore.php b/Auth/OpenID/SQLStore.php
index b71729d..bd99dd2 100644
--- a/Auth/OpenID/SQLStore.php
+++ b/Auth/OpenID/SQLStore.php
@@ -161,8 +161,9 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
function tableExists($table_name)
{
return !$this->isError(
- $this->connection->query("SELECT * FROM %s LIMIT 0",
- $table_name));
+ $this->connection->query(
+ sprintf("SELECT * FROM %s LIMIT 0",
+ $table_name)));
}
/**
diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php
index a369670..c841a2e 100644
--- a/Tests/Auth/OpenID/StoreTest.php
+++ b/Tests/Auth/OpenID/StoreTest.php
@@ -418,7 +418,15 @@ explicitly');
}
$store =& new Auth_OpenID_PostgreSQLStore($db);
+
+ $this->assertFalse($store->tableExists($store->nonces_table_name));
+ $this->assertFalse($store->tableExists($store->associations_table_name));
+
$store->createTables();
+
+ $this->assertTrue($store->tableExists($store->nonces_table_name));
+ $this->assertTrue($store->tableExists($store->associations_table_name));
+
$this->_testStore($store);
$this->_testNonce($store);