Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

SQL Azure

posted by bdavis 7 years ago

I was testing out some code on Microsoft's new SQL Azure platform that allows you to run PHP. Its pretty neat.

fDatabase will connect fine to SQL Azure database, which is awesome. Though it does look like SQL Azure removed support for "sys.extended_properties" which is used in fORMDatabase and I think a couple of other areas.

{doc_root}\\system\\models\\Route.php(7): fRecordSet::build('Route', Array, Array)
{doc_root}\\system\\vendors\\flourish\\classes\\fRecordSet.php(222): fORMDatabase::addWhereClause(Object(fDatabase), Object(fSchema), Array, 'routes', Array)
{doc_root}\\system\\vendors\\flourish\\classes\\fORMDatabase.php(735): fORMDatabase::addColumnCondition(Object(fDatabase), Object(fSchema), Array, 'routes', 'subdomain', '=', Array)
{doc_root}\\system\\vendors\\flourish\\classes\\fORMDatabase.php(159): fSchema->getColumnInfo('routes', 'subdomain', 'placeholder')
{doc_root}\\system\\vendors\\flourish\\classes\\fSchema.php(2450): fSchema->fetchColumnInfo('routes')
{doc_root}\\system\\vendors\\flourish\\classes\\fSchema.php(340): fSchema->fetchMSSQLColumnInfo('routes')
{doc_root}\\system\\vendors\\flourish\\classes\\fSchema.php(827): fDatabase->query('SELECT???????LO...', 'routes', 'dbo')
{doc_root}\\system\\vendors\\flourish\\classes\\fDatabase.php(2934): fDatabase->run('SELECT???????LO...', 'fResult')
{doc_root}\\system\\vendors\\flourish\\classes\\fDatabase.php(3027): fDatabase->performQuery('SELECT???????LO...', Object(fResult), Array)
{doc_root}\\system\\vendors\\flourish\\classes\\fDatabase.php(2564): fDatabase->checkForError(Object(fResult), false)
{doc_root}\\system\\vendors\\flourish\\classes\\fDatabase.php(455)
MSSQL error ([Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name 'SYS.EXTENDED_PROPERTIES'.) in SELECT
					LOWER(c.column_name)       AS 'column',
					c.data_type                AS 'type',
					c.is_nullable              AS nullable,
					c.column_default           AS 'default',
					c.character_maximum_length AS max_length,
					c.numeric_precision        AS precision,
					c.numeric_scale            AS decimal_places,
					CASE
						WHEN
							COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.table_schema) + '.' + QUOTENAME(c.table_name)), c.column_name, 'IsIdentity') = 1 AND
							OBJECTPROPERTY(OBJECT_ID(QUOTENAME(c.table_schema) + '.' + QUOTENAME(c.table_name)), 'IsMSShipped') = 0
						THEN '1'
						ELSE '0'
					END AS auto_increment,
					cc.check_clause AS 'constraint',
					CAST(ex.value AS VARCHAR(7500)) AS 'comment'
				FROM
					INFORMATION_SCHEMA.COLUMNS AS c LEFT JOIN
					INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ccu ON
						c.column_name = ccu.column_name AND
						c.table_name = ccu.table_name AND
						c.table_catalog = ccu.table_catalog LEFT JOIN
					INFORMATION_SCHEMA.CHECK_CONSTRAINTS AS cc ON
						ccu.constraint_name = cc.constraint_name AND
						ccu.constraint_catalog = cc.constraint_catalog LEFT JOIN SYS.EXTENDED_PROPERTIES AS ex ON ex.major_id = OBJECT_ID(QUOTENAME(c.table_schema) + '.' + QUOTENAME(c.table_name)) AND ex.minor_id = COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.table_schema) + '.' + QUOTENAME(c.table_name)), c.column_name, 'ColumnId') AND ex.name = 'MS_Description' AND OBJECTPROPERTY(OBJECT_ID(QUOTENAME(c.table_schema) + '.' + QUOTENAME(c.table_name)), 'IsMsShipped') = 0 
					WHERE
						LOWER(c.table_name) = 'routes' AND
						LOWER(c.table_schema) = 'dbo' AND
						c.table_catalog = DB_NAME()

I'm not sure if there is an equivalent call in SQL Azure for sys.extended_properties...

What do you think about supporting SQL Azure?