public function convertToPHPValue($value, AbstractPlatform $platform) { if (strlen($value) != 36) { // cast the mssql uniqueidentifier to a string $value = mssql_guid_string($value); } return $value; }
/** * This function will return a row with student data * * @param string $student * @return mssql result row */ function getSMSStudentInfo($student) { $ret['error'] = '0'; $ret['message'] = ''; $ret['student'] = ''; list($first, $last) = preg_split("/ /", $student); $first = ms_escape_string($first); $last = ms_escape_string($last); $query = "SELECT * from StudentDemographicData WHERE FirstName like '" . $first . "' AND LastName like '" . $last . "'"; $result = queryMSsql($sql); $n = mssql_num_rows($result); if (!$n) { $ret['error'] = '1'; $ret['message'] = "Problem running query {" . $query . "}. Error: "; //.mssql_error(); } else { $row = mssql_fetch_assoc($result); $ret['message'] = "Found Student using {" . $query . "}"; $info = array(); $info['query'] = $query; $info['name'] = $row['FirstName'] . " " . $row['LastName']; $info['STGUID'] = mssql_guid_string($row['STGUID']); $ret['student'] = $info; } return $ret; }
/** * Get a list of updates available on the server */ function wsus_dump_updates() { global $wsus_language; message("Function wsus_dump_updates", 1); if (dbwsus_connect() && $wsus_language) { $query = "select u.localupdateid as LocalID,u.updateid as UpdateID,pre.title as Title,kb.kbarticleid as Article from tbprecomputedlocalizedproperty pre, tbkbarticleforrevision kb, tbupdate u where pre.updateid=u.updateid and pre.revisionid=kb.revisionid and pre.shortlanguage='{$wsus_language}' order by (kb.revisionid) asc"; message("Executing: " . $query, 2); $ms_res = mssql_fetch_all($query); if ($ms_res) { db_connect(); /* $query='delete from nac_wsusupdate;'; message("Executing: ".$query,2); execute_query($query); */ foreach ($ms_res as $row) { $updateid = mssql_guid_string($row[UpdateID]); $query = sprintf("insert into nac_wsusupdate values('%s','%s','%s','%s') on duplicate key update UpdateID='%s';", validate($row[LocalID]), validate($updateid), validate($row[Title]), validate($row[Article]), validate($updateid)); message("Executing: " . $query, 2); execute_query($query); } return true; } else { return false; } } else { return false; } }