/**
  *
  * @param blaze\lang\String|string|int $identifier
  * @param mixed $value
  * @return blaze\lang\PreparedStatement
  */
 protected function set($identifier, $value, $type = \PDO::PARAM_STR)
 {
     if (\blaze\lang\String::isType($identifier)) {
         $this->stmt->bindValue(':' . $identifier, $value, $type);
     } else {
         $this->stmt->bindValue($identifier + 1, $value, $type);
     }
     //|\PDO::PARAM_INPUT_OUTPUT);
 }
Example #2
0
 public function getValue(\blaze\web\application\BlazeContext $context, $subExpressions, $subBrackets)
 {
     $left = $this->getLeftOperation()->getValue($context, $subExpressions, $subBrackets);
     $right = $this->getRightOperation()->getValue($context, $subExpressions, $subBrackets);
     if (\blaze\lang\String::isType($left) || \blaze\lang\String::isType($right)) {
         return $left . $right;
     } else {
         return $left + $right;
     }
 }
 /**
  * Construct a new FileInputStream.
  * @param string|blaze\lang\String|blaze\io\File $file
  * @throws blaze\lang\IllegalArgumentException If invalid argument specified.
  * @throws blaze\io\IOException If any IO error occurs
  */
 public function __construct($file, $append = false, $binary = true)
 {
     if ($file instanceof \blaze\io\File) {
         $this->file = $file;
     } elseif (\blaze\lang\String::isType($file)) {
         $this->file = new \blaze\io\File($file);
     } else {
         throw new \blaze\lang\IllegalArgumentException('Invalid argument type for $file.');
     }
     parent::__construct($this->file->getAbsolutePath()->toNative(), $append, $binary);
 }
Example #4
0
 /**
  *
  * @param string|blaze\lang\String|blaze\io\File|blaze\io\output\FileOutputStream $fileOrStream
  */
 public function __construct($fileOrStream, $append = false)
 {
     $stream = null;
     if ($fileOrStream instanceof FileOutputStream) {
         $stream = $fileOrStream;
     } else {
         if ($fileOrStream instanceof \blaze\io\File || \blaze\lang\String::isType($fileOrStream)) {
             $stream = new FileOutputStream($fileOrStream, $append, false);
         } else {
             throw new \blaze\lang\IllegalArgumentException('Invalid argument type for $fileOrStream.');
         }
     }
     parent::__construct($stream);
 }
Example #5
0
 private function getCondition($left, $right, $operator, $leftNegation = false, $rightNegation = false, $negation = false)
 {
     if (\blaze\lang\String::isType($left)) {
         $left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_STRING, $leftNegation);
     } else {
         $left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_SCALAR, $leftNegation);
     }
     if (\blaze\lang\String::isType($right)) {
         $right = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_STRING, $rightNegation);
     } else {
         $right = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_SCALAR, $rightNegation);
     }
     return new \blaze\persistence\ooql\Condition($left, $right, $operator, $negation);
 }
Example #6
0
 /**
  * Description of the constructor of File
  * @param blaze\io\File|string|blaze\lang\String $parent The parent File-object or a string which represents a path
  * @param int|string|blaze\lang\String $childOrPrefixLength The child pathname or the prefix length
  */
 public function __construct($parent = null, $childOrPrefixLength = null)
 {
     /* simulate signature identified constructors */
     if ($parent instanceof File && String::isType($childOrPrefixLength)) {
         $this->constructFileParentStringChild($parent, String::asNative($childOrPrefixLength));
     } elseif (String::isType($parent) && $childOrPrefixLength === null) {
         $this->constructPathname(String::asNative($parent));
     } elseif (String::isType($parent) && String::isType($childOrPrefixLength)) {
         $this->constructStringParentStringChild(String::asNative($parent), String::asNative($childOrPrefixLength));
     } else {
         if ($parent === null) {
             throw new NullPointerException("Parent may not be null");
         }
         $this->path = String::asWrapper($parent);
         $this->prefixLength = (int) $childOrPrefixLength;
     }
 }
Example #7
0
 public function on($left, $right, $operator, $leftNegation = false, $rightNegation = false, $negation = false)
 {
     if ($this->onClause === null) {
         $this->onClause = new \blaze\persistence\ooql\OnClause();
     }
     if (\blaze\lang\String::isType($left)) {
         $left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_STRING);
     } else {
         $left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_SCALAR);
     }
     if (\blaze\lang\String::isType($right)) {
         $right = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_STRING);
     } else {
         $right = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_SCALAR);
     }
     $this->onClause->setCondition(new \blaze\persistence\ooql\Condition($left, $right, $operator, $negation));
 }
 public function condition($left, $right, $operator, $leftNegation = false, $rightNegation = false, $negation = false)
 {
     if ($left instanceof \blaze\persistence\ooql\Condition || $left instanceof \blaze\persistence\ooql\Value) {
         $this->left = $left;
     } else {
         if (\blaze\lang\String::isType($left)) {
             $this->left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_STRING, $leftNegation);
         } else {
             $this->left = new \blaze\persistence\ooql\Value($left, \blaze\persistence\ooql\Value::TYPE_SCALAR, $leftNegation);
         }
     }
     if ($right instanceof \blaze\persistence\ooql\Condition || $right instanceof \blaze\persistence\ooql\Value) {
         $this->rightConditionable = $right;
     } else {
         if (\blaze\lang\String::isType($right)) {
             $this->rightConditionable = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_STRING, $rightNegation);
         } else {
             $this->rightConditionable = new \blaze\persistence\ooql\Value($right, \blaze\persistence\ooql\Value::TYPE_SCALAR, $rightNegation);
         }
     }
     $this->operator = $operator;
     $this->negation = $negation;
     return $this;
 }
Example #9
0
 /**
  * Reads the annotations of the class and adds it to the mappings of the configuration
  * @param string|blaze\lang\String|blaze\lang\ClassWrapper $class
  * @return blaze\persistence\cfg\Configuration
  */
 public function addClass($class)
 {
     if (\blaze\lang\String::isType($class)) {
         $class = \blaze\lang\ClassWrapper::forName($class);
     }
     if (!$class instanceof \blaze\lang\ClassWrapper) {
         throw new \blaze\lang\IllegalArgumentException('The parameter class must be a ClassWrapper or the full class name as string.');
     }
     $annotations = $class->getAnnotations();
     //Add mapping from the annotations
     return $this;
 }