Interested in improving this site? Please check the To Do page.

Back to SQLite Verbs

Syntax

sqlite.setColumnBlob ( queryId, parameterIndex, binaryAddress )

Params

queryId is a number, a query id.

paremeterIndex is a number, the index of a parameter in a SQLite statement.

binaryAddress is the address of a binary object database item.

Action

Sets the binary data for a column of a row.

Returns

An SQLite result code.

Examples

bundle {
	local ( databaseId, f, i, query, queryId, record, result, state );
	
	on getField ( fieldNumber ) {
		local ( s );
		
		s = string.nthField ( record, ',', fieldNumber );
		s = string.delete ( s, 1, 1 );
		s = string.delete ( s, string.length ( s ), 1 );
		
		return ( s )};
	
	bundle { // f
		local ( s );
		
		case sys.os ( ) {
			"MacOS" {
				s = "Temporary Items"};
			"Win95" {
				s = "Temp"}};
		
		f = file.getSpecialFolderPath ( "", s, false ) + "states.db3"};
	
	databaseId = sqlite.open ( f );
	
	for i = 2 to string.countFields ( sqlite.data.states.csv, '\n' ) {
		record = string.nthField ( sqlite.data.states.csv, '\n', i );
		record = string.trimWhiteSpace ( record );
		
		state = getField ( 1 );
		
		query = "INSERT into States ( State, Date_of_statehood, Capital, Capital_since, `Most_populous_city?`, Population, Notes_on_current_capital, Picture ) VALUES ( '" + state + "', '" + getField ( 2 ) + "', '" + getField ( 3 ) +  "', '" + getField ( 4 ) + "', '" + getField ( 5 ) +  "', '" + getField ( 6 ) + "', '" + getField ( 7 ) + "', ? )";
		
		queryId = sqlite.compileQuery ( databaseId, query );
		
		if defined ( sqlite.data.states.pictures.[ state ] ) {
			result = sqlite.setColumnBlob ( queryId, 1, @sqlite.data.states.pictures.[ state ] )};
		
		result = sqlite.stepQuery ( queryId );
		
		result = sqlite.getLastInsertRowId ( databaseId );
		
		result = sqlite.clearQuery ( queryId )};
	
	sqlite.close ( databaseId )}

Notes

The parameter index can be somewhat confusing. Please see < http://www.sqlite.org/capi3ref.html#sqlite3_bind_blob > about parameter forms and parameter index. The parameter index is the index of parameter form used within an SQLite statement.

See Also

See Also SQLite APIs


Personal Tools