<p>I have a database with lots of null values. Because of this I'm using the technique of passing them all as string pointers, as described in the docs. <a href="http://pastebin.com/S1y0RT8g" rel="nofollow">SAMPLE CODE</a></p>
<p>I wrote some queries and used fmt.Sprintf to build some queries. After some refactoring to substitute that code for prepared statements, my types all became their actual database types and I'm getting error messages like: "type is int64, not string".</p>
<p>I already went back to using Sprintf. It's a small project and my vars are not user input, so not really a problem. But I'd really like to know what's going on, because I'm investing in becoming a Go dev in the long run.</p>
<hr/>**评论:**<br/><br/>Ploobers: <pre><p>Show us your actual query. Prepared statements work great, so I'm sure you just have a syntax error.</p></pre>palitones: <pre><p>Here you go. Thanks for the help!</p>
<p><a href="http://pastebin.com/143AJJW1" rel="nofollow">http://pastebin.com/143AJJW1</a></p></pre>Ploobers: <pre><p>I'm assuming that in your code, there's a closing " in the prepared statement version. If not and it somehow compiled, that could cause weird issues.</p>
<p>What field type is <code>t2.date_referenced</code>? DATETIME? TIMESTAMP?</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传