/** * Quotes primitive value with its primitve variable (alias.var) * @param mixed $v * @param string $pvar * @return true|string (error message if string) */ public function quoteVar(&$v, &$pvar) { // unquote pvar $pvar_ = $this->_unquote($pvar); // split primitive var to alias and var list($alias, $var) = @explode('.', $pvar_); if (!$alias || !$var) { return "invalid primitive var '{$pvar}'"; } // get the class for alias if (!($class = $this->am->getClass($alias))) { return "no class found for alias '{$alias}'"; } // get class map if (!($cm = $this->proot->getClassMap($class))) { return "no class map for '{$class}'"; } // is var 'oid'? if ($var == 'oid') { // replace var name with column name $pvar = $this->quoteId($alias) . '.' . $this->quoteId($cm->getOidColumn()); return true; } // get field map (for non-oid field) if (!($fm = $cm->getField($var))) { return "no field map for '{$class}::{$var}'"; } // replace var name with column name $pvar = $this->quoteId($alias) . '.' . $this->quoteId($fm->getColumnName()); // quote value $v = $this->quote($v, $fm); return true; }