mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 09:47:30 +03:00 
			
		
		
		
	Added very large lobject creation to the lobject.py example
This commit is contained in:
		
							parent
							
								
									9670c9eddc
								
							
						
					
					
						commit
						8bb617ee76
					
				| 
						 | 
					@ -76,4 +76,16 @@ print "Large object with oid", loid, "removed"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conn.commit()
 | 
					conn.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# this will create a very large object with a new random oid.
 | 
				
			||||||
 | 
					lobj = conn.lobject()
 | 
				
			||||||
 | 
					loid = lobj.oid
 | 
				
			||||||
 | 
					print "Created a new large object with oid", loid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print "Manually importing a lot of data into the object:"
 | 
				
			||||||
 | 
					data = "data" * 1000000
 | 
				
			||||||
 | 
					len = lobj.write(data)
 | 
				
			||||||
 | 
					print "  imported", len, "bytes of data"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					conn.rollback()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print "\nNow try to load the new images, to check it worked!"
 | 
					print "\nNow try to load the new images, to check it worked!"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user