Update Query Sebuah update query membuat perubahan menyeluruh untuk sekelompok record dalam satu atau lebih tabel. Sebagai contoh, Anda dapat menaikkan harga sebesar 10 persen untuk semua produk susu, atau Anda dapat menaikkan gaji sebesar 5 persen untuk orang dalam kategori pekerjaan tertentu. Report sendiri sebenarnya hamper sama seperti Query namun, Report lebih layak cetak ketimbang Query. Secara Default, Nama dari Report adalah QueryTransaksi. Untuk merubahnya cukup Klik 2x pada Nama yang berukuran besar lalu ubah sesuai keinginan, misal: LaporanPembelian. Download Filenya di File Access.
Halo teman-teman yg lagi Belajar Microsoft Access,terimakasih sudah berkunjung di Video Tutorial Microsoft Access ini. Semoga dengan adanya Tutorial Microsoft Access Full ini, diharapkan kalian bisa memahami cara Belajar MicrosoftDOWNLOAD GRATIS FILE TUTORIAL di siniAccess Pemula hingga Mahir, seperti:- Cara Membuat Database Access 2013- Cara Membuat Tabel Access- Memahami Pengertian Relasi Antar Tabel- Cara Membuat Query Access- Cara membuat Rumus Ms Access- Cara Membuat Form pada Ms Access,- Cara Membuat Laporan pada Ms. Access,- Cara Membuat Switchboar di Ms Access,- Tahap Finising Ms Access,- Membuat Form otomatis Terbuka di Ms Access,Bagi subscriber yang ingin mendapatkan file jadi, silahkan request melalui email dibawah ini ya:- '[email protected]'Sekian Video Tutorial Microsoft Access Indonesia ini, Semoga video ini bermanfaat, Selamat Mencoba & salam Berbahagia bagi kita semua.
Query Builder ClassCodeIgniter gives you access to a Query Builder class. This patternallows information to be retrieved, inserted, and updated in yourdatabase with minimal scripting. In some cases only one or two linesof code are necessary to perform a database action.CodeIgniter does not require that each database table be its own classfile.
It instead provides a more simplified interface.Beyond simplicity, a major benefit to using the Query Builder featuresis that it allows you to create database independent applications, sincethe query syntax is generated by each database adapter. It also allowsfor safer queries, since the values are escaped automatically by thesystem. Echo $this - db - limit ( 10, 20 ) - getcompiledselect ( 'mytable', FALSE ); // Prints string: SELECT. FROM mytable LIMIT 20, 10 // (in MySQL. Other databases have slightly different syntax) echo $this - db - select ( 'title, content, date' ) - getcompiledselect ; // Prints string: SELECT title, content, date FROM mytable LIMIT 20, 10The key thing to notice in the above example is that the second query did notutilize $this-db-from and did not pass a table name into the firstparameter.
The reason for this outcome is because the query has not beenexecuted using $this-db-get which resets values or reset directlyusing $this-db-resetquery.$this-db-getwhereIdentical to the above function except that it permits you to add a“where” clause in the second parameter, instead of using the db-wherefunction. Echo $this - db - set ( 'title', 'My Title' ) - getcompiledinsert ( 'mytable', FALSE ); // Produces string: INSERT INTO mytable (`title`) VALUES ('My Title') echo $this - db - set ( 'content', 'My Content' ) - getcompiledinsert ; // Produces string: INSERT INTO mytable (`title`, `content`) VALUES ('My Title', 'My Content')The key thing to notice in the above example is that the second query did notutilize $this-db-from nor did it pass a table name into the firstparameter. The reason this worked is because the query has not been executedusing $this-db-insert which resets values or reset directly using$this-db-resetquery. While not “true” caching, Query Builder enables you to save (or “cache”)certain parts of your queries for reuse at a later point in yourscript’s execution. Normally, when an Query Builder call is completed,all stored information is reset for the next call.
With caching, you canprevent this reset, and reuse information easily.Cached calls are cumulative. If you make 2 cached select calls, andthen 2 uncached select calls, this will result in 4 select calls.There are three Caching functions available:$this-db-startcacheThis function must be called to begin caching. All Query Builder queriesof the correct type (see below for supported queries) are stored forlater use.$this-db-stopcacheThis function can be called to stop caching.$this-db-flushcacheThis function deletes all items from the Query Builder cache. // Note that the second parameter of the getcompiledselect method is FALSE $sql = $this - db - select ( array ( 'field1', 'field2' )) - where ( 'field3', 5 ) - getcompiledselect ( 'mytable', FALSE ); //. // Do something crazy with the SQL code.
Like add it to a cron script for // later execution or something. $data = $this - db - get - resultarray ; // Would execute and return an array of results of the following query: // SELECT field1, field1 from mytable where field3 = 5. Class CIDBquerybuilder resetquery ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderResets the current Query Builder state. Useful when you wantto build a query that can be cancelled under certain conditions.
Startcache ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStarts the Query Builder cache. Stopcache ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStops the Query Builder cache. Flushcache ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderEmpties the Query Builder cache. Setdbprefix ( $prefix = ' ) Parameters:. $prefix ( string) – The new prefix to useReturns:The DB prefix in useReturn type:stringSets the database prefix, without having to reconnect. Dbprefix ( $table = ' ) Parameters:. $table ( string) – The table name to prefixReturns:The prefixed table nameReturn type:stringPrepends a database prefix, if one exists in configuration.
Countallresults ( $table = ' , $reset = TRUE ) Parameters:. $table ( string) – Table name. $reset ( bool) – Whether to reset values for SELECTsReturns:Number of rows in the query resultReturn type:intGenerates a platform-specific query string that countsall records returned by an Query Builder query. Get ( $table = ' , $limit = NULL , $offset = NULL ) Parameters:.
$table ( string) – The table to query. $limit ( int) – The LIMIT clause. $offset ( int) – The OFFSET clauseReturns:CIDBresult instance (method chaining)Return type:CIDBresultCompiles and runs SELECT statement based on the alreadycalled Query Builder methods. Getwhere ( $table = ' , $where = NULL , $limit = NULL , $offset = NULL ) Parameters:.
$table ( mixed) – The table(s) to fetch data from; string or array. $where ( string) – The WHERE clause. $limit ( int) – The LIMIT clause.
$offset ( int) – The OFFSET clauseReturns:CIDBresult instance (method chaining)Return type:CIDBresultSame as get, but also allows the WHERE to be added directly. Select ( $select = '.' , $escape = NULL ) Parameters:. $select ( string) – The SELECT portion of a query.
$escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a SELECT clause to a query. Selectavg ( $select = ' , $alias = ' ) Parameters:. $select ( string) – Field to compute the average of. $alias ( string) – Alias for the resulting value nameReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a SELECT AVG(field) clause to a query. Selectmax ( $select = ' , $alias = ' ) Parameters:.
$select ( string) – Field to compute the maximum of. $alias ( string) – Alias for the resulting value nameReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a SELECT MAX(field) clause to a query. Selectmin ( $select = ' , $alias = ' ) Parameters:.
$select ( string) – Field to compute the minimum of. $alias ( string) – Alias for the resulting value nameReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a SELECT MIN(field) clause to a query. Selectsum ( $select = ' , $alias = ' ) Parameters:.
$select ( string) – Field to compute the sum of. $alias ( string) – Alias for the resulting value nameReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a SELECT SUM(field) clause to a query. Distinct ( $val = TRUE ) Parameters:. $val ( bool) – Desired value of the “distinct” flagReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderSets a flag which tells the query builder to adda DISTINCT clause to the SELECT portion of the query. From ( $from ) Parameters:. $from ( mixed) – Table name(s); string or arrayReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderSpecifies the FROM clause of a query. Join ( $table, $cond , $type = ' , $escape = NULL ) Parameters:.
$table ( string) – Table name to join. $cond ( string) – The JOIN ON condition. $type ( string) – The JOIN type. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a JOIN clause to a query. Where ( $key , $value = NULL , $escape = NULL ) Parameters:. $key ( mixed) – Name of field to compare, or associative array. $value ( mixed) – If a single key, compared to this value.
$escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates the WHERE portion of the query.Separates multiple calls with ‘AND’. Orwhere ( $key , $value = NULL , $escape = NULL ) Parameters:. $key ( mixed) – Name of field to compare, or associative array. $value ( mixed) – If a single key, compared to this value. $escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates the WHERE portion of the query.Separates multiple calls with ‘OR’. Orwherein ( $key = NULL , $values = NULL , $escape = NULL ) Parameters:.
$key ( string) – The field to search. $values ( array) – The values searched on. $escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates a WHERE field IN(‘item’, ‘item’) SQL query,joined with ‘OR’ if appropriate. Orwherenotin ( $key = NULL , $values = NULL , $escape = NULL ) Parameters:.
$key ( string) – The field to search. $values ( array) – The values searched on. $escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates a WHERE field NOT IN(‘item’, ‘item’) SQL query,joined with ‘OR’ if appropriate.
Wherein ( $key = NULL , $values = NULL , $escape = NULL ) Parameters:. $key ( string) – Name of field to examine. $values ( array) – Array of target values. $escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates a WHERE field IN(‘item’, ‘item’) SQL query,joined with ‘AND’ if appropriate. Wherenotin ( $key = NULL , $values = NULL , $escape = NULL ) Parameters:. $key ( string) – Name of field to examine. $values ( array) – Array of target values.
$escape ( bool) – Whether to escape values and identifiersReturns:DBquerybuilder instanceReturn type:objectGenerates a WHERE field NOT IN(‘item’, ‘item’) SQL query,joined with ‘AND’ if appropriate. Groupstart ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStarts a group expression, using ANDs for the conditions inside it. Orgroupstart ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStarts a group expression, using ORs for the conditions inside it. Notgroupstart ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStarts a group expression, using AND NOTs for the conditions inside it.
Ornotgroupstart ( ) Returns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderStarts a group expression, using OR NOTs for the conditions inside it. Groupend ( ) Returns:DBquerybuilder instanceReturn type:objectEnds a group expression. Like ( $field , $match = ' , $side = 'both' , $escape = NULL ) Parameters:. $field ( string) – Field name. $match ( string) – Text portion to match. $side ( string) – Which side of the expression to put the ‘%’ wildcard on.
$escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a LIKE clause to a query, separating multiple calls with AND. Orlike ( $field , $match = ' , $side = 'both' , $escape = NULL ) Parameters:. $field ( string) – Field name. $match ( string) – Text portion to match. $side ( string) – Which side of the expression to put the ‘%’ wildcard on. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a LIKE clause to a query, separating multiple class with OR.
![]()
Notlike ( $field , $match = ' , $side = 'both' , $escape = NULL ) Parameters:. $field ( string) – Field name. $match ( string) – Text portion to match.
$side ( string) – Which side of the expression to put the ‘%’ wildcard on. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a NOT LIKE clause to a query, separating multiple calls with AND.
Ornotlike ( $field , $match = ' , $side = 'both' , $escape = NULL ) Parameters:. $field ( string) – Field name. $match ( string) – Text portion to match. $side ( string) – Which side of the expression to put the ‘%’ wildcard on.
$escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a NOT LIKE clause to a query, separating multiple calls with OR. Having ( $key , $value = NULL , $escape = NULL ) Parameters:.
$key ( mixed) – Identifier (string) or associative array of field/value pairs. $value ( string) – Value sought if $key is an identifier. $escape ( string) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a HAVING clause to a query, separating multiple calls with AND. Orhaving ( $key , $value = NULL , $escape = NULL ) Parameters:. $key ( mixed) – Identifier (string) or associative array of field/value pairs. $value ( string) – Value sought if $key is an identifier.
$escape ( string) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a HAVING clause to a query, separating multiple calls with OR. Groupby ( $by , $escape = NULL ) Parameters:. $by ( mixed) – Field(s) to group by; string or arrayReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds a GROUP BY clause to a query.
Orderby ( $orderby , $direction = ' , $escape = NULL ) Parameters:. $orderby ( string) – Field to order by. $direction ( string) – The order requested - ASC, DESC or random. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds an ORDER BY clause to a query. Limit ( $value , $offset = 0 ) Parameters:.
$value ( int) – Number of rows to limit the results to. $offset ( int) – Number of rows to skipReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds LIMIT and OFFSET clauses to a query.
Offset ( $offset ) Parameters:. $offset ( int) – Number of rows to skipReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds an OFFSET clause to a query. Set ( $key , $value = ' , $escape = NULL ) Parameters:. $key ( mixed) – Field name, or an array of field/value pairs. $value ( string) – Field value, if $key is a single field. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds field/value pairs to be passed later to insert,update or replace.
Insert ( $table = ' , $set = NULL , $escape = NULL ) Parameters:. $table ( string) – Table name.
$set ( array) – An associative array of field/value pairs. $escape ( bool) – Whether to escape values and identifiersReturns:TRUE on success, FALSE on failureReturn type:boolCompiles and executes an INSERT statement. Insertbatch ( $table , $set = NULL , $escape = NULL , $batchsize = 100 ) Parameters:. $table ( string) – Table name.
$set ( array) – Data to insert. $escape ( bool) – Whether to escape values and identifiers.
$batchsize ( int) – Count of rows to insert at onceReturns:Number of rows inserted or FALSE on failureReturn type:mixedCompiles and executes batch INSERT statements. NoteWhen more than $batchsize rows are provided, multipleINSERT queries will be executed, each trying to insertup to $batchsize rows. Setinsertbatch ( $key , $value = ' , $escape = NULL ) Parameters:. $key ( mixed) – Field name or an array of field/value pairs.
$value ( string) – Field value, if $key is a single field. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds field/value pairs to be inserted in a table later via insertbatch. Update ( $table = ' , $set = NULL , $where = NULL , $limit = NULL ) Parameters:. $table ( string) – Table name. $set ( array) – An associative array of field/value pairs.
$where ( string) – The WHERE clause. $limit ( int) – The LIMIT clauseReturns:TRUE on success, FALSE on failureReturn type:boolCompiles and executes an UPDATE statement. Updatebatch ( $table , $set = NULL , $value = NULL , $batchsize = 100 ) Parameters:. $table ( string) – Table name.
$set ( array) – Field name, or an associative array of field/value pairs. $value ( string) – Field value, if $set is a single field.
$batchsize ( int) – Count of conditions to group in a single queryReturns:Number of rows updated or FALSE on failureReturn type:mixedCompiles and executes batch UPDATE statements. NoteWhen more than $batchsize field/value pairs are provided,multiple queries will be executed, each handling up to$batchsize field/value pairs.
Setupdatebatch ( $key , $value = ' , $escape = NULL ) Parameters:. $key ( mixed) – Field name or an array of field/value pairs. $value ( string) – Field value, if $key is a single field. $escape ( bool) – Whether to escape values and identifiersReturns:CIDBquerybuilder instance (method chaining)Return type:CIDBquerybuilderAdds field/value pairs to be updated in a table later via updatebatch. Replace ( $table = ' , $set = NULL ) Parameters:.
$table ( string) – Table name. $set ( array) – An associative array of field/value pairsReturns:TRUE on success, FALSE on failureReturn type:boolCompiles and executes a REPLACE statement. Delete ( $table = ' , $where = ' , $limit = NULL , $resetdata = TRUE ) Parameters:. $table ( mixed) – The table(s) to delete from; string or array. $where ( string) – The WHERE clause. $limit ( int) – The LIMIT clause. $resetdata ( bool) – TRUE to reset the query “write” clauseReturns:CIDBquerybuilder instance (method chaining) or FALSE on failureReturn type:mixedCompiles and executes a DELETE query.
Truncate ( $table = ' ) Parameters:. $table ( string) – Table nameReturns:TRUE on success, FALSE on failureReturn type:boolExecutes a TRUNCATE statement on a table. NoteIf the database platform in use doesn’t support TRUNCATE,a DELETE statement will be used instead. Emptytable ( $table = ' ) Parameters:. $table ( string) – Table nameReturns:TRUE on success, FALSE on failureReturn type:boolDeletes all records from a table via a DELETE statement. Getcompiledselect ( $table = ' , $reset = TRUE ) Parameters:. $table ( string) – Table name.
$reset ( bool) – Whether to reset the current QB values or notReturns:The compiled SQL statement as a stringReturn type:stringCompiles a SELECT statement and returns it as a string. Getcompiledinsert ( $table = ' , $reset = TRUE ) Parameters:. $table ( string) – Table name. $reset ( bool) – Whether to reset the current QB values or notReturns:The compiled SQL statement as a stringReturn type:stringCompiles an INSERT statement and returns it as a string. Getcompiledupdate ( $table = ' , $reset = TRUE ) Parameters:. $table ( string) – Table name. $reset ( bool) – Whether to reset the current QB values or notReturns:The compiled SQL statement as a stringReturn type:stringCompiles an UPDATE statement and returns it as a string.
Getcompileddelete ( $table = ' , $reset = TRUE ) Parameters:. $table ( string) – Table name.
$reset ( bool) – Whether to reset the current QB values or notReturns:The compiled SQL statement as a stringReturn type:stringCompiles a DELETE statement and returns it as a string.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |