Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class DBExample

This class is used to construct SQL WHERE expressions from arrays. This can be useful to build simple conditions without writing SQL query and manage binding values This class is used in classes Model, Form, ItemList to get data from the database. Example : To make the expression 'field1 = "value1" AND (field2 IS NOT NULL OR field3 < 12)', create an DBExample like :

new DBExample(array(
       array('field1' => "value1"),
       array('$or' => array(
           array(
               'field2' => '$notnull'
           ),
           array(
               'field3' => array('$lt' => 12)
           )
       ))
))
Namespace: Hawk
Package: Core
Located at DBExample.php

Methods summary

public
# __construct( array $example )

Constructor

Constructor

Parameters

$example
The DBExample structure
public static string
# make( array $example, array & $binds )

Create a DBExample and parse it

Create a DBExample and parse it

Parameters

$example
The DBExample structure
$binds

This variables, passed by reference, will be filled with the binded values during example parsing during example parsing

Returns

string
the parsed SQL expression
public string
# parse( array & $binds )

Parse the example to create the corresponding SQL expression

Parse the example to create the corresponding SQL expression

Parameters

$binds

This variable, passed by reference, will be filled with the binded values during example parsing

Returns

string
the parsed SQL expression

Properties summary

public array $example

The example content

The example content

# array()
Hawk - PHP documentation API documentation generated by ApiGen