mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 09:47:30 +03:00 
			
		
		
		
	Added a couple of tests to the sandbox.
This commit is contained in:
		
							parent
							
								
									526fd62386
								
							
						
					
					
						commit
						be9822801f
					
				
							
								
								
									
										19
									
								
								sandbox/gtk.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								sandbox/gtk.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					import psycopg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					o = psycopg2.connect("dbname=test")
 | 
				
			||||||
 | 
					c = o.cursor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def sql():
 | 
				
			||||||
 | 
					    c.execute("SELECT 1.23 AS foo")
 | 
				
			||||||
 | 
					    print 1, c.fetchone()
 | 
				
			||||||
 | 
					    #print c.description
 | 
				
			||||||
 | 
					    c.execute("SELECT 1.23::float AS foo")
 | 
				
			||||||
 | 
					    print 2, c.fetchone()
 | 
				
			||||||
 | 
					    #print c.description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print "BEFORE"
 | 
				
			||||||
 | 
					sql()
 | 
				
			||||||
 | 
					import gtk
 | 
				
			||||||
 | 
					print "AFTER"
 | 
				
			||||||
 | 
					sql()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								sandbox/textfloat.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								sandbox/textfloat.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					import gtk
 | 
				
			||||||
 | 
					import psycopg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					o = psycopg2.connect("dbname=test")
 | 
				
			||||||
 | 
					c = o.cursor()
 | 
				
			||||||
 | 
					c.execute("SELECT 1.23::float AS foo")
 | 
				
			||||||
 | 
					x = c.fetchone()[0]
 | 
				
			||||||
 | 
					print x, type(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user