Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/08/2009, 16:27
Avatar de MaBoRaK
MaBoRaK
 
Fecha de Ingreso: abril-2003
Ubicación: La Paz - Bolivia
Mensajes: 2.003
Antigüedad: 21 años
Puntos: 35
[|PREFIX|] en un query a Mysql?

loading........


Estuve viendo algunas class y vi algo que no entiendo. en un insert a mysql basado en un array se usa [|PREFIX|] .... mmm y no encuentro documentacion.

aca el método:

Código PHP:
/**
     * Build and execute a database insert query from an array of keys/values.
     *
     * @param string The table to insert into.
     * @param array Associative array of key/value pairs to insert.
     * @param bool TRUE to interpret NULL as being database NULL, FALSE to mean an empty string
     * @return mixed Insert ID or true on successful insertion, false on failure.
     */
    
function InsertQuery($table$values$useNullValues=false)
    {
        
$keys array_keys($values);
        
$fields implode($this->EscapeChar.",".$this->EscapeChar$keys);

        foreach (
$keys as $key) {

            if (
$useNullValues) {
                if (
is_null($values[$key])) {
                    
$values[$key] = "NULL";
                } else {
                    
$values[$key] = "'" $this->Quote($values[$key]) . "'";
                }
            } else {
                
$values[$key] = "'" $this->Quote($values[$key]) . "'";
            }
        }

        
$values implode(","$values);
//aqui aqui
        
$query sprintf('INSERT INTO %1$s[|PREFIX|]%2$s%1$s (%1$s%3$s%1$s) VALUES (%4$s)'$this->EscapeChar$table$fields$values);
        if (
$this->Query($query)) {
            
// only return last id if it contains a valid value, otherwise insertquery reports as failed if it returns a false value (0, null etc)
            
if ((int)$this->LastId() > 0) {
                return 
$this->LastId();
            }
            else {
                return 
true;
            }
        }
        else {
            return 
false;
        }
    } 
Que opinan que sea?

gracias.


connection closed.
__________________

Maborak Technologies