Beispiel #1
0
echo "<hr />";
// UPDATE tabla SET campo = '1', campo2 = '2', campo3 = '4'
//  WHERE campo1 = 'x'
$lstUpdateQuery = DPManager::buildUpdateQuery("tabla", $lstGetSetToUpdate, "id_cliente = 3");
echo "<hr />";
echo $lstUpdateQuery;
echo "<hr />";
$lstInsertQuery = DPManager::buildInsertQuery($cliente, "tabla");
echo "<hr />";
echo $lstInsertQuery;
echo "<hr />";
// select * from tabla order by nombre desc
$lstSelectQuery = DPManager::buildSelectQuery("nombre, paterno" . ", concat_ws(',', nombre, paterno) as completo", "tabla", false, false, "nombre", "asc");
echo "<hr />";
echo $lstSelectQuery;
echo "<hr />";
// select * from tabla order by nombre desc
$lstSelectGroupQuery = DPManager::buildSelectQuery("count(*)", "tabla", " nombre like '%i%' ");
echo "<hr />";
echo $lstSelectGroupQuery;
echo "<hr />";
// DELETE FROM tabla WHERE id_cliente = 4
$lstDeleteQuery = DPManager::buildDeleteQuery("tabla", " id_cliente = 10");
echo "<hr />";
echo $lstDeleteQuery;
echo "<hr />";
/*
 * OutPut
 * 
 * id_cliente = 1,nombre = 'H?ctor',paterno = 'H?rnandez',materno = 'Rivera'UPDATE tabla SET id_cliente = 1,nombre = 'H?ctor',paterno = 'H?rnandez',materno = 'Rivera' WHERE id_cliente = 3INSERT INTO tabla ( id_cliente,nombre,paterno,materno) VALUES (1,'H?ctor','H?rnandez','Rivera')SELECT nombre, paterno, concat_ws(',', nombre, paterno) as completo FROM tabla ORDER BY nombre ascSELECT count(*) FROM tabla WHERE nombre like '%i%' 
 */
Beispiel #2
0
 * 
 */
$lstInsertQuery1 = DPManager::buildInsertQuery($larFields, "NOMBRE_TABLA");
echo "<h1>Build Simple Insert Data From Params array type and table name</h1>";
echo $lstInsertQuery1;
/**
 * UPDATE Query Example 1
 * Para este ejemplo, necesitamos construir el SET con DPManager::buildDatosToUpdate($larFields);
 * 
 * Output : UPDATE NOMBRE_TABLA SET CAMPO1 = 'Valor 1' ,CAMPO2 = 'Valor 2' ,CAMPO3 = 'Valor 3' WHERE CAMPO = 'valor' 
 * 
 */
$lstUpdateQuery1 = DPManager::buildUpdateQuery("NOMBRE_TABLA", $lstUpdateQuery, "CAMPO = 'valor' ");
echo "<h1>Build Simple Update From Params array type, table name and condition to affect rows</h1>";
echo $lstUpdateQuery1;
/**
 * Poder iterar resultados de base de datos, Object u Array aplicando un metodo
 * de regreso
 * @param array 
 */
$array = array(array(1, 2), array(3, 4));
$result = DPManager::iteraRecord($array, function () {
    $row = func_get_args();
    $uno = $row[0] . "UNO";
    $dos = $row[1] . "DOS";
    return array($uno, $dos);
});
echo "<h1>Aplicaci&oacute;n de m&eacute;todo anonimo a cada uno " . "de los elementos del objeto o arreglo</h1>";
echo "<pre>";
print_r($result);
echo "</pre>";
Beispiel #3
0
 public static function delete($lobCon, $query)
 {
     if ($lobCon->Execute($query) === false) {
         return 0;
     } else {
         self::$affectedRows = $lobCon->Affected_Rows();
         return self::$affectedRows;
     }
 }
Beispiel #4
0
print_r($lstSelectJSONArrayQuery);
echo "<h2>Result</h2>";
print_r($lstJSONArrayRow);
echo "</pre>";
/*
 * 
 * DPManager::setSessionGroupConcatMaxLen($con);
 * 
 * Output :
 * 
 * ADORecordSet_empty Object
 *  (
 *      [dataProvider] => empty
 *      [databaseType] => 
 *      [EOF] => 1
 *      [_numOfRows] => 0
 *      [fields] => 
 *      [connection] => 
 *  )
 * 
 * Result : 
 * 
 * SET SESSION group_concat_max_len = 4294967295   
 * 
 * 
 */
$lobResult = DPManager::setSessionGroupConcatMaxLen($con);
echo "<h1>Increase the limit from GroupConcat Max Length</h1>";
echo "<pre>";
echo "<h3>Query to increase the limit from function Group_concat()</h3>";
print_r($lobResult);