The fastest easiest way to get it right.

Database Inserts

Database inserts can be made manually with the SQL() function, but this can be tedious and error-prone. The SQL function SQLX_Insert() is a much easier way to do inserts.

<?php
class x6example extends androX6 {
    function x6main() {
        $row = array(
            'headline'=>'Using SQLX_Insert'
            ,'dateline'=>'02/11/2009'
            ,'summary'=>'Today we see how to use SQLX_insert'
        );
        $skey = SQLX_insert('articles',$row);
    }    
}

The SQLX_Insert function automatically escapes all values, so you do not need to worry about protecting against SQL Injection.

The SQLX_Insert function knows about row security and column security. You can name the base table in the function and not worry about which view needs to be used.

The SQLX_Insert function quietly discards elements from the array that cannot be directly assigned by the user, such as FETCH values or values calculated with a CHAIN.

The SQLX_Insert function quietly discards elements from the array that do not match an actual column in the destination table.

The SQLX_Insert function does not trim values, if you provide a value that is too long for a column, it will throw out an error.

The SQLX_Insert function returns the skey value of the newly inserted row. There is more information available in the page on The SKEY Column.

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2