 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Rob Allen's Blog: Some notes on SQL Server blobs with sqlsrv
by Chris Cornutt November 22, 2010 @ 11:15:33
In this new post to his blog, Rob Allen has posted notes on some of his experience in working with blobs with SQL Server using UTF-8.
This turned out to be easy enough: Use ntext, nvarchar types in the database and add resources.db.params.driver_options.CharacterSet = "UTF-8" to your application.ini
He also includes some code to fix a problem he spotted with storing binary data into a varbinary field giving him an error about string translation. The fix came in the way of replacing the direct file_get_contents assignment to a variable over to a binding method that specified the data type as well.
voice your opinion now!
sqlserver binary data insert datatype varbinary
CatsWhoCode.com: WordPress How to insert data programmatically
by Chris Cornutt August 03, 2010 @ 10:14:02
On the CatsWhoCode.com blog today they share an alternative method for getting content into your WordPress blog - a programmatic approach pushing it directly in through bits of code.
Recently, a client of mine asked me to write an article importer for his WordPress powered site, which was a very interesting project for me. In this article, I'll show you how you can easily add data (posts, comments, categories, etc) to your WordPress blog, without any manual effort.
They describe and show examples for a few different types of inserts:
- Inserting posts
- Inserting comments
- Adding categories to a post
- Adding tags to a post
- Automatically create a custom field when a post is published
Code snippets are provided for each.
voice your opinion now!
wordpress insert data programmatic
Chris Jones' Blog: Inserting and Updating Oracle XMLType columns in PHP
by Chris Cornutt July 13, 2009 @ 08:14:21
All of you Oracle users out there might want to check out this recent post from Chris Jones, especially if you've been using the XMLType columns in your tables.
Today a reader mailed me about manipulating XMLType columns when the data is longer than the 4K limit that character-type handling imposes. My free book (see sidebar) has examples of how to do this using CLOB handling in PHP. I noticed that my xmlinsert.php example in the book does a SELECT and UPDATE, but never actually does an INSERT.
To correct the problem of the missing example he includes example code to connect to the database, push the XML into a bind variable and select the row back out to ensure everything's still structured correctly. You need to set up a new descriptor for the insert to work (CLOB).
voice your opinion now!
clob column xmltype xml oracle insert
Eran Galperin's Blog: Multiple row operations in MySQL / PHP
by Chris Cornutt May 14, 2009 @ 09:35:35
Eran Galperin has made a recent post about performing multiple row operations in MySQL - inserts and updates.
Multiple row operations are in common use in a normalized application databases as one database entity is often linked to multiple sub-entities (for example a user and his tags). [...] Too often I've seen such queries ran in long loops one at a time, which is very bad for performance (as I will show here) and sometimes equally bad for integrity (if the process is interrupted). So what are the alternatives?
His alternatives include concatenation of values for an insert (rather than looping) and updating the information with a "ON DUPLICATE KEY UPDATE" statement or, for multiple tables, using a join.
voice your opinion now!
tutorial insert update mysql
Rob Allen's Blog: UTF8, PHP and MySQL
by Chris Cornutt March 19, 2009 @ 08:43:19
Rob Allen had a problem - he needed to get the "pound" (as in the British monetary unit) into his MySQL database. His database didn't seem to want to comply:
Everyone else probably already knows this stuff, but I hit an issue today to that took a while to sort out. Fortunately, some kind folks on IRC helped me, but as it's embarrassing to ask for help on the same issue twice, I'm writing down what I've learned! The problem: Get a £ character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF8.
His solution? Make sure you're using UTF-8 everywhere, not just when trying to insert into the database - in the broser's headers (both going in and coming out) and in the MySQL database insert. He gives code examples for each including database examples for PDO and the Zend_Db component of the Zend Framework.
voice your opinion now!
utf8 mysql insert pound character example problem solution
DevShed: Inserting, Updating and Deleting Database Rows with Code Igniter
by Chris Cornutt September 24, 2008 @ 12:03:27
DevShed continues their series focusing on the CodeIgniter framework with the seventh part - a look at interacting with the database to update, delete and insert rows from your application.
You've seen some of the things you can accomplish with the Code Igniter PHP framework in earlier parts of this series. In this seventh part of the series, you will learn, through copious examples, how to perform insertions, updates and deletions on a selected MySQL table by using Code Igniter's database class. You'll see that these tasks are very intuitive and easy to grasp, thanks to Code Igniter's friendly learning curve.
They show how to make conditional select statements (with where clauses) and do both inserts of new information and updates to current information, all with the built-in model functionality the framework provides.
voice your opinion now!
codeigniter framework tutorial update delete insert conditional
ProDevTips.com: File Uploads with PHP Doctrine
by Chris Cornutt September 01, 2008 @ 10:37:50
The ProDevTips blog has posted the fifth part of their look at using Doctrine with PHP. This time they focus on file uploads.
It's time to take a look at how file uploads can be integrated into the Doctrine validation and CRUD process. We will have a product in the form of a digital download as an example, it will have a screenshot image that can be maximum 250 pixels wide and high. The download itself will be a zipped file.
They set up their table definitions first and set up a few validation functions (update, insert and for the file data) to work on top of that. Custom upload/uploadImage and save methods handle the user's submission while a simple delete method makes removing images easy.
voice your opinion now!
file upload doctrine tutorial database table insert image
Raphael Stolt's Blog: Transforming data centered XML into SQL statements
by Chris Cornutt May 08, 2007 @ 10:27:00
In this new post on Raphael Stolt's blog, he shows a way that you can take XML that holds SQL information (in his example INSERTs and DELETEs) and transforms them into SQL statements via XSL stylesheets.
A canny data import technique that emerged from praxis, while working on the import of data-centered XML resources, is utilitizing the abilities of Xslt. The generation of the required SQL statements actually only needs a simple Xsl stylesheet which might import for an PHP XSLTProcessor object or pass to the xsltproc command line tool. Both further described approaches are based upon the libxslt library and are assuming the use of XSLT 1.0.
He starts with an example bit of XML that has the XSL stylesheet at the top that will be used to transform the data and the information to perform inserts on several "partner" values in the XML below. Following this, he creates a PHP class to load the file and apply the stylesheet.
He also mentions a few different approaches to the same problem - XSLTProcessor class approach returning a single SQL string , xsltproc approach and the XSLTProcessor class approach using the ability to use PHP functions as XSLT functions.
voice your opinion now!
transform xml sql statement xslt insert delete transform xml sql statement xslt insert delete
|
Community Events
Don't see your event here? Let us know!
|